erofs

package
v0.0.0-...-5fb8a3f Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const BlockSize = 1 << blockSizeBits

Variables

View Source
var Magic = [4]byte{0xe2, 0xe1, 0xf5, 0xe0}

Magic contains the 4 magic bytes starting at position 1024 identifying an EROFS filesystem. Defined in @linux//include/uapi/linux/magic.h EROFS_SUPER_MAGIC_V1

Functions

This section is empty.

Types

type Base

type Base struct {
	Permissions uint16
	UID, GID    uint16
}

Base contains generic inode metadata independent from the specific inode type.

type BlockDevice

type BlockDevice struct {
	Base
	Major uint32
	Minor uint32
}

BlockDevice represents a Unix block device inode with major and minor numbers.

type CharacterDevice

type CharacterDevice struct {
	Base
	Major uint32
	Minor uint32
}

CharacterDevice represents a Unix character device inode with major and minor numbers.

type Directory

type Directory struct {
	Base
	Children []string
}

Directory represents a directory inode. The Children property contains the directories' direct children (just the name, not the full path).

type FIFO

type FIFO struct {
	Base
}

FIFO represents a Unix FIFO inode.

type FileMeta

type FileMeta struct {
	Base
}

FileMeta represents the metadata of a regular file. In this case the contents are written to a Writer returned by the CreateFile function on the EROFS Writer and not included in the structure itself.

type Inode

type Inode interface {
	// contains filtered or unexported methods
}

Inode specifies an interface that all inodes that can be written to an EROFS filesystem implement.

type Socket

type Socket struct {
	Base
}

Socket represents a Unix socket inode.

type SymbolicLink struct {
	Base
	Target string
}

SymbolicLink represents a symbolic link/symlink to another inode. Target is the literal string target of the symlink.

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

Writer writes a new EROFS filesystem.

func NewWriter

func NewWriter(w io.WriteSeeker) (*Writer, error)

NewWriter creates a new EROFS filesystem writer. The given WriteSeeker needs to be at the start.

func (*Writer) Close

func (w *Writer) Close() error

Close finishes writing an EROFS filesystem. Errors by this function need to be handled as they indicate if the written filesystem is consistent (i.e. there are no directory entries pointing to nonexistent inodes).

func (*Writer) Create

func (w *Writer) Create(pathname string, inode Inode) error

Create adds a new non-file inode to the EROFS. This includes directories, device nodes, symlinks and FIFOs. The first call to Create() needs to be with pathname "." and a directory inode. The given pathname needs to be referenced by a directory, otherwise it will not be accessible (with the exception of the directory ".").

func (*Writer) CreateFile

func (w *Writer) CreateFile(pathname string, meta *FileMeta) io.WriteCloser

CreateFile adds a new file to the EROFS. It returns a WriteCloser to which the file contents should be written and which then needs to be closed. The last writer obtained by calling CreateFile() needs to be closed first before opening a new one. The given pathname needs to be referenced by a directory created using Create(), otherwise it will not be accessible.

Jump to

Keyboard shortcuts

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