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

nodefs: add Attr to MemSymlink

parent 7572e9d8
...@@ -13,6 +13,7 @@ import ( ...@@ -13,6 +13,7 @@ import (
// MemRegularFile is a filesystem node that holds a read-only data // MemRegularFile is a filesystem node that holds a read-only data
// slice in memory. // slice in memory.
type MemRegularFile struct { type MemRegularFile struct {
Inode Inode
Data []byte Data []byte
...@@ -20,7 +21,6 @@ type MemRegularFile struct { ...@@ -20,7 +21,6 @@ type MemRegularFile struct {
} }
var _ = (Opener)((*MemRegularFile)(nil)) var _ = (Opener)((*MemRegularFile)(nil))
var _ = (Getattrer)((*MemRegularFile)(nil))
var _ = (Reader)((*MemRegularFile)(nil)) var _ = (Reader)((*MemRegularFile)(nil))
var _ = (Flusher)((*MemRegularFile)(nil)) var _ = (Flusher)((*MemRegularFile)(nil))
...@@ -32,6 +32,8 @@ func (f *MemRegularFile) Open(ctx context.Context, flags uint32) (fh FileHandle, ...@@ -32,6 +32,8 @@ func (f *MemRegularFile) Open(ctx context.Context, flags uint32) (fh FileHandle,
return nil, fuse.FOPEN_KEEP_CACHE, OK return nil, fuse.FOPEN_KEEP_CACHE, OK
} }
var _ = (Getattrer)((*MemRegularFile)(nil))
func (f *MemRegularFile) Getattr(ctx context.Context, fh FileHandle, out *fuse.AttrOut) syscall.Errno { func (f *MemRegularFile) Getattr(ctx context.Context, fh FileHandle, out *fuse.AttrOut) syscall.Errno {
out.Attr = f.Attr out.Attr = f.Attr
out.Attr.Size = uint64(len(f.Data)) out.Attr.Size = uint64(len(f.Data))
...@@ -53,6 +55,7 @@ func (f *MemRegularFile) Read(ctx context.Context, fh FileHandle, dest []byte, o ...@@ -53,6 +55,7 @@ func (f *MemRegularFile) Read(ctx context.Context, fh FileHandle, dest []byte, o
// MemSymlink is an inode holding a symlink in memory. // MemSymlink is an inode holding a symlink in memory.
type MemSymlink struct { type MemSymlink struct {
Inode Inode
Attr fuse.Attr
Data []byte Data []byte
} }
...@@ -61,3 +64,10 @@ var _ = (Readlinker)((*MemSymlink)(nil)) ...@@ -61,3 +64,10 @@ var _ = (Readlinker)((*MemSymlink)(nil))
func (l *MemSymlink) Readlink(ctx context.Context) ([]byte, syscall.Errno) { func (l *MemSymlink) Readlink(ctx context.Context) ([]byte, syscall.Errno) {
return l.Data, OK return l.Data, OK
} }
var _ = (Getattrer)((*MemSymlink)(nil))
func (l *MemSymlink) Getattr(ctx context.Context, fh FileHandle, out *fuse.AttrOut) syscall.Errno {
out.Attr = l.Attr
return 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