fuse

package
Version: v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package fuse allows the creation of user mode file systems in Go.

A user mode file system is a user mode process that receives file system operations from the OS FUSE layer and satisfies them in user mode. A user mode file system implements the interface FileSystemInterface either directly or by embedding a FileSystemBase struct which provides a default (empty) implementation of all methods in FileSystemInterface.

In order to expose the user mode file system to the OS, the file system must be hosted (mounted) by a FileSystemHost. The FileSystemHost Mount() method is used for this purpose.

A note on thread-safety: In general FUSE file systems are expected to protect their own data structures. Many FUSE implementations provide a -s command line option that when used, it instructs the FUSE implementation to serialize requests. This option can be passed to the FileSystemHost Mount() method, when the file system is mounted.

Index

Constants

View Source
const (
	E2BIG           = int(C.E2BIG)
	EACCES          = int(C.EACCES)
	EADDRINUSE      = int(C.EADDRINUSE)
	EADDRNOTAVAIL   = int(C.EADDRNOTAVAIL)
	EAFNOSUPPORT    = int(C.EAFNOSUPPORT)
	EAGAIN          = int(C.EAGAIN)
	EALREADY        = int(C.EALREADY)
	EBADF           = int(C.EBADF)
	EBADMSG         = int(C.EBADMSG)
	EBUSY           = int(C.EBUSY)
	ECANCELED       = int(C.ECANCELED)
	ECHILD          = int(C.ECHILD)
	ECONNABORTED    = int(C.ECONNABORTED)
	ECONNREFUSED    = int(C.ECONNREFUSED)
	ECONNRESET      = int(C.ECONNRESET)
	EDEADLK         = int(C.EDEADLK)
	EDESTADDRREQ    = int(C.EDESTADDRREQ)
	EDOM            = int(C.EDOM)
	EEXIST          = int(C.EEXIST)
	EFAULT          = int(C.EFAULT)
	EFBIG           = int(C.EFBIG)
	EHOSTUNREACH    = int(C.EHOSTUNREACH)
	EIDRM           = int(C.EIDRM)
	EILSEQ          = int(C.EILSEQ)
	EINPROGRESS     = int(C.EINPROGRESS)
	EINTR           = int(C.EINTR)
	EINVAL          = int(C.EINVAL)
	EIO             = int(C.EIO)
	EISCONN         = int(C.EISCONN)
	EISDIR          = int(C.EISDIR)
	ELOOP           = int(C.ELOOP)
	EMFILE          = int(C.EMFILE)
	EMLINK          = int(C.EMLINK)
	EMSGSIZE        = int(C.EMSGSIZE)
	ENAMETOOLONG    = int(C.ENAMETOOLONG)
	ENETDOWN        = int(C.ENETDOWN)
	ENETRESET       = int(C.ENETRESET)
	ENETUNREACH     = int(C.ENETUNREACH)
	ENFILE          = int(C.ENFILE)
	ENOATTR         = int(C.ENOATTR)
	ENOBUFS         = int(C.ENOBUFS)
	ENODATA         = int(C.ENODATA)
	ENODEV          = int(C.ENODEV)
	ENOENT          = int(C.ENOENT)
	ENOEXEC         = int(C.ENOEXEC)
	ENOLCK          = int(C.ENOLCK)
	ENOLINK         = int(C.ENOLINK)
	ENOMEM          = int(C.ENOMEM)
	ENOMSG          = int(C.ENOMSG)
	ENOPROTOOPT     = int(C.ENOPROTOOPT)
	ENOSPC          = int(C.ENOSPC)
	ENOSR           = int(C.ENOSR)
	ENOSTR          = int(C.ENOSTR)
	ENOSYS          = int(C.ENOSYS)
	ENOTCONN        = int(C.ENOTCONN)
	ENOTDIR         = int(C.ENOTDIR)
	ENOTEMPTY       = int(C.ENOTEMPTY)
	ENOTRECOVERABLE = int(C.ENOTRECOVERABLE)
	ENOTSOCK        = int(C.ENOTSOCK)
	ENOTSUP         = int(C.ENOTSUP)
	ENOTTY          = int(C.ENOTTY)
	ENXIO           = int(C.ENXIO)
	EOPNOTSUPP      = int(C.EOPNOTSUPP)
	EOVERFLOW       = int(C.EOVERFLOW)
	EOWNERDEAD      = int(C.EOWNERDEAD)
	EPERM           = int(C.EPERM)
	EPIPE           = int(C.EPIPE)
	EPROTO          = int(C.EPROTO)
	EPROTONOSUPPORT = int(C.EPROTONOSUPPORT)
	EPROTOTYPE      = int(C.EPROTOTYPE)
	ERANGE          = int(C.ERANGE)
	EROFS           = int(C.EROFS)
	ESPIPE          = int(C.ESPIPE)
	ESRCH           = int(C.ESRCH)
	ETIME           = int(C.ETIME)
	ETIMEDOUT       = int(C.ETIMEDOUT)
	ETXTBSY         = int(C.ETXTBSY)
	EWOULDBLOCK     = int(C.EWOULDBLOCK)
	EXDEV           = int(C.EXDEV)
)

