diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-04-28 18:17:36 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-04-29 02:07:42 +0200 |
commit | fd221544f22ecc01998956ffd5e5c2470e94501b (patch) | |
tree | 56b5b7c38ff5ccd048978fd8222f7200e1cfdb03 /src/network/networkd-util.h | |
parent | network: dhcp4: downgrade log level when interface is removed (diff) | |
download | systemd-fd221544f22ecc01998956ffd5e5c2470e94501b.tar.xz systemd-fd221544f22ecc01998956ffd5e5c2470e94501b.zip |
network: unify log_link_message_full_errno() and log_message_warning_errno()
This also introduces log_message_error_errno() or friends.
Diffstat (limited to 'src/network/networkd-util.h')
-rw-r--r-- | src/network/networkd-util.h | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/network/networkd-util.h b/src/network/networkd-util.h index 4926fc5eb7..62f38bcdc2 100644 --- a/src/network/networkd-util.h +++ b/src/network/networkd-util.h @@ -11,6 +11,8 @@ #include "network-util.h" #include "string-util.h" +typedef struct Link Link; + typedef struct NetworkConfigSection { unsigned line; bool invalid; @@ -73,9 +75,15 @@ 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 ? " " : ""); -} +int log_link_message_full_errno(Link *link, sd_netlink_message *m, int level, int err, const char *msg); +#define log_link_message_error_errno(link, m, err, msg) log_link_message_full_errno(link, m, LOG_ERR, err, msg) +#define log_link_message_warning_errno(link, m, err, msg) log_link_message_full_errno(link, m, LOG_WARNING, err, msg) +#define log_link_message_notice_errno(link, m, err, msg) log_link_message_full_errno(link, m, LOG_NOTICE, err, msg) +#define log_link_message_info_errno(link, m, err, msg) log_link_message_full_errno(link, m, LOG_INFO, err, msg) +#define log_link_message_debug_errno(link, m, err, msg) log_link_message_full_errno(link, m, LOG_DEBUG, err, msg) +#define log_message_full_errno(m, level, err, msg) log_link_message_full_errno(NULL, m, level, err, msg) +#define log_message_error_errno(m, err, msg) log_message_full_errno(m, LOG_ERR, err, msg) +#define log_message_warning_errno(m, err, msg) log_message_full_errno(m, LOG_WARNING, err, msg) +#define log_message_notice_errno(m, err, msg) log_message_full_errno(m, LOG_NOTICE, err, msg) +#define log_message_info_errno(m, err, msg) log_message_full_errno(m, LOG_INFO, err, msg) +#define log_message_debug_errno(m, err, msg) log_message_full_errno(m, LOG_DEBUG, err, msg) |