Documentation
¶
Overview ¶
Package fsmount provides functionality to mount a Files.com filesystem using FUSE.
Index ¶
- Constants
- type FSWriter
- type Filescomfs
- func (fs *Filescomfs) Access(path string, mask uint32) int
- func (fs *Filescomfs) Chflags(path string, flags uint32) int
- func (fs *Filescomfs) Chmod(path string, mode uint32) int
- func (fs *Filescomfs) Chown(path string, uid uint32, gid uint32) int
- func (fs *Filescomfs) Create(path string, flags int, mode uint32) (errc int, fh uint64)
- func (fs *Filescomfs) CreateEx(path string, mode uint32, fi *fuse.FileInfo_t) int
- func (fs *Filescomfs) Destroy()
- func (fs *Filescomfs) Flush(path string, fh uint64) int
- func (fs *Filescomfs) Fsync(path string, datasync bool, fh uint64) (errc int)
- func (fs *Filescomfs) Fsyncdir(path string, datasync bool, fh uint64) int
- func (fs *Filescomfs) Getattr(path string, stat *fuse.Stat_t, fh uint64) (errc int)
- func (fs *Filescomfs) Getpath(path string, fh uint64) (int, string)
- func (fs *Filescomfs) Getxattr(path string, name string) (int, []byte)
- func (fs *Filescomfs) Init()
- func (fs *Filescomfs) Link(oldpath string, newpath string) int
- func (fs *Filescomfs) Listxattr(path string, fill func(name string) bool) int
- func (fs *Filescomfs) Mkdir(path string, mode uint32) (errc int)
- func (fs *Filescomfs) Mknod(path string, mode uint32, dev uint64) int
- func (fs *Filescomfs) Open(path string, flags int) (errc int, fh uint64)
- func (fs *Filescomfs) OpenEx(path string, fi *fuse.FileInfo_t) int
- func (fs *Filescomfs) Opendir(path string) (errc int, fh uint64)
- func (fs *Filescomfs) Read(path string, buff []byte, ofst int64, fh uint64) (n int)
- func (fs *Filescomfs) Readdir(path string, fill func(name string, stat *fuse.Stat_t, ofst int64) bool, ...) (errc int)
- func (fs *Filescomfs) Readlink(path string) (int, string)
- func (fs *Filescomfs) Release(path string, fh uint64) (errc int)
- func (fs *Filescomfs) Releasedir(path string, fh uint64) (errc int)
- func (fs *Filescomfs) Removexattr(path string, name string) int
- func (fs *Filescomfs) Rename(oldpath string, newpath string) (errc int)
- func (fs *Filescomfs) Rmdir(path string) int
- func (fs *Filescomfs) Setchgtime(path string, tmsp fuse.Timespec) int
- func (fs *Filescomfs) Setcrtime(path string, tmsp fuse.Timespec) int
- func (fs *Filescomfs) Setxattr(path string, name string, value []byte, flags int) int
- func (fs *Filescomfs) Statfs(path string, stat *fuse.Statfs_t) (errc int)
- func (fs *Filescomfs) Symlink(target string, newpath string) int
- func (fs *Filescomfs) Truncate(path string, size int64, fh uint64) (errc int)
- func (fs *Filescomfs) Unlink(path string) int
- func (fs *Filescomfs) Utimens(path string, tmsp []fuse.Timespec) (errc int)
- func (fs *Filescomfs) Validate() error
- func (fs *Filescomfs) Write(path string, buff []byte, ofst int64, fh uint64) (n int)
- type FuseFlags
- func (f FuseFlags) IsAppend() bool
- func (f FuseFlags) IsCreate() bool
- func (f FuseFlags) IsCreateExclusive() bool
- func (f FuseFlags) IsEventOnly() bool
- func (f FuseFlags) IsExclusive() bool
- func (f FuseFlags) IsReadOnly() bool
- func (f FuseFlags) IsReadWrite() bool
- func (f FuseFlags) IsTruncate() bool
- func (f FuseFlags) IsWriteOnly() bool
- func (f FuseFlags) String() string
- type MountHost
- type MountParams
- type OpenHandles
- func (h *OpenHandles) ExtendOpenHandleTtls()
- func (h *OpenHandles) Lookup(id uint64) (*fileHandle, *fsNode, bool)
- func (h *OpenHandles) Open(n *fsNode, fl FuseFlags) (id uint64, fh *fileHandle)
- func (h *OpenHandles) OpenHandles() []*fileHandle
- func (h *OpenHandles) Release(id uint64) (*fileHandle, bool)
Constants ¶
const ( // DefaultWriteConcurrency is the default number of concurrent file parts to upload. DefaultWriteConcurrency = 50 // DefaultCacheTTL is the default cache TTL for the filesystem metadata. DefaultCacheTTL = 5 * time.Second // DefaultVolumeName is the default volume name for the filesystem. DefaultVolumeName = "Files.com" // DefaultDebugFuseLog is the default path to the fuse debug log. [Windows only] DefaultDebugFuseLog = "fuse.log" )
const (
// O_EVTONLY is a flag used to indicate that the file is opened for event notifications only.
O_EVTONLY = 0x8000
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Filescomfs ¶ added in v3.2.197
type Filescomfs struct {
fuse.FileSystemBase // implements fuse.FileSystem with no-op methods
// contains filtered or unexported fields
}
Filescomfs is a filesystem that implements the fuse.FileSystem interface, allowing it to be mounted using FUSE. It provides a virtual filesystem interface to Files.com, allowing users to interact with their Files.com account as if it were a local filesystem.
func (*Filescomfs) Access ¶ added in v3.2.197
func (fs *Filescomfs) Access(path string, mask uint32) int
Access checks file access permissions. The return value of -fuse.ENOSYS indicates the method is not supported.
func (*Filescomfs) Chflags ¶ added in v3.2.197
func (fs *Filescomfs) Chflags(path string, flags uint32) int
Chflags is part of the FileSystemChflags interface and changes the BSD file flags (Windows file attributes).
func (*Filescomfs) Chmod ¶ added in v3.2.197
func (fs *Filescomfs) Chmod(path string, mode uint32) int
Chmod changes the permission bits of a file. Files.com does not support POSIX permissions, but certain operations may fail if calling Chmod returns an error, so this implementation is a no-op that returns success.
func (*Filescomfs) Chown ¶ added in v3.2.197
func (fs *Filescomfs) Chown(path string, uid uint32, gid uint32) int
Chown changes the owner and group of a file. The return value of -fuse.ENOSYS indicates the method is not supported.
func (*Filescomfs) CreateEx ¶ added in v3.2.197
func (fs *Filescomfs) CreateEx(path string, mode uint32, fi *fuse.FileInfo_t) int
OpenEx and CreateEx are similar to Open and Create except that they allow direct manipulation of the FileInfo_t struct (which is analogous to the FUSE struct fuse_file_info). If implemented, they are preferred over Open and Create.
func (*Filescomfs) Destroy ¶ added in v3.2.197
func (fs *Filescomfs) Destroy()
func (*Filescomfs) Flush ¶ added in v3.2.197
func (fs *Filescomfs) Flush(path string, fh uint64) int
Flush flushes cached file data. The return value of -fuse.ENOSYS indicates the method is not supported.
func (*Filescomfs) Fsync ¶ added in v3.2.197
func (fs *Filescomfs) Fsync(path string, datasync bool, fh uint64) (errc int)
Fsync attempts to synchronize file contents. If an upload is active but the writer is already closed (finalizing in background), wait for completion. Otherwise, fall back to ENOSYS.
func (*Filescomfs) Fsyncdir ¶ added in v3.2.197
func (fs *Filescomfs) Fsyncdir(path string, datasync bool, fh uint64) int
Fsyncdir synchronizes directory contents. The return value of -fuse.ENOSYS indicates the method is not supported.
func (*Filescomfs) Getpath ¶ added in v3.2.197
func (fs *Filescomfs) Getpath(path string, fh uint64) (int, string)
Getpath is part of the FileSystemGetpath interface and allows a case-insensitive file system to report the correct case of a file path.
func (*Filescomfs) Getxattr ¶ added in v3.2.197
func (fs *Filescomfs) Getxattr(path string, name string) (int, []byte)
Getxattr gets extended attributes. Any return value other than -fuse.ENOSYS indicates support for extended attributes, but also expects Setxattr, Listxattr, and Removexattr to exist for extended attribute support.
func (*Filescomfs) Init ¶ added in v3.2.197
func (fs *Filescomfs) Init()
Init initializes the Filescomfs filesystem.
func (*Filescomfs) Link ¶ added in v3.2.197
func (fs *Filescomfs) Link(oldpath string, newpath string) int
Link creates a hard link to a file. The return value of -fuse.ENOSYS indicates the method is not supported.
func (*Filescomfs) Listxattr ¶ added in v3.2.197
func (fs *Filescomfs) Listxattr(path string, fill func(name string) bool) int
Listxattr lists extended attributes.
func (*Filescomfs) Mkdir ¶ added in v3.2.197
func (fs *Filescomfs) Mkdir(path string, mode uint32) (errc int)
func (*Filescomfs) Mknod ¶ added in v3.2.197
func (fs *Filescomfs) Mknod(path string, mode uint32, dev uint64) int
Mknod creates a file node. The return value of -fuse.ENOSYS indicates the method is not supported.
func (*Filescomfs) Open ¶ added in v3.2.197
func (fs *Filescomfs) Open(path string, flags int) (errc int, fh uint64)
func (*Filescomfs) OpenEx ¶ added in v3.2.197
func (fs *Filescomfs) OpenEx(path string, fi *fuse.FileInfo_t) int
func (*Filescomfs) Opendir ¶ added in v3.2.197
func (fs *Filescomfs) Opendir(path string) (errc int, fh uint64)
func (*Filescomfs) Readlink ¶ added in v3.2.197
func (fs *Filescomfs) Readlink(path string) (int, string)
Readlink reads the target of a symbolic link. The return value of -fuse.ENOSYS indicates the method is not supported.
func (*Filescomfs) Release ¶ added in v3.2.197
func (fs *Filescomfs) Release(path string, fh uint64) (errc int)
func (*Filescomfs) Releasedir ¶ added in v3.2.197
func (fs *Filescomfs) Releasedir(path string, fh uint64) (errc int)
func (*Filescomfs) Removexattr ¶ added in v3.2.197
func (fs *Filescomfs) Removexattr(path string, name string) int
Removexattr removes extended attributes.
func (*Filescomfs) Rename ¶ added in v3.2.197
func (fs *Filescomfs) Rename(oldpath string, newpath string) (errc int)
func (*Filescomfs) Rmdir ¶ added in v3.2.197
func (fs *Filescomfs) Rmdir(path string) int
func (*Filescomfs) Setchgtime ¶ added in v3.2.197
func (fs *Filescomfs) Setchgtime(path string, tmsp fuse.Timespec) int
Setchgtime is part of the FileSystemSetchgtime interface and changes the file change (ctime) time.
func (*Filescomfs) Setcrtime ¶ added in v3.2.197
func (fs *Filescomfs) Setcrtime(path string, tmsp fuse.Timespec) int
Setcrtime is part of the FileSystemSetcrtime interface and changes the file creation (birth) time.
func (*Filescomfs) Statfs ¶ added in v3.2.197
func (fs *Filescomfs) Statfs(path string, stat *fuse.Statfs_t) (errc int)
func (*Filescomfs) Symlink ¶ added in v3.2.197
func (fs *Filescomfs) Symlink(target string, newpath string) int
Symlink creates a symbolic link. The return value of -fuse.ENOSYS indicates the method is not supported.
func (*Filescomfs) Truncate ¶ added in v3.2.197
func (fs *Filescomfs) Truncate(path string, size int64, fh uint64) (errc int)
func (*Filescomfs) Unlink ¶ added in v3.2.197
func (fs *Filescomfs) Unlink(path string) int
func (*Filescomfs) Utimens ¶ added in v3.2.197
func (fs *Filescomfs) Utimens(path string, tmsp []fuse.Timespec) (errc int)
func (*Filescomfs) Validate ¶ added in v3.2.197
func (fs *Filescomfs) Validate() error
Validate checks if the Filescomfs filesystem is valid by attempting to list the root directory.
type FuseFlags ¶ added in v3.2.220
type FuseFlags int
func NewFuseFlags ¶ added in v3.2.220
NewFuseFlags initializes a FuseFlags instance with the given integer flag value.
func (FuseFlags) IsCreateExclusive ¶ added in v3.2.220
func (FuseFlags) IsEventOnly ¶ added in v3.2.220
IsEventOnly checks if the flag is open for event notifications only.
func (FuseFlags) IsExclusive ¶ added in v3.2.220
IsExclusive checks if the flag is set to exclusive.
func (FuseFlags) IsReadOnly ¶ added in v3.2.220
IsReadOnly checks if the flag is set to read-only.
func (FuseFlags) IsReadWrite ¶ added in v3.2.220
IsReadWrite checks if the flag is set to read-write.
func (FuseFlags) IsTruncate ¶ added in v3.2.220
IsTruncate checks if the flag is set to truncate.
func (FuseFlags) IsWriteOnly ¶ added in v3.2.220
IsWriteOnly checks if the flag is set to write-only.
type MountHost ¶ added in v3.2.197
type MountHost interface {
Unmount() bool
}
MountHost defines the interface for a mounted Files.com filesystem.
func Mount ¶ added in v3.2.197
func Mount(params MountParams) (MountHost, error)
Mount initializes a Files.com filesystem and mounts it using FUSE.
type MountParams ¶ added in v3.2.197
type MountParams struct {
// Required. Files.com API configuration.
Config *files_sdk.Config
// Path to mount the filesystem.
//
// Optional on Windows. If provided, this is expected to be a drive letter
// followed by a colon (e.g. "Z:"). If not specified, the letter closest to
// the end of the Latin alphabet that is not already in use will be chosen.
//
// Required on MacOS and Linux, this is the path to the mount point (e.g. "/mnt/files").
MountPoint string
// Optional. Volume name to display in Finder/Explorer. On Windows, this is also used as the
// share name for the UNC path. Defaults to "Files.com".
VolumeName string
// Optional. Files.com path to mount as the root of the filesystem. Defaults to the site root.
Root string
// Optional. Number of concurrent file parts to upload. Defaults to 50.
WriteConcurrency int
// Optional. Cache TTL for the filesystem metadata. Defaults to 5 seconds.
CacheTTL time.Duration
// Optional. Disable use of Files.com locks when writing files. Defaults to false.
DisableLocking bool
// Optional. List of patterns to ignore when creating files and directories. Defaults to
// OS-specific defaults. To ignore no patterns, pass an empty slice.
IgnorePatterns []string
// Optional. If set to true, will initialize fuse configured to provide extra debug information.
// Defaults to false.
DebugFuse bool
// Optional. The path to the fuse debug log. Only used if DebugFuse is set to true.
// Defaults to fuse.log [Windows only]
DebugFuseLog string
// Optional. The path to the icon to display in Finder. If not specified, the default icon
// for a network drive is used. [MacOS only]
IconPath string
}
MountParams contains the parameters for mounting a Files.com filesystem using FUSE.
type OpenHandles ¶ added in v3.2.220
type OpenHandles struct {
lib.LeveledLogger
// contains filtered or unexported fields
}
OpenHandles tracks currently-open FUSE file handles and allocates fresh IDs.
func NewOpenHandles ¶ added in v3.2.220
func NewOpenHandles(logger lib.LeveledLogger) *OpenHandles
NewOpenHandles initializes a new OpenHandles instance.
func (*OpenHandles) ExtendOpenHandleTtls ¶ added in v3.2.220
func (h *OpenHandles) ExtendOpenHandleTtls()
ExtendOpenHandleTtls extends the TTL of all open handles. This is useful to keep the file handles alive while the OS is still using them.
func (*OpenHandles) Lookup ¶ added in v3.2.220
func (h *OpenHandles) Lookup(id uint64) (*fileHandle, *fsNode, bool)
Lookup finds a fileHandle and node without holding the lock during use.
func (*OpenHandles) Open ¶ added in v3.2.220
func (h *OpenHandles) Open(n *fsNode, fl FuseFlags) (id uint64, fh *fileHandle)
Open creates a new ID and stores the handle. Never hold h.mu while allocating the ID to avoid lock-order issues.
func (*OpenHandles) OpenHandles ¶ added in v3.2.220
func (h *OpenHandles) OpenHandles() []*fileHandle
OpenHandles returns a slice of open file handles, excluding the root handle.
func (*OpenHandles) Release ¶ added in v3.2.220
func (h *OpenHandles) Release(id uint64) (*fileHandle, bool)
Release removes a fileHandle by id. Safe to call even if the handle was already closed.