Error codes reported by FUSE file systems.

View Source
const (
	O_RDONLY  = int(C.O_RDONLY)
	O_WRONLY  = int(C.O_WRONLY)
	O_RDWR    = int(C.O_RDWR)
	O_APPEND  = int(C.O_APPEND)
	O_CREAT   = int(C.O_CREAT)
	O_EXCL    = int(C.O_EXCL)
	O_TRUNC   = int(C.O_TRUNC)
	O_ACCMODE = int(C.O_ACCMODE)
)

Flags used in FileSystemInterface.Create and FileSystemInterface.Open.

View Source
const (
	S_IFMT   = 0170000
	S_IFBLK  = 0060000
	S_IFCHR  = 0020000
	S_IFIFO  = 0010000
	S_IFREG  = 0100000
	S_IFDIR  = 0040000
	S_IFLNK  = 0120000
	S_IFSOCK = 0140000

	S_IRWXU = 00700
	S_IRUSR = 00400
	S_IWUSR = 00200
	S_IXUSR = 00100
	S_IRWXG = 00070
	S_IRGRP = 00040
	S_IWGRP = 00020
	S_IXGRP = 00010
	S_IRWXO = 00007
	S_IROTH = 00004
	S_IWOTH = 00002
	S_IXOTH = 00001
	S_ISUID = 04000
	S_ISGID = 02000
	S_ISVTX = 01000
)

File type and permission bits.

View Source
const (
	UF_HIDDEN   = 0x00008000
	UF_READONLY = 0x00001000
	UF_SYSTEM   = 0x00000080
	UF_ARCHIVE  = 0x00000800
)

BSD file flags (Windows file attributes).

View Source
const (
	XATTR_CREATE  = int(C.XATTR_CREATE)
	XATTR_REPLACE = int(C.XATTR_REPLACE)
)

Options that control Setxattr operation.

View Source
const (
	NOTIFY_MKDIR    = 0x0001
	NOTIFY_RMDIR    = 0x0002
	NOTIFY_CREATE   = 0x0004
	NOTIFY_UNLINK   = 0x0008
	NOTIFY_CHMOD    = 0x0010
	NOTIFY_CHOWN    = 0x0020
	NOTIFY_UTIME    = 0x0040
	NOTIFY_CHFLAGS  = 0x0080
	NOTIFY_TRUNCATE = 0x0100
)

Notify actions.

Variables

This section is empty.

Functions

func Getcontext

func Getcontext() (uid uint32, gid uint32, pid int)

Getcontext gets information related to a file system operation.

func OptParse added in v1.1.0

func OptParse(args []string, format string, vals ...interface{}) (outargs []string, err error)

OptParse parses the FUSE command line arguments in args as determined by format and stores the resulting values in vals, which must be pointers. It returns a list of unparsed arguments or nil if an error happens.

The format may be empty or non-empty. An empty format is taken as a special instruction to OptParse to only return all non-option arguments in outargs.

A non-empty format is a space separated list of acceptable FUSE options. Each option is matched with a corresponding pointer value in vals. The combination of the option and the type of the corresponding pointer value, determines how the option is used. The allowed pointer types are pointer to bool, pointer to an integer type and pointer to string.

For pointer to bool types:

-x                       Match -x without parameter.
-foo --foo               As above for -foo or --foo.
foo                      Match "-o foo".
-x= -foo= --foo= foo=    Match option with parameter.
-x=%VERB ... foo=%VERB   Match option with parameter of syntax.
                         Allowed verbs: d,o,x,X,v
                         - d,o,x,X: set to true if parameter non-0.
                         - v: set to true if parameter present.

The formats -x=, and -x=%v are equivalent.

For pointer to other types:

