]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
mkfs: replace defaults source with an enum
authorLuis R. Rodriguez <mcgrof@kernel.org>
Mon, 11 Jun 2018 15:34:58 +0000 (10:34 -0500)
committerEric Sandeen <sandeen@redhat.com>
Mon, 11 Jun 2018 15:34:58 +0000 (10:34 -0500)
Using an enum will let us later just use a switch statement to print
out the source, this makes sources easier to document, update and
manage.

Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
mkfs/config.h
mkfs/xfs_mkfs.c

index e5ea968e2d65b5fad7fbddc0904578906622a05e..a3c6c99c30645bf1f96ce3c0004efba399960588 100644 (file)
@@ -54,6 +54,17 @@ struct sb_feat_args {
        bool    nortalign;
 };
 
+/*
+ * File configuration type settings
+ *
+ * These are the different possibilities by which you can end up parsing
+ * default settings with. DEFAULTS_BUILTIN indicates there was no configuration
+ * file parsed and we are using the built-in defaults on this code.
+ */
+enum default_params_type {
+       DEFAULTS_BUILTIN = 0,
+};
+
 /*
  * Default filesystem features and configuration values
  *
@@ -63,7 +74,7 @@ struct sb_feat_args {
  * calculations.
  */
 struct mkfs_default_params {
-       char    *source;        /* where the defaults came from */
+       enum default_params_type type; /* where the defaults came from */
 
        int     sectorsize;
        int     blocksize;
@@ -75,4 +86,13 @@ struct mkfs_default_params {
        struct fsxattr          fsx;
 };
 
+static inline const char *default_type_str(enum default_params_type type)
+{
+       switch (type) {
+       case DEFAULTS_BUILTIN:
+               return _("package built-in definitions");
+       }
+       return _("Unkown\n");
+}
+
 #endif /* _XFS_MKFS_CONFIG_H */
index 56e869d666be3443e9acfe0dc734fb169bfeb2a3..2e344aa9dad12dde7f2b421312349abf4af015c6 100644 (file)
@@ -3722,7 +3722,7 @@ main(
 
        /* build time defaults */
        struct mkfs_default_params      dft = {
-               .source = _("package build definitions"),
+               .type = DEFAULTS_BUILTIN,
                .sectorsize = XFS_MIN_SECTORSIZE,
                .blocksize = 1 << XFS_DFL_BLOCKSIZE_LOG,
                .sb_feat = {
@@ -3762,7 +3762,8 @@ main(
         * implemented, emit a message to indicate where the defaults being
         * used came from.
         *
-        * printf(_("Default configuration sourced from %s\n"), dft.source);
+        * printf(_("Default configuration sourced from %s\n"),
+        *        default_type_str(dft.type));
         */
 
        /* copy new defaults into CLI parsing structure */