util

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 31 Imported by: 28

Documentation

Index

Constants

View Source
const (
	BLKGETSIZE = 0x00001260
)

Variables

This section is empty.

Functions

func CopyMtimes

func CopyMtimes(source, dest *filesystem.FileSystem)

CopyMtimes will copy modification times for files from the source to the destination if the file data and metadata (other than mtime) are identical. Directory entry inode pointers are invalidated by this operation, so this should be followed by a call to dest.RebuildInodePointers().

func CopyMtimesWithFilter added in v0.3.4

func CopyMtimesWithFilter(source, dest *filesystem.FileSystem,
	filt *filter.Filter)

CopyMtimesWithFilter is similar to CopyMtimes but files matching the specified filter are not changed.

func DeletedFilteredFiles

func DeletedFilteredFiles(rootDir string, filt *filter.Filter) error

func GetUnsupportedExt4fsOptions

func GetUnsupportedExt4fsOptions(fs *filesystem.FileSystem,
	objectsGetter objectserver.ObjectsGetter) ([]string, error)

func MakeBootable

func MakeBootable(fs *filesystem.FileSystem,
	deviceName, rootLabel, rootDir, kernelOptions string,
	doChroot bool, logger log.DebugLogger) error

func MakeExt4fs

func MakeExt4fs(deviceName, label string, unsupportedOptions []string,
	bytesPerInode uint64, logger log.Logger) error

func MakeExt4fsWithParams added in v0.3.2

func MakeExt4fsWithParams(deviceName string, params MakeExt4fsParams,
	logger log.Logger) error

func MakeKernelOptions

func MakeKernelOptions(rootDevice, extraOptions string) string

func ReplaceComputedFiles

func ReplaceComputedFiles(fs *filesystem.FileSystem,
	computedFilesData *ComputedFilesData,
	objectsGetter objectserver.ObjectsGetter) (
	objectserver.ObjectsGetter, error)

func SpliceComputedFiles

func SpliceComputedFiles(fs *filesystem.FileSystem,
	computedFileList []ComputedFile) error

func Unpack

func Unpack(fs *filesystem.FileSystem, objectsGetter objectserver.ObjectsGetter,
	rootDir string, logger log.Logger) error

func WriteFstabEntry

func WriteFstabEntry(writer io.Writer,
	source, mountPoint, fileSystemType, flags string,
	dumpFrequency, checkOrder uint) error

func WriteImageName

func WriteImageName(mountPoint, imageName string) error

func WriteRaw

func WriteRaw(fs *filesystem.FileSystem,
	objectsGetter objectserver.ObjectsGetter, rawFilename string,
	perm os.FileMode, tableType mbr.TableType,
	minFreeSpace uint64, roundupPower uint64, makeBootable, allocateBlocks bool,
	logger log.DebugLogger) error

func WriteRawWithOptions

func WriteRawWithOptions(fs *filesystem.FileSystem,
	objectsGetter objectserver.ObjectsGetter, rawFilename string,
	perm os.FileMode, tableType mbr.TableType, options WriteRawOptions,
	logger log.DebugLogger) error

Types

type BootInfoType

type BootInfoType struct {
	BootDirectory     *filesystem.DirectoryInode
	InitrdImageDirent *filesystem.DirectoryEntry
	InitrdImageFile   string
	KernelImageDirent *filesystem.DirectoryEntry
	KernelImageFile   string
	KernelOptions     string
}

func GetBootInfo

func GetBootInfo(fs *filesystem.FileSystem, rootLabel string,
	extraKernelOptions string) (*BootInfoType, error)

func (*BootInfoType) WriteBootloaderConfig

func (bootInfo *BootInfoType) WriteBootloaderConfig(rootDir string,
	logger log.Logger) error

type ComputedFile

type ComputedFile struct {
	Filename string
	Source   string
}

func LoadComputedFiles

func LoadComputedFiles(filename string) ([]ComputedFile, error)

func MergeComputedFiles

func MergeComputedFiles(base, overlay []ComputedFile) []ComputedFile

type ComputedFilesData

type ComputedFilesData struct {
	FileData      map[string][]byte // Key: filename.
	RootDirectory string
}

type MakeExt4fsParams added in v0.3.2

type MakeExt4fsParams struct {
	BytesPerInode            uint64
	Label                    string
	ReservedBlocksPercentage uint16
	Size                     uint64
	UnsupportedOptions       []string
}

type WriteRawOptions

type WriteRawOptions struct {
	AllocateBlocks       bool
	DoChroot             bool
	ExtraKernelOptions   string
	InitialImageName     string
	InstallBootloader    bool
	MinimumFreeBytes     uint64
	OverlayDirectories   []string
	OverlayFiles         map[string][]byte
	PartitionWaitTimeout time.Duration // Default: 2 seconds.
	RootLabel            string
	RoundupPower         uint64
	WriteFstab           bool
}

Jump to

Keyboard shortcuts

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