Commit 6950891f authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

nodefs: use AttrOut for GetAttr

parent db20efd7
......@@ -121,7 +121,7 @@ type Node interface {
// The methods below may be called on closed files, due to
// concurrency. In that case, you should return EBADF.
GetAttr(ctx context.Context, f File, out *fuse.Attr) fuse.Status
GetAttr(ctx context.Context, f File, out *fuse.AttrOut) fuse.Status
/*
NOSUBMIT - fold into a setattr method, or expand methods?
......@@ -162,7 +162,7 @@ type File interface {
// The methods below may be called on closed files, due to
// concurrency. In that case, you should return EBADF.
// TODO - fold into a setattr method?
GetAttr(ctx context.Context, out *fuse.Attr) fuse.Status
GetAttr(ctx context.Context, out *fuse.AttrOut) fuse.Status
Truncate(ctx context.Context, size uint64) fuse.Status
Chown(ctx context.Context, uid uint32, gid uint32) fuse.Status
Chmod(ctx context.Context, perms uint32) fuse.Status
......
......@@ -267,8 +267,13 @@ func (b *rawBridge) Create(input *fuse.CreateIn, name string, out *fuse.CreateOu
out.OpenFlags = flags
f.GetAttr(ctx, &out.Attr)
var temp fuse.AttrOut
f.GetAttr(ctx, &temp)
out.Attr = temp.Attr
out.AttrValid = temp.AttrValid
out.AttrValidNsec = temp.AttrValidNsec
b.setEntryOutTimeout(&out.EntryOut)
if out.Attr.Mode&^07777 != fuse.S_IFREG {
log.Panicf("Create: mode must be S_IFREG (%o), got %o", fuse.S_IFREG, out.Attr.Mode)
}
......@@ -287,7 +292,7 @@ func (b *rawBridge) unregisterNode(nodeid uint64) {
func (b *rawBridge) SetDebug(debug bool) {}
func (b *rawBridge) GetAttr(input *fuse.GetAttrIn, out *fuse.AttrOut) (code fuse.Status) {
func (b *rawBridge) GetAttr(input *fuse.GetAttrIn, out *fuse.AttrOut) fuse.Status {
n, fEntry := b.inode(input.NodeId, input.Fh())
f := fEntry.file
......@@ -295,8 +300,7 @@ func (b *rawBridge) GetAttr(input *fuse.GetAttrIn, out *fuse.AttrOut) (code fuse
f = nil
}
dest := &out.Attr
code = n.node.GetAttr(context.TODO(), f, dest)
code = n.node.GetAttr(context.TODO(), f, out)
if out.Nlink == 0 {
// With Nlink == 0, newer kernels will refuse link
// operations.
......@@ -377,10 +381,7 @@ func (b *rawBridge) SetAttr(input *fuse.SetAttrIn, out *fuse.AttrOut) (code fuse
// Must call GetAttr(); the filesystem may override some of
// the changes we effect here.
attr := &out.Attr
// should take AttrOut
code = n.node.GetAttr(ctx, f, attr)
code = n.node.GetAttr(ctx, f, out)
b.setAttrTimeout(out)
return code
}
......
......@@ -93,7 +93,7 @@ func (n *DefaultNode) Allocate(ctx context.Context, f File, off uint64, size uin
return fuse.ENOSYS
}
func (n *DefaultNode) GetAttr(ctx context.Context, f File, out *fuse.Attr) fuse.Status {
func (n *DefaultNode) GetAttr(ctx context.Context, f File, out *fuse.AttrOut) fuse.Status {
if f != nil {
f.GetAttr(ctx, out)
}
......
......@@ -152,7 +152,7 @@ func (f *loopbackFile) Chown(ctx context.Context, uid uint32, gid uint32) fuse.S
return r
}
func (f *loopbackFile) GetAttr(ctx context.Context, a *fuse.Attr) fuse.Status {
func (f *loopbackFile) GetAttr(ctx context.Context, a *fuse.AttrOut) fuse.Status {
st := syscall.Stat_t{}
f.mu.Lock()
err := syscall.Fstat(int(f.File.Fd()), &st)
......
......@@ -19,7 +19,7 @@ type loopbackRoot struct {
root string
}
func (n *loopbackRoot) GetAttr(ctx context.Context, f File, out *fuse.Attr) fuse.Status {
func (n *loopbackRoot) GetAttr(ctx context.Context, f File, out *fuse.AttrOut) fuse.Status {
var err error = nil
st := syscall.Stat_t{}
err = syscall.Stat(n.root, &st)
......@@ -175,7 +175,7 @@ func (n *loopbackNode) Open(ctx context.Context, flags uint32) (fh File, fuseFla
return NewLoopbackFile(f), 0, fuse.OK
}
func (n *loopbackNode) GetAttr(ctx context.Context, f File, out *fuse.Attr) fuse.Status {
func (n *loopbackNode) GetAttr(ctx context.Context, f File, out *fuse.AttrOut) fuse.Status {
if f != nil {
return f.GetAttr(ctx, out)
}
......
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