3 * Copyright (c) 2012 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.
29 * @ingroup FRAMEWORK/SYSTEM
30 * @brief This file contains the API for the status of devices.
38 * @addtogroup CAPI_SYSTEM_STORAGE_MODULE
43 #include <sys/statvfs.h>
44 #include <storage-expand.h>
48 * @brief Gets the internal memory size.
49 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
50 * @param[out] buf A pointer to a statvfs structure
51 * @return @c 0 on success,
52 * otherwise a negative error value on failure
53 * @retval #STORAGE_ERROR_NONE Successful
54 * @retval #STORAGE_ERROR_INVALID_PARAMETER Invalid parameter
55 * @retval #STORAGE_ERROR_OPERATION_FAILED Operation failed
60 * if (storage_get_internal_memory_size(&s) < 0)
61 * dlog_print(DLOG_DEBUG, LOG_TAG, "Fail to get internal memory size");
63 * dlog_print(DLOG_DEBUG, LOG_TAG, "Total mem : %lf, Avail mem : %lf",
64 * (double)s.f_frsize*s.f_blocks, (double)s.f_bsize*s.f_bavail);
68 #ifdef __USE_FILE_OFFSET64
69 #define storage_get_internal_memory_size storage_get_internal_memory_size64
70 extern int storage_get_internal_memory_size64(struct statvfs *buf);
72 extern int storage_get_internal_memory_size(struct statvfs *buf);
77 * @brief Gets the external memory size.
78 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
79 * @param[out] buf A pointer to a statvfs structure
80 * @return @c 0 on success,
81 * otherwise a negative error value on failure
82 * @retval #STORAGE_ERROR_NONE Successful
83 * @retval #STORAGE_ERROR_INVALID_PARAMETER Invalid parameter
84 * @retval #STORAGE_ERROR_OPERATION_FAILED Operation failed
89 * if (storage_get_external_memory_size(&s) < 0)
90 * dlog_print(DLOG_DEBUG, LOG_TAG, "Fail to get external memory size");
92 * dlog_print(DLOG_DEBUG, LOG_TAG, "Total mem : %lf, Avail mem : %lf",
93 * (double)s.f_frsize*s.f_blocks, (double)s.f_bsize*s.f_bavail);
97 #ifdef __USE_FILE_OFFSET64
99 extern int __REDIRECT_NTH(storage_get_external_memory_size,
100 (struct statvfs *buf), storage_get_external_memory_size64)
103 #define storage_get_external_memory_size storage_get_external_memory_size64
105 extern int storage_get_external_memory_size64(struct statvfs *buf);
107 extern int storage_get_external_memory_size(struct statvfs *buf);