Documentation ¶
Overview ¶
Package fusefrontend interfaces directly with the go-fuse library.
Package fusefrontend interfaces directly with the go-fuse library.
Package fusefrontend interfaces directly with the go-fuse library.
Index ¶
- Constants
- type Args
- type FS
- func (fs *FS) Access(relPath string, mode uint32, context *fuse.Context) (code fuse.Status)
- func (fs *FS) Chmod(path string, mode uint32, context *fuse.Context) (code fuse.Status)
- func (fs *FS) Chown(path string, uid uint32, gid uint32, context *fuse.Context) (code fuse.Status)
- func (fs *FS) Create(path string, flags uint32, mode uint32, context *fuse.Context) (nodefs.File, fuse.Status)
- func (fs *FS) DecryptPath(cipherPath string) (plainPath string, err error)
- func (fs *FS) EncryptPath(plainPath string) (string, error)
- func (fs *FS) GetAttr(relPath string, context *fuse.Context) (*fuse.Attr, fuse.Status)
- func (fs *FS) GetXAttr(relPath string, attr string, context *fuse.Context) ([]byte, fuse.Status)
- func (fs *FS) Link(oldPath string, newPath string, context *fuse.Context) (code fuse.Status)
- func (fs *FS) ListXAttr(relPath string, context *fuse.Context) ([]string, fuse.Status)
- func (fs *FS) Mkdir(newPath string, mode uint32, context *fuse.Context) (code fuse.Status)
- func (fs *FS) Mknod(path string, mode uint32, dev uint32, context *fuse.Context) (code fuse.Status)
- func (fs *FS) Open(path string, flags uint32, context *fuse.Context) (fuseFile nodefs.File, status fuse.Status)
- func (fs *FS) OpenDir(dirName string, context *fuse.Context) ([]fuse.DirEntry, fuse.Status)
- func (fs *FS) Readlink(relPath string, context *fuse.Context) (out string, status fuse.Status)
- func (fs *FS) RemoveXAttr(relPath string, attr string, context *fuse.Context) fuse.Status
- func (fs *FS) Rename(oldPath string, newPath string, context *fuse.Context) (code fuse.Status)
- func (fs *FS) Rmdir(relPath string, context *fuse.Context) (code fuse.Status)
- func (fs *FS) SetXAttr(relPath string, attr string, data []byte, flags int, context *fuse.Context) fuse.Status
- func (fs *FS) StatFs(path string) *fuse.StatfsOut
- func (fs *FS) Symlink(target string, linkName string, context *fuse.Context) (code fuse.Status)
- func (fs *FS) Truncate(path string, offset uint64, context *fuse.Context) (code fuse.Status)
- func (fs *FS) Unlink(path string, context *fuse.Context) (code fuse.Status)
- func (fs *FS) Utimens(path string, a *time.Time, m *time.Time, context *fuse.Context) (code fuse.Status)
- type File
- func (f *File) Allocate(off uint64, sz uint64, mode uint32) fuse.Status
- func (f *File) Chmod(mode uint32) fuse.Status
- func (f *File) Chown(uid uint32, gid uint32) fuse.Status
- func (f *File) Flush() fuse.Status
- func (f *File) Fsync(flags int) (code fuse.Status)
- func (f *File) GetAttr(a *fuse.Attr) fuse.Status
- func (f *File) Read(buf []byte, off int64) (resultData fuse.ReadResult, code fuse.Status)
- func (f *File) Release()
- func (f *File) SeekData(oldOffset int64) (int64, error)
- func (f *File) Truncate(newSize uint64) fuse.Status
- func (f *File) Utimens(a *time.Time, m *time.Time) fuse.Status
- func (f *File) Write(data []byte, off int64) (uint32, fuse.Status)
Constants ¶
const FALLOC_DEFAULT = 0x00
FALLOC_DEFAULT is a "normal" fallocate operation
const FALLOC_FL_KEEP_SIZE = 0x01
FALLOC_FL_KEEP_SIZE allocates disk space while not modifying the file size
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Args ¶
type Args struct { // Cipherdir is the backing storage directory (absolute path). // For reverse mode, Cipherdir actually contains *plaintext* files. Cipherdir string PlaintextNames bool LongNames bool // Should we chown a file after it has been created? // This only makes sense if (1) allow_other is set and (2) we run as root. PreserveOwner bool // Should we force ownership to be presented with a given user and group? // This only makes sense if allow_other is set. In *most* cases, it also // only makes sense with PreserveOwner set, but can also make sense without // PreserveOwner if the underlying filesystem acting as backing store // enforces ownership itself. ForceOwner *fuse.Owner // ConfigCustom is true when the user select a non-default config file // location. If it is false, reverse mode maps ".gocryptfs.reverse.conf" // to "gocryptfs.conf" in the plaintext dir. ConfigCustom bool // NoPrealloc disables automatic preallocation before writing NoPrealloc bool // Try to serialize read operations, "-serialize_reads" SerializeReads bool // Force decode even if integrity check fails (openSSL only) ForceDecode bool // Exclude is a list of paths to make inaccessible, starting match at // the filesystem root Exclude []string // ExcludeWildcards is a list of paths to make inaccessible, matched // anywhere, and supporting wildcards ExcludeWildcard []string // ExcludeFrom is a list of files from which to read exclusion patterns // (with wildcard syntax) ExcludeFrom []string }
Args is a container for arguments that are passed from main() to fusefrontend
type FS ¶
type FS struct { // Embed pathfs.defaultFileSystem to avoid compile failure when the // pathfs.FileSystem interface gets new functions. defaultFileSystem // provides a no-op implementation for all functions. pathfs.FileSystem // MitigatedCorruptions is used to report data corruption that is internally // mitigated by ignoring the corrupt item. For example, when OpenDir() finds // a corrupt filename, we still return the other valid filenames. // The corruption is logged to syslog to inform the user, and in addition, // the corrupt filename is logged to this channel via // reportMitigatedCorruption(). // "gocryptfs -fsck" reads from the channel to also catch these transparently- // mitigated corruptions. MitigatedCorruptions chan string // This flag is set to zero each time fs.isFiltered() is called // (uint32 so that it can be reset with CompareAndSwapUint32). // When -idle was used when mounting, idleMonitor() sets it to 1 // periodically. IsIdle uint32 // contains filtered or unexported fields }
FS implements the go-fuse virtual filesystem interface.
func NewFS ¶
func NewFS(args Args, c *contentenc.ContentEnc, n nametransform.NameTransformer) *FS
NewFS returns a new encrypted FUSE overlay filesystem.
func (*FS) Access ¶
Access - FUSE call. Check if a file can be accessed in the specified mode(s) (read, write, execute).
From https://github.com/libfuse/libfuse/blob/master/include/fuse.h :
> Check file access permissions > > If the 'default_permissions' mount option is given, this method is not > called.
We always enable default_permissions when -allow_other is passed, so there is no need for this function to check the uid in fuse.Context.
Symlink-safe through use of faccessat.
func (*FS) Chmod ¶
Chmod - FUSE call. Change permissions on "path".
Symlink-safe through use of Fchmodat().
func (*FS) Chown ¶
Chown - FUSE call. Change the owner of "path".
Symlink-safe through use of Fchownat().
func (*FS) Create ¶
func (fs *FS) Create(path string, flags uint32, mode uint32, context *fuse.Context) (nodefs.File, fuse.Status)
Create - FUSE call. Creates a new file.
Symlink-safe through the use of Openat().
func (*FS) DecryptPath ¶ added in v1.2.1
DecryptPath implements ctlsock.Backend
DecryptPath is symlink-safe because openBackingDir() and decryptPathAt() are symlink-safe.
func (*FS) EncryptPath ¶ added in v1.2.1
EncryptPath implements ctlsock.Backend
Symlink-safe through openBackingDir().
func (*FS) GetAttr ¶
GetAttr implements pathfs.Filesystem.
GetAttr is symlink-safe through use of openBackingDir() and Fstatat().
func (*FS) GetXAttr ¶
GetXAttr - FUSE call. Reads the value of extended attribute "attr".
This function is symlink-safe through Fgetxattr.
func (*FS) Link ¶
Link - FUSE call. Creates a hard link at "newPath" pointing to file "oldPath".
Symlink-safe through use of Linkat().
func (*FS) ListXAttr ¶
ListXAttr - FUSE call. Lists extended attributes on the file at "relPath".
This function is symlink-safe through Flistxattr.
func (*FS) Mkdir ¶
Mkdir - FUSE call. Create a directory at "newPath" with permissions "mode".
Symlink-safe through use of Mkdirat().
func (*FS) Open ¶
func (fs *FS) Open(path string, flags uint32, context *fuse.Context) (fuseFile nodefs.File, status fuse.Status)
Open - FUSE call. Open already-existing file.
Symlink-safe through Openat().
func (*FS) OpenDir ¶
OpenDir - FUSE call
This function is symlink-safe through use of openBackingDir() and ReadDirIVAt().
func (*FS) RemoveXAttr ¶
RemoveXAttr - FUSE call.
This function is symlink-safe through Fremovexattr.
func (*FS) SetXAttr ¶
func (fs *FS) SetXAttr(relPath string, attr string, data []byte, flags int, context *fuse.Context) fuse.Status
SetXAttr - FUSE call. Set extended attribute.
This function is symlink-safe through Fsetxattr.
func (*FS) StatFs ¶
StatFs - FUSE call. Returns information about the filesystem.
Symlink-safe because the passed path is ignored.
func (*FS) Truncate ¶
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.
type File ¶ added in v1.6.1
type File struct { // We embed a nodefs.NewDefaultFile() that returns ENOSYS for every operation we // have not implemented. This prevents build breakage when the go-fuse library // adds new methods to the nodefs.File interface. nodefs.File // contains filtered or unexported fields }
File - based on loopbackFile in go-fuse/fuse/nodefs/files.go
func (*File) Allocate ¶ added in v1.6.1
Allocate - FUSE call for fallocate(2)
mode=FALLOC_FL_KEEP_SIZE is implemented directly.
mode=FALLOC_DEFAULT is implemented as a two-step process:
(1) Allocate the space using FALLOC_FL_KEEP_SIZE (2) Set the file size using ftruncate (via truncateGrowFile)
This allows us to reuse the file grow mechanics from Truncate as they are complicated and hard to get right.
Other modes (hole punching, zeroing) are not supported.
func (*File) SeekData ¶ added in v1.6.1
SeekData calls the lseek syscall with SEEK_DATA. It returns the offset of the next data bytes, skipping over file holes.