diff options
Diffstat (limited to 'pkg/btrfs')
-rw-r--r-- | pkg/btrfs/btrfsitem/item_uuid.go | 34 | ||||
-rw-r--r-- | pkg/btrfs/io4_fs.go | 2 |
2 files changed, 6 insertions, 30 deletions
diff --git a/pkg/btrfs/btrfsitem/item_uuid.go b/pkg/btrfs/btrfsitem/item_uuid.go index 6b47547..45543b3 100644 --- a/pkg/btrfs/btrfsitem/item_uuid.go +++ b/pkg/btrfs/btrfsitem/item_uuid.go @@ -5,36 +5,12 @@ import ( "lukeshu.com/btrfs-tools/pkg/btrfs/internal" ) -// The Key for this item is a UUID, and the item is a list of -// subvolume IDs (ObjectIDs) that that UUID maps to. +// The Key for this item is a UUID, and the item is a subvolume IDs +// that that UUID maps to. // // key.objectid = first half of UUID // key.offset = second half of UUID -type UUIDMap []internal.ObjID // UUID_SUBVOL=251 UUID_RECEIVED_SUBVOL=252 - -func (o *UUIDMap) UnmarshalBinary(dat []byte) (int, error) { - *o = nil - var n int - for len(dat) > n { - var subvolID internal.ObjID - _n, err := binstruct.Unmarshal(dat[n:], &subvolID) - n += _n - if err != nil { - return n, err - } - *o = append(*o, subvolID) - } - return n, nil -} - -func (o UUIDMap) MarshalBinary() ([]byte, error) { - var ret []byte - for _, subvolID := range o { - bs, err := binstruct.Marshal(subvolID) - ret = append(ret, bs...) - if err != nil { - return ret, err - } - } - return ret, nil +type UUIDMap struct { // UUID_SUBVOL=251 UUID_RECEIVED_SUBVOL=252 + ObjID internal.ObjID `bin:"off=0, siz=8"` + binstruct.End `bin:"off=8"` } diff --git a/pkg/btrfs/io4_fs.go b/pkg/btrfs/io4_fs.go index 75b973b..37d949e 100644 --- a/pkg/btrfs/io4_fs.go +++ b/pkg/btrfs/io4_fs.go @@ -84,7 +84,7 @@ func (sv *Subvolume) init() { rootBody, ok := root.Body.(btrfsitem.Root) if !ok { - sv.rootErr = fmt.Errorf("FS_TREE_ ROOT_ITEM has malformed body") + sv.rootErr = fmt.Errorf("FS_TREE ROOT_ITEM has malformed body") return } |