-x                       Match -x with parameter (-x=PARAM).
-foo --foo               As above for -foo or --foo.
foo                      Match "-o foo=PARAM".
-x= -foo= --foo= foo=    Match option with parameter.
-x=%VERB ... foo=%VERB   Match option with parameter of syntax.
                         Allowed verbs for pointer to int types: d,o,x,X,v
                         Allowed verbs for pointer to string types: s,v

The formats -x, -x=, and -x=%v are equivalent.

For example:

var f bool
var set_attr_timeout bool
var attr_timeout int
var umask uint32
outargs, err := OptParse(args, "-f attr_timeout= attr_timeout umask=%o",
    &f, &set_attr_timeout, &attr_timeout, &umask)

Will accept a command line of:

$ program -f -o attr_timeout=42,umask=077

And will set variables as follows:

f == true
set_attr_timeout == true
attr_timeout == 42
umask == 077

Types

type Error

type Error int

Error encapsulates a FUSE error code. In some rare circumstances it is useful to signal an error to the FUSE layer by boxing the error code using Error and calling panic(). The FUSE layer will recover and report the boxed error code to the OS.

func (Error) Error

func (self Error) Error() string

func (Error) GoString added in v1.1.0

func (self Error) GoString() string

func (Error) String added in v1.1.0

func (self Error) String() string

type FileInfo_t added in v1.3.0

type FileInfo_t struct {
	// Open flags: a combination of the fuse.O_* constants.
	Flags int

	// Use direct I/O on this file. [IGNORED on Windows]
	DirectIo bool

	// Do not invalidate file cache. [IGNORED on Windows]
	KeepCache bool

	// File is not seekable. [IGNORED on Windows]
	NonSeekable bool

	// File handle.
	Fh uint64
}

FileInfo_t contains open file information. This structure is analogous to the FUSE struct fuse_file_info.

type FileSystemBase

type FileSystemBase struct {
}

FileSystemBase provides default implementations of the methods in FileSystemInterface. The default implementations are either empty or return -ENOSYS to signal that the file system does not implement a particular operation to the FUSE layer.

func (*FileSystemBase) Access

func (*FileSystemBase) Access(path string, mask uint32) int

Access checks file access permissions. The FileSystemBase implementation returns -ENOSYS.

func (*FileSystemBase) Chmod

func (*FileSystemBase) Chmod(path string, mode uint32) int

Chmod changes the permission bits of a file. The FileSystemBase implementation returns -ENOSYS.

func (*FileSystemBase) Chown

func (*FileSystemBase) Chown(path string, uid uint32, gid uint32) int

Chown changes the owner and group of a file. The FileSystemBase implementation returns -ENOSYS.

func (*FileSystemBase) Create

func (*FileSystemBase) Create(path string, flags int, mode uint32) (int, uint64)

Create creates and opens a file. The flags are a combination of the fuse.O_* constants. The FileSystemBase implementation returns -ENOSYS.

func (*FileSystemBase) Destroy

func (*FileSystemBase) Destroy()

Destroy is called when the file system is destroyed. The FileSystemBase implementation does nothing.

func (*FileSystemBase) Flush

func (*FileSystemBase) Flush(path string, fh uint64) int

Flush flushes cached file data. The FileSystemBase implementation returns -ENOSYS.

func (*FileSystemBase) Fsync

func (*FileSystemBase) Fsync(path string, datasync bool, fh uint64) int

Fsync synchronizes file contents. The FileSystemBase implementation returns -ENOSYS.

func (*FileSystemBase) Fsyncdir

func (*FileSystemBase) Fsyncdir(path string, datasync bool, fh uint64) int

Fsyncdir synchronizes directory contents. The FileSystemBase implementation returns -ENOSYS.

func (*FileSystemBase) Getattr

func (*FileSystemBase) Getattr(path string, stat *Stat_t, fh uint64) int

Getattr gets file attributes. The FileSystemBase implementation returns -ENOSYS.

func (*FileSystemBase) Getxattr

func (*FileSystemBase) Getxattr(path string, name string) (int, []byte)

Getxattr gets extended attributes. The FileSystemBase implementation returns -ENOSYS.

func (*FileSystemBase) Init

func (*FileSystemBase) Init()

Init is called when the file system is created. The FileSystemBase implementation does nothing.

func (*FileSystemBase) Link(oldpath string, newpath string) int

Link creates a hard link to a file. The FileSystemBase implementation returns -ENOSYS.

func (*FileSystemBase) Listxattr

