diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-12-24 21:03:08 -0700 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-12-24 21:03:08 -0700 |
commit | bfe111c950da328b673ed4e3f8da0503bbd793d8 (patch) | |
tree | c93b73fd2426da5c902147d2a4eb1f4efbc5371f /lib/btrfs/btrfsitem | |
parent | 8ff81c1ed6a50179166ffc4cfb60bef85394265e (diff) | |
parent | bc06b340b71a07a0bb500e1bb7e81ece19f1a9c5 (diff) |
Merge branch 'lukeshu/rebuild-nodes-take3'
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:]), + } +} |