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

nodefs: return []byte in Readlink

parent b423903e
......@@ -129,7 +129,7 @@ type SymlinkOperations interface {
Operations
// Readlink reads the content of a symlink.
Readlink(ctx context.Context) (string, fuse.Status)
Readlink(ctx context.Context) ([]byte, fuse.Status)
}
// FileOperations holds operations that apply to regular files. The
......
......@@ -441,7 +441,7 @@ func (b *rawBridge) Readlink(cancel <-chan struct{}, header *fuse.InHeader) (out
return nil, status
}
return []byte(result), fuse.OK
return result, fuse.OK
}
func (b *rawBridge) Access(cancel <-chan struct{}, input *fuse.AccessIn) (status fuse.Status) {
......
......@@ -175,8 +175,8 @@ func (n *DefaultOperations) Symlink(ctx context.Context, target, name string, ou
}
// Readlink return ENOTSUP
func (n *DefaultOperations) Readlink(ctx context.Context) (string, fuse.Status) {
return "", fuse.ENOTSUP
func (n *DefaultOperations) Readlink(ctx context.Context) ([]byte, fuse.Status) {
return nil, fuse.ENOTSUP
}
// Fsync delegates to the FileHandle
......
......@@ -223,18 +223,18 @@ func (n *loopbackNode) Link(ctx context.Context, target Operations, name string,
return ch, fuse.OK
}
func (n *loopbackNode) Readlink(ctx context.Context) (string, fuse.Status) {
func (n *loopbackNode) Readlink(ctx context.Context) ([]byte, fuse.Status) {
p := n.path()
for l := 256; ; l *= 2 {
buf := make([]byte, l)
sz, err := syscall.Readlink(p, buf)
if err != nil {
return "", fuse.ToStatus(err)
return nil, fuse.ToStatus(err)
}
if sz < len(buf) {
return string(buf[:sz]), fuse.OK
return buf[:sz], fuse.OK
}
}
}
......
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