common: apply Tizen Coding Rule
[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  * @file        storage.h
28  * @ingroup     FRAMEWORK/SYSTEM
29  * @brief       This file contains the API for the status of devices.
30  * @author      TIZEN
31  * @date        2013-02-15
32  * @version     0.1
33  */
34
35  /**
36  * @addtogroup CAPI_SYSTEM_STORAGE_MODULE
37  * @{
38  */
39
40 #include <sys/statvfs.h>
41 #include "storage-expand.h"
42
43 /**
44  * @fn int storage_get_internal_memory_size(struct statvfs *buf)
45  * @brief This generic API is used to get the internal memory size.
46  *
47  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
48  *
49  * @param[out] buf A pointer to a statvfs structure
50  * @return @c 0 on success,
51  *         otherwise a negative error value on failure
52  * @see
53  * @par Example:
54  * @code
55  *      ...
56  *  struct statvfs s;
57  *      if (storage_get_internal_memory_size(&s) < 0)
58  *              dlog_print(DLOG_DEBUG, LOG_TAG, "Fail to get internal memory size");
59  *      else
60  *              dlog_print(DLOG_DEBUG, LOG_TAG, "Total mem : %lf, Avail mem : %lf",
61  *                              (double)s.f_frsize*s.f_blocks, (double)s.f_bsize*s.f_bavail);
62  *      ...
63  * @endcode
64  */
65 #ifndef __USE_FILE_OFFSET64
66 extern int storage_get_internal_memory_size(struct statvfs *buf);
67 #else
68 # define storage_get_internal_memory_size storage_get_internal_memory_size64
69 #endif
70
71 #ifdef __USE_FILE_OFFSET64
72 extern int storage_get_internal_memory_size64(struct statvfs *buf);
73 #endif
74
75 /**
76  * @fn int storage_get_external_memory_size(struct statvfs *buf)
77  * @brief This generic API is used to get the external memory size.
78  *
79  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
80  *
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  * @see
85  * @par Example:
86  * @code
87  *      ...
88  *  struct statvfs s;
89  *      if (storage_get_external_memory_size(&s) < 0)
90  *              dlog_print(DLOG_DEBUG, LOG_TAG, "Fail to get external memory size");
91  *      else
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);
94  *      ...
95  * @endcode
96  */
97 #ifndef __USE_FILE_OFFSET64
98 extern int storage_get_external_memory_size(struct statvfs *buf);
99 #else
100 # ifdef __REDIRECT_NTH
101 extern int __REDIRECT_NTH(storage_get_external_memory_size,
102                                 (struct statvfs *buf), storage_get_external_memory_size64)
103         __nonnull((1));
104 # else
105 #  define storage_get_external_memory_size storage_get_external_memory_size64
106 # endif
107 #endif
108
109 #ifdef __USE_FILE_OFFSET64
110 extern int storage_get_external_memory_size64(struct statvfs *buf);
111 #endif
112
113 /**
114  * @}
115  */
116
117 #ifdef __cplusplus
118 }
119 #endif
120 #endif