squashfs

package
v0.0.0-...-07cd727 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2021 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package squashfs implements writing SquashFS file system images using zlib compression for data blocks (inodes and directory entries are written uncompressed for simplicity).

Note that SquashFS requires directory entries to be sorted, i.e. files and directories need to be added in the correct order.

This package intentionally only implements a subset of SquashFS. Notably, block devices, character devices, FIFOs, sockets and xattrs are not supported.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Directory

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

Directory represents a SquashFS directory.

func (*Directory) Directory

func (d *Directory) Directory(name string, modTime time.Time) *Directory

Directory creates a new directory with the specified name and modTime.

func (*Directory) File

func (d *Directory) File(name string, modTime time.Time, mode os.FileMode) (io.WriteCloser, error)

File creates a file with the specified name, modTime and mode. The returned io.WriterCloser must be closed after writing the file.

func (*Directory) Flush

func (d *Directory) Flush() error

Flush writes directory entries and creates inodes for the directory.

func (d *Directory) Symlink(oldname, newname string, modTime time.Time, mode os.FileMode) error

Symlink creates a symbolic link from newname to oldname with the specified modTime and mode.

type Writer

type Writer struct {
	// Root represents the file system root. Like all directories, Flush must be
	// called precisely once.
	Root *Directory
	// contains filtered or unexported fields
}

func NewWriter

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

NewWriter returns a Writer which will write a SquashFS file system image to w once Flush is called.

Create new files and directories with the corresponding methods on the Root directory of the Writer.

File data is written to w even before Flush is called.

func (*Writer) Flush

func (w *Writer) Flush() error

Flush writes the SquashFS file system. The Writer must not be used after calling Flush.

Jump to

Keyboard shortcuts

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