Proofread header file
[platform/core/system/libstorage.git] / include / storage.h
1 /*
2  * storage
3  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4  *
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
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  */
17
18
19 #ifndef __STORAGE_H__
20 #define __STORAGE_H__
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26
27 /**
28  * @file storage.h
29  * @ingroup FRAMEWORK/SYSTEM
30  * @brief This file contains the API for the status of devices.
31  * @author TIZEN
32  * @date 2013-02-15
33  * @version 0.1
34  */
35
36
37  /**
38  * @addtogroup CAPI_SYSTEM_STORAGE_MODULE
39  * @{
40  */
41
42
43 #include <sys/statvfs.h>
44 #include "storage-expand.h"
45
46
47 /**
48  * @brief int storage_get_internal_memory_size(struct statvfs *buf).
49  * @brief This generic API is used to get the internal memory size.
50  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
51  * @param[out] buf A pointer to a statvfs structure
52  * @return @c 0 on success,
53  *         otherwise a negative error value on failure
54  * @par Example:
55  * @code
56  *      ...
57  *  struct statvfs s;
58  *      if (storage_get_internal_memory_size(&s) < 0)
59  *      dlog_print(DLOG_DEBUG, LOG_TAG, "Fail to get internal memory size");
60  *      else
61  *              dlog_print(DLOG_DEBUG, LOG_TAG, "Total mem : %lf, Avail mem : %lf",
62  *                              (double)s.f_frsize*s.f_blocks, (double)s.f_bsize*s.f_bavail);
63  *      ...
64  * @endcode
65  */
66 #ifndef __USE_FILE_OFFSET64
67 extern int storage_get_internal_memory_size(struct statvfs *buf);
68 #else
69 # define storage_get_internal_memory_size storage_get_internal_memory_size64
70 #endif
71
72 #ifdef __USE_FILE_OFFSET64
73 extern int storage_get_internal_memory_size64(struct statvfs *buf);
74 #endif
75
76
77 /**
78  * @brief int storage_get_external_memory_size(struct statvfs *buf).
79  * @brief This generic API is used to get the external memory size.
80  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
81  * @param[out] buf A pointer to a statvfs structure
82  * @return @c 0 on success,
83  *         otherwise a negative error value on failure
84  * @par Example:
85  * @code
86  *      ...
87  *  struct statvfs s;
88  *      if (storage_get_external_memory_size(&s) < 0)
89  *              dlog_print(DLOG_DEBUG, LOG_TAG, "Fail to get external memory size");
90  *      else
91  *              dlog_print(DLOG_DEBUG, LOG_TAG, "Total mem : %lf, Avail mem : %lf",
92  *                              (double)s.f_frsize*s.f_blocks, (double)s.f_bsize*s.f_bavail);
93  *      ...
94  * @endcode
95  */
96 #ifndef __USE_FILE_OFFSET64
97 extern int storage_get_external_memory_size(struct statvfs *buf);
98 #else
99 # ifdef __REDIRECT_NTH
100 extern int __REDIRECT_NTH(storage_get_external_memory_size,
101                                 (struct statvfs *buf), storage_get_external_memory_size64)
102         __nonnull((1));
103 # else
104 #  define storage_get_external_memory_size storage_get_external_memory_size64
105 # endif
106 #endif
107
108 #ifdef __USE_FILE_OFFSET64
109 extern int storage_get_external_memory_size64(struct statvfs *buf);
110 #endif
111
112
113 /**
114  * @}
115  */
116
117 #ifdef __cplusplus
118 }
119 #endif
120 #endif