2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
23 #include <sys/statvfs.h>
24 #include <tzplatform_config.h>
30 #ifndef __USE_FILE_OFFSET64
31 int __WEAK__ storage_get_internal_memory_size(struct statvfs *buf);
33 int __WEAK__ storage_get_internal_memory_size64(struct statvfs *buf);
36 static int internal_get_state(void)
38 return STORAGE_STATE_MOUNTED;
41 static int internal_get_space(unsigned long long *total, unsigned long long *available)
46 #ifndef __USE_FILE_OFFSET64
47 ret = storage_get_internal_memory_size(&s);
49 ret = storage_get_internal_memory_size64(&s);
55 *total = (unsigned long long)s.f_frsize*s.f_blocks;
57 *available = (unsigned long long)s.f_bsize*s.f_bavail;
61 static const char *internal_get_root(void)
65 if (is_compat_bind_mount())
68 ret = tzplatform_getenv(TZ_USER_CONTENT);
73 const struct storage_ops internal = {
74 .type = STORAGE_TYPE_INTERNAL,
75 .root = internal_get_root,
76 .get_state = internal_get_state,
77 .get_space = internal_get_space,
81 STORAGE_OPS_REGISTER(&internal)