Commit ba7cc06b authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

fs: document FileHandle argument for Getattr

Change-Id: I48236bf879939537944e617baa620884e7601055
parent daaa0cfa
......@@ -225,7 +225,10 @@ type NodeAccesser interface {
// returning zeroed permissions, the default behavior is to change the
// mode of 0755 (directory) or 0644 (files). This can be switched off
// with the Options.NullPermissions setting. If blksize is unset, 4096
// is assumed, and the 'blocks' field is set accordingly.
// is assumed, and the 'blocks' field is set accordingly. The 'f'
// argument is provided for consistency, however, in practice the
// kernel never sends a file handle, even if the Getattr call
// originated from a fstat system call.
type NodeGetattrer interface {
Getattr(ctx context.Context, f FileHandle, out *fuse.AttrOut) syscall.Errno
}
......
......@@ -548,15 +548,10 @@ func (b *rawBridge) GetAttr(cancel <-chan struct{}, input *fuse.GetAttrIn, out *
func (b *rawBridge) getattr(ctx context.Context, n *Inode, f FileHandle, out *fuse.AttrOut) syscall.Errno {
var errno syscall.Errno
var fg FileGetattrer
if f != nil {
fg, _ = f.(FileGetattrer)
}
if fops, ok := n.ops.(NodeGetattrer); ok {
errno = fops.Getattr(ctx, f, out)
} else if fg != nil {
errno = fg.Getattr(ctx, out)
if nodeOps, ok := n.ops.(NodeGetattrer); ok {
errno = nodeOps.Getattr(ctx, f, out)
} else if fileOps, ok := f.(FileGetattrer); ok {
errno = fileOps.Getattr(ctx, out)
} else {
// We set Mode below, which is the minimum for success
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment