CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/libstorage.conf DESTINATION lib/pkgconfig RENAME libstorage.conf)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/libstorage.conf DESTINATION /etc/${PROJECT_NAME} RENAME libstorage.conf)
FOREACH(hfile ${HEADERS})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${hfile} DESTINATION include/${PROJECT_NAME})
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*
* @remarks The directory path may not exist, so you must make sure that it exists before using it.\n
- * If you want to access files or directories in internal storage, you must declare http://tizen.org/privilege/mediastorage.\n
+ * If you want to access files or directories in internal storage except #STORAGE_DIRECTORY_SYSTEM_RINGTONES, you must declare http://tizen.org/privilege/mediastorage.\n
+ * If you want to access files or directories in #STORAGE_DIRECTORY_SYSTEM_RINGTONES, you must declare %http://tizen.org/privilege/systemsettings.\n
* If you want to access files or directories in external storage, you must declare http://tizen.org/privilege/externalstorage.\n
* You must release @a path using free().
*
Version: 0.1.0
Release: 0
Group: System/Libraries
-License: Apache-2.0
+License: Apache License, Version 2.0
Source0: %{name}-%{version}.tar.gz
Source1: %{name}.manifest
BuildRequires: cmake
%files
%{_libdir}/*.so.*
-%{_libdir}/pkgconfig/libstorage.conf
+%{_sysconfdir}/storage/libstorage.conf
%{_datadir}/license/%{name}
%manifest %{_datadir}/%{name}.manifest
#define MEMORY_STATUS_USR_PATH "/opt/usr"
#define EXTERNAL_MEMORY_PATH "/opt/storage/sdcard"
-#define STORAGE_CONF_FILE "/usr/lib/pkgconfig/libstorage.conf"
+#define STORAGE_CONF_FILE "/etc/storage/libstorage.conf"
/* it's for 32bit file offset */
struct statvfs_32 {
value = result->value;
if (info->check_size > 0 && check_size < 0)
- check_size = (storage_info.total_size < info->check_size)? 1 : 0;
+ check_size = (storage_info.total_size < info->check_size) ? 1 : 0;
if (MATCH(name, "CHECK_SIZE"))
info->check_size = atoi(value);
else if (check_size == 0 && MATCH(name, "RESERVE"))
if (ret)
return -errno;
+ memset(buf, 0, sizeof(struct statvfs_32));
+
buf->f_bsize = s.f_bsize;
buf->f_frsize = s.f_frsize;
buf->f_blocks = (unsigned long)s.f_blocks;
API int storage_get_internal_memory_size(struct statvfs *buf)
{
- struct statvfs_32 temp = {0,};
+ struct statvfs_32 temp;
static unsigned long reserved = 0;
int ret;
}
ret = get_memory_size(MEMORY_STATUS_USR_PATH, &temp);
- if (ret) {
+ if (ret || temp.f_bsize == 0) {
_E("fail to get memory size");
return -errno;
}
return 0;
}
-static int mount_check(const char* path)
+static int mount_check(const char *path)
{
int ret = false;
- struct mntent* mnt;
- const char* table = "/etc/mtab";
- FILE* fp;
+ struct mntent *mnt;
+ const char *table = "/etc/mtab";
+ FILE *fp;
fp = setmntent(table, "r");
if (!fp)
return ret;
- while ((mnt=getmntent(fp))) {
+ while ((mnt = getmntent(fp))) {
if (!strcmp(mnt->mnt_dir, path)) {
ret = true;
break;
API int storage_get_external_memory_size(struct statvfs *buf)
{
- struct statvfs_32 temp = {0,};
+ struct statvfs_32 temp;
int ret;
_D("storage_get_external_memory_size");
{
storage_state_e state;
struct statvfs s;
- int ret, t, a;
+ int ret;
+ unsigned long long t = 0, a = 0;
state = sdcard_get_state();
- if (state < STORAGE_STATE_MOUNTED) {
- t = 0;
- a = 0;
- } else { /* if sdcard is mounted */
+ if (state >= STORAGE_STATE_MOUNTED) {
#ifndef __USE_FILE_OFFSET64
ret = storage_get_external_memory_size(&s);
#else
return SDCARD_PATH;
}
-static void sdcard_state_cb(keynode_t* key, void* data)
+static void sdcard_state_cb(keynode_t *key, void *data)
{
struct storage_cb_info *cb_info;
dd_list *elem;