Skip to content

Commit b37e514

Browse files
shuoranliuawzhgw
authored andcommitted
clientv2: introduce Mknod method
Signed-off-by: Shuoran Liu <[email protected]>
1 parent 2006f0d commit b37e514

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

clientv2/fs/dir.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,25 @@ func (s *Super) MkDir(ctx context.Context, op *fuseops.MkDirOp) error {
4646
}
4747

4848
func (s *Super) MkNode(ctx context.Context, op *fuseops.MkNodeOp) error {
49-
return fuse.ENOSYS
49+
if op.Mode&os.ModeNamedPipe == 0 && op.Mode&os.ModeSocket == 0 {
50+
return fuse.ENOSYS
51+
}
52+
53+
pino := uint64(op.Parent)
54+
desc := fuse.OpDescription(op)
55+
56+
info, err := s.mw.Create_ll(pino, op.Name, proto.Mode(op.Mode|os.ModePerm), nil)
57+
if err != nil {
58+
log.LogErrorf("%v: err(%v)", desc, err)
59+
return ParseError(err)
60+
}
61+
62+
child := NewInode(info)
63+
s.ic.Put(child)
64+
fillChildEntry(&op.Entry, child)
65+
66+
log.LogDebugf("TRACE %v: child(%v)", desc, child)
67+
return nil
5068
}
5169

5270
func (s *Super) CreateFile(ctx context.Context, op *fuseops.CreateFileOp) error {

0 commit comments

Comments
 (0)