3 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
5 * Licensed under the Apache License, Version 2.0 (the License);
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
19 #ifndef __STORAGE_INTERNAL_H__
20 #define __STORAGE_INTERNAL_H__
28 * @addtogroup CAPI_SYSTEM_STORAGE_MODULE
35 #define STORAGE_ERROR_NO_DEVICE TIZEN_ERROR_NO_SUCH_DEVICE
38 * @brief Get the mount path for the primary partition of sdcard.
42 * @remarks You must release the path using free() after use
44 * @param[out] storage_id The storage id
45 * @param[out] path The mount path of sdcard primary partition.
47 * @return @c 0 on success,
48 * otherwise a negative error value
50 * @retval #STORAGE_ERROR_NONE Successful
51 * @retval #STORAGE_ERROR_INVALID_PARAMETER Invalid parameter
52 * @retval #STORAGE_ERROR_NO_DEVICE No such device
53 * @retval #STORAGE_ERROR_OPERATION_FAILED Operation failed
54 * @retval #STORAGE_ERROR_OUT_OF_MEMORY Out of memory
56 int storage_get_primary_sdcard(int *storage_id, char **path);
58 int storage_get_compat_internal_path(const char* origin, int len, char* compat);
59 int storage_get_origin_internal_path(const char* compat, int len, char* origin);
60 int storage_get_storage_level(const char *path, char **level);
63 * @brief This structure defines the data for receive result of mmc operations(mount/unmount/format)
66 void (*mmc_cb) (int result, void* data); /**< user callback function for receive result of mmc operations */
67 void* user_data; /**< input data for callback function's second-param(data) */
71 * @brief This API is used to mount mmc.\n
73 * @param[in] mmc_data for receive result of mount operation
75 * @return @c 0 on success,
76 * otherwise a negative error value
78 * @retval #STORAGE_ERROR_NONE Successful
79 * @retval #STORAGE_ERROR_INVALID_PARAMETER Invalid parameter
80 * @retval #STORAGE_ERROR_NO_DEVICE No such device
81 * @retval #STORAGE_ERROR_OPERATION_FAILED Operation failed
82 * @retval #STORAGE_ERROR_OUT_OF_MEMORY Out of memory
84 int storage_request_mount_mmc(struct mmc_contents *mmc_data);
87 * @brief This API is used to unmount mmc.\n
89 * @param[in] mmc_data for receive result of unmount operation
90 * @param[in] option type of unmount option \n
91 * 0 : Normal unmount \n
92 * (if other process still access a sdcard, \n
93 * unmount will be failed.) \n
94 * 1 : Force unmount \n
95 * (if other process still access a sdcard, \n
96 * this process will be received SIGTERM or SIGKILL.)
98 * @return @c 0 on success,
99 * otherwise a negative error value
101 * @retval #STORAGE_ERROR_NONE Successful
102 * @retval #STORAGE_ERROR_INVALID_PARAMETER Invalid parameter
103 * @retval #STORAGE_ERROR_NO_DEVICE No such device
104 * @retval #STORAGE_ERROR_OPERATION_FAILED Operation failed
105 * @retval #STORAGE_ERROR_OUT_OF_MEMORY Out of memory
107 int storage_request_unmount_mmc(struct mmc_contents *mmc_data, int option);
110 * @brief This API is used to format mmc.\n
112 * @param[in] mmc_data for receive result of format operation
114 * @return @c 0 on success,
115 * otherwise a negative error value
117 * @retval #STORAGE_ERROR_NONE Successful
118 * @retval #STORAGE_ERROR_INVALID_PARAMETER Invalid parameter
119 * @retval #STORAGE_ERROR_NO_DEVICE No such device
120 * @retval #STORAGE_ERROR_OPERATION_FAILED Operation failed
121 * @retval #STORAGE_ERROR_OUT_OF_MEMORY Out of memory
123 int storage_request_format_mmc(struct mmc_contents *mmc_data);
126 * @brief This API is used to format mmc.\n
128 * @param[in] mmc_data for receive result of format operation
129 * @param[in] option FMT_NORMAL is 0, FMT_FORCE is 1
131 * @return @c 0 on success,
132 * otherwise a negative error value
134 * @retval #STORAGE_ERROR_NONE Successful
135 * @retval #STORAGE_ERROR_INVALID_PARAMETER Invalid parameter
136 * @retval #STORAGE_ERROR_NO_DEVICE No such device
137 * @retval #STORAGE_ERROR_OPERATION_FAILED Operation failed
138 * @retval #STORAGE_ERROR_OUT_OF_MEMORY Out of memory
140 int storage_format_mmc(struct mmc_contents *mmc_data, int option);
143 STORAGE_PART_ERROR = -1, /**< Checking partition is failed */
144 STORAGE_PART_NOT_MOUNTED = 0, /**< Partition is not mounted */
145 STORAGE_PART_MOUNTED = 1, /**< Partition is mounted */
146 STORAGE_PART_NOT_SUPPORTED = 2, /**< Partition is not supported */
147 } storage_part_mount_e;
150 * @brief This API is used to check user data partition is mounted.\n
152 * @param[out] mounted 1 when user partition is mounted, 0 when user partition is not mounted, 2 when user partition is not supported(2 partitions), and Less then 0 when error return.
154 * @return @c 0 on success,
155 * otherwise a negative error value
157 * @retval #STORAGE_ERROR_NONE Successful
158 * @retval #STORAGE_ERROR_OPERATION_FAILED Operation failed
159 * @retval #STORAGE_ERROR_OUT_OF_MEMORY Out of memory
161 int storage_is_mounted_opt_usr(storage_part_mount_e *mounted);
170 #endif /* __STORAGE_INTERNAL_H__ */