From acfcf54187f182515e9ebf1e99400b037b589f77 Mon Sep 17 00:00:00 2001 From: "pr.jung" Date: Fri, 23 Mar 2018 18:58:14 +0900 Subject: [PATCH] libgdbus: Change dbus methods to use libgdbus Change-Id: I91baa9945d6351fbc99a832f4847a25ce4ef0c9e Signed-off-by: pr.jung --- apps/extended-sd/CMakeLists.txt | 2 +- apps/extended-sd/include/dbus-call.h | 66 ---- apps/extended-sd/include/extended-sd-main.h | 7 + apps/extended-sd/src/dbus-call.c | 410 ------------------------ apps/extended-sd/src/es-internal-storage-page.c | 25 +- apps/extended-sd/src/es-portable-storage-page.c | 52 +-- apps/extended-sd/src/extended-sd-main.c | 11 +- 7 files changed, 33 insertions(+), 540 deletions(-) delete mode 100644 apps/extended-sd/include/dbus-call.h delete mode 100644 apps/extended-sd/src/dbus-call.c diff --git a/apps/extended-sd/CMakeLists.txt b/apps/extended-sd/CMakeLists.txt index 9c8b6fa..8d5c040 100644 --- a/apps/extended-sd/CMakeLists.txt +++ b/apps/extended-sd/CMakeLists.txt @@ -9,7 +9,6 @@ SET(SRCS src/es-internal-storage-page.c src/es-portable-storage-page.c src/es-preference-util.c - src/dbus-call.c ) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) @@ -25,6 +24,7 @@ pkg_check_modules(pkgs REQUIRED efl-extension capi-appfw-app-control storage + libgdbus ) FIND_LIBRARY(LIB_M m) diff --git a/apps/extended-sd/include/dbus-call.h b/apps/extended-sd/include/dbus-call.h deleted file mode 100644 index ffc6cb1..0000000 --- a/apps/extended-sd/include/dbus-call.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * system-dbus - * - * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#ifndef __DBUS_H__ -#define __DBUS_H__ - -#include -#include -#include "extended-sd-main.h" - -#define DBUS_REPLY_TIMEOUT (-1) - -#define STORAGED_BUS_NAME "org.tizen.system.storage" -#define STORAGED_OBJECT_PATH "/Org/Tizen/System/Storage" -#define STORAGED_INTERFACE_NAME STORAGED_BUS_NAME - -#define STORAGED_PATH_BLOCK STORAGED_OBJECT_PATH"/Block" -#define STORAGED_PATH_BLOCK_MANAGER STORAGED_PATH_BLOCK"/Manager" -#define STORAGED_INTERFACE_BLOCK_MANAGER STORAGED_INTERFACE_NAME".BlockManager" - -#define VIEWTYPE_KEY "viewtype" -#define DEVPATH_KEY "dev_path" -#define MAPPING_NODE_KEY "mapping_node" -#define SDCARD_SETUP_TYPE "_SDCARD_SETUP_TYPE_" - -struct dbus_int { - int *list; - int size; -}; - -int dbus_method_sync(const char *dest, const char *path, - const char *interface, const char *method, - const char *sig, char *param[]); -int dbus_method_sync_with_reply(const char *dest, - const char *path, const char *interface, - const char *method, const char *sig, - char *param[], GVariant **info); - -typedef void (*dbus_pending_cb)(void *data, GVariant *result, GError *err); - -int dbus_method_async_with_reply(const char *dest, const char *path, - const char *interface, const char *method, - const char *sig, char *param[], dbus_pending_cb cb, int timeout, void *data); - -/** - * If result is NULL, err is set. - * Do not invoke g_variant_unref() with result. - */ - -#endif diff --git a/apps/extended-sd/include/extended-sd-main.h b/apps/extended-sd/include/extended-sd-main.h index b8cc0a1..9c2f2ab 100644 --- a/apps/extended-sd/include/extended-sd-main.h +++ b/apps/extended-sd/include/extended-sd-main.h @@ -19,6 +19,13 @@ #define UNMOUNT_FORCE 1 +#define DBUS_REPLY_TIMEOUT (-1) + +#define VIEWTYPE_KEY "viewtype" +#define DEVPATH_KEY "dev_path" +#define MAPPING_NODE_KEY "mapping_node" +#define SDCARD_SETUP_TYPE "_SDCARD_SETUP_TYPE_" + #define MYFILES_APP_ID "org.tizen.myfile" #define SETTING_APP_ID "org.tizen.setting-storage" #define SECURITY_APP_ID "org.tizen.ode" diff --git a/apps/extended-sd/src/dbus-call.c b/apps/extended-sd/src/dbus-call.c deleted file mode 100644 index 8921955..0000000 --- a/apps/extended-sd/src/dbus-call.c +++ /dev/null @@ -1,410 +0,0 @@ -/* - * system-dbus - * - * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include -#include -#include -#include - -#include "dbus-call.h" -#include "log-util.h" - -#define DBUS_MAXIMUM_NAME_LENGTH 255 - -struct pending_call_data { - dbus_pending_cb func; - void *data; -}; - -struct proxy_node { - GDBusProxy *proxy; - char *dest; - char *path; - char *interface; -}; - -static GList *proxy_pool; -static pthread_mutex_t dmutex = PTHREAD_MUTEX_INITIALIZER; -static int bus_init; - -static int g_dbus_error_to_errno(int code) -{ - /** - * if device is not supported, - * deviced does not register the method call of the device. - * in this case, dbus will return UNKNOWN_METHOD error. - */ - /* refer to gio/gioenums.h */ - if (code == G_DBUS_ERROR_ACCESS_DENIED) - return -EACCES; - else if (code == G_DBUS_ERROR_UNKNOWN_METHOD) - return -ENOTSUP; - return -ECOMM; -} - -static GVariant *append_g_variant(const char *sig, char *param[]) -{ - GVariantBuilder builder; - GVariantBuilder *sub_builder; - GVariant *var; - struct dbus_int *array_int; - char *ch; - int i, j; - - if (!sig || !param) - return NULL; - - g_variant_builder_init(&builder, G_VARIANT_TYPE_TUPLE); - - for (ch = (char*)sig, i = 0; *ch != '\0'; ++i, ++ch) { - switch (*ch) { - case 'i': - g_variant_builder_add(&builder, "i", atoi(param[i])); - break; - case 'u': - g_variant_builder_add(&builder, "u", strtoul(param[i], NULL, 10)); - break; - case 't': - g_variant_builder_add(&builder, "t", atoll(param[i])); - break; - case 's': - g_variant_builder_add(&builder, "s", param[i]); - break; - case 'a': - ++ch; - switch (*ch) { - case 'i': - sub_builder = g_variant_builder_new(G_VARIANT_TYPE("ai")); - array_int = (struct dbus_int *)param[i]; - for (j = 0; j < array_int->size; j++) - g_variant_builder_add(sub_builder, "i", array_int->list[j]); - var = g_variant_new("ai", sub_builder); - g_variant_builder_unref(sub_builder); - g_variant_builder_add_value(&builder, var); - break; - default: - break; - } - break; - default: - return NULL; - } - } - - return g_variant_builder_end(&builder); -} - -static struct proxy_node *find_matched_proxy_node(const char *dest, - const char *path, - const char *interface) -{ - GList *elem; - struct proxy_node *node; - int plen; - - if (!dest || !path || !interface) - return NULL; - - plen = strlen(path) + 1; - - /* find matched proxy object */ - for (elem = proxy_pool; elem; elem = elem->next) { - node = elem->data; - if (!node) - continue; - if (!strncmp(node->dest, dest, DBUS_MAXIMUM_NAME_LENGTH) && - !strncmp(node->path, path, plen) && - !strncmp(node->interface, interface, - DBUS_MAXIMUM_NAME_LENGTH)) - return node; - } - - return NULL; -} - -static void on_name_vanished(GDBusConnection *connection, - const gchar *name, - gpointer user_data) -{ - GList *elem; - GList *next; - struct proxy_node *node; - - pthread_mutex_lock(&dmutex); - for (elem = proxy_pool, next = g_list_next(elem); elem; - elem = next, next = g_list_next(elem)) { - node = elem->data; - if (!node) - continue; - proxy_pool = g_list_delete_link(proxy_pool, elem); - g_object_unref(node->proxy); - free(node->dest); - free(node->path); - free(node->interface); - free(node); - } - pthread_mutex_unlock(&dmutex); -} - -static GDBusProxy *get_proxy_from_proxy_pool(const char *dest, - const char *path, - const char *interface, - GError **err) -{ - GDBusConnection *conn; - GDBusProxy *proxy; - struct proxy_node *node; - - if (!dest || !path || !interface) { - if (err) - g_set_error(err, G_IO_ERROR, - G_IO_ERROR_INVALID_ARGUMENT, - "Cannot determine destination address"); - return NULL; - } - - /* find matched proxy node in proxy pool */ - node = find_matched_proxy_node(dest, path, interface); - if (node) - return node->proxy; - - conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, err); - if (!conn) - return NULL; - - if (!bus_init) { - bus_init++; - g_bus_watch_name_on_connection(conn, - STORAGED_BUS_NAME, - G_BUS_NAME_WATCHER_FLAGS_NONE, - NULL, - on_name_vanished, - NULL, - NULL); - } - - proxy = g_dbus_proxy_new_sync(conn, - G_DBUS_PROXY_FLAGS_NONE, - NULL, /* GDBusinterfaceinfo */ - dest, /* bus name */ - path, /* object path */ - interface, /* interface name */ - NULL, /* GCancellable */ - err); - if (!proxy) - return NULL; - - node = malloc(sizeof(struct proxy_node)); - if (!node) { - g_object_unref(proxy); - if (err) - g_set_error(err, G_IO_ERROR, - G_IO_ERROR_FAILED, - "Cannot allocate proxy_node memory"); - return NULL; - } - - node->proxy = proxy; - node->dest = strdup(dest); - node->path = strdup(path); - node->interface = strdup(interface); - - proxy_pool = g_list_append(proxy_pool, node); - - return proxy; -} - -int dbus_method_sync(const char *dest, const char *path, - const char *interface, const char *method, - const char *sig, char *param[]) -{ - GDBusProxy *proxy; - GError *err = NULL; - GVariant *output; - int result; - -#if !GLIB_CHECK_VERSION(2, 35, 0) - g_type_init(); -#endif - - pthread_mutex_lock(&dmutex); - proxy = get_proxy_from_proxy_pool(dest, path, interface, &err); - if (!proxy) { - pthread_mutex_unlock(&dmutex); - DMSG_ERR("fail to get proxy from proxy pool : %s-%s (%d-%s)", - interface, method, err->code, err->message); - result = g_dbus_error_to_errno(err->code); - g_clear_error(&err); - return result; - } - - output = g_dbus_proxy_call_sync(proxy, - method, /* method name */ - append_g_variant(sig, param), /* parameters */ - G_DBUS_CALL_FLAGS_NONE, - DBUS_REPLY_TIMEOUT, /* timeout */ - NULL, /* GCancellable */ - &err); - pthread_mutex_unlock(&dmutex); - - if (!output) { - if (!err) { - DMSG_ERR("g_dbus_proxy_call_sync error : %s-%s", - interface, method); - return -EPERM; - } - DMSG_ERR("g_dbus_proxy_call_sync error : %s-%s (%d-%s)", - interface, method, err->code, err->message); - result = g_dbus_error_to_errno(err->code); - g_clear_error(&err); - return result; - } - - /* get output value */ - g_variant_get(output, "(i)", &result); - - g_variant_unref(output); - - return result; -} - -int dbus_method_sync_with_reply(const char *dest, - const char *path, const char *interface, - const char *method, const char *sig, - char *param[], GVariant **info) -{ - GDBusProxy *proxy; - GError *err = NULL; - GVariant *output; - int result; - -#if !GLIB_CHECK_VERSION(2, 35, 0) - g_type_init(); -#endif - - pthread_mutex_lock(&dmutex); - proxy = get_proxy_from_proxy_pool(dest, path, interface, &err); - if (!proxy) { - pthread_mutex_unlock(&dmutex); - _E("fail to get proxy from proxy pool : %s-%s (%d-%s)", - interface, method, err->code, err->message); - result = g_dbus_error_to_errno(err->code); - g_clear_error(&err); - return result; - } - - output = g_dbus_proxy_call_sync(proxy, - method, /* method name */ - append_g_variant(sig, param), /* parameters */ - G_DBUS_CALL_FLAGS_NONE, - DBUS_REPLY_TIMEOUT, /* timeout */ - NULL, /* GCancellable */ - &err); - pthread_mutex_unlock(&dmutex); - if (!output) { - if (!err) { - _E("g_dbus_proxy_call_sync error : %s-%s", - interface, method); - return -EPERM; - } - _E("g_dbus_proxy_call_sync error : %s-%s (%d-%s)", - interface, method, err->code, err->message); - result = g_dbus_error_to_errno(err->code); - g_clear_error(&err); - return result; - } - - *info = output; - return 0; -} - -static void cb_pending(GDBusProxy *proxy, - GAsyncResult *res, - gpointer user_data) -{ - struct pending_call_data *data = user_data; - GError *err = NULL; - GVariant *output; - - output = g_dbus_proxy_call_finish(proxy, - res, /* GAsyncResult */ - &err); - if (!output) - DMSG_ERR("g_dbus_proxy_call_finish error : %d-%s", - err->code, err->message); - - if (data && data->func) - data->func(data->data, output, err); - free(data); - - if (err) - g_clear_error(&err); - if (output) - g_variant_unref(output); -} - -int dbus_method_async_with_reply(const char *dest, const char *path, - const char *interface, const char *method, - const char *sig, char *param[], - dbus_pending_cb cb, int timeout, void *data) -{ - GDBusProxy *proxy; - GError *err = NULL; - struct pending_call_data *pdata; - int result; - -#if !GLIB_CHECK_VERSION(2, 35, 0) - g_type_init(); -#endif - - pthread_mutex_lock(&dmutex); - proxy = get_proxy_from_proxy_pool(dest, path, interface, &err); - if (!proxy) { - pthread_mutex_unlock(&dmutex); - DMSG_ERR("fail to get proxy from proxy pool : %s-%s (%d-%s)", - interface, method, err->code, err->message); - result = g_dbus_error_to_errno(err->code); - g_clear_error(&err); - return result; - } - - pdata = malloc(sizeof(struct pending_call_data)); - if (!pdata) { - pthread_mutex_unlock(&dmutex); - DMSG_ERR("malloc error : %s-%s", - interface, method); - return -ENOMEM; - } - - pdata->func = cb; - pdata->data = data; - - g_dbus_proxy_call(proxy, - method, /* method name */ - append_g_variant(sig, param), /* parameters */ - G_DBUS_CALL_FLAGS_NONE, - timeout, //DBUS_REPLY_TIMEOUT, /* timeout */ - NULL, /* GCancellable */ - (GAsyncReadyCallback)cb_pending, /* GAsyncReadyCallback */ - pdata); /* user data */ - pthread_mutex_unlock(&dmutex); - - return 0; -} diff --git a/apps/extended-sd/src/es-internal-storage-page.c b/apps/extended-sd/src/es-internal-storage-page.c index 17d53c3..5274a8e 100644 --- a/apps/extended-sd/src/es-internal-storage-page.c +++ b/apps/extended-sd/src/es-internal-storage-page.c @@ -1,7 +1,7 @@ #include +#include #include "extended-sd-main.h" -#include "dbus-call.h" #include "log-util.h" #define UNMOUNT_FORCE 1 @@ -83,9 +83,6 @@ encryption_format(void *data) app_control_h app_control = NULL; appdata_s* ad = (appdata_s*)data; int ret; - char str_id[32]; - char str_option[32]; - char *arr[2]; ret_if(ad == NULL); @@ -95,13 +92,8 @@ encryption_format(void *data) elm_object_part_content_set(ad->internal_storage_page_data->internal_storage_page_base_layout, "elm.swallow.content", page_content); // Unmount sdcard - snprintf(str_id, sizeof(str_id), "%d", ad->storage_id); - arr[0] = str_id; - snprintf(str_option, sizeof(str_option), "%d", UNMOUNT_FORCE); - arr[1] = str_option; - - ret = dbus_method_sync(STORAGED_BUS_NAME, - STORAGED_PATH_BLOCK_MANAGER, STORAGED_INTERFACE_BLOCK_MANAGER, "Unmount", "ii", arr); + ret = dbus_handle_method_sync_var(STORAGED_BUS_NAME, + STORAGED_PATH_BLOCK_MANAGER, STORAGED_INTERFACE_BLOCK_MANAGER, "Unmount", g_variant_new("(ii)", ad->storage_id, UNMOUNT_FORCE)); if (ret < 0) { DMSG("Failed to mount sd card as portable storage: %d", ret); return; @@ -132,7 +124,7 @@ encryption_format(void *data) } static void -check_speed_done(void *data, GVariant *result, GError *err) +check_speed_done(GVariant *result, void *data, GError *err) { appdata_s* ad = (appdata_s*)data; int ret; @@ -163,8 +155,6 @@ _format_click_cb(void *data, Evas_Object* obj, void *event_info) FUNC_BEGIN(); appdata_s* ad = (appdata_s*)data; - char str_id[32]; - char *arr[1]; int ret; ret_if(ad == NULL); @@ -174,14 +164,11 @@ _format_click_cb(void *data, Evas_Object* obj, void *event_info) page_content = create_page_2(ad); elm_object_part_content_set(ad->internal_storage_page_data->internal_storage_page_base_layout, "elm.swallow.content", page_content); - snprintf(str_id, sizeof(str_id), "%d", ad->storage_id); - arr[0] = str_id; - ret = dbus_method_async_with_reply(STORAGED_BUS_NAME, + ret = dbus_handle_method_async_with_reply_var(STORAGED_BUS_NAME, STORAGED_PATH_BLOCK_MANAGER, STORAGED_INTERFACE_BLOCK_MANAGER, "CheckSpeed", - "i", - arr, + g_variant_new("(i)", ad->storage_id), check_speed_done, DBUS_REPLY_TIMEOUT, // ms ad); diff --git a/apps/extended-sd/src/es-portable-storage-page.c b/apps/extended-sd/src/es-portable-storage-page.c index 509bfa6..b093347 100644 --- a/apps/extended-sd/src/es-portable-storage-page.c +++ b/apps/extended-sd/src/es-portable-storage-page.c @@ -1,8 +1,7 @@ #include +#include #include "extended-sd-main.h" -#include "dbus-call.h" -//#include "dbus-macro.h" #include "log-util.h" #define LUKS_NAME "crypto_LUKS" @@ -34,11 +33,9 @@ static Evas_Object* create_page_2(appdata_s* ad); static Evas_Object* create_page_3(appdata_s* ad); static void -format_done(void *data, GVariant *result, GError *err) +format_done(GVariant *result, void *data, GError *err) { appdata_s* ad = (appdata_s*)data; - char str_id[32]; - char *arr[2]; int ret; FUNC_BEGIN(); @@ -51,12 +48,8 @@ format_done(void *data, GVariant *result, GError *err) return; } - snprintf(str_id, sizeof(str_id), "%d", ad->storage_id); - arr[0] = str_id; - arr[1] = ""; - - ret = dbus_method_sync(STORAGED_BUS_NAME, - STORAGED_PATH_BLOCK_MANAGER, STORAGED_INTERFACE_BLOCK_MANAGER, "Mount", "is", arr); + ret = dbus_handle_method_sync_var(STORAGED_BUS_NAME, + STORAGED_PATH_BLOCK_MANAGER, STORAGED_INTERFACE_BLOCK_MANAGER, "Mount", g_variant_new("(is)", ad->storage_id, "")); if (ret < 0) { DMSG("Failed to mount sd card as portable storage: %d", ret); return; @@ -80,9 +73,6 @@ mapper_device_cb(int mapper_id, storage_dev_e dev, storage_state_e state, appdata_s* ad = (appdata_s*)user_data; GVariant *output; GVariantIter *iter; - char str_id[32]; - char str_option[32]; - char *arr[3]; char *new_fstype; bool new_primary; int ret; @@ -105,11 +95,10 @@ mapper_device_cb(int mapper_id, storage_dev_e dev, storage_state_e state, if (state != STORAGE_STATE_REMOVED) return; - arr[0] = "mmc"; - ret = dbus_method_sync_with_reply(STORAGED_BUS_NAME, - STORAGED_PATH_BLOCK_MANAGER, STORAGED_INTERFACE_BLOCK_MANAGER, "GetDeviceList", "s", arr, &output); - if (ret < 0) { - DMSG("Failed to get storage information: %d", ret); + output = dbus_handle_method_sync_with_reply_var(STORAGED_BUS_NAME, + STORAGED_PATH_BLOCK_MANAGER, STORAGED_INTERFACE_BLOCK_MANAGER, "GetDeviceList", g_variant_new("(s)", "mmc")); + if (!output) { + DMSG("Failed to get storage information"); return; } @@ -132,18 +121,11 @@ mapper_device_cb(int mapper_id, storage_dev_e dev, storage_state_e state, break; } - snprintf(str_id, sizeof(str_id), "%d", ad->storage_id); - arr[0] = str_id; - snprintf(str_option, sizeof(str_option), "%d", UNMOUNT_FORCE); - arr[1] = str_option; - arr[2] = "vfat"; - - ret = dbus_method_async_with_reply(STORAGED_BUS_NAME, + ret = dbus_handle_method_async_with_reply_var(STORAGED_BUS_NAME, STORAGED_PATH_BLOCK_MANAGER, STORAGED_INTERFACE_BLOCK_MANAGER, "FormatwithType", - "iis", - arr, + g_variant_new("(iis)", ad->storage_id, UNMOUNT_FORCE, "vfat"), format_done, 120000, ad); @@ -154,7 +136,7 @@ mapper_device_cb(int mapper_id, storage_dev_e dev, storage_state_e state, } static void -unmount_done(void *data, GVariant *result, GError *err) +unmount_done(GVariant *result, void *data, GError *err) { appdata_s* ad = (appdata_s*)data; int ret; @@ -176,9 +158,6 @@ static void _format_click_cb(void *data, Evas_Object* obj, void *event_info) { FUNC_BEGIN(); - char str_id[32]; - char str_option[32]; - char *arr[2]; int ret; appdata_s* ad = (appdata_s*)data; @@ -190,16 +169,11 @@ _format_click_cb(void *data, Evas_Object* obj, void *event_info) elm_object_part_content_set(ad->portable_storage_page_data->portable_storage_page_base_layout, "elm.swallow.content", page_content); - snprintf(str_id, sizeof(str_id), "%d", ad->storage_id); - arr[0] = str_id; - snprintf(str_option, sizeof(str_option), "%d", UNMOUNT_FORCE); - arr[1] = str_option; - ret = dbus_method_async_with_reply(STORAGED_BUS_NAME, + ret = dbus_handle_method_async_with_reply_var(STORAGED_BUS_NAME, STORAGED_PATH_BLOCK_MANAGER, STORAGED_INTERFACE_BLOCK_MANAGER, "Unmount", - "ii", - arr, + g_variant_new("(ii)", ad->storage_id, UNMOUNT_FORCE), unmount_done, DBUS_REPLY_TIMEOUT, ad); diff --git a/apps/extended-sd/src/extended-sd-main.c b/apps/extended-sd/src/extended-sd-main.c index 625f62f..192dbe2 100644 --- a/apps/extended-sd/src/extended-sd-main.c +++ b/apps/extended-sd/src/extended-sd-main.c @@ -1,7 +1,8 @@ +#include + #include "extended-sd-main.h" #include "es-preference-util.h" #include "log-util.h" -#include "dbus-call.h" #define SETUP_EXTENDED "EXTENDED_STORAGE_SETUP" #define SETUP_EXTERNAL "EXTERNAL_STORAGE_SETUP" @@ -128,10 +129,10 @@ app_control(app_control_h app_control, void *data) } else create_home_page_base_layout(ad); - ret = dbus_method_sync_with_reply(STORAGED_BUS_NAME, - STORAGED_PATH_BLOCK_MANAGER, STORAGED_INTERFACE_BLOCK_MANAGER, "GetMmcPrimary", NULL, NULL, &output); - if (ret < 0) { - DMSG("Failed to get storage information: %d", ret); + output = dbus_handle_method_sync_with_reply_var(STORAGED_BUS_NAME, + STORAGED_PATH_BLOCK_MANAGER, STORAGED_INTERFACE_BLOCK_MANAGER, "GetMmcPrimary", NULL); + if (!output) { + DMSG("Failed to get storage information"); return; } -- 2.7.4