From 12d10ff2e3317c280e5f6ebfd913c73a6a1d896b Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 6 Jul 2022 03:19:40 -0600 Subject: subvolumes working, kinda --- pkg/btrfs/btrfsitem/item_inoderef.go | 33 +++------------------------------ 1 file changed, 3 insertions(+), 30 deletions(-) (limited to 'pkg/btrfs/btrfsitem/item_inoderef.go') diff --git a/pkg/btrfs/btrfsitem/item_inoderef.go b/pkg/btrfs/btrfsitem/item_inoderef.go index 78dd677..2c26df6 100644 --- a/pkg/btrfs/btrfsitem/item_inoderef.go +++ b/pkg/btrfs/btrfsitem/item_inoderef.go @@ -4,36 +4,9 @@ import ( "lukeshu.com/btrfs-tools/pkg/binstruct" ) -type InodeRefList []InodeRef // INODE_REF=12 - -func (o *InodeRefList) UnmarshalBinary(dat []byte) (int, error) { - *o = nil - n := 0 - for n < len(dat) { - var ref InodeRef - _n, err := binstruct.Unmarshal(dat, &ref) - n += _n - if err != nil { - return n, err - } - *o = append(*o, ref) - } - return n, nil -} - -func (o InodeRefList) MarshalBinary() ([]byte, error) { - var ret []byte - for _, ref := range o { - bs, err := binstruct.Marshal(ref) - ret = append(ret, bs...) - if err != nil { - return ret, err - } - } - return ret, nil -} - -type InodeRef struct { +// key.objectid = inode number of the file +// key.offset = inode number of the parent file +type InodeRef struct { // INODE_REF=12 Index int64 `bin:"off=0x0, siz=0x8"` NameLen uint16 `bin:"off=0x8, siz=0x2"` // [ignored-when-writing] binstruct.End `bin:"off=0xa"` -- cgit v1.2.3-2-g168b