diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-07-14 04:45:48 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-07-14 05:45:45 -0600 |
commit | bb73a2fb7678698353bb995754e8702caa2f6e0a (patch) | |
tree | 0ecd149e8ea61db883c7450accfacf42db08b82e /lib/btrfs/io4_fs.go | |
parent | ae42c45061e6e68ed2cdb455ba45a14c39f7cae7 (diff) |
wip ls-files
Diffstat (limited to 'lib/btrfs/io4_fs.go')
-rw-r--r-- | lib/btrfs/io4_fs.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/btrfs/io4_fs.go b/lib/btrfs/io4_fs.go index ad489c7..0ef922b 100644 --- a/lib/btrfs/io4_fs.go +++ b/lib/btrfs/io4_fs.go @@ -191,9 +191,15 @@ func (ret *Dir) populate() { for _, item := range ret.OtherItems { switch item.Key.ItemType { case btrfsitem.INODE_REF_KEY: + body := item.Body.(btrfsitem.InodeRefs) + if len(body) != 1 { + ret.Errs = append(ret.Errs, fmt.Errorf("INODE_REF item with %d entries on a directory", + len(body))) + continue + } ref := InodeRef{ Inode: ObjID(item.Key.Offset), - InodeRef: item.Body.(btrfsitem.InodeRef), + InodeRef: body[0], } if ret.DotDot != nil { if !reflect.DeepEqual(ref, *ret.DotDot) { @@ -336,13 +342,13 @@ func (ret *File) populate() { } pos += size } - if ret.InodeItem != nil && pos != ret.InodeItem.Size { - if ret.InodeItem.Size > pos { + if ret.InodeItem != nil && pos != ret.InodeItem.NumBytes { + if ret.InodeItem.NumBytes > pos { ret.Errs = append(ret.Errs, fmt.Errorf("extent gap from %v to %v", - pos, ret.InodeItem.Size)) + pos, ret.InodeItem.NumBytes)) } else { ret.Errs = append(ret.Errs, fmt.Errorf("extent mapped past end of file from %v to %v", - ret.InodeItem.Size, pos)) + ret.InodeItem.NumBytes, pos)) } } } |