2020-09-29 16:42:22 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
2019-09-25 13:13:40 +02:00
|
|
|
/*
|
2014-08-02 14:52:49 +02:00
|
|
|
* Copyright (C) 2014 Red Hat, Inc.
|
|
|
|
|
*/
|
|
|
|
|
|
all: fix up multiple-include-guard defines
Previously, src/nm-ip4-config.h, libnm/nm-ip4-config.h, and
libnm-glib/nm-ip4-config.h all used "NM_IP4_CONFIG_H" as an include
guard, which meant that nm-test-utils.h could not tell which of them
was being included (and so, eg, if you tried to include
nm-ip4-config.h in a libnm test, it would fail to compile because
nm-test-utils.h was referring to symbols in src/nm-ip4-config.h).
Fix this by changing the include guards in the non-API-stable parts of
the tree:
- libnm-glib/nm-ip4-config.h remains NM_IP4_CONFIG_H
- libnm/nm-ip4-config.h now uses __NM_IP4_CONFIG_H__
- src/nm-ip4-config.h now uses __NETWORKMANAGER_IP4_CONFIG_H__
And likewise for all other headers.
The two non-"nm"-prefixed headers, libnm/NetworkManager.h and
src/NetworkManagerUtils.h are now __NETWORKMANAGER_H__ and
__NETWORKMANAGER_UTILS_H__ respectively, which, while not entirely
consistent with the general scheme, do still mostly make sense in
isolation.
2014-08-13 14:10:11 -04:00
|
|
|
#ifndef __NETWORKMANAGER_DEVICE_LOGGING_H__
|
|
|
|
|
#define __NETWORKMANAGER_DEVICE_LOGGING_H__
|
2014-08-02 14:52:49 +02:00
|
|
|
|
|
|
|
|
#include "nm-device.h"
|
|
|
|
|
|
|
|
|
|
#define _LOG_DECLARE_SELF(t) \
|
|
|
|
|
_nm_unused static inline NMDevice *_nm_device_log_self_to_device(t *self) \
|
|
|
|
|
{ \
|
|
|
|
|
return (NMDevice *) self; \
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-20 00:07:14 +02:00
|
|
|
#undef _NMLOG_ENABLED
|
|
|
|
|
#define _NMLOG_ENABLED(level, domain) (nm_logging_enabled((level), (domain)))
|
|
|
|
|
#define _NMLOG(level, domain, ...) \
|
2017-06-07 12:18:21 +02:00
|
|
|
G_STMT_START \
|
|
|
|
|
{ \
|
|
|
|
|
const NMLogLevel _level = (level); \
|
|
|
|
|
const NMLogDomain _domain = (domain); \
|
|
|
|
|
\
|
|
|
|
|
if (nm_logging_enabled(_level, _domain)) { \
|
|
|
|
|
typeof(*self) *const _self = (self); \
|
2017-10-31 18:48:41 +01:00
|
|
|
const char *const _ifname = \
|
|
|
|
|
_nm_device_get_iface(_nm_device_log_self_to_device(_self)); \
|
2017-06-07 12:18:21 +02:00
|
|
|
\
|
|
|
|
|
nm_log_obj(_level, \
|
|
|
|
|
_domain, \
|
|
|
|
|
_ifname, \
|
|
|
|
|
NULL, \
|
|
|
|
|
_self, \
|
|
|
|
|
"device", \
|
2017-10-31 18:48:41 +01:00
|
|
|
"%s%s%s: " _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
|
|
|
|
|
NM_PRINT_FMT_QUOTED(_ifname, "(", _ifname, ")", "[null]") \
|
2017-06-07 12:18:21 +02:00
|
|
|
_NM_UTILS_MACRO_REST(__VA_ARGS__)); \
|
|
|
|
|
} \
|
|
|
|
|
} \
|
|
|
|
|
G_STMT_END
|
2014-08-02 14:52:49 +02:00
|
|
|
|
all: fix up multiple-include-guard defines
Previously, src/nm-ip4-config.h, libnm/nm-ip4-config.h, and
libnm-glib/nm-ip4-config.h all used "NM_IP4_CONFIG_H" as an include
guard, which meant that nm-test-utils.h could not tell which of them
was being included (and so, eg, if you tried to include
nm-ip4-config.h in a libnm test, it would fail to compile because
nm-test-utils.h was referring to symbols in src/nm-ip4-config.h).
Fix this by changing the include guards in the non-API-stable parts of
the tree:
- libnm-glib/nm-ip4-config.h remains NM_IP4_CONFIG_H
- libnm/nm-ip4-config.h now uses __NM_IP4_CONFIG_H__
- src/nm-ip4-config.h now uses __NETWORKMANAGER_IP4_CONFIG_H__
And likewise for all other headers.
The two non-"nm"-prefixed headers, libnm/NetworkManager.h and
src/NetworkManagerUtils.h are now __NETWORKMANAGER_H__ and
__NETWORKMANAGER_UTILS_H__ respectively, which, while not entirely
consistent with the general scheme, do still mostly make sense in
isolation.
2014-08-13 14:10:11 -04:00
|
|
|
#endif /* __NETWORKMANAGER_DEVICE_LOGGING_H__ */
|