profile: Remove profile.c and profile.h
authorAlok Barsode <alok.barsode@linux.intel.com>
Wed, 24 Aug 2011 13:44:23 +0000 (16:44 +0300)
committerSamuel Ortiz <sameo@linux.intel.com>
Thu, 25 Aug 2011 09:14:23 +0000 (11:14 +0200)
Makefile.am
include/profile.h [deleted file]
include/storage.h
src/connman.h
src/main.c
src/profile.c [deleted file]
src/service.c
src/storage.c

index 9c08453..acd0c76 100644 (file)
@@ -13,7 +13,7 @@ nodist_include_HEADERS = include/version.h
 
 noinst_HEADERS = include/rtnl.h include/task.h \
                        include/dbus.h include/rfkill.h include/option.h \
-                       include/profile.h include/provider.h \
+                       include/provider.h \
                        include/utsname.h include/timeserver.h include/proxy.h \
                        include/location.h include/technology.h \
                        include/setting.h
@@ -71,7 +71,7 @@ src_connmand_SOURCES = $(gdbus_sources) $(gdhcp_sources) \
                        src/main.c src/connman.h src/log.c \
                        src/error.c src/plugin.c src/task.c \
                        src/device.c src/network.c src/connection.c \
-                       src/manager.c src/profile.c src/service.c \
+                       src/manager.c src/service.c \
                        src/clock.c src/timezone.c \
                        src/agent.c src/notifier.c src/provider.c \
                        src/resolver.c src/ipconfig.c src/detect.c src/inet.c \
diff --git a/include/profile.h b/include/profile.h
deleted file mode 100644 (file)
index cea395e..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *
- *  Connection Manager
- *
- *  Copyright (C) 2007-2010  Intel Corporation. All rights reserved.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 2 as
- *  published by the Free Software Foundation.
- *
- *  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 St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- */
-
-#ifndef __CONNMAN_PROFILE_H
-#define __CONNMAN_PROFILE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * SECTION:profile
- * @title: Profile premitives
- * @short_description: Functions for handling profiles
- */
-
-struct connman_profile;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __CONNMAN_PROFILE_H */
index cf5d359..c8a7b3c 100644 (file)
@@ -22,7 +22,6 @@
 #ifndef __CONNMAN_STORAGE_H
 #define __CONNMAN_STORAGE_H
 
-#include <connman/profile.h>
 #include <connman/service.h>
 #include <connman/device.h>
 #include <connman/technology.h>
