+
+static int storage_ext_type_changed(storage_ext_device *dev, enum storage_ext_state blk_state, void *data)
+{
+ enum storage_cb_type type = (enum storage_cb_type)data;
+ struct storage_cb_info *cb_info;
+ GList *elem;
+ storage_state_e state;
+ int ret_val;
+ storage_dev_e strdev;
+ storage_type_e storage_type;
+ const char *fstype, *fsuuid, *mountpath;
+
+ if (!dev)
+ return -EINVAL;
+
+ if (type != STORAGE_CALLBACK_TYPE)
+ return -EINVAL;
+
+ ret_val = storage_ext_get_dev_state(dev, blk_state, &state);
+ if (ret_val < 0) {
+ _E("Failed to get storage state (devnode:%s, ret_val:%d)", dev->devnode, ret_val);
+ return ret_val;
+ }
+
+ if (dev->type == STORAGE_EXT_SCSI) {
+ strdev = STORAGE_DEV_EXT_USB_MASS_STORAGE;
+ storage_type = STORAGE_TYPE_EXTERNAL;
+ } else if (dev->type == STORAGE_EXT_MMC) {
+ strdev = STORAGE_DEV_EXT_SDCARD;
+ storage_type = STORAGE_TYPE_EXTERNAL;
+ } else if (dev->type == STORAGE_EXT_MMC_EXTENDED_INTERNAL) {
+ strdev = STORAGE_DEV_EXTENDED_INTERNAL;
+ storage_type = STORAGE_TYPE_EXTENDED_INTERNAL;
+ } else {
+ _E("Invalid dev type (%d)", dev->type);
+ return -EINVAL;
+ }
+
+ fstype = (dev->fs_type ? (const char *)dev->fs_type : "");
+ fsuuid = (dev->fs_uuid ? (const char *)dev->fs_uuid : "");
+ mountpath = (dev->mount_point ? (const char *)dev->mount_point : "");
+
+ if (!strncmp(fstype, LUKS_NAME, strlen(LUKS_NAME)))
+ storage_type = STORAGE_TYPE_EXTENDED_INTERNAL;
+
+ SYS_G_LIST_FOREACH(cb_list[STORAGE_CALLBACK_TYPE], elem, cb_info) {
+ if (cb_info->type != storage_type)
+ continue;
+ if (cb_info->type_cb)
+ cb_info->type_cb(dev->storage_id, strdev, state,
+ fstype, fsuuid, mountpath, dev->primary,
+ dev->flags, cb_info->user_data);
+ }
+
+ return 0;
+}
+