[systemd-commits] 4 commits - src/libsystemd-rtnl src/systemd

Lennart Poettering lennart at kemper.freedesktop.org
Thu Nov 7 03:49:02 CET 2013


 src/libsystemd-rtnl/rtnl-internal.h |    4 ++++
 src/libsystemd-rtnl/rtnl-message.c  |    1 +
 src/libsystemd-rtnl/rtnl-util.c     |    1 +
 src/libsystemd-rtnl/rtnl-util.h     |    9 +++++++++
 src/libsystemd-rtnl/sd-rtnl.c       |    1 +
 src/libsystemd-rtnl/test-rtnl.c     |    2 ++
 src/systemd/sd-bus-vtable.h         |    8 ++++++++
 src/systemd/sd-event.h              |    8 ++++++++
 src/systemd/sd-id128.h              |    4 ++--
 src/systemd/sd-journal.h            |    4 ++--
 src/systemd/sd-rtnl.h               |   20 +++++++++++---------
 src/systemd/sd-utf8.h               |   12 ++++++++++--
 12 files changed, 59 insertions(+), 15 deletions(-)

New commits:
commit 6695ed7a841faad68df3d5cb466f5e0e01f57536
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Nov 7 03:47:42 2013 +0100

    api: add C++ guards

diff --git a/src/systemd/sd-bus-vtable.h b/src/systemd/sd-bus-vtable.h
index 82e50d2..d1642ba 100644
--- a/src/systemd/sd-bus-vtable.h
+++ b/src/systemd/sd-bus-vtable.h
@@ -22,6 +22,10 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct sd_bus_vtable sd_bus_vtable;
 
 #include "sd-bus.h"
@@ -124,4 +128,8 @@ struct sd_bus_vtable {
                 .type = _SD_BUS_VTABLE_END,                             \
         }
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/src/systemd/sd-event.h b/src/systemd/sd-event.h
index 46d1d05..bc4c01d 100644
--- a/src/systemd/sd-event.h
+++ b/src/systemd/sd-event.h
@@ -37,6 +37,10 @@
   - Handles signals and child PIDs
 */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct sd_event sd_event;
 typedef struct sd_event_source sd_event_source;
 
@@ -111,4 +115,8 @@ int sd_event_source_get_time_accuracy(sd_event_source *s, uint64_t *usec);
 int sd_event_source_get_signal(sd_event_source *s);
 int sd_event_source_get_child_pid(sd_event_source *s, pid_t *pid);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/src/systemd/sd-id128.h b/src/systemd/sd-id128.h
index 3a83932..6066f39 100644
--- a/src/systemd/sd-id128.h
+++ b/src/systemd/sd-id128.h
@@ -1,7 +1,7 @@
 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
 
-#ifndef fooid128hfoo
-#define fooid128hfoo
+#ifndef foosdid128hfoo
+#define foosdid128hfoo
 
 /***
   This file is part of systemd.
diff --git a/src/systemd/sd-journal.h b/src/systemd/sd-journal.h
index a10a54e..e319c6e 100644
--- a/src/systemd/sd-journal.h
+++ b/src/systemd/sd-journal.h
@@ -1,7 +1,7 @@
 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
 
-#ifndef foojournalhfoo
-#define foojournalhfoo
+#ifndef foosdjournalhfoo
+#define foosdjournalhfoo
 
 /***
   This file is part of systemd.
diff --git a/src/systemd/sd-rtnl.h b/src/systemd/sd-rtnl.h
index 0066f54..e3ad37c 100644
--- a/src/systemd/sd-rtnl.h
+++ b/src/systemd/sd-rtnl.h
@@ -24,6 +24,10 @@
 
 #include <inttypes.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct sd_rtnl sd_rtnl;
 typedef struct sd_rtnl_message sd_rtnl_message;
 
@@ -53,4 +57,8 @@ 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);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/src/systemd/sd-utf8.h b/src/systemd/sd-utf8.h
index 039c36e..54ef5fb 100644
--- a/src/systemd/sd-utf8.h
+++ b/src/systemd/sd-utf8.h
@@ -1,7 +1,7 @@
 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
 
-#ifndef fooutf8hfoo
-#define fooutf8hfoo
+#ifndef foosdutf8hfoo
+#define foosdutf8hfoo
 
 /***
   This file is part of systemd.
@@ -22,7 +22,15 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 const char *sd_utf8_is_valid(const char *s);
 const char *sd_ascii_is_valid(const char *s);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif

commit 0a0a68282c3f9d3148dd924e1378c448a9a92028
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Nov 7 03:40:43 2013 +0100

    rtnl: headers in src/systemd/ may not use #pragma once

diff --git a/src/systemd/sd-rtnl.h b/src/systemd/sd-rtnl.h
index 289f96b..0066f54 100644
--- a/src/systemd/sd-rtnl.h
+++ b/src/systemd/sd-rtnl.h
@@ -1,5 +1,8 @@
 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
 
+#ifndef foosdrtnlhfoo
+#define foosdrtnlhfoo
+
 /***
   This file is part of systemd.
 
@@ -19,8 +22,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#pragma once
-
 #include <inttypes.h>
 
 typedef struct sd_rtnl sd_rtnl;
@@ -51,3 +52,5 @@ 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);
+
+#endif

commit a33dece5f8cce7f1946263bec76068ef84abc07b
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Nov 7 03:39:32 2013 +0100

    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 b34e7ea..b05290f 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 <http://www.gnu.org/licenses/>.
 ***/
 
