cli/trivial: rename metadata related names

They will be moved out of nmcli as they are generally useful.
Even if they happen to be used only inside nmcli, there should
be a better separation between logic (nmcli) and setting decriptions.
This commit is contained in:
Thomas Haller
2017-03-28 11:02:03 +02:00
parent fcc19ea760
commit 2a71b5322f
6 changed files with 224 additions and 224 deletions

View File

@@ -152,7 +152,7 @@ NmcOutputField nmc_fields_con_show[] = {
{ \
.name = setting, \
.name_l10n = N_ (setting), \
.setting_info = &nmc_setting_infos[setting_type], \
.setting_info = &nm_meta_setting_infos_editor[setting_type], \
}
/* Available settings for 'connection show <con>' - profile part */
@@ -3185,7 +3185,7 @@ get_valid_properties_string (const NameItem *array,
{
const NameItem *iter = array;
const NmcOutputField *field_iter;
const NmcSettingInfo *setting_info;
const NMMetaSettingInfoEditor *setting_info;
const char *prop_name = NULL;
GString *str;
int i, j;

View File

@@ -68,7 +68,7 @@ NM_CACHED_QUARK_FCN ("nmcli-error-quark", nmcli_error_quark)
static void
complete_field_new (GHashTable *h, const char *setting, NMMetaSettingType setting_type)
{
const NmcSettingInfo *setting_info = &nmc_setting_infos[setting_type];
const NMMetaSettingInfoEditor *setting_info = &nm_meta_setting_infos_editor[setting_type];
int i;
for (i = 0; i < setting_info->properties_num; i++) {

View File

@@ -104,7 +104,7 @@ typedef enum {
#define NMC_OF_FLAG_MAIN_HEADER_ADD 0x00000004 /* Print main header in addition to values/field names */
#define NMC_OF_FLAG_MAIN_HEADER_ONLY 0x00000008 /* Print main header only */
struct _NmcSettingInfo;
struct _NMMetaSettingInfoEditor;
typedef struct _NmcOutputField {
const char *name; /* Field's name */
@@ -124,7 +124,7 @@ typedef struct _NmcOutputField {
*
* For now, hack around that by alternatively providing a @setting_info instead
* of @group_list. */
const struct _NmcSettingInfo *setting_info;
const struct _NMMetaSettingInfoEditor *setting_info;
} NmcOutputField;
typedef struct {

File diff suppressed because it is too large Load Diff

View File

@@ -28,50 +28,50 @@
/*****************************************************************************/
typedef enum {
NMC_PROPERTY_GET_PRETTY,
NMC_PROPERTY_GET_PARSABLE,
} NmcPropertyGetType;
NM_META_ACCESSOR_GET_TYPE_PRETTY,
NM_META_ACCESSOR_GET_TYPE_PARSABLE,
} NMMetaAccessorGetType;
typedef enum {
NMC_PROPERTY_TYPE_MAC_MODE_DEFAULT,
NMC_PROPERTY_TYPE_MAC_MODE_CLONED,
NMC_PROPERTY_TYPE_MAC_MODE_INFINIBAND,
} NmcPropertyTypeMacMode;
NM_META_PROPERTY_TYPE_MAC_MODE_DEFAULT,
NM_META_PROPERTY_TYPE_MAC_MODE_CLONED,
NM_META_PROPERTY_TYPE_MAC_MODE_INFINIBAND,
} NMMetaPropertyTypeMacMode;
typedef struct _NmcSettingInfo NmcSettingInfo;
typedef struct _NmcPropertyInfo NmcPropertyInfo;
typedef struct _NmcPropertyType NmcPropertyType;
typedef struct _NmcPropertyTypData NmcPropertyTypData;
typedef struct _NMMetaSettingInfoEditor NMMetaSettingInfoEditor;
typedef struct _NMMetaPropertyInfo NMMetaPropertyInfo;
typedef struct _NMMetaPropertyType NMMetaPropertyType;
typedef struct _NMMetaPropertyTypData NMMetaPropertyTypData;
struct _NmcPropertyType {
struct _NMMetaPropertyType {
const char *(*describe_fcn) (const NmcSettingInfo *setting_info,
const NmcPropertyInfo *property_info,
const char *(*describe_fcn) (const NMMetaSettingInfoEditor *setting_info,
const NMMetaPropertyInfo *property_info,
char **out_to_free);
char *(*get_fcn) (const NmcSettingInfo *setting_info,
const NmcPropertyInfo *property_info,
char *(*get_fcn) (const NMMetaSettingInfoEditor *setting_info,
const NMMetaPropertyInfo *property_info,
NMSetting *setting,
NmcPropertyGetType get_type,
NMMetaAccessorGetType get_type,
gboolean show_secrets);
gboolean (*set_fcn) (const NmcSettingInfo *setting_info,
const NmcPropertyInfo *property_info,
gboolean (*set_fcn) (const NMMetaSettingInfoEditor *setting_info,
const NMMetaPropertyInfo *property_info,
NMSetting *setting,
const char *value,
GError **error);
gboolean (*remove_fcn) (const NmcSettingInfo *setting_info,
const NmcPropertyInfo *property_info,
gboolean (*remove_fcn) (const NMMetaSettingInfoEditor *setting_info,
const NMMetaPropertyInfo *property_info,
NMSetting *setting,
const char *option,
guint32 idx,
GError **error);
const char *const*(*values_fcn) (const NmcSettingInfo *setting_info,
const NmcPropertyInfo *property_info,
const char *const*(*values_fcn) (const NMMetaSettingInfoEditor *setting_info,
const NMMetaPropertyInfo *property_info,
char ***out_to_free);
};
struct _NmcPropertyTypData {
struct _NMMetaPropertyTypData {
union {
struct {
gboolean (*fcn) (NMSetting *setting);
@@ -85,13 +85,13 @@ struct _NmcPropertyTypData {
guint32 (*get_fcn) (NMSetting *setting);
} mtu;
struct {
NmcPropertyTypeMacMode mode;
NMMetaPropertyTypeMacMode mode;
} mac;
} subtype;
const char *const*values_static;
};
struct _NmcPropertyInfo {
struct _NMMetaPropertyInfo {
const char *property_name;
/* the property list for now must contain as first field the
@@ -104,19 +104,19 @@ struct _NmcPropertyInfo {
const char *describe_message;
const NmcPropertyType *property_type;
const NmcPropertyTypData *property_typ_data;
const NMMetaPropertyType *property_type;
const NMMetaPropertyTypData *property_typ_data;
};
struct _NmcSettingInfo {
struct _NMMetaSettingInfoEditor {
const NMMetaSettingInfo *general;
/* the order of the properties matter. The first *must* be the
* "name", and then the order is as they are listed by default. */
const NmcPropertyInfo *properties;
const NMMetaPropertyInfo *properties;
guint properties_num;
};
extern const NmcSettingInfo nmc_setting_infos[_NM_META_SETTING_TYPE_NUM];
extern const NMMetaSettingInfoEditor nm_meta_setting_infos_editor[_NM_META_SETTING_TYPE_NUM];
/*****************************************************************************/

View File

@@ -871,7 +871,7 @@ parse_output_fields (const char *fields_str,
for (i = 0; fields_array[i].name; i++) {
if (strcasecmp (left, fields_array[i].name) == 0) {
const NmcOutputField *valid_names = fields_array[i].group_list;
const NmcSettingInfo *setting_info = fields_array[i].setting_info;
const NMMetaSettingInfoEditor *setting_info = fields_array[i].setting_info;
idx = i;
if (!right && !valid_names && !setting_info) {
@@ -966,7 +966,7 @@ nmc_get_allowed_fields (const NmcOutputField fields_array[], int group_idx)
fields_array[group_idx].name, second_level[i].name);
}
} else if (group_idx != -1 && fields_array[group_idx].setting_info) {
const NmcSettingInfo *second_level = fields_array[group_idx].setting_info;
const NMMetaSettingInfoEditor *second_level = fields_array[group_idx].setting_info;
for (i = 1; i < second_level->properties_num; i++) {
g_string_append_printf (allowed_fields, "%s.%s,",