Documentation ¶
Overview ¶
Package tmpfs is a filesystem implementation backed by memory.
Index ¶
- Constants
- func AddSeals(inode *fs.Inode, val uint32) error
- func GetSeals(inode *fs.Inode) (uint32, error)
- func NewDir(ctx context.Context, contents map[string]*fs.Inode, owner fs.FileOwner, ...) *fs.Inode
- func NewFifo(ctx context.Context, owner fs.FileOwner, perms fs.FilePermissions, ...) *fs.Inode
- func NewInMemoryFile(ctx context.Context, usage usage.MemoryKind, uattr fs.UnstableAttr) fs.InodeOperations
- func NewMemfdInode(ctx context.Context, allowSeals bool) *fs.Inode
- func NewSocket(ctx context.Context, socket transport.BoundEndpoint, owner fs.FileOwner, ...) *fs.Inode
- func NewSymlink(ctx context.Context, target string, owner fs.FileOwner, msrc *fs.MountSource) *fs.Inode
- type Dir
- func (d *Dir) AddLink()
- func (d *Dir) Allocate(ctx context.Context, node *fs.Inode, offset, length int64) error
- func (d *Dir) Bind(ctx context.Context, dir *fs.Inode, name string, ep transport.BoundEndpoint, ...) (*fs.Dirent, error)
- func (d *Dir) Create(ctx context.Context, dir *fs.Inode, name string, flags fs.FileFlags, ...) (*fs.File, error)
- func (d *Dir) CreateDirectory(ctx context.Context, dir *fs.Inode, name string, perms fs.FilePermissions) error
- func (d *Dir) CreateFifo(ctx context.Context, dir *fs.Inode, name string, perms fs.FilePermissions) error
- func (d *Dir) CreateHardLink(ctx context.Context, dir *fs.Inode, target *fs.Inode, name string) error
- func (d *Dir) CreateLink(ctx context.Context, dir *fs.Inode, oldname, newname string) error
- func (d *Dir) DropLink()
- func (d *Dir) GetFile(ctx context.Context, dirent *fs.Dirent, flags fs.FileFlags) (*fs.File, error)
- func (d *Dir) GetXattr(ctx context.Context, i *fs.Inode, name string, size uint64) (string, error)
- func (d *Dir) ListXattr(ctx context.Context, i *fs.Inode, size uint64) (map[string]struct{}, error)
- func (d *Dir) Lookup(ctx context.Context, i *fs.Inode, p string) (*fs.Dirent, error)
- func (d *Dir) NotifyStatusChange(ctx context.Context)
- func (d *Dir) Release(ctx context.Context)
- func (d *Dir) Remove(ctx context.Context, i *fs.Inode, name string) error
- func (d *Dir) RemoveDirectory(ctx context.Context, i *fs.Inode, name string) error
- func (d *Dir) RemoveXattr(ctx context.Context, i *fs.Inode, name string) error
- func (d *Dir) Rename(ctx context.Context, inode *fs.Inode, oldParent *fs.Inode, oldName string, ...) error
- func (d *Dir) SetOwner(ctx context.Context, i *fs.Inode, owner fs.FileOwner) error
- func (d *Dir) SetPermissions(ctx context.Context, i *fs.Inode, p fs.FilePermissions) bool
- func (d *Dir) SetTimestamps(ctx context.Context, i *fs.Inode, ts fs.TimeSpec) error
- func (d *Dir) SetXattr(ctx context.Context, i *fs.Inode, name, value string, flags uint32) error
- func (*Dir) StatFS(context.Context) (fs.Info, error)
- func (d *Dir) StateFields() []string
- func (d *Dir) StateLoad(stateSourceObject state.Source)
- func (d *Dir) StateSave(stateSinkObject state.Sink)
- func (d *Dir) StateTypeName() string
- func (d *Dir) UnstableAttr(ctx context.Context, i *fs.Inode) (fs.UnstableAttr, error)
- type Fifo
- func (f *Fifo) Rename(ctx context.Context, inode *fs.Inode, oldParent *fs.Inode, oldName string, ...) error
- func (*Fifo) StatFS(context.Context) (fs.Info, error)
- func (f *Fifo) StateFields() []string
- func (f *Fifo) StateLoad(stateSourceObject state.Source)
- func (f *Fifo) StateSave(stateSinkObject state.Sink)
- func (f *Fifo) StateTypeName() string
- type Filesystem
- func (*Filesystem) AllowUserList() bool
- func (*Filesystem) AllowUserMount() bool
- func (*Filesystem) Flags() fs.FilesystemFlags
- func (f *Filesystem) Mount(ctx context.Context, device string, flags fs.MountSourceFlags, data string, ...) (*fs.Inode, error)
- func (*Filesystem) Name() string
- func (f *Filesystem) StateFields() []string
- func (f *Filesystem) StateLoad(stateSourceObject state.Source)
- func (f *Filesystem) StateSave(stateSinkObject state.Sink)
- func (f *Filesystem) StateTypeName() string
- type Socket
- func (s *Socket) Rename(ctx context.Context, inode *fs.Inode, oldParent *fs.Inode, oldName string, ...) error
- func (s *Socket) StatFS(context.Context) (fs.Info, error)
- func (s *Socket) StateFields() []string
- func (s *Socket) StateLoad(stateSourceObject state.Source)
- func (s *Socket) StateSave(stateSinkObject state.Sink)
- func (s *Socket) StateTypeName() string
- type Symlink
- func (s *Symlink) Rename(ctx context.Context, inode *fs.Inode, oldParent *fs.Inode, oldName string, ...) error
- func (s *Symlink) StatFS(context.Context) (fs.Info, error)
- func (s *Symlink) StateFields() []string
- func (s *Symlink) StateLoad(stateSourceObject state.Source)
- func (s *Symlink) StateSave(stateSinkObject state.Sink)
- func (s *Symlink) StateTypeName() string
Constants ¶
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 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 ¶
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.
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 (*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 (*Dir) CreateHardLink ¶
func (d *Dir) CreateHardLink(ctx context.Context, dir *fs.Inode, target *fs.Inode, name string) error
CreateHardLink implements fs.InodeOperations.CreateHardLink.
func (*Dir) CreateLink ¶
CreateLink implements fs.InodeOperations.CreateLink.
func (*Dir) NotifyStatusChange ¶
NotifyStatusChange implements fs.InodeOperations.NotifyStatusChange.
func (*Dir) RemoveDirectory ¶
RemoveDirectory implements fs.InodeOperations.RemoveDirectory.
func (*Dir) RemoveXattr ¶
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) SetPermissions ¶
SetPermissions implements fs.InodeOperations.SetPermissions.
func (*Dir) SetTimestamps ¶
SetTimestamps implements fs.InodeOperations.SetTimestamps.
func (*Dir) StateFields ¶
func (*Dir) StateTypeName ¶
func (*Dir) UnstableAttr ¶
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) StateFields ¶
func (*Fifo) StateTypeName ¶
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) 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) StateFields ¶
func (*Socket) StateTypeName ¶
type 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.