diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-12-20 21:17:21 -0700 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-12-20 21:20:23 -0700 |
commit | f7701686ccdb294e3a67f24a3b333342925e89bc (patch) | |
tree | 36e31af9b5d631e34667346049e6e094acf05aab /lib/btrfs/btrfsitem | |
parent | abd7485b9fb78db233839effcd06e69d44da3859 (diff) |
rebuildnodes: rebuild_graph.go: Have Root items want their UUIDs
Diffstat (limited to 'lib/btrfs/btrfsitem')
-rw-r--r-- | lib/btrfs/btrfsitem/item_uuid.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/btrfs/btrfsitem/item_uuid.go b/lib/btrfs/btrfsitem/item_uuid.go index 451ccae..e1a6cf9 100644 --- a/lib/btrfs/btrfsitem/item_uuid.go +++ b/lib/btrfs/btrfsitem/item_uuid.go @@ -24,6 +24,14 @@ type UUIDMap struct { // UUID_SUBVOL=251 UUID_RECEIVED_SUBVOL=252 func KeyToUUID(key btrfsprim.Key) btrfsprim.UUID { var uuid btrfsprim.UUID binary.LittleEndian.PutUint64(uuid[:8], uint64(key.ObjectID)) - binary.LittleEndian.PutUint64(uuid[8:], uint64(key.Offset)) + binary.LittleEndian.PutUint64(uuid[8:], key.Offset) return uuid } + +func UUIDToKey(uuid btrfsprim.UUID) btrfsprim.Key { + return btrfsprim.Key{ + ObjectID: btrfsprim.ObjID(binary.LittleEndian.Uint64(uuid[:8])), + ItemType: UUID_SUBVOL_KEY, + Offset: binary.LittleEndian.Uint64(uuid[8:]), + } +} |