chiark / gitweb /
log: rearrange log function naming
[elogind.git] / src / network / networkd-netdev.c
index bdb0b88..310b20a 100644 (file)
@@ -136,7 +136,7 @@ void netdev_drop(NetDev *netdev) {
 
         netdev->state = NETDEV_STATE_LINGER;
 
-        log_debug_netdev(netdev, "netdev removed");
+        log_netdev_debug(netdev, "netdev removed");
 
         netdev_cancel_callbacks(netdev);
 
@@ -184,7 +184,7 @@ static int netdev_enslave_ready(NetDev *netdev, Link* link, sd_rtnl_message_hand
         r = sd_rtnl_message_new_link(netdev->manager->rtnl, &req,
                                      RTM_SETLINK, link->ifindex);
         if (r < 0) {
-                log_error_netdev(netdev,
+                log_netdev_error(netdev,
                                  "Could not allocate RTM_SETLINK message: %s",
                                  strerror(-r));
                 return r;
@@ -192,7 +192,7 @@ static int netdev_enslave_ready(NetDev *netdev, Link* link, sd_rtnl_message_hand
 
         r = sd_rtnl_message_append_u32(req, IFLA_MASTER, netdev->ifindex);
         if (r < 0) {
-                log_error_netdev(netdev,
+                log_netdev_error(netdev,
                                  "Could not append IFLA_MASTER attribute: %s",
                                  strerror(-r));
                 return r;
@@ -200,7 +200,7 @@ static int netdev_enslave_ready(NetDev *netdev, Link* link, sd_rtnl_message_hand
 
         r = sd_rtnl_call_async(netdev->manager->rtnl, req, callback, link, 0, NULL);
         if (r < 0) {
-                log_error_netdev(netdev,
+                log_netdev_error(netdev,
                                  "Could not send rtnetlink message: %s",
                                  strerror(-r));
                 return r;
@@ -208,7 +208,7 @@ static int netdev_enslave_ready(NetDev *netdev, Link* link, sd_rtnl_message_hand
 
         link_ref(link);
 
-        log_debug_netdev(netdev, "enslaving link '%s'", link->ifname);
+        log_netdev_debug(netdev, "enslaving link '%s'", link->ifname);
 
         return 0;
 }
@@ -251,7 +251,7 @@ 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_debug_netdev(netdev, "netdev exists, using existing");
+                log_netdev_debug(netdev, "netdev exists, using existing");
         else if (r < 0) {
                 log_warning_netdev(netdev, "netdev could not be created: %s", strerror(-r));
                 netdev_drop(netdev);
@@ -259,7 +259,7 @@ static int netdev_create_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userda
                 return 1;
         }
 
-        log_debug_netdev(netdev, "created");
+        log_netdev_debug(netdev, "created");
 
         return 1;
 }
@@ -288,7 +288,7 @@ int netdev_enslave(NetDev *netdev, Link *link, sd_rtnl_message_handler_t callbac
 
                 LIST_PREPEND(callbacks, netdev->callbacks, cb);
 
-                log_debug_netdev(netdev, "will enslave '%s', when reday",
+                log_netdev_debug(netdev, "will enslave '%s', when reday",
                                  link->ifname);
         }
 
@@ -307,29 +307,29 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) {
 
         r = sd_rtnl_message_get_type(message, &type);
         if (r < 0) {
-                log_error_netdev(netdev, "Could not get rtnl message type");
+                log_netdev_error(netdev, "Could not get rtnl message type");
                 return r;
         }
 
         if (type != RTM_NEWLINK) {
-                log_error_netdev(netdev, "Can not set ifindex from unexpected rtnl message type");
+                log_netdev_error(netdev, "Can not set ifindex from unexpected rtnl message type");
                 return -EINVAL;
         }
 
         r = sd_rtnl_message_link_get_ifindex(message, &ifindex);
         if (r < 0) {
-                log_error_netdev(netdev, "Could not get ifindex: %s", strerror(-r));
+                log_netdev_error(netdev, "Could not get ifindex: %s", strerror(-r));
                 netdev_enter_failed(netdev);
                 return r;
         } else if (ifindex <= 0) {
-                log_error_netdev(netdev, "Got invalid ifindex: %d", ifindex);
+                log_netdev_error(netdev, "Got invalid ifindex: %d", ifindex);
                 netdev_enter_failed(netdev);
                 return r;
         }
 
         if (netdev->ifindex > 0) {
                 if (netdev->ifindex != ifindex) {
-                        log_error_netdev(netdev, "Could not set ifindex to %d, already set to %d",
+                        log_netdev_error(netdev, "Could not set ifindex to %d, already set to %d",
                                          ifindex, netdev->ifindex);
                         netdev_enter_failed(netdev);
                         return -EEXIST;
@@ -340,12 +340,12 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) {
 
         r = sd_rtnl_message_read_string(message, IFLA_IFNAME, &received_name);
         if (r < 0) {
-                log_error_netdev(netdev, "Could not get IFNAME");
+                log_netdev_error(netdev, "Could not get IFNAME");
                 return r;
         }
 
         if (!streq(netdev->ifname, received_name)) {
-                log_error_netdev(netdev, "Received newlink with wrong IFNAME %s",
+                log_netdev_error(netdev, "Received newlink with wrong IFNAME %s",
                                  received_name);
                 netdev_enter_failed(netdev);
                 return r;
@@ -353,19 +353,19 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) {
 
         r = sd_rtnl_message_enter_container(message, IFLA_LINKINFO);
         if (r < 0) {
-                log_error_netdev(netdev, "Could not get LINKINFO");
+                log_netdev_error(netdev, "Could not get LINKINFO");
                 return r;
         }
 
         r = sd_rtnl_message_read_string(message, IFLA_INFO_KIND, &received_kind);
         if (r < 0) {
-                log_error_netdev(netdev, "Could not get KIND");
+                log_netdev_error(netdev, "Could not get KIND");
                 return r;
         }
 
         r = sd_rtnl_message_exit_container(message);
         if (r < 0) {
-                log_error_netdev(netdev, "Could not exit container");
+                log_netdev_error(netdev, "Could not exit container");
                 return r;
         }
 
@@ -375,14 +375,14 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) {
         else {
                 kind = netdev_kind_to_string(netdev->kind);
                 if (!kind) {
-                        log_error_netdev(netdev, "Could not get kind");
+                        log_netdev_error(netdev, "Could not get kind");
                         netdev_enter_failed(netdev);
                         return -EINVAL;
                 }
         }
 
         if (!streq(kind, received_kind)) {
-                log_error_netdev(netdev,
+                log_netdev_error(netdev,
                                  "Received newlink with wrong KIND %s, "
                                  "expected %s", received_kind, kind);
                 netdev_enter_failed(netdev);
@@ -391,7 +391,7 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) {
 
         netdev->ifindex = ifindex;
 
-        log_debug_netdev(netdev, "netdev has index %d", netdev->ifindex);
+        log_netdev_debug(netdev, "netdev has index %d", netdev->ifindex);
 
         netdev_enter_ready(netdev);
 
@@ -459,13 +459,13 @@ static int netdev_create(NetDev *netdev, Link *link,
                 if (r < 0)
                         return r;
 
-                log_debug_netdev(netdev, "created");
+                log_netdev_debug(netdev, "created");
         } else {
                 _cleanup_rtnl_message_unref_ sd_rtnl_message *m = NULL;
 
                 r = sd_rtnl_message_new_link(netdev->manager->rtnl, &m, RTM_NEWLINK, 0);
                 if (r < 0) {
-                        log_error_netdev(netdev,
+                        log_netdev_error(netdev,
                                          "Could not allocate RTM_NEWLINK message: %s",
                                          strerror(-r));
                         return r;
@@ -473,7 +473,7 @@ static int netdev_create(NetDev *netdev, Link *link,
 
                 r = sd_rtnl_message_append_string(m, IFLA_IFNAME, netdev->ifname);
                 if (r < 0) {
-                        log_error_netdev(netdev,
+                        log_netdev_error(netdev,
                                          "Could not append IFLA_IFNAME, attribute: %s",
                                          strerror(-r));
                         return r;
@@ -482,7 +482,7 @@ static int netdev_create(NetDev *netdev, Link *link,
                 if (netdev->mac) {
                         r = sd_rtnl_message_append_ether_addr(m, IFLA_ADDRESS, netdev->mac);
                         if (r < 0) {
-                                log_error_netdev(netdev,
+                                log_netdev_error(netdev,
                                                  "Could not append IFLA_ADDRESS attribute: %s",
                                                  strerror(-r));
                             return r;
@@ -492,7 +492,7 @@ static int netdev_create(NetDev *netdev, Link *link,
                 if (netdev->mtu) {
                         r = sd_rtnl_message_append_u32(m, IFLA_MTU, netdev->mtu);
                         if (r < 0) {
-                                log_error_netdev(netdev,
+                                log_netdev_error(netdev,
                                                  "Could not append IFLA_MTU attribute: %s",
                                                  strerror(-r));
                                 return r;
@@ -502,7 +502,7 @@ static int netdev_create(NetDev *netdev, Link *link,
                 if (link) {
                         r = sd_rtnl_message_append_u32(m, IFLA_LINK, link->ifindex);
                         if (r < 0) {
-                                log_error_netdev(netdev,
+                                log_netdev_error(netdev,
                                                  "Colud not append IFLA_LINK attribute: %s",
                                                  strerror(-r));
                                 return r;
@@ -511,7 +511,7 @@ static int netdev_create(NetDev *netdev, Link *link,
 
                 r = sd_rtnl_message_open_container(m, IFLA_LINKINFO);
                 if (r < 0) {
-                        log_error_netdev(netdev,
+                        log_netdev_error(netdev,
                                          "Could not append IFLA_LINKINFO attribute: %s",
                                          strerror(-r));
                         return r;
@@ -520,7 +520,7 @@ static int netdev_create(NetDev *netdev, Link *link,
                 r = sd_rtnl_message_open_container_union(m, IFLA_INFO_DATA,
                                                          netdev_kind_to_string(netdev->kind));
                 if (r < 0) {
-                        log_error_netdev(netdev,
+                        log_netdev_error(netdev,
                                          "Could not append IFLA_INFO_DATA attribute: %s",
                                          strerror(-r));
                         return r;
@@ -534,7 +534,7 @@ static int netdev_create(NetDev *netdev, Link *link,
 
                 r = sd_rtnl_message_close_container(m);
                 if (r < 0) {
-                        log_error_netdev(netdev,
+                        log_netdev_error(netdev,
                                          "Could not append IFLA_LINKINFO attribute: %s",
                                          strerror(-r));
                         return r;
@@ -542,7 +542,7 @@ static int netdev_create(NetDev *netdev, Link *link,
 
                 r = sd_rtnl_message_close_container(m);
                 if (r < 0) {
-                        log_error_netdev(netdev,
+                        log_netdev_error(netdev,
                                          "Could not append IFLA_LINKINFO attribute: %s",
                                          strerror(-r));
                         return r;
@@ -553,7 +553,7 @@ static int netdev_create(NetDev *netdev, Link *link,
                         r = sd_rtnl_call_async(netdev->manager->rtnl, m,
                                                callback, link, 0, NULL);
                         if (r < 0) {
-                                log_error_netdev(netdev,
+                                log_netdev_error(netdev,
                                                  "Could not send rtnetlink message: %s",
                                                  strerror(-r));
                                 return r;
@@ -565,7 +565,7 @@ static int netdev_create(NetDev *netdev, Link *link,
                                                netdev_create_handler, netdev, 0,
                                                NULL);
                         if (r < 0) {
-                                log_error_netdev(netdev,
+                                log_netdev_error(netdev,
                                                  "Could not send rtnetlink message: %s",
                                                  strerror(-r));
                                 return r;
@@ -576,7 +576,7 @@ static int netdev_create(NetDev *netdev, Link *link,
 
                 netdev->state = NETDEV_STATE_CREATING;
 
-                log_debug_netdev(netdev, "creating");
+                log_netdev_debug(netdev, "creating");
         }
 
         return 0;
@@ -713,7 +713,7 @@ static int netdev_load_one(Manager *manager, const char *filename) {
 
         LIST_HEAD_INIT(netdev->callbacks);
 
-        log_debug_netdev(netdev, "loaded %s", netdev_kind_to_string(netdev->kind));
+        log_netdev_debug(netdev, "loaded %s", netdev_kind_to_string(netdev->kind));
 
         switch (NETDEV_VTABLE(netdev)->create_type) {
         case NETDEV_CREATE_MASTER: