diff options
author | Tom Gundersen <teg@jklm.no> | 2014-02-07 17:03:23 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-02-07 17:07:11 +0100 |
commit | 1a436809498faf6486815baa0338fb6b8e5def07 (patch) | |
tree | 10ecafd58cf2f9a9f25cd287b4ee530133e96f9c /src | |
parent | 99e7e3922e1d25d0092bd61444c86dcc9a1e030e (diff) |
networkd: netdev - rename Netdev to NetDev
Both in the configuration file format and everywhere else in the code.
Diffstat (limited to 'src')
-rw-r--r-- | src/network/networkd-gperf.gperf | 8 | ||||
-rw-r--r-- | src/network/networkd-manager.c | 4 | ||||
-rw-r--r-- | src/network/networkd-netdev.c | 36 | ||||
-rw-r--r-- | src/network/networkd-network.c | 12 | ||||
-rw-r--r-- | src/network/networkd.h | 38 |
5 files changed, 49 insertions, 49 deletions
diff --git a/src/network/networkd-gperf.gperf b/src/network/networkd-gperf.gperf index 64dab7cf0c..37bb8db149 100644 --- a/src/network/networkd-gperf.gperf +++ b/src/network/networkd-gperf.gperf @@ -38,7 +38,7 @@ DHCPv4.UseMTU, config_parse_bool, 0, offsetof(Netw DHCPv4.UseHostname, config_parse_bool, 0, offsetof(Network, dhcp_hostname) DHCPv4.UseDomainName, config_parse_bool, 0, offsetof(Network, dhcp_domainname) DHCPv4.CriticalConnection, config_parse_bool, 0, offsetof(Network, dhcp_critical) -Netdev.Description, config_parse_string, 0, offsetof(Netdev, description) -Netdev.Name, config_parse_ifname, 0, offsetof(Netdev, name) -Netdev.Kind, config_parse_netdev_kind, 0, offsetof(Netdev, kind) -VLAN.Id, config_parse_int, 0, offsetof(Netdev, vlanid) +NetDev.Description, config_parse_string, 0, offsetof(NetDev, description) +NetDev.Name, config_parse_ifname, 0, offsetof(NetDev, name) +NetDev.Kind, config_parse_netdev_kind, 0, offsetof(NetDev, kind) +VLAN.Id, config_parse_int, 0, offsetof(NetDev, vlanid) diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c index 1b3e71ab0e..fb3360db0a 100644 --- a/src/network/networkd-manager.c +++ b/src/network/networkd-manager.c @@ -85,7 +85,7 @@ int manager_new(Manager **ret) { void manager_free(Manager *m) { Network *network; - Netdev *netdev; + NetDev *netdev; Link *link; udev_monitor_unref(m->udev_monitor); @@ -259,7 +259,7 @@ static int manager_rtnl_process_link(sd_rtnl *rtnl, sd_rtnl_message *message, vo if (r < 0) log_debug("received RTM_NEWLINK message without valid IFLA_IFNAME"); else { - Netdev *netdev; + NetDev *netdev; r = netdev_get(m, name, &netdev); if (r >= 0) { diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c index 0df583a15c..76f1deae58 100644 --- a/src/network/networkd-netdev.c +++ b/src/network/networkd-netdev.c @@ -32,10 +32,10 @@ static const char* const netdev_kind_table[] = { [NETDEV_KIND_VLAN] = "vlan", }; -DEFINE_STRING_TABLE_LOOKUP(netdev_kind, NetdevKind); -DEFINE_CONFIG_PARSE_ENUM(config_parse_netdev_kind, netdev_kind, NetdevKind, "Failed to parse netdev kind"); +DEFINE_STRING_TABLE_LOOKUP(netdev_kind, NetDevKind); +DEFINE_CONFIG_PARSE_ENUM(config_parse_netdev_kind, netdev_kind, NetDevKind, "Failed to parse netdev kind"); -void netdev_free(Netdev *netdev) { +void netdev_free(NetDev *netdev) { netdev_enslave_callback *callback; if (!netdev) @@ -57,8 +57,8 @@ void netdev_free(Netdev *netdev) { free(netdev); } -int netdev_get(Manager *manager, const char *name, Netdev **ret) { - Netdev *netdev; +int netdev_get(Manager *manager, const char *name, NetDev **ret) { + NetDev *netdev; assert(manager); assert(name); @@ -75,13 +75,13 @@ int netdev_get(Manager *manager, const char *name, Netdev **ret) { return 0; } -static int netdev_enter_failed(Netdev *netdev) { +static int netdev_enter_failed(NetDev *netdev) { netdev->state = NETDEV_STATE_FAILED; return 0; } -static int netdev_enslave_ready(Netdev *netdev, Link* link, sd_rtnl_message_handler_t callback) { +static int netdev_enslave_ready(NetDev *netdev, Link* link, sd_rtnl_message_handler_t callback) { _cleanup_sd_rtnl_message_unref_ sd_rtnl_message *req = NULL; int r; @@ -119,7 +119,7 @@ static int netdev_enslave_ready(Netdev *netdev, Link* link, sd_rtnl_message_hand return 0; } -static int netdev_enter_ready(Netdev *netdev) { +static int netdev_enter_ready(NetDev *netdev) { netdev_enslave_callback *callback; assert(netdev); @@ -139,7 +139,7 @@ static int netdev_enter_ready(Netdev *netdev) { } static int netdev_create_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) { - Netdev *netdev = userdata; + NetDev *netdev = userdata; int r; assert(netdev->state != _NETDEV_STATE_INVALID); @@ -155,7 +155,7 @@ static int netdev_create_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userda return 1; } -static int netdev_create(Netdev *netdev, Link *link, sd_rtnl_message_handler_t callback) { +static int netdev_create(NetDev *netdev, Link *link, sd_rtnl_message_handler_t callback) { _cleanup_sd_rtnl_message_unref_ sd_rtnl_message *req = NULL; const char *kind; int r; @@ -265,7 +265,7 @@ static int netdev_create(Netdev *netdev, Link *link, sd_rtnl_message_handler_t c return 0; } -int netdev_enslave(Netdev *netdev, Link *link, sd_rtnl_message_handler_t callback) { +int netdev_enslave(NetDev *netdev, Link *link, sd_rtnl_message_handler_t callback) { if (netdev->kind == NETDEV_KIND_VLAN) return netdev_create(netdev, link, callback); @@ -288,7 +288,7 @@ int netdev_enslave(Netdev *netdev, Link *link, sd_rtnl_message_handler_t callbac return 0; } -int netdev_set_ifindex(Netdev *netdev, int ifindex) { +int netdev_set_ifindex(NetDev *netdev, int ifindex) { assert(netdev); assert(ifindex > 0); @@ -307,7 +307,7 @@ int netdev_set_ifindex(Netdev *netdev, int ifindex) { } static int netdev_load_one(Manager *manager, const char *filename) { - _cleanup_netdev_free_ Netdev *netdev = NULL; + _cleanup_netdev_free_ NetDev *netdev = NULL; _cleanup_fclose_ FILE *file = NULL; int r; @@ -322,7 +322,7 @@ static int netdev_load_one(Manager *manager, const char *filename) { return errno; } - netdev = new0(Netdev, 1); + netdev = new0(NetDev, 1); if (!netdev) return log_oom(); @@ -331,7 +331,7 @@ static int netdev_load_one(Manager *manager, const char *filename) { netdev->kind = _NETDEV_KIND_INVALID; netdev->vlanid = -1; - r = config_parse(NULL, filename, file, "Netdev\0VLAN\0", config_item_perf_lookup, + r = config_parse(NULL, filename, file, "NetDev\0VLAN\0", config_item_perf_lookup, (void*) network_gperf_lookup, false, false, netdev); if (r < 0) { log_warning("Could not parse config file %s: %s", filename, strerror(-r)); @@ -339,12 +339,12 @@ static int netdev_load_one(Manager *manager, const char *filename) { } if (netdev->kind == _NETDEV_KIND_INVALID) { - log_warning("Netdev without Kind configured in %s. Ignoring", filename); + log_warning("NetDev without Kind configured in %s. Ignoring", filename); return 0; } if (!netdev->name) { - log_warning("Netdev without Name configured in %s. Ignoring", filename); + log_warning("NetDev without Name configured in %s. Ignoring", filename); return 0; } @@ -375,7 +375,7 @@ static int netdev_load_one(Manager *manager, const char *filename) { } int netdev_load(Manager *manager) { - Netdev *netdev; + NetDev *netdev; char **files, **f; int r; diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index 94138cd558..5d930235b3 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -217,7 +217,7 @@ int config_parse_bridge(const char *unit, void *data, void *userdata) { Network *network = userdata; - Netdev *netdev; + NetDev *netdev; int r; assert(filename); @@ -234,7 +234,7 @@ int config_parse_bridge(const char *unit, if (netdev->kind != NETDEV_KIND_BRIDGE) { log_syntax(unit, LOG_ERR, filename, line, EINVAL, - "Netdev is not a bridge, ignoring assignment: %s", rvalue); + "NetDev is not a bridge, ignoring assignment: %s", rvalue); return 0; } @@ -254,7 +254,7 @@ int config_parse_bond(const char *unit, void *data, void *userdata) { Network *network = userdata; - Netdev *netdev; + NetDev *netdev; int r; assert(filename); @@ -271,7 +271,7 @@ int config_parse_bond(const char *unit, if (netdev->kind != NETDEV_KIND_BOND) { log_syntax(unit, LOG_ERR, filename, line, EINVAL, - "Netdev is not a bond, ignoring assignment: %s", rvalue); + "NetDev is not a bond, ignoring assignment: %s", rvalue); return 0; } @@ -291,7 +291,7 @@ int config_parse_vlan(const char *unit, void *data, void *userdata) { Network *network = userdata; - Netdev *netdev; + NetDev *netdev; int r; assert(filename); @@ -308,7 +308,7 @@ int config_parse_vlan(const char *unit, if (netdev->kind != NETDEV_KIND_VLAN) { log_syntax(unit, LOG_ERR, filename, line, EINVAL, - "Netdev is not a VLAN, ignoring assignment: %s", rvalue); + "NetDev is not a VLAN, ignoring assignment: %s", rvalue); return 0; } diff --git a/src/network/networkd.h b/src/network/networkd.h index e9ca38f597..184f631ecf 100644 --- a/src/network/networkd.h +++ b/src/network/networkd.h @@ -34,7 +34,7 @@ #include "hashmap.h" #include "list.h" -typedef struct Netdev Netdev; +typedef struct NetDev NetDev; typedef struct Network Network; typedef struct Link Link; typedef struct Address Address; @@ -50,35 +50,35 @@ struct netdev_enslave_callback { LIST_FIELDS(netdev_enslave_callback, callbacks); }; -typedef enum NetdevKind { +typedef enum NetDevKind { NETDEV_KIND_BRIDGE, NETDEV_KIND_BOND, NETDEV_KIND_VLAN, _NETDEV_KIND_MAX, _NETDEV_KIND_INVALID = -1 -} NetdevKind; +} NetDevKind; -typedef enum NetdevState { +typedef enum NetDevState { NETDEV_STATE_FAILED, NETDEV_STATE_CREATING, NETDEV_STATE_READY, _NETDEV_STATE_MAX, _NETDEV_STATE_INVALID = -1, -} NetdevState; +} NetDevState; -struct Netdev { +struct NetDev { Manager *manager; char *filename; char *description; char *name; - NetdevKind kind; + NetDevKind kind; int vlanid; int ifindex; - NetdevState state; + NetDevState state; LIST_HEAD(netdev_enslave_callback, callbacks); }; @@ -95,9 +95,9 @@ struct Network { char *match_name; char *description; - Netdev *bridge; - Netdev *bond; - Netdev *vlan; + NetDev *bridge; + NetDev *bond; + NetDev *vlan; bool dhcp; bool dhcp_dns; bool dhcp_mtu; @@ -221,21 +221,21 @@ int manager_update_resolv_conf(Manager *m); DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_free); #define _cleanup_manager_free_ _cleanup_(manager_freep) -/* Netdev */ +/* NetDev */ int netdev_load(Manager *manager); -void netdev_free(Netdev *netdev); +void netdev_free(NetDev *netdev); -DEFINE_TRIVIAL_CLEANUP_FUNC(Netdev*, netdev_free); +DEFINE_TRIVIAL_CLEANUP_FUNC(NetDev*, netdev_free); #define _cleanup_netdev_free_ _cleanup_(netdev_freep) -int netdev_get(Manager *manager, const char *name, Netdev **ret); -int netdev_set_ifindex(Netdev *netdev, int ifindex); -int netdev_enslave(Netdev *netdev, Link *link, sd_rtnl_message_handler_t cb); +int netdev_get(Manager *manager, const char *name, NetDev **ret); +int netdev_set_ifindex(NetDev *netdev, int ifindex); +int netdev_enslave(NetDev *netdev, Link *link, sd_rtnl_message_handler_t cb); -const char *netdev_kind_to_string(NetdevKind d) _const_; -NetdevKind netdev_kind_from_string(const char *d) _pure_; +const char *netdev_kind_to_string(NetDevKind d) _const_; +NetDevKind netdev_kind_from_string(const char *d) _pure_; int config_parse_netdev_kind(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); |