From 22a16114452511c732e2d72bf11666145f87eca8 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 5 Jan 2009 21:57:20 +0100 Subject: [PATCH] Remove element subtype details --- include/driver.h | 1 - include/element.h | 11 ----------- src/connman.h | 1 - src/device.c | 22 ++-------------------- src/element.c | 36 ++---------------------------------- src/network.c | 22 ++-------------------- 6 files changed, 6 insertions(+), 87 deletions(-) diff --git a/include/driver.h b/include/driver.h index 6cf7d0d..f4c6187 100644 --- a/include/driver.h +++ b/include/driver.h @@ -41,7 +41,6 @@ extern "C" { struct connman_driver { const char *name; enum connman_element_type type; - enum connman_element_subtype subtype; int priority; int (*probe) (struct connman_element *element); void (*remove) (struct connman_element *element); diff --git a/include/element.h b/include/element.h index fbd28f2..4824731 100644 --- a/include/element.h +++ b/include/element.h @@ -68,16 +68,6 @@ enum connman_element_type { CONNMAN_ELEMENT_TYPE_VENDOR = 10000, }; -enum connman_element_subtype { - CONNMAN_ELEMENT_SUBTYPE_UNKNOWN = 0, - CONNMAN_ELEMENT_SUBTYPE_FAKE = 1, - CONNMAN_ELEMENT_SUBTYPE_ETHERNET = 3, - CONNMAN_ELEMENT_SUBTYPE_WIFI = 4, - CONNMAN_ELEMENT_SUBTYPE_WIMAX = 5, - CONNMAN_ELEMENT_SUBTYPE_CELLULAR = 6, - CONNMAN_ELEMENT_SUBTYPE_BLUETOOTH = 7, -}; - struct connman_driver; struct connman_element { @@ -86,7 +76,6 @@ struct connman_element { gchar *name; gchar *path; enum connman_element_type type; - enum connman_element_subtype subtype; enum connman_element_state state; enum connman_element_policy policy; gboolean enabled; diff --git a/src/connman.h b/src/connman.h index 698c007..b4276a4 100644 --- a/src/connman.h +++ b/src/connman.h @@ -115,7 +115,6 @@ int __connman_element_count(struct connman_element *element, enum connman_element_type type); const char *__connman_element_type2string(enum connman_element_type type); -const char *__connman_element_subtype2string(enum connman_element_subtype type); const char *__connman_element_policy2string(enum connman_element_policy policy); enum connman_element_policy __connman_element_string2policy(const char *policy); diff --git a/src/device.c b/src/device.c index 57e370c..5bfd8e5 100644 --- a/src/device.c +++ b/src/device.c @@ -694,23 +694,6 @@ struct connman_device *connman_device_create(const char *node, device->element.type = CONNMAN_ELEMENT_TYPE_DEVICE; device->element.index = -1; - switch (type) { - case CONNMAN_DEVICE_TYPE_UNKNOWN: - case CONNMAN_DEVICE_TYPE_VENDOR: - case CONNMAN_DEVICE_TYPE_WIFI: - case CONNMAN_DEVICE_TYPE_WIMAX: - case CONNMAN_DEVICE_TYPE_BLUETOOTH: - case CONNMAN_DEVICE_TYPE_HSO: - case CONNMAN_DEVICE_TYPE_NOZOMI: - case CONNMAN_DEVICE_TYPE_HUAWEI: - case CONNMAN_DEVICE_TYPE_NOVATEL: - device->element.subtype = CONNMAN_ELEMENT_SUBTYPE_UNKNOWN; - break; - case CONNMAN_DEVICE_TYPE_ETHERNET: - device->element.subtype = CONNMAN_ELEMENT_SUBTYPE_ETHERNET; - break; - } - device->element.device = device; device->element.destruct = device_destruct; @@ -928,9 +911,8 @@ int connman_device_set_carrier(struct connman_device *device, element = connman_element_create(NULL); if (element != NULL) { - element->type = CONNMAN_ELEMENT_TYPE_DHCP; - element->subtype = device->element.subtype; - element->index = device->element.index; + element->type = CONNMAN_ELEMENT_TYPE_DHCP; + element->index = device->element.index; if (connman_element_register(element, &device->element) < 0) diff --git a/src/element.c b/src/element.c index eb26ae6..129fa62 100644 --- a/src/element.c +++ b/src/element.c @@ -127,30 +127,6 @@ static const char *type2string(enum connman_element_type type) return NULL; } -#if 0 -static const char *subtype2string(enum connman_element_subtype type) -{ - switch (type) { - case CONNMAN_ELEMENT_SUBTYPE_UNKNOWN: - return "unknown"; - case CONNMAN_ELEMENT_SUBTYPE_FAKE: - return "fake"; - case CONNMAN_ELEMENT_SUBTYPE_ETHERNET: - return "ethernet"; - case CONNMAN_ELEMENT_SUBTYPE_WIFI: - return "wifi"; - case CONNMAN_ELEMENT_SUBTYPE_WIMAX: - return "wimax"; - case CONNMAN_ELEMENT_SUBTYPE_CELLULAR: - return "cellular"; - case CONNMAN_ELEMENT_SUBTYPE_BLUETOOTH: - return "bluetooth"; - } - - return NULL; -} -#endif - const char *__connman_element_policy2string(enum connman_element_policy policy) { switch (policy) { @@ -499,12 +475,8 @@ static gboolean match_driver(struct connman_element *element, if (element->type == CONNMAN_ELEMENT_TYPE_ROOT) return FALSE; - if (element->type != driver->type && - driver->type != CONNMAN_ELEMENT_TYPE_UNKNOWN) - return FALSE; - - if (element->subtype == driver->subtype || - driver->subtype == CONNMAN_ELEMENT_SUBTYPE_UNKNOWN) + if (element->type == driver->type || + driver->type == CONNMAN_ELEMENT_TYPE_UNKNOWN) return TRUE; return FALSE; @@ -631,7 +603,6 @@ struct connman_element *connman_element_create(const char *name) element->name = g_strdup(name); element->type = CONNMAN_ELEMENT_TYPE_UNKNOWN; - element->subtype = CONNMAN_ELEMENT_SUBTYPE_UNKNOWN; element->state = CONNMAN_ELEMENT_STATE_CLOSED; element->policy = CONNMAN_ELEMENT_POLICY_AUTO; element->index = -1; @@ -1309,9 +1280,6 @@ static void register_element(gpointer data, gpointer user_data) node = g_node_find(element_root, G_PRE_ORDER, G_TRAVERSE_ALL, element->parent); basepath = element->parent->path; - - if (element->subtype == CONNMAN_ELEMENT_SUBTYPE_UNKNOWN) - element->subtype = element->parent->subtype; } else { element->parent = element_root->data; diff --git a/src/network.c b/src/network.c index 6c17088..9ed6dc4 100644 --- a/src/network.c +++ b/src/network.c @@ -349,23 +349,6 @@ struct connman_network *connman_network_create(const char *identifier, network->element.type = CONNMAN_ELEMENT_TYPE_NETWORK; network->element.index = -1; - switch (type) { - case CONNMAN_NETWORK_TYPE_UNKNOWN: - case CONNMAN_NETWORK_TYPE_VENDOR: - network->element.subtype = CONNMAN_ELEMENT_SUBTYPE_UNKNOWN; - break; - case CONNMAN_NETWORK_TYPE_WIFI: - network->element.subtype = CONNMAN_ELEMENT_SUBTYPE_WIFI; - break; - case CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN: - case CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN: - network->element.subtype = CONNMAN_ELEMENT_SUBTYPE_BLUETOOTH; - break; - case CONNMAN_NETWORK_TYPE_HSO: - network->element.subtype = CONNMAN_ELEMENT_SUBTYPE_CELLULAR; - break; - } - network->element.network = network; network->element.destruct = network_destruct; @@ -494,9 +477,8 @@ int connman_network_set_connected(struct connman_network *network, element = connman_element_create(NULL); if (element != NULL) { - element->type = type; - element->subtype = network->element.subtype; - element->index = network->element.index; + element->type = type; + element->index = network->element.index; if (connman_element_register(element, &network->element) < 0) -- 2.7.4