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.
19 #include <sys/types.h>
25 #include <sys/statvfs.h>
26 #include <tzplatform_config.h>
32 #ifdef __USE_FILE_OFFSET64
33 int __WEAK__ storage_get_internal_memory_size64(struct statvfs *buf);
35 int __WEAK__ storage_get_internal_memory_size(struct statvfs *buf);
38 static int internal_get_state(void)
40 return STORAGE_STATE_MOUNTED;
43 static int internal_get_space(unsigned long long *total, unsigned long long *available)
48 #ifdef __USE_FILE_OFFSET64
49 ret = storage_get_internal_memory_size64(&s);
51 ret = storage_get_internal_memory_size(&s);
57 *total = (unsigned long long)s.f_frsize*s.f_blocks;
59 *available = (unsigned long long)s.f_bsize*s.f_bavail;
63 static const char *internal_get_root(void)
66 ret = tzplatform_uid_getenv(getuid(), TZ_USER_CONTENT);
71 const struct storage_ops internal = {
72 .type = STORAGE_TYPE_INTERNAL,
73 .root = internal_get_root,
74 .get_state = internal_get_state,
75 .get_space = internal_get_space,
79 STORAGE_OPS_REGISTER(&internal)