From 98b32556701f2cc80495488b5d724577637540f6 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 21 Apr 2015 01:26:59 +0200 Subject: networkd: fix confusion between log_netdev_error() but log_warning_netdev() We should always name the object first, the level second, like everywhere else in the sources. --- src/network/networkd-netdev-tuntap.c | 14 +++++--------- src/network/networkd-netdev.c | 6 +++--- src/network/networkd-netdev.h | 16 ++++++++-------- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/src/network/networkd-netdev-tuntap.c b/src/network/networkd-netdev-tuntap.c index 4f449aea48..4e974927cb 100644 --- a/src/network/networkd-netdev-tuntap.c +++ b/src/network/networkd-netdev-tuntap.c @@ -108,7 +108,7 @@ static int netdev_tuntap_add(NetDev *netdev, struct ifreq *ifr) { } } - if(t->group_name) { + if (t->group_name) { group = t->group_name; @@ -173,15 +173,11 @@ static void tuntap_done(NetDev *netdev) { static int tuntap_verify(NetDev *netdev, const char *filename) { assert(netdev); - if (netdev->mtu) { - log_warning_netdev(netdev, "MTU configured for %s, ignoring", - netdev_kind_to_string(netdev->kind)); - } + if (netdev->mtu) + log_netdev_warning(netdev, "MTU configured for %s, ignoring", netdev_kind_to_string(netdev->kind)); - if (netdev->mac) { - log_warning_netdev(netdev, "MAC configured for %s, ignoring", - netdev_kind_to_string(netdev->kind)); - } + if (netdev->mac) + log_netdev_warning(netdev, "MAC configured for %s, ignoring", netdev_kind_to_string(netdev->kind)); return 0; } diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c index e98040d6ec..8456bf5f12 100644 --- a/src/network/networkd-netdev.c +++ b/src/network/networkd-netdev.c @@ -234,7 +234,7 @@ static int netdev_enter_ready(NetDev *netdev) { netdev->state = NETDEV_STATE_READY; - log_info_netdev(netdev, "netdev ready"); + log_netdev_info(netdev, "netdev ready"); LIST_FOREACH_SAFE(callbacks, callback, callback_next, netdev->callbacks) { /* enslave the links that were attempted to be enslaved before the @@ -260,9 +260,9 @@ static int netdev_create_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userda r = sd_rtnl_message_get_errno(m); if (r == -EEXIST) - log_info_netdev(netdev, "netdev exists, using existing without changing its parameters"); + log_netdev_info(netdev, "netdev exists, using existing without changing its parameters"); else if (r < 0) { - log_warning_netdev(netdev, "netdev could not be created: %s", strerror(-r)); + log_netdev_warning(netdev, "netdev could not be created: %s", strerror(-r)); netdev_drop(netdev); return 1; diff --git a/src/network/networkd-netdev.h b/src/network/networkd-netdev.h index 7fd83964a5..5f5fcfb082 100644 --- a/src/network/networkd-netdev.h +++ b/src/network/networkd-netdev.h @@ -200,13 +200,13 @@ const struct ConfigPerfItem* network_netdev_gperf_lookup(const char *key, unsign /* Macros which append INTERFACE= to the message */ -#define log_full_netdev(level, netdev, fmt, ...) log_object_internal(level, 0, __FILE__, __LINE__, __func__, "INTERFACE=", netdev->ifname, "%-*s: " fmt, IFNAMSIZ, netdev->ifname, ##__VA_ARGS__) -#define log_netdev_debug(netdev, ...) log_full_netdev(LOG_DEBUG, netdev, ##__VA_ARGS__) -#define log_info_netdev(netdev, ...) log_full_netdev(LOG_INFO, netdev, ##__VA_ARGS__) -#define log_notice_netdev(netdev, ...) log_full_netdev(LOG_NOTICE, netdev, ##__VA_ARGS__) -#define log_warning_netdev(netdev, ...) log_full_netdev(LOG_WARNING, netdev,## __VA_ARGS__) -#define log_netdev_error(netdev, ...) log_full_netdev(LOG_ERR, netdev, ##__VA_ARGS__) - -#define log_struct_netdev(level, netdev, ...) log_struct(level, "INTERFACE=%s", netdev->ifname, __VA_ARGS__) +#define log_netdev_full(level, netdev, fmt, ...) log_object_internal(level, 0, __FILE__, __LINE__, __func__, "INTERFACE=", netdev->ifname, "%-*s: " fmt, IFNAMSIZ, netdev->ifname, ##__VA_ARGS__) +#define log_netdev_debug(netdev, ...) log_netdev_full(LOG_DEBUG, netdev, ##__VA_ARGS__) +#define log_netdev_info(netdev, ...) log_netdev_full(LOG_INFO, netdev, ##__VA_ARGS__) +#define log_netdev_notice(netdev, ...) log_netdev_full(LOG_NOTICE, netdev, ##__VA_ARGS__) +#define log_netdev_warning(netdev, ...) log_netdev_full(LOG_WARNING, netdev,## __VA_ARGS__) +#define log_netdev_error(netdev, ...) log_netdev_full(LOG_ERR, netdev, ##__VA_ARGS__) + +#define log_netdev_struct(level, netdev, ...) log_struct(level, "INTERFACE=%s", netdev->ifname, __VA_ARGS__) #define NETDEVIF(netdev) "INTERFACE=%s", netdev->ifname -- cgit v1.2.3-54-g00ecf