2014-08-02 14:52:49 +02:00
|
|
|
/* NetworkManager -- Network link manager
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
|
*
|
|
|
|
|
* 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) \
|
2017-02-23 15:24:18 +01:00
|
|
|
_nm_unused \
|
|
|
|
|
static inline NMDevice * \
|
2014-08-02 14:52:49 +02:00
|
|
|
_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__ */
|