*/
int storage_get_primary_sdcard(int *storage_id, char **path);
+/**
+ * @brief Get the type and the kind of external device for given storage id.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] storage_id The storage id
+ * @param[out] storage type (internal, external).
+ * @param[out] the kind of storage device for external type (sdcard, usb).
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #STORAGE_ERROR_NONE Successful
+ * @retval #STORAGE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #STORAGE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #STORAGE_ERROR_NOT_SUPPORTED Storage not supported
+ * @retval #STORAGE_ERROR_NO_DEVICE No such device
+ */
+int storage_get_type_dev(int storage_id, storage_type_e *type, storage_dev_e *dev);
+
int storage_get_compat_internal_path(const char* origin, int len, char* compat);
int storage_get_origin_internal_path(const char* compat, int len, char* origin);
return -ENODEV;
}
- g_variant_get(result, "(issssssisibii)",
- &info->type, &info->devnode, &info->syspath,
- &info->fs_usage, &info->fs_type,
- &info->fs_version, &info->fs_uuid,
- &info->readonly, &info->mount_point,
- &info->state, &info->primary,
- &info->flags, &info->storage_id);
+ if (g_variant_check_format_string(result, "(issssssisibii)", true)) {
+ g_variant_get(result, "(issssssisibii)",
+ &info->type, &info->devnode, &info->syspath,
+ &info->fs_usage, &info->fs_type,
+ &info->fs_version, &info->fs_uuid,
+ &info->readonly, &info->mount_point,
+ &info->state, &info->primary,
+ &info->flags, &info->storage_id);
+ } else
+ return -ENODEV;
g_variant_unref(result);
return STORAGE_ERROR_NONE;
}
+
+API int storage_get_type_dev(int storage_id, storage_type_e *type, storage_dev_e *dev)
+{
+ storage_ext_device *ext_dev;
+ int ret;
+
+ if (storage_id < 0) {
+ _E("Invalid parameger");
+ return STORAGE_ERROR_NOT_SUPPORTED;
+ }
+
+ if (!type) {
+ _E("Invalid parameger");
+ return STORAGE_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!dev) {
+ _E("Invalid parameger");
+ return STORAGE_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = storage_get_type(storage_id, type);
+ if (ret != STORAGE_ERROR_NONE) {
+ _E("Failed to get storage type: %d", ret);
+ return ret;
+ }
+
+ ext_dev = calloc(1, sizeof(storage_ext_device));
+ if (!ext_dev) {
+//LCOV_EXCL_START System Error
+ _E("calloc failed");
+ return STORAGE_ERROR_OUT_OF_MEMORY;
+//LCOV_EXCL_STOP
+ }
+
+ ret = storage_ext_get_device_info(storage_id, ext_dev);
+ if (ret < 0) {
+ _E("Cannot get the storage with id (%d, ret:%d)", storage_id, ret); //LCOV_EXCL_LINE
+ ret = STORAGE_ERROR_NOT_SUPPORTED;
+ goto out;
+ }
+
+ *dev = ext_dev->type;
+ ret = STORAGE_ERROR_NONE;
+ _I("type: %d(internal:0, external:1) dev: %d(sdcard: 1001, usb: 1002)", *type, *dev);
+
+out:
+ storage_ext_release_device(&ext_dev);
+ return ret;
+}