diff options
Diffstat (limited to 'internal/fusefrontend')
-rw-r--r-- | internal/fusefrontend/fs.go | 15 | ||||
-rw-r--r-- | internal/fusefrontend/xattr.go | 5 |
2 files changed, 16 insertions, 4 deletions
diff --git a/internal/fusefrontend/fs.go b/internal/fusefrontend/fs.go index 444a34a..e41b9fa 100644 --- a/internal/fusefrontend/fs.go +++ b/internal/fusefrontend/fs.go @@ -341,10 +341,13 @@ func (fs *FS) Mknod(path string, mode uint32, dev uint32, context *fuse.Context) return fuse.OK } -// Truncate implements pathfs.Filesystem. +// Truncate - FUSE call. Truncates a file. +// // Support truncate(2) by opening the file and calling ftruncate(2) // While the glibc "truncate" wrapper seems to always use ftruncate, fsstress from // xfstests uses this a lot by calling "truncate64" directly. +// +// Symlink-safe by letting file.Truncate() do all the work. func (fs *FS) Truncate(path string, offset uint64, context *fuse.Context) (code fuse.Status) { file, code := fs.Open(path, uint32(os.O_RDWR), context) if code != fuse.OK { @@ -419,7 +422,9 @@ func (fs *FS) Readlink(relPath string, context *fuse.Context) (out string, statu return string(target), fuse.OK } -// Unlink implements pathfs.Filesystem. +// Unlink - FUSE call. Delete a file. +// +// Symlink-safe through use of Unlinkat(). func (fs *FS) Unlink(path string, context *fuse.Context) (code fuse.Status) { if fs.isFiltered(path) { return fuse.EPERM @@ -447,6 +452,8 @@ func (fs *FS) Unlink(path string, context *fuse.Context) (code fuse.Status) { // encryptSymlinkTarget: "data" is encrypted like file contents (GCM) // and base64-encoded. // The empty string encrypts to the empty string. +// +// Symlink-safe because it does not do any I/O. func (fs *FS) encryptSymlinkTarget(data string) (cData64 string) { if data == "" { return "" @@ -456,7 +463,9 @@ func (fs *FS) encryptSymlinkTarget(data string) (cData64 string) { return cData64 } -// Symlink implements pathfs.Filesystem. +// Symlink - FUSE call. Create a symlink. +// +// Symlink-safe through use of Symlinkat. func (fs *FS) Symlink(target string, linkName string, context *fuse.Context) (code fuse.Status) { tlog.Debug.Printf("Symlink(\"%s\", \"%s\")", target, linkName) if fs.isFiltered(linkName) { diff --git a/internal/fusefrontend/xattr.go b/internal/fusefrontend/xattr.go index a0f795a..74b3790 100644 --- a/internal/fusefrontend/xattr.go +++ b/internal/fusefrontend/xattr.go @@ -50,7 +50,10 @@ func (fs *FS) GetXAttr(path string, attr string, context *fuse.Context) ([]byte, return data, fuse.OK } -// SetXAttr implements pathfs.Filesystem. +// SetXAttr - FUSE call. +// +// TODO: Make symlink-safe. Currently blocked because the xattr package does +// not provide fsetxattr. func (fs *FS) SetXAttr(path string, attr string, data []byte, flags int, context *fuse.Context) fuse.Status { if fs.isFiltered(path) { return fuse.EPERM |