diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-08-29 20:28:58 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-08-30 21:29:16 -0600 |
commit | 079c2a1316616b997e0050a1423c0a5e6bda4f16 (patch) | |
tree | 7fc070389da190e4af2ff9acf76f33840989a755 /lib/btrfs/btrfsitem/item_uuid.go | |
parent | 709553bb19fcd5abf0a2839a18d2dd0c66554dd2 (diff) |
wip
Diffstat (limited to 'lib/btrfs/btrfsitem/item_uuid.go')
-rw-r--r-- | lib/btrfs/btrfsitem/item_uuid.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/btrfs/btrfsitem/item_uuid.go b/lib/btrfs/btrfsitem/item_uuid.go index 03823ce..451ccae 100644 --- a/lib/btrfs/btrfsitem/item_uuid.go +++ b/lib/btrfs/btrfsitem/item_uuid.go @@ -5,6 +5,8 @@ package btrfsitem import ( + "encoding/binary" + "git.lukeshu.com/btrfs-progs-ng/lib/binstruct" "git.lukeshu.com/btrfs-progs-ng/lib/btrfs/btrfsprim" ) @@ -18,3 +20,10 @@ type UUIDMap struct { // UUID_SUBVOL=251 UUID_RECEIVED_SUBVOL=252 ObjID btrfsprim.ObjID `bin:"off=0, siz=8"` binstruct.End `bin:"off=8"` } + +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)) + return uuid +} |