API int storage_get_primary_sdcard(int *storage_id, char **path)
{
GVariant *result;
- storage_ext_device info;
+ int ret;
+ char *mount_point = NULL;
+ int id;
if (!storage_id || !path)
return STORAGE_ERROR_INVALID_PARAMETER;
}
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);
+ NULL, NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, &mount_point,
+ NULL, NULL,
+ NULL, &id);
g_variant_unref(result);
- if (info.storage_id < 0)
- return STORAGE_ERROR_NO_DEVICE;
+ if (id < 0) {
+ ret = STORAGE_ERROR_NO_DEVICE;
+ goto out;
+ }
- *path = strdup(info.mount_point);
- if (*path == NULL)
- return STORAGE_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE System Error
+ *path = strdup(mount_point);
+ if (*path == NULL) {
+ ret = STORAGE_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE System Error
+ goto out;
+ }
- *storage_id = info.storage_id;
+ *storage_id = id;
- return STORAGE_ERROR_NONE;
+ ret = STORAGE_ERROR_NONE;
+out:
+ g_free(mount_point);
+
+ return ret;
}
API int storage_get_storage_level(const char *path, char **level)