SET(HEADERS
include/storage.h
include/storage-expand.h
- include/storage-internal.h
- include/storage-experimental.h)
+ include/storage-internal.h)
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g")
int storage_get_available_space(int storage_id, unsigned long long *bytes);
+/**
+ * @brief Gets the type and the kind of external device for the given storage id.
+ *
+ * @since_tizen 5.0
+ *
+ * @remarks This function works only for external storages.
+ * If @a type is #STORAGE_TYPE_INTERNAL, this function returns #STORAGE_ERROR_INVALID_PARAMETER and @a dev is unchanged.
+ *
+ * @param[in] storage_id The storage id
+ * @param[out] type The storage @a type (internal or external). If @a type is #STORAGE_TYPE_INTERNAL, this function returns #STORAGE_ERROR_INVALID_PARAMETER and @a dev is unchanged.
+ * @param[out] dev The storage device for external storage.
+ *
+ * @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_OPERATION_FAILED Operation failed
+ */
+int storage_get_type_dev(int storage_id, storage_type_e *type, storage_dev_e *dev);
+
+
/**
* @}
*/
+++ /dev/null
-/*
- * storage
- * Copyright (c) 2016 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 __STORAGE_EXPERIMENTAL_H__
-#define __STORAGE_EXPERIMENTAL_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/**
- * @addtogroup CAPI_SYSTEM_STORAGE_MODULE
- * @{
- */
-
-#include <tizen.h>
-
-#define STORAGE_ERROR_NO_DEVICE TIZEN_ERROR_NO_SUCH_DEVICE
-
-/**
- * @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] type The storage @a type (internal or external).
- * @param[out] dev The storage device for external storage. If @a type is #STORAGE_TYPE_INTERNAL, then value of @a dev should be ignored.
- *
- * @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_NO_DEVICE No such device
- */
-int storage_get_type_dev(int storage_id, storage_type_e *type, storage_dev_e *dev);
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __STORAGE_EXPERIMENTAL_H__ */
#include "log.h"
#include "storage-internal.h"
#include "storage-external-dbus.h"
-#include "storage-experimental.h"
/*
Get compat path from origin Multi-user path
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_NO_DEVICE;
- }
-
- 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;
- }
- if (*type == STORAGE_TYPE_INTERNAL)
- return STORAGE_ERROR_NONE;
-
- 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_NO_DEVICE;
- goto out;
- }
-
- if (ext_dev->type == STORAGE_EXT_SCSI)
- *dev = STORAGE_DEV_EXT_USB_MASS_STORAGE;
- else if (ext_dev->type == STORAGE_EXT_MMC)
- *dev = STORAGE_DEV_EXT_SDCARD;
- 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;
-}
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 || !type || !dev) {
+ _E("Invalid parameter");
+ 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;
+ }
+ if (*type == STORAGE_TYPE_INTERNAL || *type == STORAGE_TYPE_EXTENDED_INTERNAL)
+ return STORAGE_ERROR_INVALID_PARAMETER;
+
+ 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_OPERATION_FAILED;
+ goto out;
+ }
+
+ if (ext_dev->type == STORAGE_EXT_SCSI)
+ *dev = STORAGE_DEV_EXT_USB_MASS_STORAGE;
+ else if (ext_dev->type == STORAGE_EXT_MMC)
+ *dev = STORAGE_DEV_EXT_SDCARD;
+ 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;
+}
+
static void __CONSTRUCTOR__ init(void)
{
const char *tmp;