Commit 0e98d4bf authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

nodefs: add EntryOut to Create signature

parent 2d41aad8
......@@ -334,7 +334,7 @@ type Symlinker interface {
// reference for future reads/writes.
// Default is to return EROFS.
type Creater interface {
Create(ctx context.Context, name string, flags uint32, mode uint32) (node *Inode, fh FileHandle, fuseFlags uint32, errno syscall.Errno)
Create(ctx context.Context, name string, flags uint32, mode uint32, out *fuse.EntryOut) (node *Inode, fh FileHandle, fuseFlags uint32, errno syscall.Errno)
}
// Unlink should remove a child from this directory. If the
......
......@@ -337,7 +337,7 @@ func (b *rawBridge) Create(cancel <-chan struct{}, input *fuse.CreateIn, name st
var f FileHandle
var flags uint32
if mops, ok := parent.ops.(Creater); ok {
child, f, flags, errno = mops.Create(ctx, name, input.Flags, input.Mode)
child, f, flags, errno = mops.Create(ctx, name, input.Flags, input.Mode, &out.EntryOut)
} else {
return fuse.EROFS
}
......@@ -353,15 +353,8 @@ func (b *rawBridge) Create(cancel <-chan struct{}, input *fuse.CreateIn, name st
out.OpenFlags = flags
var temp fuse.AttrOut
b.getattr(ctx, child, f, &temp)
out.Attr = temp.Attr
out.AttrValid = temp.AttrValid
out.AttrValidNsec = temp.AttrValidNsec
child.setEntryOut(&out.EntryOut)
b.setEntryOutTimeout(&out.EntryOut)
return fuse.OK
}
......
......@@ -41,7 +41,6 @@ var _ = (Mkdirer)((*loopbackNode)(nil))
var _ = (Mknoder)((*loopbackNode)(nil))
var _ = (Linker)((*loopbackNode)(nil))
var _ = (Symlinker)((*loopbackNode)(nil))
var _ = (Creater)((*loopbackNode)(nil))
var _ = (Unlinker)((*loopbackNode)(nil))
var _ = (Rmdirer)((*loopbackNode)(nil))
var _ = (Renamer)((*loopbackNode)(nil))
......@@ -182,7 +181,9 @@ func (r *loopbackRoot) idFromStat(st *syscall.Stat_t) NodeAttr {
}
}
func (n *loopbackNode) Create(ctx context.Context, name string, flags uint32, mode uint32) (inode *Inode, fh FileHandle, fuseFlags uint32, errno syscall.Errno) {
var _ = (Creater)((*loopbackNode)(nil))
func (n *loopbackNode) Create(ctx context.Context, name string, flags uint32, mode uint32, out *fuse.EntryOut) (inode *Inode, fh FileHandle, fuseFlags uint32, errno syscall.Errno) {
p := filepath.Join(n.path(), name)
fd, err := syscall.Open(p, int(flags)|os.O_CREATE, mode)
......@@ -199,6 +200,8 @@ func (n *loopbackNode) Create(ctx context.Context, name string, flags uint32, mo
node := &loopbackNode{}
ch := n.NewInode(ctx, node, n.root().idFromStat(&st))
lf := NewLoopbackFile(fd)
out.FromStat(&st)
return ch, lf, 0, 0
}
......
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