Documentation ¶
Overview ¶
Package tmpfs provides an in-memory filesystem whose contents are application-mutable, consistent with Linux's tmpfs.
Lock order:
filesystem.mu
inode.mu regularFileFD.offMu *** "memmap.Mappable locks" below this point regularFile.mapsMu *** "memmap.Mappable locks taken by Translate" below this point regularFile.dataMu directory.iterMu
Index ¶
- Constants
- func AddSeals(fd *vfs.FileDescription, val uint32) error
- func GetSeals(fd *vfs.FileDescription) (uint32, error)
- func NewFilesystem(ctx context.Context, vfsObj *vfs.VirtualFilesystem, creds *auth.Credentials) (*vfs.Filesystem, *vfs.Dentry, error)
- func NewMemfd(ctx context.Context, creds *auth.Credentials, mount *vfs.Mount, ...) (*vfs.FileDescription, error)
- func NewZeroFile(ctx context.Context, creds *auth.Credentials, mount *vfs.Mount, size uint64) (*vfs.FileDescription, error)
- type FilesystemOpts
- type FilesystemType
Constants ¶
const Name = "tmpfs"
Name is the default filesystem name.
Variables ¶
This section is empty.
Functions ¶
func AddSeals ¶
func AddSeals(fd *vfs.FileDescription, val uint32) error
AddSeals adds new file seals to a memfd inode.
func GetSeals ¶
func GetSeals(fd *vfs.FileDescription) (uint32, error)
GetSeals returns the current set of seals on a memfd inode.
func NewFilesystem ¶
func NewFilesystem(ctx context.Context, vfsObj *vfs.VirtualFilesystem, creds *auth.Credentials) (*vfs.Filesystem, *vfs.Dentry, error)
NewFilesystem returns a new tmpfs filesystem.
func NewMemfd ¶
func NewMemfd(ctx context.Context, creds *auth.Credentials, mount *vfs.Mount, allowSeals bool, name string) (*vfs.FileDescription, error)
NewMemfd creates a new regular file and file description as for memfd_create.
Preconditions: mount must be a tmpfs mount.
func NewZeroFile ¶
func NewZeroFile(ctx context.Context, creds *auth.Credentials, mount *vfs.Mount, size uint64) (*vfs.FileDescription, error)
NewZeroFile creates a new regular file and file description as for mmap(MAP_SHARED | MAP_ANONYMOUS). The file has the given size and is initially (implicitly) filled with zeroes.
Preconditions: mount must be a tmpfs mount.
Types ¶
type FilesystemOpts ¶
type FilesystemOpts struct { // RootFileType is the FileType of the filesystem root. Valid values // are: S_IFDIR, S_IFREG, and S_IFLNK. Defaults to S_IFDIR. RootFileType uint16 // RootSymlinkTarget is the target of the root symlink. Only valid if // RootFileType == S_IFLNK. RootSymlinkTarget string // FilesystemType allows setting a different FilesystemType for this // tmpfs filesystem. This allows tmpfs to "impersonate" other // filesystems, like ramdiskfs and cgroupfs. FilesystemType vfs.FilesystemType // Usage is the memory accounting category under which pages backing files in // the filesystem are accounted. Usage *usage.MemoryKind // MaxFilenameLen is the maximum filename length allowed by the tmpfs. MaxFilenameLen int }
FilesystemOpts is used to pass configuration data to tmpfs.
+stateify savable
type FilesystemType ¶
type FilesystemType struct{}
FilesystemType implements vfs.FilesystemType.
+stateify savable
func (FilesystemType) GetFilesystem ¶
func (fstype FilesystemType) GetFilesystem(ctx context.Context, vfsObj *vfs.VirtualFilesystem, creds *auth.Credentials, _ string, opts vfs.GetFilesystemOptions) (*vfs.Filesystem, *vfs.Dentry, error)
GetFilesystem implements vfs.FilesystemType.GetFilesystem.
func (FilesystemType) Name ¶
func (FilesystemType) Name() string
Name implements vfs.FilesystemType.Name.
func (FilesystemType) Release ¶
func (FilesystemType) Release(ctx context.Context)
Release implements vfs.FilesystemType.Release.