-static void prep_error (prep_data *data, const char *filename, const char *fs, ...) __attribute__((noreturn, format (printf,3,4)));
-
-struct prep {
- const char *name; /* eg. "fs" */
-
- size_t nr_params; /* optional parameters */
- struct param *params;
-
- const char *shortdesc; /* short description */
- const char *longdesc; /* long description */
-
- /* functions to implement it */
- void (*prelaunch) (const char *filename, prep_data *);
- void (*postlaunch) (const char *filename, prep_data *, const char *device);
-};
-
-struct param {
- const char *pname; /* parameter name */
- const char *pdefault; /* parameter default */
- const char *pdesc; /* parameter description */
-};
-
-static void prelaunch_disk (const char *filename, prep_data *data);
-static struct param disk_params[] = {
- { "size", "100M", "the size of the disk image" },
-};
-
-static void prelaunch_part (const char *filename, prep_data *data);
-static void postlaunch_part (const char *filename, prep_data *data, const char *device);
-static struct param part_params[] = {
- { "size", "100M", "the size of the disk image" },
- { "partition", "mbr", "partition table type" },
-};
-
-static void prelaunch_fs (const char *filename, prep_data *data);
-static void postlaunch_fs (const char *filename, prep_data *data, const char *device);
-static struct param fs_params[] = {
- { "filesystem", "ext2", "the type of filesystem to use" },
- { "size", "100M", "the size of the disk image" },
- { "partition", "mbr", "partition table type" },
-};
-
-static const struct prep preps[] = {
- { "disk",
- 1, disk_params,
- "create a blank disk",
- "\
- Create a blank disk, size 100MB (by default).\n\
-\n\
- The default size can be changed by supplying an optional parameter.",
- prelaunch_disk, NULL
- },
- { "part",
- 2, part_params,
- "create a partitioned disk",
- "\
- Create a disk with a single partition. By default the size of the disk\n\
- is 100MB (the available space in the partition will be a tiny bit smaller)\n\
- and the partition table will be MBR (old DOS-style).\n\
-\n\
- These defaults can be changed by supplying optional parameters.",
- prelaunch_part, postlaunch_part
- },
- { "fs",
- 3, fs_params,
- "create a filesystem",
- "\
- Create a disk with a single partition, with the partition containing\n\
- an empty filesystem. This defaults to creating a 100MB disk (the available\n\
- space in the filesystem will be a tiny bit smaller) with an MBR (old\n\
- DOS-style) partition table and an ext2 filesystem.\n\
-\n\
- These defaults can be changed by supplying optional parameters.",
- prelaunch_fs, postlaunch_fs
- },
-};
-
-#define nr_preps (sizeof preps / sizeof preps[0])