errorFS.LookUpInode
parent
c71b2cbf33
commit
54db03b63d
|
@ -31,6 +31,12 @@ const FooContents = "xxxx"
|
||||||
|
|
||||||
const fooInodeID = fuseops.RootInodeID + 1
|
const fooInodeID = fuseops.RootInodeID + 1
|
||||||
|
|
||||||
|
var fooAttrs = fuseops.InodeAttributes{
|
||||||
|
Nlink: 1,
|
||||||
|
Size: uint64(len(FooContents)),
|
||||||
|
Mode: 0444,
|
||||||
|
}
|
||||||
|
|
||||||
// A file system whose sole contents are a file named "foo" containing the
|
// A file system whose sole contents are a file named "foo" containing the
|
||||||
// string defined by FooContents.
|
// string defined by FooContents.
|
||||||
//
|
//
|
||||||
|
@ -103,11 +109,7 @@ func (fs *errorFS) GetInodeAttributes(
|
||||||
}
|
}
|
||||||
|
|
||||||
case op.Inode == fooInodeID:
|
case op.Inode == fooInodeID:
|
||||||
op.Attributes = fuseops.InodeAttributes{
|
op.Attributes = fooAttrs
|
||||||
Nlink: 1,
|
|
||||||
Size: uint64(len(FooContents)),
|
|
||||||
Mode: 0444,
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
err = fmt.Errorf("Unknown inode: %d", op.Inode)
|
err = fmt.Errorf("Unknown inode: %d", op.Inode)
|
||||||
|
@ -116,3 +118,23 @@ func (fs *errorFS) GetInodeAttributes(
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LOCKS_EXCLUDED(fs.mu)
|
||||||
|
func (fs *errorFS) LookUpInode(
|
||||||
|
ctx context.Context,
|
||||||
|
op *fuseops.LookUpInodeOp) (err error) {
|
||||||
|
if fs.transformError(op, &err) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Is this a known inode?
|
||||||
|
if !(op.Parent == fuseops.RootInodeID && op.Name == "foo") {
|
||||||
|
err = syscall.ENOENT
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
op.Entry.Child = fooInodeID
|
||||||
|
op.Entry.Attributes = fooAttrs
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue