summaryrefslogtreecommitdiff
path: root/lib/btrfs
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2022-07-17 23:06:57 -0600
committerLuke Shumaker <lukeshu@lukeshu.com>2022-07-17 23:06:57 -0600
commit8f4278dcdc1767bad9a26315e5a180c7114b2eb4 (patch)
treee64fb27032d86b0905911c46cacb596aec49ea60 /lib/btrfs
parenteb76093d28930db57e6605babf542ee88ca5ee09 (diff)
implement xattrs
Diffstat (limited to 'lib/btrfs')
-rw-r--r--lib/btrfs/io4_fs.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/btrfs/io4_fs.go b/lib/btrfs/io4_fs.go
index d28e36f..65a7562 100644
--- a/lib/btrfs/io4_fs.go
+++ b/lib/btrfs/io4_fs.go
@@ -29,6 +29,7 @@ type BareInode struct {
type FullInode struct {
BareInode
+ XAttrs map[string]string
OtherItems []Item
}
@@ -133,6 +134,7 @@ func (sv *Subvolume) LoadFullInode(inode ObjID) (*FullInode, error) {
BareInode: BareInode{
Inode: inode,
},
+ XAttrs: make(map[string]string),
}
items, err := sv.FS.TreeSearchAll(sv.TreeID, func(key Key, _ uint32) int {
return containers.NativeCmp(inode, key.ObjectID)
@@ -154,6 +156,9 @@ func (sv *Subvolume) LoadFullInode(inode ObjID) (*FullInode, error) {
continue
}
val.InodeItem = &itemBody
+ case btrfsitem.XATTR_ITEM_KEY:
+ itemBody := item.Body.(btrfsitem.DirEntry)
+ val.XAttrs[string(itemBody.Name)] = string(itemBody.Data)
default:
val.OtherItems = append(val.OtherItems, item)
}
@@ -233,7 +238,6 @@ func (ret *Dir) populate() {
continue
}
ret.ChildrenByIndex[index] = entry
- //case btrfsitem.XATTR_ITEM_KEY:
default:
panic(fmt.Errorf("TODO: handle item type %v", item.Key.ItemType))
}