[virt-tools-list] [PATCH 3/3] config_param: add is_{required, optional} functions
Fabiano Fidêncio
fabiano at fidencio.org
Mon Oct 1 00:46:43 UTC 2012
These functions help applications to check if a config_param is required
or optional.
---
osinfo/libosinfo.syms | 2 ++
osinfo/osinfo_install_config_param.c | 32 ++++++++++++++++++++++++++++++++
osinfo/osinfo_install_config_param.h | 4 ++++
3 files changed, 38 insertions(+)
diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms
index df76108..0efc162 100644
--- a/osinfo/libosinfo.syms
+++ b/osinfo/libosinfo.syms
@@ -308,6 +308,8 @@ LIBOSINFO_0.2.1 {
osinfo_entity_get_param_value_int64;
osinfo_entity_get_param_value_int64_with_default;
osinfo_entity_set_param_int64;
+ osinfo_install_config_param_is_optional;
+ osinfo_install_config_param_is_required;
osinfo_install_script_get_expected_filename;
osinfo_install_script_get_config_param;
} LIBOSINFO_0.2.0;
diff --git a/osinfo/osinfo_install_config_param.c b/osinfo/osinfo_install_config_param.c
index 8a0ab56..7e1e3fc 100644
--- a/osinfo/osinfo_install_config_param.c
+++ b/osinfo/osinfo_install_config_param.c
@@ -225,6 +225,38 @@ OsinfoInstallConfigParamPolicy osinfo_install_config_param_get_policy(const Osin
return config_param->priv->policy;
}
+/**
+ * osinfo_install_config_param_is_required:
+ * @config_param: the configuration parameter
+ *
+ * Returns: (transfer none): TRUE if the config_param is required.
+ * FALSE otherwise.
+ */
+gboolean osinfo_install_config_param_is_required(const OsinfoInstallConfigParam *config_param)
+{
+ if (config_param->priv->policy ==
+ OSINFO_INSTALL_CONFIG_PARAM_POLICY_REQUIRED)
+ return TRUE;
+
+ return FALSE;
+}
+
+/**
+ * osinfo_install_config_param_is_optional:
+ * @config_param: the configuration parameter
+ *
+ * Returns: (transfer none): TRUE if the config_param is optional.
+ * FALSE otherwise.
+ */
+gboolean osinfo_install_config_param_is_optional(const OsinfoInstallConfigParam *config_param)
+{
+ if (config_param->priv->policy ==
+ OSINFO_INSTALL_CONFIG_PARAM_POLICY_OPTIONAL)
+ return TRUE;
+
+ return FALSE;
+}
+
/*
* Local variables:
* indent-tabs-mode: nil
diff --git a/osinfo/osinfo_install_config_param.h b/osinfo/osinfo_install_config_param.h
index e3a7a4e..dbe5e23 100644
--- a/osinfo/osinfo_install_config_param.h
+++ b/osinfo/osinfo_install_config_param.h
@@ -72,6 +72,10 @@ const gchar *osinfo_install_config_param_get_name(const OsinfoInstallConfigParam
OsinfoInstallConfigParamPolicy osinfo_install_config_param_get_policy(const OsinfoInstallConfigParam *config_param);
+gboolean osinfo_install_config_param_is_required(const OsinfoInstallConfigParam *config_param);
+
+gboolean osinfo_install_config_param_is_optional(const OsinfoInstallConfigParam *config_param);
+
#endif /* __OSINFO_INSTALL_CONFIG_PARAM_H__ */
/*
--
1.7.12.1
More information about the virt-tools-list
mailing list