systemd: hide "nm-sd-adapt.h" and expose required internal API in "nm-sd.h"

Users outside of src/systemd should not make use of internal API.

Currently, "nm-dhcp-systemd.c" still makes use of internal systemd
functions. Instead of letting "nm-dhcp-systemd.c" include internal
headers, handpick the required defines to "nm-sd.h" and hide "nm-sd-adapt.h".

"nm-sd-adapt.h" is now only used to compile internal systemd sources.
This commit is contained in:
Thomas Haller 2016-08-11 17:33:12 +02:00
parent 4c849d148f
commit f5a4a7e007
6 changed files with 21 additions and 5 deletions

View file

@ -106,8 +106,8 @@ noinst_LTLIBRARIES = \
libsystemd_nm_la_SOURCES = \
systemd/nm-sd.c \
systemd/nm-sd.h \
systemd/nm-sd-adapt.c \
systemd/nm-sd-adapt.h \
systemd/sd-adapt/nm-sd-adapt.c \
systemd/sd-adapt/nm-sd-adapt.h \
systemd/sd-adapt/build.h \
systemd/sd-adapt/cgroup-util.h \
systemd/sd-adapt/condition.h \

View file

@ -34,13 +34,11 @@
#include "NetworkManagerUtils.h"
#include "nm-platform.h"
#include "nm-dhcp-client-logging.h"
#include "nm-sd.h"
#include "sd-dhcp-client.h"
#include "sd-dhcp6-client.h"
#include "nm-sd-adapt.h"
#include "dhcp-lease-internal.h"
G_DEFINE_TYPE (NMDhcpSystemd, nm_dhcp_systemd, NM_TYPE_DHCP_CLIENT)
#define NM_DHCP_SYSTEMD_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DHCP_SYSTEMD, NMDhcpSystemdPrivate))

View file

@ -134,3 +134,10 @@ nm_sd_event_attach_default (void)
/*****************************************************************************/
/* ensure that defines in nm-sd.h correspond to the internal defines. */
#include "nm-sd-adapt.h"
#include "dhcp-lease-internal.h"
/*****************************************************************************/

View file

@ -21,5 +21,16 @@
guint nm_sd_event_attach_default (void);
/*****************************************************************************
* expose internal systemd API
*
* FIXME: don't use any internal systemd API.
*****************************************************************************/
struct sd_dhcp_lease;
int dhcp_lease_save(struct sd_dhcp_lease *lease, const char *lease_file);
int dhcp_lease_load(struct sd_dhcp_lease **ret, const char *lease_file);
#endif /* __NM_SD_H__ */