ifcfg-rh: cleanup includes

- don't include "nm-default.h" from headers. All source files
  include this header as first.

- drop G_BEGIN_DECLS/G_END_DECLS. This is not C++ nor public
  API.

- drop unnecessary includes from header files. They are either
  not required, or already provided via "nm-default.h".

- include in source files the corresponding header file as first
  after "nm-default.h". This should ensure that header files are
  self-contained (appart from "nm-default.h").
This commit is contained in:
Thomas Haller 2016-05-16 16:02:21 +02:00
parent b503b37636
commit 4dcb5e5ba5
13 changed files with 21 additions and 42 deletions

View file

@ -21,8 +21,6 @@
#ifndef __COMMON_H__
#define __COMMON_H__
#include "nm-default.h"
#define IFCFG_TAG "ifcfg-"
#define KEYS_TAG "keys-"
#define ROUTE_TAG "route-"
@ -38,7 +36,7 @@
#define AUGNEW_TAG ".augnew"
#define AUGTMP_TAG ".augtmp"
#define IFCFG_DIR SYSCONFDIR"/sysconfig/network-scripts"
#define IFCFG_DIR SYSCONFDIR "/sysconfig/network-scripts"
#define IFCFG_PLUGIN_NAME "ifcfg-rh"
#define IFCFG_PLUGIN_INFO "(c) 2007 - 2015 Red Hat, Inc. To report bugs please use the NetworkManager mailing list."

View file

@ -20,6 +20,8 @@
#include "nm-default.h"
#include "nm-ifcfg-connection.h"
#include <string.h>
#include <glib/gstdio.h>
@ -37,7 +39,6 @@
#include "common.h"
#include "nm-config.h"
#include "nm-ifcfg-connection.h"
#include "reader.h"
#include "writer.h"
#include "nm-inotify-helper.h"

View file

@ -21,10 +21,8 @@
#ifndef __NETWORKMANAGER_IFCFG_CONNECTION_H__
#define __NETWORKMANAGER_IFCFG_CONNECTION_H__
G_BEGIN_DECLS
#include <nm-dbus-interface.h>
#include <nm-settings-connection.h>
#include "nm-dbus-interface.h"
#include "nm-settings-connection.h"
#define NM_TYPE_IFCFG_CONNECTION (nm_ifcfg_connection_get_type ())
#define NM_IFCFG_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_IFCFG_CONNECTION, NMIfcfgConnection))
@ -58,6 +56,4 @@ gboolean nm_ifcfg_connection_update (NMIfcfgConnection *self,
GHashTable *new_settings,
GError **error);
G_END_DECLS
#endif /* __NETWORKMANAGER_IFCFG_CONNECTION_H__ */

View file

@ -23,6 +23,8 @@
#include "nm-default.h"
#include "plugin.h"
#include <string.h>
#include <unistd.h>
#include <errno.h>
@ -31,20 +33,19 @@
#include <gmodule.h>
#include "nm-dbus-compat.h"
#include "nm-setting-connection.h"
#include "common.h"
#include "plugin.h"
#include "nm-settings-plugin.h"
#include "nm-config.h"
#include "NetworkManagerUtils.h"
#include "nm-ifcfg-connection.h"
#include "shvar.h"
#include "common.h"
#include "reader.h"
#include "writer.h"
#include "utils.h"
#include "nm-dbus-compat.h"
#include "nm-exported-object.h"
#include "nmdbus-ifcfg-rh.h"

View file

@ -24,8 +24,6 @@
#ifndef _PLUGIN_H_
#define _PLUGIN_H_
#include "nm-exported-object.h"
#define SETTINGS_TYPE_PLUGIN_IFCFG (settings_plugin_ifcfg_get_type ())
#define SETTINGS_PLUGIN_IFCFG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SETTINGS_TYPE_PLUGIN_IFCFG, SettingsPluginIfcfg))
#define SETTINGS_PLUGIN_IFCFG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SETTINGS_TYPE_PLUGIN_IFCFG, SettingsPluginIfcfgClass))
@ -46,5 +44,5 @@ struct _SettingsPluginIfcfgClass {
GType settings_plugin_ifcfg_get_type (void);
#endif /* _PLUGIN_H_ */
#endif /* _PLUGIN_H_ */

View file

@ -20,6 +20,8 @@
#include "nm-default.h"
#include "reader.h"
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
@ -57,8 +59,6 @@
#include "shvar.h"
#include "utils.h"
#include "reader.h"
/*****************************************************************************/
#define _NMLOG_DOMAIN LOGD_SETTINGS

View file

@ -21,10 +21,7 @@
#ifndef __READER_H__
#define __READER_H__
#include <nm-connection.h>
#include "nm-default.h"
#include "shvar.h"
#include "nm-connection.h"
NMConnection *connection_from_file (const char *filename,
char **out_unhandled,

View file

@ -25,6 +25,8 @@
#include "nm-default.h"
#include "shvar.h"
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
@ -34,8 +36,6 @@
#include <sys/stat.h>
#include <unistd.h>
#include "shvar.h"
#include "nm-core-internal.h"
/* Open the file <name>, returning a shvarFile on success and NULL on failure.

View file

@ -31,10 +31,6 @@
#ifndef _SHVAR_H
#define _SHVAR_H
#include "nm-default.h"
G_BEGIN_DECLS
typedef struct _shvarFile shvarFile;
struct _shvarFile {
char *fileName; /* read-only */
@ -95,6 +91,4 @@ const char *svEscape (const char *s, char **to_free);
/* Unescape a string in-place */
void svUnescape (char *s);
G_END_DECLS
#endif /* ! _SHVAR_H */
#endif /* _SHVAR_H */

View file

@ -27,7 +27,8 @@
#include "nm-core-internal.h"
#include "NetworkManagerUtils.h"
#include "shvar.h"
#include "common.h"
/*
* utils_single_quote_string

View file

@ -21,10 +21,9 @@
#ifndef _UTILS_H_
#define _UTILS_H_
#include <nm-connection.h>
#include "nm-default.h"
#include "nm-connection.h"
#include "shvar.h"
#include "common.h"
#define NM_IFCFG_CONNECTION_LOG_PATH(path) ((path) ?: "in-memory")
#define NM_IFCFG_CONNECTION_LOG_FMT "%s (%s,\"%s\")"

View file

@ -42,7 +42,6 @@
#include "nm-setting-vlan.h"
#include "nm-setting-team.h"
#include "nm-setting-team-port.h"
#include "nm-core-internal.h"
#include "nm-utils.h"
#include "nm-core-internal.h"
#include "NetworkManagerUtils.h"
@ -51,7 +50,6 @@
#include "shvar.h"
#include "reader.h"
#include "utils.h"
#include "crypto.h"
/*****************************************************************************/

View file

@ -21,11 +21,7 @@
#ifndef _WRITER_H_
#define _WRITER_H_
#include <sys/types.h>
#include <nm-connection.h>
#include "nm-default.h"
#include "nm-connection.h"
gboolean writer_can_write_connection (NMConnection *connection,
GError **error);