From: pr.jung Date: Wed, 20 Jul 2016 09:40:23 +0000 (+0900) Subject: Add DeviceBlocked signal for storage callback X-Git-Tag: accepted/tizen/common/20160905.171511^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F27%2F80827%2F5;p=platform%2Fcore%2Fsystem%2Flibstorage.git Add DeviceBlocked signal for storage callback Change-Id: I629060f98ce5ca907f0b8e3ce869b5657ecf3a10 Signed-off-by: pr.jung --- diff --git a/src/storage-external-dbus.c b/src/storage-external-dbus.c index bf032b1..626feb9 100755 --- a/src/storage-external-dbus.c +++ b/src/storage-external-dbus.c @@ -36,6 +36,7 @@ #define STORAGE_EXT_DEVICE_CHANGED "DeviceChanged" #define STORAGE_EXT_DEVICE_ADDED "DeviceAdded" #define STORAGE_EXT_DEVICE_REMOVED "DeviceRemoved" +#define STORAGE_EXT_DEVICE_BLOCKED "DeviceBlocked" #define DBUS_REPLY_TIMEOUT (-1) @@ -240,6 +241,12 @@ static void storage_ext_device_changed(GVariant *params, enum storage_ext_state &dev->flags, &dev->storage_id); + /* Callback is called when unmount is started(DeviceBlocked signal) */ + if (state == STORAGE_EXT_CHANGED && dev->state == STORAGE_EXT_UNMOUNTED) { + storage_ext_release_device(&dev); + return; + } + DD_LIST_FOREACH(changed_list, elem, callback) { if (!callback->func) continue; @@ -282,6 +289,9 @@ static void storage_ext_changed(GDBusConnection *conn, else if (!strncmp(signal, STORAGE_EXT_DEVICE_REMOVED, signal_len)) state = STORAGE_EXT_REMOVED; + else if (!strncmp(signal, STORAGE_EXT_DEVICE_BLOCKED, signal_len)) + state = STORAGE_EXT_BLOCKED; + else return; diff --git a/src/storage-external-dbus.h b/src/storage-external-dbus.h index 7ae0d1f..0589959 100644 --- a/src/storage-external-dbus.h +++ b/src/storage-external-dbus.h @@ -38,6 +38,7 @@ enum storage_ext_state { STORAGE_EXT_REMOVED, STORAGE_EXT_ADDED, STORAGE_EXT_CHANGED, + STORAGE_EXT_BLOCKED, }; enum storage_ext_type { diff --git a/src/storage-external.c b/src/storage-external.c index 980c94b..9eba26d 100755 --- a/src/storage-external.c +++ b/src/storage-external.c @@ -58,6 +58,9 @@ static int storage_ext_get_dev_state(storage_ext_device *dev, default: return -EINVAL; } + case STORAGE_EXT_BLOCKED: + *state = STORAGE_STATE_UNMOUNTABLE; + return 0; default: return -EINVAL; }