compactext4

package
v0.12.9 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	S_IXOTH  = format.S_IXOTH
	S_IWOTH  = format.S_IWOTH
	S_IROTH  = format.S_IROTH
	S_IXGRP  = format.S_IXGRP
	S_IWGRP  = format.S_IWGRP
	S_IRGRP  = format.S_IRGRP
	S_IXUSR  = format.S_IXUSR
	S_IWUSR  = format.S_IWUSR
	S_IRUSR  = format.S_IRUSR
	S_ISVTX  = format.S_ISVTX
	S_ISGID  = format.S_ISGID
	S_ISUID  = format.S_ISUID
	S_IFIFO  = format.S_IFIFO
	S_IFCHR  = format.S_IFCHR
	S_IFDIR  = format.S_IFDIR
	S_IFBLK  = format.S_IFBLK
	S_IFREG  = format.S_IFREG
	S_IFLNK  = format.S_IFLNK
	S_IFSOCK = format.S_IFSOCK

	TypeMask = format.TypeMask
)

Mode flags for Linux files.

View Source
const (
	BlockSize = 4096
)

Variables

This section is empty.

Functions

func InlineData

func InlineData(w *Writer)

InlineData instructs the Writer to write small files into the inode structures directly. This creates smaller images but currently is not compatible with DAX.

Types

type File

type File struct {
	Linkname                    string
	Size                        int64
	Mode                        uint16
	Uid, Gid                    uint32
	Atime, Ctime, Mtime, Crtime time.Time
	Devmajor, Devminor          uint32
	Xattrs                      map[string][]byte
}

A File represents a file to be added to an ext4 file system.

type Option

type Option func(*Writer)

An Option provides extra options to NewWriter.

func MaximumDiskSize added in v0.7.8

func MaximumDiskSize(size int64) Option

MaximumDiskSize instructs the writer to reserve enough metadata space for the specified disk size. If not provided, then 16GB is the default.

type Writer

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

Writer writes a compact ext4 file system.

It expects all paths to use directory separator '/', even on Windows.

func NewWriter

func NewWriter(f io.ReadWriteSeeker, opts ...Option) *Writer

NewWriter returns a Writer that writes an ext4 file system to the provided ReadWriteSeeker.

func (*Writer) Close

func (w *Writer) Close() error

func (*Writer) Create

func (w *Writer) Create(name string, f *File) error

Create adds a file to the file system.

func (w *Writer) Link(oldname, newname string) error

Link adds a hard link to the file system. We support creating hardlinks to symlinks themselves instead of what the symlinks link to, as this is what containerd does upstream.

func (*Writer) MakeParents added in v0.10.0

func (w *Writer) MakeParents(name string) error

MakeParents ensures that all the parent directories in the path specified by `name` exists. If they don't exist it creates them (like `mkdir -p`). These non existing parent directories are created with the same permissions as that of it's parent directory. It is expected that the a call to make these parent directories will be made at a later point with the correct permissions, at that time the permissions of these directories will be updated.

func (*Writer) Stat

func (w *Writer) Stat(name string) (*File, error)

Stat returns information about a file that has been written.

func (*Writer) Write

func (w *Writer) Write(b []byte) (int, error)

Jump to

Keyboard shortcuts

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