summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-04-18 13:44:22 +0200
committerThomas Haller <thaller@redhat.com>2015-04-22 16:50:52 +0200
commitfe2608c9032932e1a731dfeb6fb3196bd15a1cbf (patch)
treeff4aa7b871f0b010fc1c74b095f56dcf2771ed7c
parenta50d77d952b3c183d53a304ae0ae386f6694eca2 (diff)
downloadNetworkManager-fe2608c9032932e1a731dfeb6fb3196bd15a1cbf.tar.gz
platform: drop virtual setup() initalization function
We already have nm_*_platform_setup() that gets specified via -DSETUP. This SETUP() hook gives us all the flexiblity we need to customize our singleton, so just do any required setup there. Also, it would be easier to add an alternative (hypotetical) nm_fake_platform_setup_custom() to customize the singleton then to parametrize the NMPlatform:setup() implementation. So this virtual function is less flexible and redundant.
-rw-r--r--src/platform/nm-fake-platform.c22
-rw-r--r--src/platform/nm-platform.c9
-rw-r--r--src/platform/nm-platform.h2
3 files changed, 8 insertions, 25 deletions
diff --git a/src/platform/nm-fake-platform.c b/src/platform/nm-fake-platform.c
index 75ffbd3efb..c9785b0035 100644
--- a/src/platform/nm-fake-platform.c
+++ b/src/platform/nm-fake-platform.c
@@ -60,14 +60,6 @@ G_DEFINE_TYPE (NMFakePlatform, nm_fake_platform, NM_TYPE_PLATFORM)
/******************************************************************/
-void
-nm_fake_platform_setup (void)
-{
- nm_platform_setup (g_object_new (NM_TYPE_FAKE_PLATFORM, NULL));
-}
-
-/******************************************************************/
-
static gboolean
sysctl_set (NMPlatform *platform, const char *path, const char *value)
{
@@ -1336,9 +1328,15 @@ nm_fake_platform_init (NMFakePlatform *fake_platform)
priv->ip6_routes = g_array_new (TRUE, TRUE, sizeof (NMPlatformIP6Route));
}
-static gboolean
-setup (NMPlatform *platform)
+void
+nm_fake_platform_setup (void)
{
+ NMPlatform *platform;
+
+ platform = g_object_new (NM_TYPE_FAKE_PLATFORM, NULL);
+
+ nm_platform_setup (platform);
+
/* skip zero element */
link_add (platform, NULL, NM_LINK_TYPE_NONE, NULL, 0);
@@ -1349,8 +1347,6 @@ setup (NMPlatform *platform)
link_add (platform, "eth0", NM_LINK_TYPE_ETHERNET, NULL, 0);
link_add (platform, "eth1", NM_LINK_TYPE_ETHERNET, NULL, 0);
link_add (platform, "eth2", NM_LINK_TYPE_ETHERNET, NULL, 0);
-
- return TRUE;
}
static void
@@ -1386,8 +1382,6 @@ nm_fake_platform_class_init (NMFakePlatformClass *klass)
/* virtual methods */
object_class->finalize = nm_fake_platform_finalize;
- platform_class->setup = setup;
-
platform_class->sysctl_set = sysctl_set;
platform_class->sysctl_get = sysctl_get;
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index 4dfc086b7b..bb2a8c970e 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -96,19 +96,10 @@ static NMPlatform *singleton_instance = NULL;
void
nm_platform_setup (NMPlatform *instance)
{
- NMPlatformClass *klass;
-
g_return_if_fail (NM_IS_PLATFORM (instance));
g_return_if_fail (!singleton_instance);
singleton_instance = instance;
-
- klass = NM_PLATFORM_GET_CLASS (singleton_instance);
-
- if (klass->setup) {
- if (!klass->setup (singleton_instance))
- g_assert_not_reached ();
- }
}
/**
diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h
index 08bceb3d88..d0273910e9 100644
--- a/src/platform/nm-platform.h
+++ b/src/platform/nm-platform.h
@@ -357,8 +357,6 @@ struct _NMPlatform {
typedef struct {
GObjectClass parent;
- gboolean (*setup) (NMPlatform *);
-
gboolean (*sysctl_set) (NMPlatform *, const char *path, const char *value);
char * (*sysctl_get) (NMPlatform *, const char *path);