@@ -44,9 +43,6 @@ extern "C" {
 struct connman_storage {
        const char *name;
        int priority;
-       int (*profile_init) (void);
-       int (*profile_load) (struct connman_profile *profile);
-       int (*profile_save) (struct connman_profile *profile);
        enum connman_service_type service_type;
        int (*service_load) (struct connman_service *service);
        int (*service_save) (struct connman_service *service);
index ef9060a..9254428 100644 (file)
@@ -162,9 +162,6 @@ void __connman_storage_close_config(const char *ident,
                                        GKeyFile *keyfile, gboolean save);
 void __connman_storage_delete_config(const char *ident);
 
-int __connman_storage_init_profile(void);
-int __connman_storage_load_profile(struct connman_profile *profile);
-int __connman_storage_save_profile(struct connman_profile *profile);
 int __connman_storage_load_service(struct connman_service *service);
 int __connman_storage_save_service(struct connman_service *service);
 int __connman_storage_load_technology(struct connman_technology *technology);
@@ -407,24 +404,6 @@ int __connman_config_provision_service(struct connman_service *service);
 int __connman_config_provision_service_ident(struct connman_service *service,
                                                        const char *ident);
 
-#include <connman/profile.h>
-
-int __connman_profile_init();
-void __connman_profile_cleanup(void);
-
-connman_bool_t __connman_profile_get_offlinemode(void);
-int __connman_profile_set_offlinemode(connman_bool_t offlinemode);
-int __connman_profile_save_default(void);
-
-void __connman_profile_list(DBusMessageIter *iter, void *user_data);
-const char *__connman_profile_active_ident(void);
-const char *__connman_profile_active_path(void);
-
-int __connman_profile_create(const char *name, const char **path);
-int __connman_profile_remove(const char *path);
-
-void __connman_profile_changed(gboolean delayed);
-
 int __connman_tethering_init(void);
 void __connman_tethering_cleanup(void);
 
index cb78e12..535d2d1 100644 (file)
@@ -348,7 +348,6 @@ int main(int argc, char *argv[])
        __connman_tethering_init();
        __connman_counter_init();
        __connman_manager_init();
-       __connman_profile_init();
        __connman_config_init();
        __connman_stats_init();
        __connman_clock_init();
@@ -365,8 +364,6 @@ int main(int argc, char *argv[])
 
        __connman_plugin_init(option_plugin, option_noplugin);
 
-       __connman_storage_init_profile();
-
        __connman_rtnl_start();
        __connman_dhcp_init();
        __connman_wpad_init();
@@ -401,7 +398,6 @@ int main(int argc, char *argv[])
        __connman_clock_cleanup();
        __connman_stats_cleanup();
        __connman_config_cleanup();
-       __connman_profile_cleanup();
        __connman_manager_cleanup();
        __connman_counter_cleanup();
        __connman_agent_cleanup();
diff --git a/src/profile.c b/src/profile.c
deleted file mode 100644 (file)
index b0cb3ef..0000000
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- *
- *  Connection Manager
- *
- *  Copyright (C) 2007-2010  Intel Corporation. All rights reserved.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 2 as
- *  published by the Free Software Foundation.
- *
- *  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 St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <errno.h>
-#include <string.h>
-
-#include <glib.h>
-#include <gdbus.h>
-
-#include "connman.h"
-
-#define PROFILE_DEFAULT_IDENT  "default"
-
-struct connman_profile {
-       char *ident;
-       char *path;
-       char *name;
-       connman_bool_t offlinemode;
-};
-
-static struct connman_profile *default_profile = NULL;
-
-static DBusConnection *connection = NULL;
-
-connman_bool_t __connman_profile_get_offlinemode(void)
-{
-       if (default_profile == NULL)
-               return FALSE;
-
-       DBG("offlinemode %d", default_profile->offlinemode);
-
-       return default_profile->offlinemode;
-}
-
-int __connman_profile_set_offlinemode(connman_bool_t offlinemode)
-{
-       DBG("offlinemode %d", offlinemode);
-
-       if (default_profile == NULL)
-               return -EINVAL;
-
-       if (default_profile->offlinemode == offlinemode)
-               return -EALREADY;
-
-       default_profile->offlinemode = offlinemode;
-       return 0;
-}
-
-int __connman_profile_save_default(void)
-{
-       DBG("");
-
-       if (default_profile != NULL)
-               __connman_storage_save_profile(default_profile);
-
-       return 0;
-}
-
-const char *__connman_profile_active_ident(void)
-{
-       DBG("");
-
-       return PROFILE_DEFAULT_IDENT;
-}
-
-const char *__connman_profile_active_path(void)
-{
-       DBG("");
-
-       if (default_profile == NULL)
-               return NULL;
-
-       return default_profile->path;
-}
-
-static void free_profile(struct connman_profile *profile)
-{
-       g_free(profile->name);
-       g_free(profile->path);
-       g_free(profile->ident);
-       g_free(profile);
-}
-
-static int profile_init(void)
-{
-       DBG("");
-
-       default_profile = g_try_new0(struct connman_profile, 1);
-       if (default_profile == NULL)
-               return -ENOMEM;
-
-       default_profile->ident = g_strdup(PROFILE_DEFAULT_IDENT);
-       default_profile->path = g_strdup_printf("/profile/%s",
-                                       PROFILE_DEFAULT_IDENT);
-
-       if (default_profile->ident == NULL || default_profile->path == NULL) {
-               free_profile(default_profile);
-               return -ENOMEM;
-       }
-
-       default_profile->name = g_strdup("Default");
-
-       __connman_storage_load_profile(default_profile);
-
-       connman_info("Adding default profile");
-
-       DBG("profile %p path %s", default_profile, default_profile->path);
-
-       return 0;
-}
-
-static int profile_load(struct connman_profile *profile)
-{
-       GKeyFile *keyfile;
-       GError *error = NULL;
-       connman_bool_t offlinemode;
-       char *name;
-
-       DBG("profile %p", profile);
-
-       keyfile = __connman_storage_open_profile(profile->ident);
-       if (keyfile == NULL)
-               return -EIO;
-
-       name = g_key_file_get_string(keyfile, "global", "Name", NULL);
-       if (name != NULL) {
-               g_free(profile->name);
-               profile->name = name;
-       }
-
-       offlinemode = g_key_file_get_boolean(keyfile, "global",
-                                               "OfflineMode", &error);
-       if (error == NULL)
-               profile->offlinemode = offlinemode;
-       g_clear_error(&error);
-
-       __connman_storage_close_profile(profile->ident, keyfile, FALSE);
-
-       return 0;
-}
-
-static int profile_save(struct connman_profile *profile)
-{
-       GKeyFile *keyfile;
-
-       DBG("profile %p", profile);
-
-       keyfile = __connman_storage_open_profile(profile->ident);
-       if (keyfile == NULL)
-               return -EIO;
-
-       if (profile->name != NULL)
-               g_key_file_set_string(keyfile, "global",
-                                               "Name", profile->name);
-
-       g_key_file_set_boolean(keyfile, "global",
-                                       "OfflineMode", profile->offlinemode);
-
-       __connman_storage_close_profile(profile->ident, keyfile, TRUE);
-
-       return 0;
-}
-
-static struct connman_storage profile_storage = {
-       .name           = "profile",
-       .priority       = CONNMAN_STORAGE_PRIORITY_LOW,
-       .profile_init   = profile_init,
-       .profile_load   = profile_load,
-       .profile_save   = profile_save,
-};
-
-int __connman_profile_init(void)
-{
-       DBG("");
-
-       connection = connman_dbus_get_connection();
-       if (connection == NULL)
-               return -1;
-
-       if (connman_storage_register(&profile_storage) < 0)
-               connman_error("Failed to register profile storage");
-
-       return 0;
-}
-
-void __connman_profile_cleanup(void)
-{
-       DBG("");
-
-       if (connection == NULL)
-               return;
-
-       connman_storage_unregister(&profile_storage);
-
-       dbus_connection_unref(connection);
-}
index 8a78611..dd97bea 100644 (file)
@@ -76,7 +76,6 @@ struct connman_service {
        char *name;
        char *passphrase;
        char *agent_passphrase;
-       char *profile;
        connman_bool_t roaming;
        connman_bool_t login_required;
        connman_bool_t network_created;
@@ -3152,7 +3151,6 @@ static void service_free(gpointer user_data)
 
        g_free(service->domainname);
        g_free(service->pac);
-       g_free(service->profile);
        g_free(service->name);
        g_free(service->passphrase);
        g_free(service->agent_passphrase);
@@ -4561,8 +4559,6 @@ static struct connman_service *service_get(const char *identifier)
 
        service->identifier = g_strdup(identifier);
 
-       service->profile = g_strdup(__connman_profile_active_ident());
-
        iter = g_sequence_insert_sorted(service_list, service,
                                                service_compare, NULL);
 
@@ -4573,7 +4569,6 @@ static struct connman_service *service_get(const char *identifier)
 
 static int service_register(struct connman_service *service)
 {
-       const char *path = __connman_profile_active_path();
        GSequenceIter *iter;
 
        DBG("service %p", service);
@@ -4581,7 +4576,8 @@ static int service_register(struct connman_service *service)
        if (service->path != NULL)
                return -EALREADY;
 
-       service->path = g_strdup_printf("%s/%s", path, service->identifier);
+       service->path = g_strdup_printf("%s/service/%s", CONNMAN_PATH,
+                                               service->identifier);
 
        DBG("path %s", service->path);
 
@@ -4735,7 +4731,7 @@ static void setup_ip6config(struct connman_service *service, int index)
 
 void __connman_service_read_ip4config(struct connman_service *service)
 {
-       const char *ident = service->profile;
+       const char *ident = "default";
        GKeyFile *keyfile;
 
        if (ident == NULL)
@@ -4768,7 +4764,7 @@ void __connman_service_create_ip4config(struct connman_service *service,
 
 void __connman_service_read_ip6config(struct connman_service *service)
 {
-       const char *ident = service->profile;
+       const char *ident = "default";
        GKeyFile *keyfile;
 
        if (ident == NULL)
@@ -5228,7 +5224,7 @@ void __connman_service_downgrade_state(struct connman_service *service)
 
 static int service_load(struct connman_service *service)
 {
-       const char *ident = service->profile;
+       const char *ident = "default";
        GKeyFile *keyfile;
        GError *error = NULL;
        gchar *pathname, *data = NULL;
@@ -5417,7 +5413,7 @@ done:
 
 static int service_save(struct connman_service *service)
 {
-       const char *ident = service->profile;
+       const char *ident = "default";
        GKeyFile *keyfile;
        gchar *pathname, *data = NULL;
        gsize length;
index 53ba237..261b615 100644 (file)
@@ -181,60 +181,6 @@ void __connman_storage_delete_config(const char *ident)
        __connman_storage_delete(ident, CONFIG_SUFFIX);
 }
 
-int __connman_storage_init_profile(void)
-{
-       GSList *list;
-
-       DBG("");
-
-       for (list = storage_list; list; list = list->next) {
-               struct connman_storage *storage = list->data;
-
-               if (storage->profile_init) {
-                       if (storage->profile_init() == 0)
-                               return 0;
-               }
-       }
-
-       return -ENOENT;
-}
-
-int __connman_storage_load_profile(struct connman_profile *profile)
-{
-       GSList *list;
-
-       DBG("profile %p", profile);
-
-       for (list = storage_list; list; list = list->next) {
-               struct connman_storage *storage = list->data;
-
-               if (storage->profile_load) {
-                       if (storage->profile_load(profile) == 0)
-                               return 0;
-               }
-       }
-
-       return -ENOENT;
-}
-
-int __connman_storage_save_profile(struct connman_profile *profile)
-{
-       GSList *list;
-
-       DBG("profile %p", profile);
-
-       for (list = storage_list; list; list = list->next) {
-               struct connman_storage *storage = list->data;
-
-               if (storage->profile_save) {
-                       if (storage->profile_save(profile) == 0)
-                               return 0;
-               }
-       }
-
-       return -ENOENT;
-}
-
 int __connman_storage_load_service(struct connman_service *service)
 {
        GSList *list;