.I naming_options
] [
.B \-p
-.I protofile
+.I protofile_options
] [
.B \-q
] [
enabled, and cannot be turned off.
.IP
In other words, this option is only tunable on the deprecated V4 format.
-.IP
.RE
+.PP
+.PD 0
.TP
-.BI \-p " protofile"
+.BI \-p " protofile_options"
+.TP
+.BI "Section Name: " [proto]
+.PD
+These options specify the protofile parameters for populating the filesystem.
+The valid
+.I protofile_options
+are:
+.RS 1.2i
+.TP
+.BI [file=] protofile
+The
+.B file=
+prefix is not required for this CLI argument for legacy reasons.
+If specified as a config file directive, the prefix is required.
+
If the optional
-.BI \-p " protofile"
+.PD
+.I protofile
argument is given,
.B mkfs.xfs
uses
always terminated with the dollar (
.B $
) token.
+.RE
.TP
.B \-q
Quiet option. Normally
N_MAX_OPTS,
};
+enum {
+ P_FILE = 0,
+ P_MAX_OPTS,
+};
+
enum {
R_EXTSIZE = 0,
R_SIZE,
},
};
+static struct opt_params popts = {
+ .name = 'p',
+ .ini_section = "proto",
+ .subopts = {
+ [P_FILE] = "file",
+ [P_MAX_OPTS] = NULL,
+ },
+ .subopt_params = {
+ { .index = P_FILE,
+ .conflicts = { { NULL, LAST_CONFLICT } },
+ .defaultval = SUBOPT_NEEDS_VAL,
+ },
+ },
+};
+
static struct opt_params ropts = {
.name = 'r',
.ini_section = "realtime",
int blocksize;
char *cfgfile;
+ char *protofile;
/* parameters that depend on sector/block size being validated. */
char *dsize;
return 0;
}
+static int
+proto_opts_parser(
+ struct opt_params *opts,
+ int subopt,
+ const char *value,
+ struct cli_params *cli)
+{
+ switch (subopt) {
+ case P_FILE:
+ fallthrough;
+ default:
+ if (cli->protofile) {
+ if (subopt < 0)
+ subopt = P_FILE;
+ respec(opts->name, opts->subopts, subopt);
+ }
+ cli->protofile = strdup(value);
+ if (!cli->protofile) {
+ fprintf(stderr,
+ _("Out of memory while saving protofile option.\n"));
+ exit(1);
+ }
+ break;
+ }
+ return 0;
+}
+
static int
rtdev_opts_parser(
struct opt_params *opts,
{ &lopts, log_opts_parser },
{ &mopts, meta_opts_parser },
{ &nopts, naming_opts_parser },
+ { &popts, proto_opts_parser },
{ &ropts, rtdev_opts_parser },
{ &sopts, sector_opts_parser },
{ NULL, NULL },
int discard = 1;
int force_overwrite = 0;
int quiet = 0;
- char *protofile = NULL;
char *protostring = NULL;
int worst_freelist = 0;
case 'l':
case 'm':
case 'n':
+ case 'p':
case 'r':
case 's':
parse_subopts(c, optarg, &cli);
case 'K':
discard = 0;
break;
- case 'p':
- if (protofile)
- respec('p', NULL, 0);
- protofile = optarg;
- break;
case 'q':
quiet = 1;
break;
*/
cfgfile_parse(&cli);
- protostring = setup_proto(protofile);
+ protostring = setup_proto(cli.protofile);
/*
* Extract as much of the valid config as we can from the CLI input