func (*FileSystemBase) Listxattr(path string, fill func(name string) bool) int

Listxattr lists extended attributes. The FileSystemBase implementation returns -ENOSYS.

func (*FileSystemBase) Mkdir

func (*FileSystemBase) Mkdir(path string, mode uint32) int

Mkdir creates a directory. The FileSystemBase implementation returns -ENOSYS.

func (*FileSystemBase) Mknod

func (*FileSystemBase) Mknod(path string, mode uint32, dev uint64) int

Mknod creates a file node. The FileSystemBase implementation returns -ENOSYS.

func (*FileSystemBase) Open

func (*FileSystemBase) Open(path string, flags int) (int, uint64)

Open opens a file. The flags are a combination of the fuse.O_* constants. The FileSystemBase implementation returns -ENOSYS.

func (*FileSystemBase) Opendir

func (*FileSystemBase) Opendir(path string) (int, uint64)

Opendir opens a directory. The FileSystemBase implementation returns -ENOSYS.

func (*FileSystemBase) Read

func (*FileSystemBase) Read(path string, buff []byte, ofst int64, fh uint64) int

Read reads data from a file. The FileSystemBase implementation returns -ENOSYS.

func (*FileSystemBase) Readdir

func (*FileSystemBase) Readdir(path string,
	fill func(name string, stat *Stat_t, ofst int64) bool,
	ofst int64,
	fh uint64) int

Readdir reads a directory. The FileSystemBase implementation returns -ENOSYS.

func (*FileSystemBase) Readlink(path string) (int, string)

Readlink reads the target of a symbolic link. The FileSystemBase implementation returns -ENOSYS.

func (*FileSystemBase) Release

func (*FileSystemBase) Release(path string, fh uint64) int

Release closes an open file. The FileSystemBase implementation returns -ENOSYS.

func (*FileSystemBase) Releasedir

func (*FileSystemBase) Releasedir(path string, fh uint64) int

Releasedir closes an open directory. The FileSystemBase implementation returns -ENOSYS.

func (*FileSystemBase) Removexattr

func (*FileSystemBase) Removexattr(path string, name string) int

Removexattr removes extended attributes. The FileSystemBase implementation returns -ENOSYS.

func (*FileSystemBase) Rename

func (*FileSystemBase) Rename(oldpath string, newpath string) int

Rename renames a file. The FileSystemBase implementation returns -ENOSYS.

func (*FileSystemBase) Rmdir

func (*FileSystemBase) Rmdir(path string) int

Rmdir removes a directory. The FileSystemBase implementation returns -ENOSYS.

func (*FileSystemBase) Setxattr

func (*FileSystemBase) Setxattr(path string, name string, value []byte, flags int) int

Setxattr sets extended attributes. The FileSystemBase implementation returns -ENOSYS.

func (*FileSystemBase) Statfs

func (*FileSystemBase) Statfs(path string, stat *Statfs_t) int

Statfs gets file system statistics. The FileSystemBase implementation returns -ENOSYS.

func (*FileSystemBase) Symlink(target string, newpath string) int

Symlink creates a symbolic link. The FileSystemBase implementation returns -ENOSYS.

func (*FileSystemBase) Truncate

func (*FileSystemBase) Truncate(path string, size int64, fh uint64) int

Truncate changes the size of a file. The FileSystemBase implementation returns -ENOSYS.

func (*FileSystemBase) Unlink(path string) int

Unlink removes a file. The FileSystemBase implementation returns -ENOSYS.

func (*FileSystemBase) Utimens

func (*FileSystemBase) Utimens(path string, tmsp []Timespec) int

Utimens changes the access and modification times of a file. The FileSystemBase implementation returns -ENOSYS.

func (*FileSystemBase) Write

func (*FileSystemBase) Write(path string, buff []byte, ofst int64, fh uint64) int

Write writes data to a file. The FileSystemBase implementation returns -ENOSYS.

type FileSystemChflags added in v1.0.4

type FileSystemChflags interface {
	Chflags(path string, flags uint32) int
}

FileSystemChflags is the interface that wraps the Chflags method.

Chflags changes the BSD file flags (Windows file attributes). [OSX and Windows only]

type FileSystemHost

type FileSystemHost struct {
	// contains filtered or unexported fields
}

FileSystemHost is used to host a file system.

func NewFileSystemHost

func NewFileSystemHost(fsop FileSystemInterface) *FileSystemHost

NewFileSystemHost creates a file system host.

