2 * Copyright (C) 2014 The Android Open Source Project
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.
17 #ifndef F2FS_UTILS_F2F2_UTILS_H_
18 #define F2FS_UTILS_F2F2_UTILS_H_
28 #define ver_after(a, b) (typecheck(unsigned long long, a) && \
29 typecheck(unsigned long long, b) && \
30 ((long long)((a) - (b)) > 0))
32 #define ver_equal(a, b) (typecheck(unsigned long long, a) && \
33 typecheck(unsigned long long, b) && \
34 ((long long)((a) - (b)) == 0))
36 struct f2fs_sit_block;
37 struct f2fs_summary_block;
40 u_int64_t blocks_per_segment;
44 u_int32_t sit_bmp_size;
45 u_int64_t blocks_per_sit;
46 struct f2fs_sit_block *sit_blocks;
47 struct f2fs_summary_block *sit_sums;
50 u_int64_t cp_valid_cp_blkaddr;
52 u_int64_t sit_blkaddr;
54 u_int64_t nat_blkaddr;
56 u_int64_t ssa_blkaddr;
58 u_int64_t main_blkaddr;
60 u_int64_t total_user_used;
61 u_int64_t total_blocks;
64 u64 get_num_blocks_used(struct f2fs_info *info);
65 struct f2fs_info *generate_f2fs_info(int fd);
66 void free_f2fs_info(struct f2fs_info *info);
67 unsigned int get_f2fs_filesystem_size_sec(char *dev);
68 int run_on_used_blocks(u64 startblock, struct f2fs_info *info, int (*func)(u64 pos, void *data), void *data);
74 #endif // F2FS_UTILS_F2F2_UTILS_H_