network: rename Link.sd_device -> Link.dev

This commit is contained in:
Yu Watanabe
2022-07-23 20:00:44 +09:00
parent 853188db90
commit 8de56fb3e0
5 changed files with 11 additions and 11 deletions

View File

@@ -1324,7 +1324,7 @@ static bool link_needs_dhcp_broadcast(Link *link) {
* If neither is set or a failure occurs, return false, which is the default for this flag.
*/
r = link->network->dhcp_broadcast;
if (r < 0 && link->sd_device && sd_device_get_property_value(link->sd_device, "ID_NET_DHCP_BROADCAST", &val) >= 0) {
if (r < 0 && link->dev && sd_device_get_property_value(link->dev, "ID_NET_DHCP_BROADCAST", &val) >= 0) {
r = parse_boolean(val);
if (r < 0)
log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to parse ID_NET_DHCP_BROADCAST, ignoring: %m");

View File

@@ -187,8 +187,8 @@ int ipv4ll_configure(Link *link) {
if (r < 0)
return r;
if (link->sd_device &&
net_get_unique_predictable_data(link->sd_device, true, &seed) >= 0) {
if (link->dev &&
net_get_unique_predictable_data(link->dev, true, &seed) >= 0) {
r = sd_ipv4ll_set_address_seed(link->ipv4ll, seed);
if (r < 0)
return r;

View File

@@ -1158,7 +1158,7 @@ int link_build_json(Link *link, JsonVariant **ret) {
assert(link);
assert(ret);
r = net_get_type_string(link->sd_device, link->iftype, &type);
r = net_get_type_string(link->dev, link->iftype, &type);
if (r == -ENOMEM)
return r;
@@ -1215,7 +1215,7 @@ int link_build_json(Link *link, JsonVariant **ret) {
w = json_variant_unref(w);
r = device_build_json(link->sd_device, &w);
r = device_build_json(link->dev, &w);
if (r < 0)
return r;

View File

@@ -229,7 +229,7 @@ static Link *link_free(Link *link) {
unlink_and_free(link->lldp_file);
unlink_and_free(link->state_file);
sd_device_unref(link->sd_device);
sd_device_unref(link->dev);
netdev_unref(link->netdev);
hashmap_free(link->bound_to_links);
@@ -1164,7 +1164,7 @@ static int link_get_network(Link *link, Network **ret) {
r = net_match_config(
&network->match,
link->sd_device,
link->dev,
&link->hw_addr,
&link->permanent_hw_addr,
link->driver,
@@ -1180,11 +1180,11 @@ static int link_get_network(Link *link, Network **ret) {
if (r == 0)
continue;
if (network->match.ifname && link->sd_device) {
if (network->match.ifname && link->dev) {
uint8_t name_assign_type = NET_NAME_UNKNOWN;
const char *attr;
if (sd_device_get_sysattr_value(link->sd_device, "name_assign_type", &attr) >= 0)
if (sd_device_get_sysattr_value(link->dev, "name_assign_type", &attr) >= 0)
(void) safe_atou8(attr, &name_assign_type);
warn = name_assign_type == NET_NAME_ENUM;
@@ -1433,7 +1433,7 @@ static int link_initialized(Link *link, sd_device *device) {
/* Always replace with the new sd_device object. As the sysname (and possibly other properties
* or sysattrs) may be outdated. */
device_unref_and_replace(link->sd_device, device);
device_unref_and_replace(link->dev, device);
/* Do not ignore unamanaged state case here. If an interface is renamed after being once
* configured, and the corresponding .network file has Name= in [Match] section, then the

View File

@@ -66,7 +66,7 @@ typedef struct Link {
uint32_t min_mtu;
uint32_t max_mtu;
uint32_t original_mtu;
sd_device *sd_device;
sd_device *dev;
char *driver;
/* link-local addressing */