summaryrefslogtreecommitdiff
path: root/pkg/btrfs/btrfsitem/item_uuid.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/btrfs/btrfsitem/item_uuid.go')
-rw-r--r--pkg/btrfs/btrfsitem/item_uuid.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/pkg/btrfs/btrfsitem/item_uuid.go b/pkg/btrfs/btrfsitem/item_uuid.go
index 894ccff..d66e102 100644
--- a/pkg/btrfs/btrfsitem/item_uuid.go
+++ b/pkg/btrfs/btrfsitem/item_uuid.go
@@ -7,12 +7,10 @@ import (
// The Key for this item is a UUID, and the item is a list of
// subvolume IDs (ObjectIDs) that that UUID maps to.
-type UUIDMap struct { // UUID_SUBVOL=251 UUID_RECEIVED_SUBVOL=252
- SubvolIDs []internal.ObjID
-}
+type UUIDMap []internal.ObjID // UUID_SUBVOL=251 UUID_RECEIVED_SUBVOL=252
func (o *UUIDMap) UnmarshalBinary(dat []byte) (int, error) {
- o.SubvolIDs = nil
+ *o = nil
var n int
for len(dat) > n {
var subvolID internal.ObjID
@@ -21,14 +19,14 @@ func (o *UUIDMap) UnmarshalBinary(dat []byte) (int, error) {
if err != nil {
return n, err
}
- o.SubvolIDs = append(o.SubvolIDs, subvolID)
+ *o = append(*o, subvolID)
}
return n, nil
}
func (o UUIDMap) MarshalBinary() ([]byte, error) {
var ret []byte
- for _, subvolID := range o.SubvolIDs {
+ for _, subvolID := range o {
bs, err := binstruct.Marshal(subvolID)
ret = append(ret, bs...)
if err != nil {