func (*FileSystemHost) Mount

func (host *FileSystemHost) Mount(mountpoint string, opts []string) bool

Mount mounts a file system on the given mountpoint with the mount options in opts.

Many of the mount options in opts are specific to the underlying FUSE implementation. Some of the common options include:

-h   --help            print help
-V   --version         print FUSE version
-d   -o debug          enable FUSE debug output
-s                     disable multi-threaded operation

Please refer to the individual FUSE implementation documentation for additional options.

It is allowed for the mountpoint to be the empty string ("") in which case opts is assumed to contain the mountpoint. It is also allowed for opts to be nil, although in this case the mountpoint must be non-empty.

func (*FileSystemHost) Notify added in v1.5.0

func (host *FileSystemHost) Notify(path string, action uint32) bool

Notify notifies the operating system about a file change. The action is a combination of the fuse.NOTIFY_* constants.

func (*FileSystemHost) SetCapCaseInsensitive

func (host *FileSystemHost) SetCapCaseInsensitive(value bool)

SetCapCaseInsensitive informs the host that the hosted file system is case insensitive [OSX and Windows only].

func (*FileSystemHost) SetCapReaddirPlus

func (host *FileSystemHost) SetCapReaddirPlus(value bool)

SetCapReaddirPlus informs the host that the hosted file system has the readdir-plus capability [Windows only]. A file system that has the readdir-plus capability can send full stat information during Readdir, thus avoiding extraneous Getattr calls.

func (*FileSystemHost) Unmount

func (host *FileSystemHost) Unmount() bool

Unmount unmounts a mounted file system. Unmount may be called at any time after the Init() method has been called and before the Destroy() method has been called.

type FileSystemInterface

type FileSystemInterface interface {
	// Init is called when the file system is created.
	Init()

	// Destroy is called when the file system is destroyed.
	Destroy()

	// Statfs gets file system statistics.
	Statfs(path string, stat *Statfs_t) int

	// Mknod creates a file node.
	Mknod(path string, mode uint32, dev uint64) int

	// Mkdir creates a directory.
	Mkdir(path string, mode uint32) int

	// Unlink removes a file.
	Unlink(path string) int

	// Rmdir removes a directory.
	Rmdir(path string) int

	// Link creates a hard link to a file.
	Link(oldpath string, newpath string) int

	// Symlink creates a symbolic link.
	Symlink(target string, newpath string) int

	// Readlink reads the target of a symbolic link.
	Readlink(path string) (int, string)

	// Rename renames a file.
	Rename(oldpath string, newpath string) int

	// Chmod changes the permission bits of a file.
	Chmod(path string, mode uint32) int

	// Chown changes the owner and group of a file.
	Chown(path string, uid uint32, gid uint32) int

	// Utimens changes the access and modification times of a file.
	Utimens(path string, tmsp []Timespec) int

	// Access checks file access permissions.
	Access(path string, mask uint32) int

	// Create creates and opens a file.
	// The flags are a combination of the fuse.O_* constants.
	Create(path string, flags int, mode uint32) (int, uint64)

	// Open opens a file.
	// The flags are a combination of the fuse.O_* constants.
	Open(path string, flags int) (int, uint64)

	// Getattr gets file attributes.
	Getattr(path string, stat *Stat_t, fh uint64) int

	// Truncate changes the size of a file.
	Truncate(path string, size int64, fh uint64) int

	// Read reads data from a file.
	Read(path string, buff []byte, ofst int64, fh uint64) int

	// Write writes data to a file.
	Write(path string, buff []byte, ofst int64, fh uint64) int

	// Flush flushes cached file data.
	Flush(path string, fh uint64) int

	// Release closes an open file.
	Release(path string, fh uint64) int

	// Fsync synchronizes file contents.
	Fsync(path string, datasync bool, fh uint64) int

	// Opendir opens a directory.
	Opendir(path string) (int, uint64)

	// Readdir reads a directory.
	Readdir(path string,
		fill func(name string, stat *Stat_t, ofst int64) bool,
		ofst int64,
		fh uint64) int

	// Releasedir closes an open directory.
	Releasedir(path string, fh uint64) int

	// Fsyncdir synchronizes directory contents.
	Fsyncdir(path string, datasync bool, fh uint64) int

	// Setxattr sets extended attributes.
	Setxattr(path string, name string, value []byte, flags int) int

	// Getxattr gets extended attributes.
	Getxattr(path string, name string) (int, []byte)

	// Removexattr removes extended attributes.
	Removexattr(path string, name string) int

	// Listxattr lists extended attributes.
	Listxattr(path string, fill func(name string) bool) int
}

