]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: move log_message_warning_errno() to networkd-util.h
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 29 Sep 2020 07:00:21 +0000 (16:00 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 6 Oct 2020 17:36:29 +0000 (02:36 +0900)
src/network/networkd-manager.c
src/network/networkd-util.h

index 9ded5fae0a069839ea608013e842134f984e7c41..ad1c97b83ea88438d27ca6117926f95b6fa7f886 100644 (file)
 /* use 128 MB for receive socket kernel queue. */
 #define RCVBUF_SIZE    (128*1024*1024)
 
-static int log_message_warning_errno(sd_netlink_message *m, int err, const char *msg) {
-        const char *err_msg = NULL;
-
-        (void) sd_netlink_message_read_string(m, NLMSGERR_ATTR_MSG, &err_msg);
-        return log_warning_errno(err, "%s: %s%s%m", msg, strempty(err_msg), err_msg ? " " : "");
-}
-
 static int setup_default_address_pool(Manager *m) {
         AddressPool *p;
         int r;
index 0433f883a32856417fea5b130e0fad9a59545714..2b6541d57edf2febd1076cc2f51741961a2deaea 100644 (file)
@@ -2,10 +2,13 @@
 #pragma once
 
 #include "sd-dhcp-lease.h"
+#include "sd-netlink.h"
 
 #include "conf-parser.h"
 #include "hash-funcs.h"
+#include "log.h"
 #include "macro.h"
+#include "string-util.h"
 
 typedef enum AddressFamily {
         /* This is a bitmask, though it usually doesn't feel that way! */
@@ -70,3 +73,10 @@ static inline bool section_is_invalid(NetworkConfigSection *section) {
         }                                                               \
         DEFINE_TRIVIAL_CLEANUP_FUNC(type*, free_func);                  \
         DEFINE_TRIVIAL_CLEANUP_FUNC(type*, free_func##_or_set_invalid);
+
+static inline int log_message_warning_errno(sd_netlink_message *m, int err, const char *msg) {
+        const char *err_msg = NULL;
+
+        (void) sd_netlink_message_read_string(m, NLMSGERR_ATTR_MSG, &err_msg);
+        return log_warning_errno(err, "%s: %s%s%m", msg, strempty(err_msg), err_msg ? " " : "");
+}