/* Just define the max options array size manually right now */
#define MAX_SUBOPTS 5
-static int config_check_bool(
- uint64_t value)
+static int
+config_check_bool(
+ uint64_t value)
{
if (value > 1)
goto out;
int psubopt,
uint64_t value)
{
- enum data_subopts subopt = psubopt;
+ enum data_subopts subopt = psubopt;
if (config_check_bool(value) != 0)
return -1;
int psubopt,
uint64_t value)
{
- enum inode_subopts subopt = psubopt;
+ enum inode_subopts subopt = psubopt;
if (config_check_bool(value) != 0)
return -1;
int psubopt,
uint64_t value)
{
- enum log_subopts subopt = psubopt;
+ enum log_subopts subopt = psubopt;
if (config_check_bool(value) != 0)
return -1;
int psubopt,
uint64_t value)
{
- enum metadata_subopts subopt = psubopt;
+ enum metadata_subopts subopt = psubopt;
if (config_check_bool(value) != 0)
return -1;
int psubopt,
uint64_t value)
{
- enum naming_subopts subopt = psubopt;
+ enum naming_subopts subopt = psubopt;
if (config_check_bool(value) != 0)
return -1;
int psubopt,
uint64_t value)
{
- enum rtdev_subopts subopt = psubopt;
+ enum rtdev_subopts subopt = psubopt;
if (config_check_bool(value) != 0)
return -1;
}
struct confopts {
- const char *name;
- const char *subopts[MAX_SUBOPTS];
- int (*parser)(struct mkfs_default_params *dft,
- int psubopt, uint64_t value);
- bool seen;
+ const char *name;
+ const char *subopts[MAX_SUBOPTS];
+ int (*parser)(struct mkfs_default_params *dft,
+ int psubopt, uint64_t value);
+ bool seen;
} confopts_tab[] = {
{
.name = "data",
enum parse_line_type parse_type;
struct confopts *confopt = NULL;
int subopt;
- char *tag = NULL;
+ char *tag = NULL;
while ((linelen = getline(&line, &len, fp)) != -1) {
- char *ignore_value;
- char *p;
+ char *ignore_value;
+ char *p;
lineno++;
/*
- * tag is allocated for us by scanf(), it must freed only on any
- * successful parse of a section or tag-value pair.
+ * tag is allocated for us by scanf(), it must freed only on
+ * any successful parse of a section or tag-value pair.
*/
parse_type = parse_get_line_type(line, linelen, &tag, &value);
case PARSE_SECTION:
confopt = get_confopts(tag);
if (!confopt) {
- fprintf(stderr, _("Invalid section on line %s:%zu : %s\n"),
- config_file, lineno, tag);
+ fprintf(stderr,
+_("Invalid section on line %s:%zu : %s\n"),
+ config_file, lineno, tag);
goto out_free_tag;
}
if (!confopt->subopts) {
- fprintf(stderr, _("Section not yet supported on line %s:%zu : %s\n"),
- config_file, lineno, tag);
+ fprintf(stderr,
+_("Section not yet supported on line %s:%zu : %s\n"),
+ config_file, lineno, tag);
goto out_free_tag;
}
if (confopt->seen) {
errno = EINVAL;
- fprintf(stderr, _("Section '%s' respecified\n"),
- tag);
+ fprintf(stderr,
+_("Section '%s' respecified\n"),
+ tag);
goto out_free_tag;
}
confopt->seen = true;
break;
case PARSE_TAG_VALUE:
if (!confopt) {
- fprintf(stderr, _("No section specified yet on line %s:%zu : %s\n"),
- config_file, lineno, line);
+ fprintf(stderr,
+_("No section specified yet on line %s:%zu : %s\n"),
+ config_file, lineno, line);
goto out_free_tag;
}
ret = confopt->parser(dft, subopt, value);
if (ret) {
errno = EINVAL;
- fprintf(stderr, _("Error parsine line %s:%zu : %s\n"),
- config_file, lineno, line);
+ fprintf(stderr,
+_("Error parsing line %s:%zu : %s\n"),
+ config_file, lineno, line);
goto out;
}
static int
config_stat_check(
- struct stat *sp)
+ struct stat *sp)
{
if (!S_ISREG(sp->st_mode)) {
errno = EINVAL;
*/
int
open_cli_config(
- int dirfd,
- const char *cli_config_file,
- char **fpath)
+ int dirfd,
+ const char *cli_config_file,
+ char **fpath)
{
- int fd = -1, len, ret;
- struct stat st;
+ int fd = -1, len, ret;
+ struct stat st;
fd = openat(AT_FDCWD, cli_config_file, O_NOFOLLOW, O_RDONLY);
if (fd < 0) {
if (fd < 0)
goto out;
- ret = fstatat(dirfd, cli_config_file, &st,
- AT_SYMLINK_NOFOLLOW);
+ ret = fstatat(dirfd, cli_config_file, &st, AT_SYMLINK_NOFOLLOW);
if (ret != 0)
goto err_out_close;
struct mkfs_default_params *dft,
char **fpath)
{
- int dirfd, fd = -1, len, ret;
- struct stat st;
+ int dirfd, fd = -1, len, ret;
+ struct stat st;
*fpath = malloc(PATH_MAX);
if (!*fpath)
out:
if (fd < 0) {
if (dft->type != DEFAULTS_BUILTIN) {
- fprintf(stderr, _("Unable to open %s config file: %s : %s\n"),
- default_type_str(dft->type), *fpath,
- strerror(errno));
+ fprintf(stderr,
+_("Unable to open %s config file: %s : %s\n"),
+ default_type_str(dft->type), *fpath,
+ strerror(errno));
free(*fpath);
exit(1);
}
*/
int
parse_defaults_file(
- int fd,
- struct mkfs_default_params *dft,
- const char *config_file)
+ int fd,
+ struct mkfs_default_params *dft,
+ const char *config_file)
{
- FILE *fp;
- int ret;
+ FILE *fp;
+ int ret;
fp = fdopen(fd, "r");
if (!fp)