class FsCreator

Defined at line 68 of file ../../src/storage/lib/host/common.h

An abstract class which defines an interface for processing and running commands for file system

host-side tools. This includes parsing all command line options, pre-processing any files to be

copied, and resizing the file system image as necessary. Child classes must implement any

commands they wish to support, as well as providing their own space calculations for files to be

added.

Protected Members

unique_fd fd_
uint64_t data_blocks_

Public Methods

void FsCreator (FsCreator && )

Defined at line 70 of file ../../src/storage/lib/host/common.h

void FsCreator (const FsCreator & )

Defined at line 70 of file ../../src/storage/lib/host/common.h

void FsCreator (uint64_t data_blocks)

Defined at line 72 of file ../../src/storage/lib/host/common.h

zx_status_t ProcessAndRun (int argc, char ** argv)

Process the command line arguments and run the specified command.

Defined at line 86 of file ../../src/storage/lib/host/common.cc

zx_status_t AppendDepfile (const char * str)

If a depfile was requested, |str| will be appended (followed by a space)

to the depfile. |str| must be less than PATH_MAX.

Defined at line 447 of file ../../src/storage/lib/host/common.cc

FsCreator & operator= (FsCreator && )

Defined at line 70 of file ../../src/storage/lib/host/common.h

FsCreator & operator= (const FsCreator & )

Defined at line 70 of file ../../src/storage/lib/host/common.h

void ~FsCreator ()

Defined at line 74 of file ../../src/storage/lib/host/common.h

Protected Methods

zx_status_t Add ()

Adds all files specified in manifests or other command line arguments to the fs.

Defined at line 135 of file ../../src/storage/lib/host/common.h

Command GetCommand ()

Defined at line 139 of file ../../src/storage/lib/host/common.h

off_t GetOffset ()

Defined at line 140 of file ../../src/storage/lib/host/common.h

off_t GetLength ()

Defined at line 141 of file ../../src/storage/lib/host/common.h

zx_status_t Usage ()

Print usage information for all options, commands, and arguments valid for this fs.

Defined at line 95 of file ../../src/storage/lib/host/common.cc

const char * GetToolName ()

Returns the command name of the child fs.

bool IsCommandValid (Command command)

Tells whether a given |command|, |option|, or |argument| are valid for this fs.

bool IsOptionValid (Option option)
bool IsArgumentValid (Argument argument)
zx_status_t ProcessCustom (int argc, char ** argv, uint8_t * processed)

Process custom arguments specific to the child fs. Returns the number of processed arguments

in |processed|.

Defined at line 109 of file ../../src/storage/lib/host/common.h

zx_status_t Mkfs ()

Commands.

Creates the fs at fd_.

Defined at line 118 of file ../../src/storage/lib/host/common.h

zx_status_t Fsck ()

Runs fsck on the fs at fd_.

Defined at line 120 of file ../../src/storage/lib/host/common.h

zx_status_t Ls ()

Runs ls on the fs at fd_, at the specified path (if any).

Defined at line 137 of file ../../src/storage/lib/host/common.h

zx_status_t ProcessManifest (char * manifest_path)

Processes the manifest at |manifest_path| and adds all relevant source/destination files to

the child's internal processing lists.

Defined at line 137 of file ../../src/storage/lib/host/common.cc

zx_status_t ParseManifestLine (FILE * manifest, const char * dir_path, char * src, char * dst)

Parses the next line in the |manifest| file located at |dir_path|,

and returns the |dst| and |src| paths (if found).

Defined at line 160 of file ../../src/storage/lib/host/common.cc

zx_status_t ProcessManifestLine (FILE * manifest, const char * dir_path)

Processes one line in |manifest|, storing files to copy and calculating total space required.

Returns "ZX_ERR_OUT_OF_RANGE" when manifest has reached EOF.

zx_status_t CalculateRequiredSize (off_t * out)

Calculates the minimum fs size required for all files processed up to this point.

zx_status_t UsedDataSize ()

On success, returns ZX_OK and prints to stdout the number of bytes used

by data within the fs.

Defined at line 124 of file ../../src/storage/lib/host/common.h

zx_status_t UsedInodes ()

On success, returns ZX_OK and prints to stdout the number allocated

inodes within the fs.

Defined at line 128 of file ../../src/storage/lib/host/common.h

zx_status_t UsedSize ()

On success, returns ZX_OK and prints to stdout the number of bytes used by data

and bytes reserved for superblock, bitmaps, inodes and journal within the fs.

Defined at line 132 of file ../../src/storage/lib/host/common.h

bool ShouldCompress ()

Defined at line 142 of file ../../src/storage/lib/host/common.h

const std::optional<std::filesystem::path> & json_output_path ()

Defined at line 144 of file ../../src/storage/lib/host/common.h