diff options
author | Thomas Haller <thaller@redhat.com> | 2020-07-31 12:39:58 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2020-08-05 12:47:55 +0200 |
commit | 9798a90d539318e9b651a1ed0f1bb8ba847d7feb (patch) | |
tree | 498acd9ed657e6b0fa3c3bcaf849847702d4a9dd | |
parent | c9409f8692d21c2a926ffca0136a93d9dc6cc864 (diff) | |
download | NetworkManager-9798a90d539318e9b651a1ed0f1bb8ba847d7feb.tar.gz |
l3cfg: rename NML3ConfigData instances from l3cfg to l3cd
The name l3cfg is nicer, but it would make you think that it's an
NML3Cfg instance, when it's really NML3ConfigData.
-rw-r--r-- | src/nm-l3-config-data.c | 2 | ||||
-rw-r--r-- | src/nm-l3-config-data.h | 10 | ||||
-rw-r--r-- | src/nm-l3cfg.c | 100 | ||||
-rw-r--r-- | src/nm-l3cfg.h | 2 |
4 files changed, 57 insertions, 57 deletions
diff --git a/src/nm-l3-config-data.c b/src/nm-l3-config-data.c index f384ae2343..3391f77bd3 100644 --- a/src/nm-l3-config-data.c +++ b/src/nm-l3-config-data.c @@ -1951,7 +1951,7 @@ nm_l3_config_data_new_combined (NMDedupMultiIndex *multi_idx, for (i = 0; i < merge_infos_len; i++) { _init_merge (self, - merge_infos[i]->l3cfg, + merge_infos[i]->l3cd, merge_infos[i]->merge_flags, merge_infos[i]->default_route_penalty_x); } diff --git a/src/nm-l3-config-data.h b/src/nm-l3-config-data.h index 59fbffce66..c7830c656f 100644 --- a/src/nm-l3-config-data.h +++ b/src/nm-l3-config-data.h @@ -66,7 +66,7 @@ typedef enum { typedef struct _NML3ConfigData NML3ConfigData; typedef struct { - const NML3ConfigData *l3cfg; + const NML3ConfigData *l3cd; NML3ConfigMergeFlags merge_flags; union { struct { @@ -84,11 +84,11 @@ const NML3ConfigData *nm_l3_config_data_ref_and_seal (const NML3ConfigData *self const NML3ConfigData *nm_l3_config_data_seal (const NML3ConfigData *self); void nm_l3_config_data_unref (const NML3ConfigData *self); -NM_AUTO_DEFINE_FCN0 (const NML3ConfigData *, _nm_auto_unref_l3cfg, nm_l3_config_data_unref); -#define nm_auto_unref_l3cfg nm_auto (_nm_auto_unref_l3cfg) +NM_AUTO_DEFINE_FCN0 (const NML3ConfigData *, _nm_auto_unref_l3cd, nm_l3_config_data_unref); +#define nm_auto_unref_l3cd nm_auto (_nm_auto_unref_l3cd) -NM_AUTO_DEFINE_FCN0 (NML3ConfigData *, _nm_auto_unref_l3cfg_init, nm_l3_config_data_unref); -#define nm_auto_unref_l3cfg_init nm_auto (_nm_auto_unref_l3cfg_init) +NM_AUTO_DEFINE_FCN0 (NML3ConfigData *, _nm_auto_unref_l3cd_init, nm_l3_config_data_unref); +#define nm_auto_unref_l3cd_init nm_auto (_nm_auto_unref_l3cd_init) gboolean nm_l3_config_data_is_sealed (const NML3ConfigData *self); diff --git a/src/nm-l3cfg.c b/src/nm-l3cfg.c index 5e0890ded2..7966be2c1a 100644 --- a/src/nm-l3cfg.c +++ b/src/nm-l3cfg.c @@ -37,7 +37,7 @@ static GQuark signal_notify_quarks[_NM_L3_CONFIG_NOTIFY_TYPE_NUM]; typedef struct _NML3CfgPrivate { GArray *property_emit_list; GArray *l3_config_datas; - const NML3ConfigData *combined_l3cfg; + const NML3ConfigData *combined_l3cd; GHashTable *routes_temporary_not_available_hash; @@ -191,14 +191,14 @@ _l3cfg_externally_removed_objs_drop_unused (NML3Cfg *self) if (!self->priv.p->externally_removed_objs_hash) return; - if (!self->priv.p->combined_l3cfg) { + if (!self->priv.p->combined_l3cd) { _l3cfg_externally_removed_objs_drop (self, AF_UNSPEC); return; } g_hash_table_iter_init (&h_iter, self->priv.p->externally_removed_objs_hash); while (g_hash_table_iter_next (&h_iter, (gpointer *) &obj, NULL)) { - if (!nm_l3_config_data_lookup_route_obj (self->priv.p->combined_l3cfg, + if (!nm_l3_config_data_lookup_route_obj (self->priv.p->combined_l3cd, obj)) { /* The object is no longer tracked in the configuration. * The externally_removed_objs_hash is to prevent adding entires that were @@ -221,7 +221,7 @@ _l3cfg_externally_removed_objs_track (NML3Cfg *self, nm_assert (NM_IS_L3CFG (self)); - if (!self->priv.p->combined_l3cfg) + if (!self->priv.p->combined_l3cd) return; if (!is_removed) { @@ -238,7 +238,7 @@ _l3cfg_externally_removed_objs_track (NML3Cfg *self, return; } - if (!nm_l3_config_data_lookup_route_obj (self->priv.p->combined_l3cfg, + if (!nm_l3_config_data_lookup_route_obj (self->priv.p->combined_l3cd, obj)) { /* we don't care about this object, so there is nothing to hide hide */ return; @@ -268,16 +268,16 @@ _l3cfg_externally_removed_objs_pickup (NML3Cfg *self, NMDedupMultiIter iter; const NMPObject *obj; - if (!self->priv.p->combined_l3cfg) + if (!self->priv.p->combined_l3cd) return; - nm_l3_config_data_iter_obj_for_each (iter, self->priv.p->combined_l3cfg, obj, NMP_OBJECT_TYPE_IP_ADDRESS (IS_IPv4)) { + nm_l3_config_data_iter_obj_for_each (iter, self->priv.p->combined_l3cd, obj, NMP_OBJECT_TYPE_IP_ADDRESS (IS_IPv4)) { if (!nm_platform_lookup_entry (self->priv.platform, NMP_CACHE_ID_TYPE_OBJECT_TYPE, obj)) _l3cfg_externally_removed_objs_track (self, obj, TRUE); } - nm_l3_config_data_iter_obj_for_each (iter, self->priv.p->combined_l3cfg, obj, NMP_OBJECT_TYPE_IP_ROUTE (IS_IPv4)) { + nm_l3_config_data_iter_obj_for_each (iter, self->priv.p->combined_l3cd, obj, NMP_OBJECT_TYPE_IP_ROUTE (IS_IPv4)) { if (!nm_platform_lookup_entry (self->priv.platform, NMP_CACHE_ID_TYPE_OBJECT_TYPE, obj)) @@ -514,7 +514,7 @@ static gssize _l3_config_datas_find_next (GArray *l3_config_datas, guint start_idx, gconstpointer needle_tag, - const NML3ConfigData *needle_l3cfg) + const NML3ConfigData *needle_l3cd) { guint i; @@ -525,7 +525,7 @@ _l3_config_datas_find_next (GArray *l3_config_datas, const L3ConfigData *l3_config_data = _l3_config_datas_at (l3_config_datas, i); if ( NM_IN_SET (needle_tag, NULL, l3_config_data->tag) - && NM_IN_SET (needle_l3cfg, NULL, l3_config_data->merge_info.l3cfg)) + && NM_IN_SET (needle_l3cd, NULL, l3_config_data->merge_info.l3cd)) return i; } return -1; @@ -542,7 +542,7 @@ _l3_config_datas_remove_index_fast (GArray *arr, l3_config_data = _l3_config_datas_at (arr, idx); - nm_l3_config_data_unref (l3_config_data->merge_info.l3cfg); + nm_l3_config_data_unref (l3_config_data->merge_info.l3cd); g_array_remove_index_fast (arr, idx); } @@ -580,7 +580,7 @@ void nm_l3cfg_add_config (NML3Cfg *self, gconstpointer tag, gboolean replace_same_tag, - const NML3ConfigData *l3cfg, + const NML3ConfigData *l3cd, int priority, guint32 default_route_penalty_4, guint32 default_route_penalty_6, @@ -593,15 +593,15 @@ nm_l3cfg_add_config (NML3Cfg *self, nm_assert (NM_IS_L3CFG (self)); nm_assert (tag); - nm_assert (l3cfg); - nm_assert (nm_l3_config_data_get_ifindex (l3cfg) == self->priv.ifindex); + nm_assert (l3cd); + nm_assert (nm_l3_config_data_get_ifindex (l3cd) == self->priv.ifindex); l3_config_datas = _l3_config_datas_ensure (&self->priv.p->l3_config_datas); idx = _l3_config_datas_find_next (l3_config_datas, 0, tag, - replace_same_tag ? NULL : l3cfg); + replace_same_tag ? NULL : l3cd); if (replace_same_tag) { gssize idx2; @@ -611,7 +611,7 @@ nm_l3cfg_add_config (NML3Cfg *self, while (TRUE) { l3_config_data = _l3_config_datas_at (l3_config_datas, idx2); - if (l3_config_data->merge_info.l3cfg == l3cfg) { + if (l3_config_data->merge_info.l3cd == l3cd) { nm_assert (idx == -1); idx = idx2; continue; @@ -630,7 +630,7 @@ nm_l3cfg_add_config (NML3Cfg *self, l3_config_data = nm_g_array_append_new (l3_config_datas, L3ConfigData); *l3_config_data = (L3ConfigData) { .tag = tag, - .merge_info.l3cfg = nm_l3_config_data_ref_and_seal (l3cfg), + .merge_info.l3cd = nm_l3_config_data_ref_and_seal (l3cd), .merge_info.merge_flags = merge_flags, .merge_info.default_route_penalty_4 = default_route_penalty_4, .merge_info.default_route_penalty_6 = default_route_penalty_6, @@ -643,7 +643,7 @@ nm_l3cfg_add_config (NML3Cfg *self, l3_config_data = _l3_config_datas_at (l3_config_datas, idx); l3_config_data->dirty = FALSE; nm_assert (l3_config_data->tag == tag); - nm_assert (l3_config_data->merge_info.l3cfg == l3cfg); + nm_assert (l3_config_data->merge_info.l3cd == l3cd); if (l3_config_data->priority != priority) { l3_config_data->priority = priority; changed = TRUE; @@ -670,7 +670,7 @@ static void _l3cfg_remove_config (NML3Cfg *self, gconstpointer tag, gboolean only_dirty, - const NML3ConfigData *l3cfg) + const NML3ConfigData *l3cd) { GArray *l3_config_datas; gssize idx; @@ -687,7 +687,7 @@ _l3cfg_remove_config (NML3Cfg *self, idx = _l3_config_datas_find_next (l3_config_datas, idx, tag, - l3cfg); + l3cd); if (idx < 0) return; @@ -699,7 +699,7 @@ _l3cfg_remove_config (NML3Cfg *self, self->priv.changed_configs = TRUE; _l3_config_datas_remove_index_fast (l3_config_datas, idx); - if (!l3cfg) + if (!l3cd) return; } } @@ -734,7 +734,7 @@ _l3_config_combine_sort_fcn (gconstpointer p_a, nm_assert (a); nm_assert (b); - nm_assert (nm_l3_config_data_get_ifindex (a->merge_info.l3cfg) == nm_l3_config_data_get_ifindex (b->merge_info.l3cfg)); + nm_assert (nm_l3_config_data_get_ifindex (a->merge_info.l3cd) == nm_l3_config_data_get_ifindex (b->merge_info.l3cd)); /* we sort the entries with higher priority (more important, lower numerical value) * first. */ @@ -753,7 +753,7 @@ _l3cfg_combine_config (GArray *l3_config_datas, int ifindex) { gs_free L3ConfigData **infos_heap = NULL; - NML3ConfigData *l3cfg; + NML3ConfigData *l3cd; L3ConfigData **infos; guint i; @@ -762,7 +762,7 @@ _l3cfg_combine_config (GArray *l3_config_datas, return NULL; if (l3_config_datas->len == 1) - return nm_l3_config_data_ref (_l3_config_datas_at (l3_config_datas, 0)->merge_info.l3cfg); + return nm_l3_config_data_ref (_l3_config_datas_at (l3_config_datas, 0)->merge_info.l3cd); if (l3_config_datas->len < 300 / sizeof (infos[0])) infos = g_alloca (l3_config_datas->len * sizeof (infos[0])); @@ -782,23 +782,23 @@ _l3cfg_combine_config (GArray *l3_config_datas, nm_assert (&infos[0]->merge_info == (NML3ConfigDatMergeInfo *) infos[0]); - l3cfg = nm_l3_config_data_new_combined (multi_idx, - ifindex, - (const NML3ConfigDatMergeInfo *const*) infos, - l3_config_datas->len); + l3cd = nm_l3_config_data_new_combined (multi_idx, + ifindex, + (const NML3ConfigDatMergeInfo *const*) infos, + l3_config_datas->len); - nm_assert (l3cfg); - nm_assert (nm_l3_config_data_get_ifindex (l3cfg) == ifindex); + nm_assert (l3cd); + nm_assert (nm_l3_config_data_get_ifindex (l3cd) == ifindex); - return nm_l3_config_data_seal (l3cfg); + return nm_l3_config_data_seal (l3cd); } static gboolean _l3cfg_update_combined_config (NML3Cfg *self, const NML3ConfigData **out_old /* transfer reference */) { - nm_auto_unref_l3cfg const NML3ConfigData *l3cfg_old = NULL; - nm_auto_unref_l3cfg const NML3ConfigData *l3cfg = NULL; + nm_auto_unref_l3cd const NML3ConfigData *l3cd_old = NULL; + nm_auto_unref_l3cd const NML3ConfigData *l3cd = NULL; nm_assert (NM_IS_L3CFG (self)); nm_assert (!out_old || !*out_old); @@ -808,18 +808,18 @@ _l3cfg_update_combined_config (NML3Cfg *self, self->priv.changed_configs = FALSE; - l3cfg = _l3cfg_combine_config (self->priv.p->l3_config_datas, - nm_platform_get_multi_idx (self->priv.platform), - self->priv.ifindex); + l3cd = _l3cfg_combine_config (self->priv.p->l3_config_datas, + nm_platform_get_multi_idx (self->priv.platform), + self->priv.ifindex); - if (nm_l3_config_data_equal (l3cfg, self->priv.p->combined_l3cfg)) + if (nm_l3_config_data_equal (l3cd, self->priv.p->combined_l3cd)) return FALSE; _LOGT ("desired IP configuration changed"); - l3cfg_old = g_steal_pointer (&self->priv.p->combined_l3cfg); - self->priv.p->combined_l3cfg = nm_l3_config_data_seal (g_steal_pointer (&l3cfg)); - NM_SET_OUT (out_old, nm_l3_config_data_ref (self->priv.p->combined_l3cfg)); + l3cd_old = g_steal_pointer (&self->priv.p->combined_l3cd); + self->priv.p->combined_l3cd = nm_l3_config_data_seal (g_steal_pointer (&l3cd)); + NM_SET_OUT (out_old, nm_l3_config_data_ref (self->priv.p->combined_l3cd)); return TRUE; } @@ -1008,7 +1008,7 @@ nm_l3cfg_platform_commit (NML3Cfg *self, int addr_family, gboolean *out_final_failure_for_temporary_not_available) { - nm_auto_unref_l3cfg const NML3ConfigData *l3cfg_old = NULL; + nm_auto_unref_l3cd const NML3ConfigData *l3cd_old = NULL; gs_unref_ptrarray GPtrArray *addresses = NULL; gs_unref_ptrarray GPtrArray *routes = NULL; gs_unref_ptrarray GPtrArray *addresses_prune = NULL; @@ -1046,7 +1046,7 @@ nm_l3cfg_platform_commit (NML3Cfg *self, nm_utils_addr_family_to_char (addr_family), _l3_cfg_commit_type_to_string (commit_type, sbuf_commit_type, sizeof (sbuf_commit_type))); - combined_changed = _l3cfg_update_combined_config (self, &l3cfg_old); + combined_changed = _l3cfg_update_combined_config (self, &l3cd_old); IS_IPv4 = NM_IS_IPv4 (addr_family); @@ -1061,7 +1061,7 @@ nm_l3cfg_platform_commit (NML3Cfg *self, _l3cfg_externally_removed_objs_pickup (self, addr_family); } - if (self->priv.p->combined_l3cfg) { + if (self->priv.p->combined_l3cd) { NMDedupMultiFcnSelectPredicate predicate; if ( commit_type != NM_L3_CFG_COMMIT_TYPE_REAPPLY @@ -1069,7 +1069,7 @@ nm_l3cfg_platform_commit (NML3Cfg *self, predicate = _l3cfg_externally_removed_objs_filter; else predicate = NULL; - addresses = nm_dedup_multi_objs_to_ptr_array_head (nm_l3_config_data_lookup_objs (self->priv.p->combined_l3cfg, + addresses = nm_dedup_multi_objs_to_ptr_array_head (nm_l3_config_data_lookup_objs (self->priv.p->combined_l3cd, NMP_OBJECT_TYPE_IP_ADDRESS (IS_IPv4)), predicate, self->priv.p->externally_removed_objs_hash); @@ -1079,12 +1079,12 @@ nm_l3cfg_platform_commit (NML3Cfg *self, predicate = _l3cfg_externally_removed_objs_filter; else predicate = NULL; - routes = nm_dedup_multi_objs_to_ptr_array_head (nm_l3_config_data_lookup_objs (self->priv.p->combined_l3cfg, + routes = nm_dedup_multi_objs_to_ptr_array_head (nm_l3_config_data_lookup_objs (self->priv.p->combined_l3cd, NMP_OBJECT_TYPE_IP_ROUTE (IS_IPv4)), predicate, self->priv.p->externally_removed_objs_hash); - route_table_sync = nm_l3_config_data_get_route_table_sync (self->priv.p->combined_l3cfg, addr_family); + route_table_sync = nm_l3_config_data_get_route_table_sync (self->priv.p->combined_l3cd, addr_family); } if (route_table_sync == NM_IP_ROUTE_TABLE_SYNC_MODE_NONE) @@ -1104,16 +1104,16 @@ nm_l3cfg_platform_commit (NML3Cfg *self, * * Of course, if an entry is both to be pruned and to be added, then * the latter wins. So, this works just nicely. */ - if (l3cfg_old) { + if (l3cd_old) { const NMDedupMultiHeadEntry *head_entry; - head_entry = nm_l3_config_data_lookup_objs (l3cfg_old, + head_entry = nm_l3_config_data_lookup_objs (l3cd_old, NMP_OBJECT_TYPE_IP_ADDRESS (IS_IPv4)); addresses_prune = nm_dedup_multi_objs_to_ptr_array_head (head_entry, NULL, NULL); - head_entry = nm_l3_config_data_lookup_objs (l3cfg_old, + head_entry = nm_l3_config_data_lookup_objs (l3cd_old, NMP_OBJECT_TYPE_IP_ROUTE (IS_IPv4)); addresses_prune = nm_dedup_multi_objs_to_ptr_array_head (head_entry, NULL, @@ -1230,7 +1230,7 @@ finalize (GObject *object) g_clear_object (&self->priv.netns); g_clear_object (&self->priv.platform); - nm_clear_pointer (&self->priv.p->combined_l3cfg, nm_l3_config_data_unref); + nm_clear_pointer (&self->priv.p->combined_l3cd, nm_l3_config_data_unref); nm_clear_pointer (&self->priv.pllink, nmp_object_unref); diff --git a/src/nm-l3cfg.h b/src/nm-l3cfg.h index 55a062156d..69748b6e79 100644 --- a/src/nm-l3cfg.h +++ b/src/nm-l3cfg.h @@ -113,7 +113,7 @@ void nm_l3cfg_mark_config_dirty (NML3Cfg *self, void nm_l3cfg_add_config (NML3Cfg *self, gconstpointer tag, gboolean replace_same_tag, - const NML3ConfigData *l3cfg, + const NML3ConfigData *l3cd, int priority, guint32 default_route_penalty_4, guint32 default_route_penalty_6, |