Documentation
¶
Index ¶
Constants ¶
const BlockSize = 1 << blockSizeBits
Variables ¶
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 BlockDevice ¶
BlockDevice represents a Unix block device inode with major and minor numbers.
type CharacterDevice ¶
CharacterDevice represents a Unix character device inode with major and minor numbers.
type Directory ¶
Directory represents a directory inode. The Children property contains the directories' direct children (just the name, not the full path).
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 SymbolicLink ¶
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 ¶
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 ¶
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.