From 8f4278dcdc1767bad9a26315e5a180c7114b2eb4 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 17 Jul 2022 23:06:57 -0600 Subject: implement xattrs --- lib/btrfs/io4_fs.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/btrfs/io4_fs.go') 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)) } -- cgit v1.2.3-54-g00ecf