FileSystemInterface is the interface that a user mode file system must implement.

The file system will receive an Init() call when the file system is created; the Init() call will happen prior to receiving any other file system calls. Note that there are no guarantees on the exact timing of when Init() is called. For example, it cannot be assumed that the file system is mounted at the time the Init() call is received.

The file system will receive a Destroy() call when the file system is destroyed; the Destroy() call will always be the last call to be received by the file system. Note that depending on how the file system is terminated the file system may not receive the Destroy() call. For example, it will not receive the Destroy() call if the file system process is forcibly killed.

Except for Init() and Destroy() all file system operations must return 0 on success or a FUSE error on failure. To return an error return the NEGATIVE value of a particular error. For example, to report "file not found" return -fuse.ENOENT.

type FileSystemOpenEx added in v1.3.0

type FileSystemOpenEx interface {
	CreateEx(path string, mode uint32, fi *FileInfo_t) int
	OpenEx(path string, fi *FileInfo_t) int
}

FileSystemOpenEx is the interface that wraps the OpenEx and CreateEx methods.

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).

type FileSystemSetchgtime added in v1.0.4

type FileSystemSetchgtime interface {
	Setchgtime(path string, tmsp Timespec) int
}

FileSystemSetchgtime is the interface that wraps the Setchgtime method.

Setchgtime changes the file change (ctime) time. [OSX and Windows only]

type FileSystemSetcrtime added in v1.0.4

type FileSystemSetcrtime interface {
	Setcrtime(path string, tmsp Timespec) int
}

FileSystemSetcrtime is the interface that wraps the Setcrtime method.

Setcrtime changes the file creation (birth) time. [OSX and Windows only]

type Stat_t

type Stat_t struct {
	// Device ID of device containing file. [IGNORED]
	Dev uint64

	// File serial number. [IGNORED unless the use_ino mount option is given.]
	Ino uint64

	// Mode of file.
	Mode uint32

	// Number of hard links to the file.
	Nlink uint32

	// User ID of file.
	Uid uint32

	// Group ID of file.
	Gid uint32

	// Device ID (if file is character or block special).
	Rdev uint64

	// For regular files, the file size in bytes.
	// For symbolic links, the length in bytes of the
	// pathname contained in the symbolic link.
	Size int64

	// Last data access timestamp.
	Atim Timespec

	// Last data modification timestamp.
	Mtim Timespec

	// Last file status change timestamp.
	Ctim Timespec

	// A file system-specific preferred I/O block size for this object.
	Blksize int64

	// Number of blocks allocated for this object.
	Blocks int64

	// File creation (birth) timestamp. [OSX and Windows only]
	Birthtim Timespec

	// BSD flags (UF_*). [OSX and Windows only]
	Flags uint32
}

Stat_t contains file metadata information. This structure is analogous to the POSIX struct stat. Not all fields are honored by all FUSE implementations.

type Statfs_t

type Statfs_t struct {
	// File system block size.
	Bsize uint64

	// Fundamental file system block size.
	Frsize uint64

	// Total number of blocks on file system in units of Frsize.
	Blocks uint64

	// Total number of free blocks.
	Bfree uint64

	// Number of free blocks available to non-privileged process.
	Bavail uint64

	// Total number of file serial numbers.
	Files uint64

	// Total number of free file serial numbers.
	Ffree uint64

	// Number of file serial numbers available to non-privileged process.
	Favail uint64

	// File system ID. [IGNORED]
	Fsid uint64

	// Bit mask of Flag values. [IGNORED]
	Flag uint64

	// Maximum filename length.
	Namemax uint64
}

Statfs_t contains file system information. This structure is analogous to the POSIX struct statvfs (NOT struct statfs). Not all fields are honored by all FUSE implementations.

type Timespec

type Timespec struct {
	Sec  int64
	Nsec int64
}

Timespec contains a time as the UNIX time in seconds and nanoseconds. This structure is analogous to the POSIX struct timespec.

func NewTimespec

func NewTimespec(t time.Time) Timespec

NewTimespec creates a Timespec from a time.Time.

func Now

func Now() Timespec

Now creates a Timespec that contains the current time.

func (*Timespec) Time

func (ts *Timespec) Time() time.Time

Time returns the Timespec as a time.Time.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL