tmpfs

package
v0.0.0-...-ff2c174 Latest Latest
Warning

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

Go to latest
Published: May 9, 2021 License: Apache-2.0, MIT Imports: 25 Imported by: 0

Documentation

Overview

Package tmpfs is a filesystem implementation backed by memory.

Index

Constants

View Source
const FilesystemName = "tmpfs"

FilesystemName is the name under which the filesystem is registered. Name matches mm/shmem.c:shmem_fs_type.name.

Variables

This section is empty.

Functions

func AddSeals

func AddSeals(inode *fs.Inode, val uint32) error

AddSeals adds new file seals to a memfd inode.

func GetSeals

func GetSeals(inode *fs.Inode) (uint32, error)

GetSeals returns the current set of seals on a memfd inode.

func NewDir

func NewDir(ctx context.Context, contents map[string]*fs.Inode, owner fs.FileOwner, perms fs.FilePermissions, msrc *fs.MountSource) *fs.Inode

NewDir returns a new directory.

func NewFifo

func NewFifo(ctx context.Context, owner fs.FileOwner, perms fs.FilePermissions, msrc *fs.MountSource) *fs.Inode

NewFifo creates a new named pipe.

func NewInMemoryFile

func NewInMemoryFile(ctx context.Context, usage usage.MemoryKind, uattr fs.UnstableAttr) fs.InodeOperations

NewInMemoryFile returns a new file backed by Kernel.MemoryFile().

func NewMemfdInode

func NewMemfdInode(ctx context.Context, allowSeals bool) *fs.Inode

NewMemfdInode creates a new inode backing a memfd. Memory used by the memfd is backed by platform memory.

func NewSocket

func NewSocket(ctx context.Context, socket transport.BoundEndpoint, owner fs.FileOwner, perms fs.FilePermissions, msrc *fs.MountSource) *fs.Inode

NewSocket returns a new socket with the provided permissions.

func NewSymlink(ctx context.Context, target string, owner fs.FileOwner, msrc *fs.MountSource) *fs.Inode

NewSymlink returns a new symlink with the provided permissions.

Types

type Dir

type Dir struct {
	fsutil.InodeGenericChecker `state:"nosave"`
	fsutil.InodeIsDirTruncate  `state:"nosave"`
	fsutil.InodeNoopWriteOut   `state:"nosave"`
	fsutil.InodeNotMappable    `state:"nosave"`
	fsutil.InodeNotSocket      `state:"nosave"`
	fsutil.InodeNotSymlink     `state:"nosave"`
	fsutil.InodeVirtual        `state:"nosave"`
	// contains filtered or unexported fields
}

Dir is a directory.

+stateify savable

func (d *Dir) AddLink()

AddLink implements fs.InodeOperations.AddLink.

func (*Dir) Allocate

func (d *Dir) Allocate(ctx context.Context, node *fs.Inode, offset, length int64) error

Allocate implements fs.InodeOperations.Allocate.

func (*Dir) Bind

func (d *Dir) Bind(ctx context.Context, dir *fs.Inode, name string, ep transport.BoundEndpoint, perms fs.FilePermissions) (*fs.Dirent, error)

Bind implements fs.InodeOperations.Bind.

func (*Dir) Create

func (d *Dir) Create(ctx context.Context, dir *fs.Inode, name string, flags fs.FileFlags, perms fs.FilePermissions) (*fs.File, error)

Create implements fs.InodeOperations.Create.

func (*Dir) CreateDirectory

func (d *Dir) CreateDirectory(ctx context.Context, dir *fs.Inode, name string, perms fs.FilePermissions) error

CreateDirectory implements fs.InodeOperations.CreateDirectory.

func (*Dir) CreateFifo

func (d *Dir) CreateFifo(ctx context.Context, dir *fs.Inode, name string, perms fs.FilePermissions) error

CreateFifo implements fs.InodeOperations.CreateFifo.

func (d *Dir) CreateHardLink(ctx context.Context, dir *fs.Inode, target *fs.Inode, name string) error

CreateHardLink implements fs.InodeOperations.CreateHardLink.

func (d *Dir) CreateLink(ctx context.Context, dir *fs.Inode, oldname, newname string) error

CreateLink implements fs.InodeOperations.CreateLink.

func (d *Dir) DropLink()

DropLink implements fs.InodeOperations.DropLink.

func (*Dir) GetFile

func (d *Dir) GetFile(ctx context.Context, dirent *fs.Dirent, flags fs.FileFlags) (*fs.File, error)

GetFile implements fs.InodeOperations.GetFile.

func (*Dir) GetXattr

func (d *Dir) GetXattr(ctx context.Context, i *fs.Inode, name string, size uint64) (string, error)

GetXattr implements fs.InodeOperations.GetXattr.

func (*Dir) ListXattr

func (d *Dir) ListXattr(ctx context.Context, i *fs.Inode, size uint64) (map[string]struct{}, error)

ListXattr implements fs.InodeOperations.ListXattr.

func (*Dir) Lookup

func (d *Dir) Lookup(ctx context.Context, i *fs.Inode, p string) (*fs.Dirent, error)

Lookup implements fs.InodeOperations.Lookup.

func (*Dir) NotifyStatusChange

func (d *Dir) NotifyStatusChange(ctx context.Context)

NotifyStatusChange implements fs.InodeOperations.NotifyStatusChange.

func (*Dir) Release

func (d *Dir) Release(ctx context.Context)

Release implements fs.InodeOperations.Release.

func (*Dir) Remove

func (d *Dir) Remove(ctx context.Context, i *fs.Inode, name string) error

Remove implements fs.InodeOperations.Remove.

func (*Dir) RemoveDirectory

func (d *Dir) RemoveDirectory(ctx context.Context, i *fs.Inode, name string) error

RemoveDirectory implements fs.InodeOperations.RemoveDirectory.

func (*Dir) RemoveXattr

func (d *Dir) RemoveXattr(ctx context.Context, i *fs.Inode, name string) error

RemoveXattr implements fs.InodeOperations.RemoveXattr.

func (*Dir) Rename

func (d *Dir) Rename(ctx context.Context, inode *fs.Inode, oldParent *fs.Inode, oldName string, newParent *fs.Inode, newName string, replacement bool) error

Rename implements fs.InodeOperations.Rename.

func (*Dir) SetOwner

func (d *Dir) SetOwner(ctx context.Context, i *fs.Inode, owner fs.FileOwner) error

SetOwner implements fs.InodeOperations.SetOwner.

func (*Dir) SetPermissions

func (d *Dir) SetPermissions(ctx context.Context, i *fs.Inode, p fs.FilePermissions) bool

SetPermissions implements fs.InodeOperations.SetPermissions.

func (*Dir) SetTimestamps

func (d *Dir) SetTimestamps(ctx context.Context, i *fs.Inode, ts fs.TimeSpec) error

SetTimestamps implements fs.InodeOperations.SetTimestamps.

func (*Dir) SetXattr

func (d *Dir) SetXattr(ctx context.Context, i *fs.Inode, name, value string, flags uint32) error

SetXattr implements fs.InodeOperations.SetXattr.

func (*Dir) StatFS

func (*Dir) StatFS(context.Context) (fs.Info, error)

StatFS implements fs.InodeOperations.StatFS.

func (*Dir) StateFields

func (d *Dir) StateFields() []string

func (*Dir) StateLoad

func (d *Dir) StateLoad(stateSourceObject state.Source)

+checklocksignore

func (*Dir) StateSave

func (d *Dir) StateSave(stateSinkObject state.Sink)

+checklocksignore

func (*Dir) StateTypeName

func (d *Dir) StateTypeName() string

func (*Dir) UnstableAttr

func (d *Dir) UnstableAttr(ctx context.Context, i *fs.Inode) (fs.UnstableAttr, error)

UnstableAttr implements fs.InodeOperations.UnstableAttr.

type Fifo

type Fifo struct {
	fs.InodeOperations
}

Fifo is a tmpfs named pipe.

+stateify savable

func (*Fifo) Rename

func (f *Fifo) Rename(ctx context.Context, inode *fs.Inode, oldParent *fs.Inode, oldName string, newParent *fs.Inode, newName string, replacement bool) error

Rename implements fs.InodeOperations.Rename.

func (*Fifo) StatFS

func (*Fifo) StatFS(context.Context) (fs.Info, error)

StatFS returns the tmpfs info.

func (*Fifo) StateFields

func (f *Fifo) StateFields() []string

func (*Fifo) StateLoad

func (f *Fifo) StateLoad(stateSourceObject state.Source)

+checklocksignore

func (*Fifo) StateSave

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

+checklocksignore

func (*Fifo) StateTypeName

func (f *Fifo) StateTypeName() string

type Filesystem

type Filesystem struct{}

Filesystem is a tmpfs.

+stateify savable

func (*Filesystem) AllowUserList

func (*Filesystem) AllowUserList() bool

AllowUserList allows this filesystem to be listed in /proc/filesystems.

func (*Filesystem) AllowUserMount

func (*Filesystem) AllowUserMount() bool

AllowUserMount allows users to mount(2) this file system.

func (*Filesystem) Flags

func (*Filesystem) Flags() fs.FilesystemFlags

Flags returns that there is nothing special about this file system.

In Linux, tmpfs returns FS_USERNS_MOUNT, see mm/shmem.c.

func (*Filesystem) Mount

func (f *Filesystem) Mount(ctx context.Context, device string, flags fs.MountSourceFlags, data string, _ interface{}) (*fs.Inode, error)

Mount returns a tmpfs root that can be positioned in the vfs.

func (*Filesystem) Name

func (*Filesystem) Name() string

Name is the name of the file system.

func (*Filesystem) StateFields

func (f *Filesystem) StateFields() []string

func (*Filesystem) StateLoad

func (f *Filesystem) StateLoad(stateSourceObject state.Source)

+checklocksignore

func (*Filesystem) StateSave

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

+checklocksignore

func (*Filesystem) StateTypeName

func (f *Filesystem) StateTypeName() string

type Socket

type Socket struct {
	ramfs.Socket
	fsutil.InodeNotTruncatable `state:"nosave"`
	fsutil.InodeNotAllocatable `state:"nosave"`
}

Socket is a socket.

+stateify savable

func (*Socket) Rename

func (s *Socket) Rename(ctx context.Context, inode *fs.Inode, oldParent *fs.Inode, oldName string, newParent *fs.Inode, newName string, replacement bool) error

Rename implements fs.InodeOperations.Rename.

func (*Socket) StatFS

func (s *Socket) StatFS(context.Context) (fs.Info, error)

StatFS returns the tmpfs info.

func (*Socket) StateFields

func (s *Socket) StateFields() []string

func (*Socket) StateLoad

func (s *Socket) StateLoad(stateSourceObject state.Source)

+checklocksignore

func (*Socket) StateSave

func (s *Socket) StateSave(stateSinkObject state.Sink)

+checklocksignore

func (*Socket) StateTypeName

func (s *Socket) StateTypeName() string
type Symlink struct {
	ramfs.Symlink
}

Symlink is a symlink.

+stateify savable

func (*Symlink) Rename

func (s *Symlink) Rename(ctx context.Context, inode *fs.Inode, oldParent *fs.Inode, oldName string, newParent *fs.Inode, newName string, replacement bool) error

Rename implements fs.InodeOperations.Rename.

func (*Symlink) StatFS

func (s *Symlink) StatFS(context.Context) (fs.Info, error)

StatFS returns the tmpfs info.

func (*Symlink) StateFields

func (s *Symlink) StateFields() []string

func (*Symlink) StateLoad

func (s *Symlink) StateLoad(stateSourceObject state.Source)

+checklocksignore

func (*Symlink) StateSave

func (s *Symlink) StateSave(stateSinkObject state.Sink)

+checklocksignore

func (*Symlink) StateTypeName

func (s *Symlink) StateTypeName() string

Jump to

Keyboard shortcuts

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