platform/trivial: rename NMPlatformLink's "flags" field to "n_ifi_flags"
There are far too many "flags". Rename the "flags" to "n_ifi_flags" which reminds to "ifi_flags" in 'struct ifinfomsg', but with a distinctive "n_" prefix.
This commit is contained in:
@@ -1498,7 +1498,7 @@ device_link_changed (NMDevice *self)
|
||||
update_dynamic_ip_setup (self);
|
||||
|
||||
was_up = priv->up;
|
||||
priv->up = NM_FLAGS_HAS (info.flags, IFF_UP);
|
||||
priv->up = NM_FLAGS_HAS (info.n_ifi_flags, IFF_UP);
|
||||
|
||||
if ( priv->ifindex > 0
|
||||
&& info.initialized
|
||||
@@ -1778,7 +1778,7 @@ update_device_from_platform_link (NMDevice *self, const NMPlatformLink *plink)
|
||||
priv->ifindex = plink->ifindex;
|
||||
_notify (self, PROP_IFINDEX);
|
||||
|
||||
priv->up = NM_FLAGS_HAS (plink->flags, IFF_UP);
|
||||
priv->up = NM_FLAGS_HAS (plink->n_ifi_flags, IFF_UP);
|
||||
if (plink->driver && g_strcmp0 (plink->driver, priv->driver) != 0) {
|
||||
g_free (priv->driver);
|
||||
priv->driver = g_strdup (plink->driver);
|
||||
@@ -11046,7 +11046,7 @@ constructor (GType type,
|
||||
|
||||
if (pllink && link_type_compatible (self, pllink->type, NULL, NULL)) {
|
||||
priv->ifindex = pllink->ifindex;
|
||||
priv->up = NM_FLAGS_HAS (pllink->flags, IFF_UP);
|
||||
priv->up = NM_FLAGS_HAS (pllink->n_ifi_flags, IFF_UP);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -172,10 +172,10 @@ link_init (NMFakePlatformLink *device, int ifindex, int type, const char *name)
|
||||
strcpy (device->link.name, name);
|
||||
switch (device->link.type) {
|
||||
case NM_LINK_TYPE_DUMMY:
|
||||
device->link.flags = NM_FLAGS_SET (device->link.flags, IFF_NOARP);
|
||||
device->link.n_ifi_flags = NM_FLAGS_SET (device->link.n_ifi_flags, IFF_NOARP);
|
||||
break;
|
||||
default:
|
||||
device->link.flags = NM_FLAGS_UNSET (device->link.flags, IFF_NOARP);
|
||||
device->link.n_ifi_flags = NM_FLAGS_UNSET (device->link.n_ifi_flags, IFF_NOARP);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -439,9 +439,9 @@ link_set_up (NMPlatform *platform, int ifindex, gboolean *out_no_firmware)
|
||||
g_error ("Unexpected device type: %d", device->link.type);
|
||||
}
|
||||
|
||||
if ( NM_FLAGS_HAS (device->link.flags, IFF_UP) != !!up
|
||||
if ( NM_FLAGS_HAS (device->link.n_ifi_flags, IFF_UP) != !!up
|
||||
|| device->link.connected != connected) {
|
||||
device->link.flags = NM_FLAGS_ASSIGN (device->link.flags, IFF_UP, up);
|
||||
device->link.n_ifi_flags = NM_FLAGS_ASSIGN (device->link.n_ifi_flags, IFF_UP, up);
|
||||
device->link.connected = connected;
|
||||
link_changed (platform, device, TRUE);
|
||||
}
|
||||
@@ -459,8 +459,8 @@ link_set_down (NMPlatform *platform, int ifindex)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (NM_FLAGS_HAS (device->link.flags, IFF_UP) || device->link.connected) {
|
||||
device->link.flags = NM_FLAGS_UNSET (device->link.flags, IFF_UP);
|
||||
if (NM_FLAGS_HAS (device->link.n_ifi_flags, IFF_UP) || device->link.connected) {
|
||||
device->link.n_ifi_flags = NM_FLAGS_UNSET (device->link.n_ifi_flags, IFF_UP);
|
||||
device->link.connected = FALSE;
|
||||
|
||||
link_changed (platform, device, TRUE);
|
||||
@@ -479,7 +479,7 @@ link_set_arp (NMPlatform *platform, int ifindex)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
device->link.flags = NM_FLAGS_UNSET (device->link.flags, IFF_NOARP);
|
||||
device->link.n_ifi_flags = NM_FLAGS_UNSET (device->link.n_ifi_flags, IFF_NOARP);
|
||||
|
||||
link_changed (platform, device, TRUE);
|
||||
|
||||
@@ -496,7 +496,7 @@ link_set_noarp (NMPlatform *platform, int ifindex)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
device->link.flags = NM_FLAGS_SET (device->link.flags, IFF_NOARP);
|
||||
device->link.n_ifi_flags = NM_FLAGS_SET (device->link.n_ifi_flags, IFF_NOARP);
|
||||
|
||||
link_changed (platform, device, TRUE);
|
||||
|
||||
@@ -611,7 +611,7 @@ link_enslave (NMPlatform *platform, int master, int slave)
|
||||
device->link.master = master;
|
||||
|
||||
if (NM_IN_SET (master_device->link.type, NM_LINK_TYPE_BOND, NM_LINK_TYPE_TEAM)) {
|
||||
device->link.flags = NM_FLAGS_SET (device->link.flags, IFF_UP);
|
||||
device->link.n_ifi_flags = NM_FLAGS_SET (device->link.n_ifi_flags, IFF_UP);
|
||||
device->link.connected = TRUE;
|
||||
}
|
||||
|
||||
|
@@ -1489,8 +1489,8 @@ _new_from_nl_link (NMPlatform *platform, const NMPCache *cache, struct nlmsghdr
|
||||
nl_info_data = li[IFLA_INFO_DATA];
|
||||
}
|
||||
|
||||
obj->link.flags = ifi->ifi_flags;
|
||||
obj->link.connected = NM_FLAGS_HAS (obj->link.flags, IFF_LOWER_UP);
|
||||
obj->link.n_ifi_flags = ifi->ifi_flags;
|
||||
obj->link.connected = NM_FLAGS_HAS (obj->link.n_ifi_flags, IFF_LOWER_UP);
|
||||
obj->link.arptype = ifi->ifi_type;
|
||||
|
||||
obj->link.type = _linktype_get_type (platform,
|
||||
@@ -1498,7 +1498,7 @@ _new_from_nl_link (NMPlatform *platform, const NMPCache *cache, struct nlmsghdr
|
||||
nl_info_kind,
|
||||
obj->link.ifindex,
|
||||
obj->link.name,
|
||||
obj->link.flags,
|
||||
obj->link.n_ifi_flags,
|
||||
obj->link.arptype,
|
||||
completed_from_cache,
|
||||
&link_cached,
|
||||
@@ -3233,9 +3233,9 @@ cache_pre_hook (NMPCache *cache, const NMPObject *old, const NMPObject *new, NMP
|
||||
if ( ops_type == NMP_CACHE_OPS_UPDATED
|
||||
&& old && new /* <-- nonsensical, make coverity happy */
|
||||
&& old->_link.netlink.is_in_netlink
|
||||
&& NM_FLAGS_HAS (old->link.flags, IFF_LOWER_UP)
|
||||
&& NM_FLAGS_HAS (old->link.n_ifi_flags, IFF_LOWER_UP)
|
||||
&& new->_link.netlink.is_in_netlink
|
||||
&& !NM_FLAGS_HAS (new->link.flags, IFF_LOWER_UP)) {
|
||||
&& !NM_FLAGS_HAS (new->link.n_ifi_flags, IFF_LOWER_UP)) {
|
||||
delayed_action_schedule (platform,
|
||||
DELAYED_ACTION_TYPE_REFRESH_ALL_IP4_ROUTES |
|
||||
DELAYED_ACTION_TYPE_REFRESH_ALL_IP6_ROUTES,
|
||||
@@ -3299,8 +3299,8 @@ cache_pre_hook (NMPCache *cache, const NMPObject *old, const NMPObject *new, NMP
|
||||
|
||||
changed_master = (new && new->_link.netlink.is_in_netlink && new->link.master > 0 ? new->link.master : 0)
|
||||
!= (old && old->_link.netlink.is_in_netlink && old->link.master > 0 ? old->link.master : 0);
|
||||
changed_connected = (new && new->_link.netlink.is_in_netlink ? NM_FLAGS_HAS (new->link.flags, IFF_LOWER_UP) : 2)
|
||||
!= (old && old->_link.netlink.is_in_netlink ? NM_FLAGS_HAS (old->link.flags, IFF_LOWER_UP) : 2);
|
||||
changed_connected = (new && new->_link.netlink.is_in_netlink ? NM_FLAGS_HAS (new->link.n_ifi_flags, IFF_LOWER_UP) : 2)
|
||||
!= (old && old->_link.netlink.is_in_netlink ? NM_FLAGS_HAS (old->link.n_ifi_flags, IFF_LOWER_UP) : 2);
|
||||
|
||||
if (changed_master || changed_connected) {
|
||||
ifindex1 = (old && old->_link.netlink.is_in_netlink && old->link.master > 0) ? old->link.master : 0;
|
||||
|
@@ -809,7 +809,7 @@ _link_get_flags (NMPlatform *self, int ifindex)
|
||||
const NMPlatformLink *pllink;
|
||||
|
||||
pllink = nm_platform_link_get (self, ifindex);
|
||||
return pllink ? pllink->flags : IFF_NOARP;
|
||||
return pllink ? pllink->n_ifi_flags : IFF_NOARP;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2967,19 +2967,19 @@ nm_platform_link_to_string (const NMPlatformLink *link, char *buf, gsize len)
|
||||
return buf;
|
||||
|
||||
str_flags = g_string_new (NULL);
|
||||
if (NM_FLAGS_HAS (link->flags, IFF_NOARP))
|
||||
if (NM_FLAGS_HAS (link->n_ifi_flags, IFF_NOARP))
|
||||
g_string_append (str_flags, "NOARP,");
|
||||
if (NM_FLAGS_HAS (link->flags, IFF_UP))
|
||||
if (NM_FLAGS_HAS (link->n_ifi_flags, IFF_UP))
|
||||
g_string_append (str_flags, "UP");
|
||||
else
|
||||
g_string_append (str_flags, "DOWN");
|
||||
if (link->connected)
|
||||
g_string_append (str_flags, ",LOWER_UP");
|
||||
|
||||
if (link->flags) {
|
||||
if (link->n_ifi_flags) {
|
||||
char str_flags_buf[64];
|
||||
|
||||
nm_platform_link_flags2str (link->flags, str_flags_buf, sizeof (str_flags_buf));
|
||||
nm_platform_link_flags2str (link->n_ifi_flags, str_flags_buf, sizeof (str_flags_buf));
|
||||
g_string_append_printf (str_flags, ";%s", str_flags_buf);
|
||||
}
|
||||
|
||||
@@ -3683,7 +3683,7 @@ nm_platform_link_cmp (const NMPlatformLink *a, const NMPlatformLink *b)
|
||||
_CMP_FIELD_STR (a, b, name);
|
||||
_CMP_FIELD (a, b, master);
|
||||
_CMP_FIELD (a, b, parent);
|
||||
_CMP_FIELD (a, b, flags);
|
||||
_CMP_FIELD (a, b, n_ifi_flags);
|
||||
_CMP_FIELD (a, b, connected);
|
||||
_CMP_FIELD (a, b, mtu);
|
||||
_CMP_FIELD_BOOL (a, b, initialized);
|
||||
|
@@ -148,9 +148,9 @@ struct _NMPlatformLink {
|
||||
guint8 inet6_addr_gen_mode_inv;
|
||||
|
||||
/* IFF_* flags. Note that the flags in 'struct ifinfomsg' are declared as 'unsigned'. */
|
||||
guint flags;
|
||||
guint n_ifi_flags;
|
||||
|
||||
/* @connected is mostly identical to (@flags & IFF_UP). Except for bridge/bond masters,
|
||||
/* @connected is mostly identical to (@n_ifi_flags & IFF_UP). Except for bridge/bond masters,
|
||||
* where we coerce the link as disconnect if it has no slaves. */
|
||||
gboolean connected;
|
||||
|
||||
|
@@ -1255,7 +1255,7 @@ nmp_cache_link_connected_needs_toggle (const NMPCache *cache, const NMPObject *m
|
||||
|
||||
/* if native IFF_LOWER_UP is down, link.connected must also be down
|
||||
* regardless of the slaves. */
|
||||
if (!NM_FLAGS_HAS (master->link.flags, IFF_LOWER_UP))
|
||||
if (!NM_FLAGS_HAS (master->link.n_ifi_flags, IFF_LOWER_UP))
|
||||
return !!master->link.connected;
|
||||
|
||||
if (potential_slave && NMP_OBJECT_GET_TYPE (potential_slave) != NMP_OBJECT_TYPE_LINK)
|
||||
|
@@ -1282,7 +1282,7 @@ nmtstp_link_set_updown (gboolean external_command,
|
||||
plink = nm_platform_link_get (NM_PLATFORM_GET, ifindex);
|
||||
g_assert (plink);
|
||||
|
||||
if (NM_FLAGS_HAS (plink->flags, IFF_UP) == !!up)
|
||||
if (NM_FLAGS_HAS (plink->n_ifi_flags, IFF_UP) == !!up)
|
||||
break;
|
||||
|
||||
/* for internal command, we expect not to reach this line.*/
|
||||
|
Reference in New Issue
Block a user