Refactor: sysroot.bootloader: Store enum value rather than string

It's easier to extend and it centralises the config parsing.  In other
places we will no longer need to use `g_str_equal` to match these values,
a `switch` statement will be sufficient.
This commit is contained in:
William Manley committed 2020-10-26 23:51:11 +00:00
1 parent 062df6ee81
commit 9482ecfe5a
3 files changed
+73 -55

No files matched your search

+17 -1
View File
@@ -110,6 +110,22 @@ typedef enum {
_OSTREE_FEATURE_YES,
} _OstreeFeatureSupport;
/* Possible values for the sysroot.bootloader configuration variable */
typedef enum {
CFG_SYSROOT_BOOTLOADER_OPT_AUTO = 0,
CFG_SYSROOT_BOOTLOADER_OPT_NONE,
CFG_SYSROOT_BOOTLOADER_OPT_ZIPL,
/* Non-exhaustive */
} OstreeCfgSysrootBootloaderOpt;
static const char* const CFG_SYSROOT_BOOTLOADER_OPTS_STR[] = {
/* This must be kept in the same order as the enum */
"auto",
"none",
"zipl",
NULL,
};
/**
* OstreeRepo:
*
@@ -193,7 +209,7 @@ struct OstreeRepo {
guint64 payload_link_threshold;
gint fs_support_reflink; /* The underlying filesystem has support for ioctl (FICLONE..) */
gchar **repo_finders;
gchar *bootloader; /* Configure which bootloader to use. */
OstreeCfgSysrootBootloaderOpt bootloader; /* Configure which bootloader to use. */
OstreeRepo *parent_repo;
};