+#include <linux/netlink.h>
+
 #include "refcnt.h"
 
 struct sd_rtnl {
diff --git a/src/libsystemd-rtnl/rtnl-message.c b/src/libsystemd-rtnl/rtnl-message.c
index 9a40a75..85cf55a 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 <http://www.gnu.org/licenses/>.
 ***/
 
+#include <linux/rtnetlink.h>
 #include <netinet/in.h>
 #include <netinet/ether.h>
 #include <stdbool.h>
diff --git a/src/libsystemd-rtnl/rtnl-util.c b/src/libsystemd-rtnl/rtnl-util.c
index 93804bb..9707aa0 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 <http://www.gnu.org/licenses/>.
 ***/
 
+#include <linux/rtnetlink.h>
 #include <netinet/ether.h>
 
 #include "sd-rtnl.h"
diff --git a/src/libsystemd-rtnl/rtnl-util.h b/src/libsystemd-rtnl/rtnl-util.h
index 902ff64..ba0f71f 100644
--- a/src/libsystemd-rtnl/rtnl-util.h
+++ b/src/libsystemd-rtnl/rtnl-util.h
@@ -23,7 +23,14 @@
 
 #include <netinet/ether.h>
 
+#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 ed145b9..8ea11df 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 2d2b237..39a83f3 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 <http://www.gnu.org/licenses/>.
 ***/
 
+#include <linux/rtnetlink.h>
 #include <netinet/ether.h>
 
 #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 5c964a3..289f96b 100644
--- a/src/systemd/sd-rtnl.h
+++ b/src/systemd/sd-rtnl.h
@@ -21,10 +21,7 @@
 
 #pragma once
 
-#include <linux/rtnetlink.h>
-#include <linux/netlink.h>
-#include <stdint.h>
-#include <util.h>
+#include <inttypes.h>
 
 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)

commit a2cdd907d1ffd314d1f15d83851610231f69eb61
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Nov 7 03:38:08 2013 +0100

    rtnl: internal headers must include pragma once protection

diff --git a/src/libsystemd-rtnl/rtnl-internal.h b/src/libsystemd-rtnl/rtnl-internal.h
index 70bb6d0..b34e7ea 100644
--- a/src/libsystemd-rtnl/rtnl-internal.h
+++ b/src/libsystemd-rtnl/rtnl-internal.h
@@ -1,5 +1,7 @@
 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
 
+#pragma once
+
 /***
   This file is part of systemd.
 
diff --git a/src/libsystemd-rtnl/rtnl-util.h b/src/libsystemd-rtnl/rtnl-util.h
index a6ac4b6..902ff64 100644
--- a/src/libsystemd-rtnl/rtnl-util.h
+++ b/src/libsystemd-rtnl/rtnl-util.h
@@ -1,5 +1,7 @@
 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
 
+#pragma once
+
 /***
  This file is part of systemd.
 



More information about the systemd-commits mailing list