summaryrefslogtreecommitdiff
path: root/lib/btrfsprogs/btrfsinspect
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2022-07-12 22:36:30 -0600
committerLuke Shumaker <lukeshu@lukeshu.com>2022-07-12 22:36:30 -0600
commitec6929e40ca17cacb6a4ba23508d2b724b9201c1 (patch)
treedf5180c4880fe88cfd5c18996da327af07d17900 /lib/btrfsprogs/btrfsinspect
parentd250398e68fae70bd765a7f90389b58a4eeb4ee2 (diff)
Don't have .Superblock() return a reference
Diffstat (limited to 'lib/btrfsprogs/btrfsinspect')
-rw-r--r--lib/btrfsprogs/btrfsinspect/mount.go6
-rw-r--r--lib/btrfsprogs/btrfsinspect/print_tree.go18
-rw-r--r--lib/btrfsprogs/btrfsinspect/recoverchunks.go4
3 files changed, 14 insertions, 14 deletions
diff --git a/lib/btrfsprogs/btrfsinspect/mount.go b/lib/btrfsprogs/btrfsinspect/mount.go
index 641bc64..9cb28dc 100644
--- a/lib/btrfsprogs/btrfsinspect/mount.go
+++ b/lib/btrfsprogs/btrfsinspect/mount.go
@@ -205,9 +205,9 @@ func (sv *subvolume) StatFS(_ context.Context, op *fuseops.StatFSOp) error {
return err
}
- op.IoSize = sb.Data.SectorSize
- op.BlockSize = sb.Data.SectorSize
- op.Blocks = sb.Data.TotalBytes / uint64(sb.Data.SectorSize) // TODO: adjust for RAID type
+ op.IoSize = sb.SectorSize
+ op.BlockSize = sb.SectorSize
+ op.Blocks = sb.TotalBytes / uint64(sb.SectorSize) // TODO: adjust for RAID type
//op.BlocksFree = TODO
// btrfs doesn't have a fixed number of inodes
diff --git a/lib/btrfsprogs/btrfsinspect/print_tree.go b/lib/btrfsprogs/btrfsinspect/print_tree.go
index 2de9818..6c4f550 100644
--- a/lib/btrfsprogs/btrfsinspect/print_tree.go
+++ b/lib/btrfsprogs/btrfsinspect/print_tree.go
@@ -27,19 +27,19 @@ func DumpTrees(ctx context.Context, out io.Writer, fs *btrfs.FS) {
return
}
- if superblock.Data.RootTree != 0 {
+ if superblock.RootTree != 0 {
fmt.Fprintf(out, "root tree\n")
printTree(ctx, out, fs, btrfs.ROOT_TREE_OBJECTID)
}
- if superblock.Data.ChunkTree != 0 {
+ if superblock.ChunkTree != 0 {
fmt.Fprintf(out, "chunk tree\n")
printTree(ctx, out, fs, btrfs.CHUNK_TREE_OBJECTID)
}
- if superblock.Data.LogTree != 0 {
+ if superblock.LogTree != 0 {
fmt.Fprintf(out, "log root tree\n")
printTree(ctx, out, fs, btrfs.TREE_LOG_OBJECTID)
}
- if superblock.Data.BlockGroupRoot != 0 {
+ if superblock.BlockGroupRoot != 0 {
fmt.Fprintf(out, "block group tree\n")
printTree(ctx, out, fs, btrfs.BLOCK_GROUP_TREE_OBJECTID)
}
@@ -82,9 +82,9 @@ func DumpTrees(ctx context.Context, out io.Writer, fs *btrfs.FS) {
},
},
)
- fmt.Fprintf(out, "total bytes %v\n", superblock.Data.TotalBytes)
- fmt.Fprintf(out, "bytes used %v\n", superblock.Data.BytesUsed)
- fmt.Fprintf(out, "uuid %v\n", superblock.Data.FSUUID)
+ fmt.Fprintf(out, "total bytes %v\n", superblock.TotalBytes)
+ fmt.Fprintf(out, "bytes used %v\n", superblock.BytesUsed)
+ fmt.Fprintf(out, "uuid %v\n", superblock.FSUUID)
}
// printTree mimics btrfs-progs
@@ -199,7 +199,7 @@ func printTree(ctx context.Context, out io.Writer, fs *btrfs.FS, treeID btrfs.Ob
// // TODO
case btrfsitem.ExtentCSum:
sb, _ := fs.Superblock()
- sectorSize := btrfsvol.AddrDelta(sb.Data.SectorSize)
+ sectorSize := btrfsvol.AddrDelta(sb.SectorSize)
start := btrfsvol.LogicalAddr(item.Key.Offset)
itemSize := btrfsvol.AddrDelta(len(body.Sums)) * sectorSize
@@ -214,7 +214,7 @@ func printTree(ctx context.Context, out io.Writer, fs *btrfs.FS, treeID btrfs.Ob
} else {
fmt.Fprintf(out, " ")
}
- fmt.Fprintf(out, "[%d] 0x%s", pos, sum.Fmt(sb.Data.ChecksumType))
+ fmt.Fprintf(out, "[%d] 0x%s", pos, sum.Fmt(sb.ChecksumType))
pos = pos.Add(sectorSize)
}
fmt.Fprintf(out, "\n")
diff --git a/lib/btrfsprogs/btrfsinspect/recoverchunks.go b/lib/btrfsprogs/btrfsinspect/recoverchunks.go
index aae46b0..9f97b45 100644
--- a/lib/btrfsprogs/btrfsinspect/recoverchunks.go
+++ b/lib/btrfsprogs/btrfsinspect/recoverchunks.go
@@ -84,10 +84,10 @@ func (found ScanOneDevResult) AddToLV(ctx context.Context, fs *btrfs.FS, dev *bt
if err := fs.LV.AddMapping(btrfsvol.Mapping{
LAddr: laddr,
PAddr: btrfsvol.QualifiedPhysicalAddr{
- Dev: sb.Data.DevItem.DevID,
+ Dev: sb.DevItem.DevID,
Addr: paddr,
},
- Size: btrfsvol.AddrDelta(sb.Data.NodeSize),
+ Size: btrfsvol.AddrDelta(sb.NodeSize),
SizeLocked: false,
Flags: nil,
}); err != nil {