From: Lennart Poettering Date: Thu, 7 Nov 2013 02:39:32 +0000 (+0100) Subject: rtnl: headers in src/systemd/ may not include internal headers X-Git-Tag: v209~1581 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=a33dece5f8cce7f1946263bec76068ef84abc07b rtnl: headers in src/systemd/ may not include internal headers Hence including "util.h" from sd-rtnl.h is not OK. Let's minimize our headers we pull in a bit. --- diff --git a/src/libsystemd-rtnl/rtnl-internal.h b/src/libsystemd-rtnl/rtnl-internal.h index b34e7ea12..b05290fd8 100644 --- a/src/libsystemd-rtnl/rtnl-internal.h +++ b/src/libsystemd-rtnl/rtnl-internal.h @@ -21,6 +21,8 @@ along with systemd; If not, see . ***/ +#include + #include "refcnt.h" struct sd_rtnl { diff --git a/src/libsystemd-rtnl/rtnl-message.c b/src/libsystemd-rtnl/rtnl-message.c index 9a40a75a9..85cf55a3c 100644 --- a/src/libsystemd-rtnl/rtnl-message.c +++ b/src/libsystemd-rtnl/rtnl-message.c @@ -19,6 +19,7 @@ along with systemd; If not, see . ***/ +#include #include #include #include diff --git a/src/libsystemd-rtnl/rtnl-util.c b/src/libsystemd-rtnl/rtnl-util.c index 93804bb74..9707aa04a 100644 --- a/src/libsystemd-rtnl/rtnl-util.c +++ b/src/libsystemd-rtnl/rtnl-util.c @@ -19,6 +19,7 @@ along with systemd; If not, see . ***/ +#include #include #include "sd-rtnl.h" diff --git a/src/libsystemd-rtnl/rtnl-util.h b/src/libsystemd-rtnl/rtnl-util.h index 902ff646c..ba0f71f94 100644 --- a/src/libsystemd-rtnl/rtnl-util.h +++ b/src/libsystemd-rtnl/rtnl-util.h @@ -23,7 +23,14 @@ #include +#include "util.h" #include "sd-rtnl.h" int rtnl_set_link_name(sd_rtnl *rtnl, int ifindex, const char *name); int rtnl_set_link_properties(sd_rtnl *rtnl, int ifindex, const struct ether_addr *mac, unsigned mtu); + +DEFINE_TRIVIAL_CLEANUP_FUNC(sd_rtnl*, sd_rtnl_unref); +DEFINE_TRIVIAL_CLEANUP_FUNC(sd_rtnl_message*, sd_rtnl_message_unref); + +#define _cleanup_sd_rtnl_unref_ _cleanup_(sd_rtnl_unrefp) +#define _cleanup_sd_rtnl_message_unref_ _cleanup_(sd_rtnl_message_unrefp) diff --git a/src/libsystemd-rtnl/sd-rtnl.c b/src/libsystemd-rtnl/sd-rtnl.c index ed145b9ab..8ea11df80 100644 --- a/src/libsystemd-rtnl/sd-rtnl.c +++ b/src/libsystemd-rtnl/sd-rtnl.c @@ -27,6 +27,7 @@ #include "sd-rtnl.h" #include "rtnl-internal.h" +#include "rtnl-util.h" static int sd_rtnl_new(sd_rtnl **ret) { sd_rtnl *rtnl; diff --git a/src/libsystemd-rtnl/test-rtnl.c b/src/libsystemd-rtnl/test-rtnl.c index 2d2b2373b..39a83f353 100644 --- a/src/libsystemd-rtnl/test-rtnl.c +++ b/src/libsystemd-rtnl/test-rtnl.c @@ -19,12 +19,14 @@ along with systemd; If not, see . ***/ +#include #include #include "util.h" #include "macro.h" #include "sd-rtnl.h" #include "socket-util.h" +#include "rtnl-util.h" static void test_link_configure(sd_rtnl *rtnl, int ifindex) { _cleanup_sd_rtnl_message_unref_ sd_rtnl_message *message; diff --git a/src/systemd/sd-rtnl.h b/src/systemd/sd-rtnl.h index 5c964a39b..289f96b5b 100644 --- a/src/systemd/sd-rtnl.h +++ b/src/systemd/sd-rtnl.h @@ -21,10 +21,7 @@ #pragma once -#include -#include -#include -#include +#include typedef struct sd_rtnl sd_rtnl; typedef struct sd_rtnl_message sd_rtnl_message; @@ -54,9 +51,3 @@ sd_rtnl_message *sd_rtnl_message_unref(sd_rtnl_message *m); int sd_rtnl_message_get_type(sd_rtnl_message *m, uint16_t *type); int sd_rtnl_message_append(sd_rtnl_message *m, unsigned short type, const void *data); int sd_rtnl_message_read(sd_rtnl_message *m, unsigned short *type, void **data); - -DEFINE_TRIVIAL_CLEANUP_FUNC(sd_rtnl*, sd_rtnl_unref); -DEFINE_TRIVIAL_CLEANUP_FUNC(sd_rtnl_message*, sd_rtnl_message_unref); - -#define _cleanup_sd_rtnl_unref_ _cleanup_(sd_rtnl_unrefp) -#define _cleanup_sd_rtnl_message_unref_ _cleanup_(sd_rtnl_message_unrefp)