tmpfs

package
v0.0.0-...-4bf4b70 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2021 License: Apache-2.0, MIT Imports: 27 Imported by: 0

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

View Source
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
}

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)

func (*FilesystemOpts) StateSave

func (f *FilesystemOpts) StateSave(stateSinkObject state.Sink)

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)

func (*FilesystemType) StateSave

func (fstype *FilesystemType) StateSave(stateSinkObject state.Sink)

func (*FilesystemType) StateTypeName

func (fstype *FilesystemType) StateTypeName() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL