summaryrefslogtreecommitdiff
path: root/lib/btrfs/btrfsitem/item_rootref.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2022-10-17 00:15:06 -0600
committerLuke Shumaker <lukeshu@lukeshu.com>2022-12-20 19:58:11 -0700
commit53a2ce3b4dcbfd17ac15230da17130a2aeae42dc (patch)
tree4d915a8ae475b82f53014b2c8c90a31932794168 /lib/btrfs/btrfsitem/item_rootref.go
parent85169c799b4a0d4ba7d39347c07690dc0b49a1d1 (diff)
Add and improve comments
Diffstat (limited to 'lib/btrfs/btrfsitem/item_rootref.go')
-rw-r--r--lib/btrfs/btrfsitem/item_rootref.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/btrfs/btrfsitem/item_rootref.go b/lib/btrfs/btrfsitem/item_rootref.go
index d1dfd3b..b33883d 100644
--- a/lib/btrfs/btrfsitem/item_rootref.go
+++ b/lib/btrfs/btrfsitem/item_rootref.go
@@ -12,9 +12,16 @@ import (
"git.lukeshu.com/btrfs-progs-ng/lib/btrfs/btrfsprim"
)
+// RootRefs link subvolumes parent→child for normal subvolumes and
+// base→snapshot for snapshot subvolumes. BACKREF items go the other
+// direction; child→parent and snapshot→base.
+//
+// ROOT_REF | ROOT_BACKREF
+// key.objectid = ID of the parent subvolume | ID of the child subvolume
+// key.offset = ID of the child subvolume | ID of the parent subvolume
type RootRef struct { // ROOT_REF=156 ROOT_BACKREF=144
- DirID btrfsprim.ObjID `bin:"off=0x00, siz=0x8"`
- Sequence int64 `bin:"off=0x08, siz=0x8"`
+ DirID btrfsprim.ObjID `bin:"off=0x00, siz=0x8"` // inode of the parent directory of the dir entry
+ Sequence int64 `bin:"off=0x08, siz=0x8"` // index of that dir entry within the parent
NameLen uint16 `bin:"off=0x10, siz=0x2"` // [ignored-when-writing]
binstruct.End `bin:"off=0x12"`
Name []byte `bin:"-"`