diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2023-02-12 13:14:43 -0700 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2023-02-12 14:27:30 -0700 |
commit | 79cb12dde9352331c15724b7d0892fd4ce5ea342 (patch) | |
tree | a90ef3875bc235e442d6abe9b9fcd67fadd3d830 /lib/btrfsprogs/btrfsinspect/print_tree.go | |
parent | 2cb3cb14dd85535a0a691d42874d7045d7c81571 (diff) |
btrfsitem, btrfsinspect/print_tree: Implement the QGroup types
Diffstat (limited to 'lib/btrfsprogs/btrfsinspect/print_tree.go')
-rw-r--r-- | lib/btrfsprogs/btrfsinspect/print_tree.go | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/lib/btrfsprogs/btrfsinspect/print_tree.go b/lib/btrfsprogs/btrfsinspect/print_tree.go index 62d1d7b..3fc3a3f 100644 --- a/lib/btrfsprogs/btrfsinspect/print_tree.go +++ b/lib/btrfsprogs/btrfsinspect/print_tree.go @@ -291,12 +291,26 @@ func printTree(ctx context.Context, out io.Writer, fs *btrfs.FS, treeID btrfspri "\t\tchunk_tree_uuid %v\n", body.ChunkTree, body.ChunkObjectID, body.ChunkOffset, body.Length, body.ChunkTreeUUID) - // case btrfsitem.QGROUP_STATUS_KEY: - // // TODO - // case btrfsitem.QGROUP_INFO_KEY: - // // TODO - // case btrfsitem.QGROUP_LIMIT_KEY: - // // TODO + case btrfsitem.QGroupStatus: + textui.Fprintf(out, ""+ + "\t\tversion %v generation %v flags %v scan %d\n", + body.Version, body.Generation, body.Flags, body.RescanProgress) + case btrfsitem.QGroupInfo: + textui.Fprintf(out, ""+ + "\t\tgeneration %v\n"+ + "\t\treferenced %d referenced_compressed %d\n"+ + "\t\texclusive %d exclusive_compressed %d\n", + body.Generation, + body.ReferencedBytes, body.ReferencedBytesCompressed, + body.ExclusiveBytes, body.ExclusiveBytesCompressed) + case btrfsitem.QGroupLimit: + textui.Fprintf(out, ""+ + "\t\tflags %x\n"+ + "\t\tmax_referenced %d max_exclusive %d\n"+ + "\t\trsv_referenced %d rsv_exclusive %d\n", + uint64(body.Flags), + body.MaxReferenced, body.MaxExclusive, + body.RsvReferenced, body.RsvExclusive) case btrfsitem.UUIDMap: textui.Fprintf(out, "\t\tsubvol_id %d\n", body.ObjID) // case btrfsitem.STRING_ITEM_KEY: @@ -426,8 +440,8 @@ func fmtKey(key btrfsprim.Key) string { var out strings.Builder textui.Fprintf(&out, "key (%v %v", key.ObjectID.Format(key.ItemType), key.ItemType) switch key.ItemType { - case btrfsitem.QGROUP_RELATION_KEY: // TODO, btrfsitem.QGROUP_INFO_KEY, btrfsitem.QGROUP_LIMIT_KEY: - panic("TODO: printing qgroup items not yet implemented") + case btrfsitem.QGROUP_RELATION_KEY, btrfsitem.QGROUP_INFO_KEY, btrfsitem.QGROUP_LIMIT_KEY: + textui.Fprintf(&out, " %v)", btrfsprim.ObjID(key.Offset).Format(btrfsprim.QGROUP_RELATION_KEY)) case btrfsitem.UUID_SUBVOL_KEY, btrfsitem.UUID_RECEIVED_SUBVOL_KEY: textui.Fprintf(&out, " %#08x)", key.Offset) case btrfsitem.ROOT_ITEM_KEY: |