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 fs.pagesUsedMu directory.iterMu
Index ¶
- Constants
- func AddSeals(fd *vfs.FileDescription, val uint32) error
- func GetSeals(fd *vfs.FileDescription) (uint32, 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)
- func SetDefaultSizeLimit(sizeLimit uint64)
- type FilesystemOpts
- type FilesystemType
- func (fstype FilesystemType) GetFilesystem(ctx context.Context, vfsObj *vfs.VirtualFilesystem, creds *auth.Credentials, ...) (*vfs.Filesystem, *vfs.Dentry, error)
- func (FilesystemType) Name() string
- func (FilesystemType) Release(ctx context.Context)
- func (fstype *FilesystemType) StateFields() []string
- func (fstype *FilesystemType) StateLoad(stateSourceObject state.Source)
- func (fstype *FilesystemType) StateSave(stateSinkObject state.Sink)
- func (fstype *FilesystemType) StateTypeName() string
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 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.
func SetDefaultSizeLimit ¶
func SetDefaultSizeLimit(sizeLimit uint64)
SetDefaultSizeLimit configures the size limit to be used for tmpfs mounts that do not specify a size= mount option. This must be called only once, before any tmpfs filesystems are created.
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 // FilestoreFD is the FD for the memory file that will be used to store file // data. If this is nil, then MemoryFileProviderFromContext() is used. FilestoreFD *fd.FD // DisableDefaultSizeLimit disables setting a default size limit. In Linux, // SB_KERNMOUNT has this effect on tmpfs mounts; see mm/shmem.c:shmem_fill_super(). DisableDefaultSizeLimit bool }
FilesystemOpts is used to pass configuration data to tmpfs.
+stateify savable
func (*FilesystemOpts) StateFields ¶
func (f *FilesystemOpts) StateFields() []string
func (*FilesystemOpts) StateLoad ¶
func (f *FilesystemOpts) StateLoad(stateSourceObject state.Source)
+checklocksignore
func (*FilesystemOpts) StateSave ¶
func (f *FilesystemOpts) StateSave(stateSinkObject state.Sink)
+checklocksignore
func (*FilesystemOpts) StateTypeName ¶
func (f *FilesystemOpts) StateTypeName() string
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.
func (*FilesystemType) StateFields ¶
func (fstype *FilesystemType) StateFields() []string
func (*FilesystemType) StateLoad ¶
func (fstype *FilesystemType) StateLoad(stateSourceObject state.Source)
+checklocksignore
func (*FilesystemType) StateSave ¶
func (fstype *FilesystemType) StateSave(stateSinkObject state.Sink)
+checklocksignore
func (*FilesystemType) StateTypeName ¶
func (fstype *FilesystemType) StateTypeName() string