/src/e2fsprogs/lib/ext2fs/ext2fsP.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * ext2fsP.h --- private header file for ext2 library |
3 | | * |
4 | | * Copyright (C) 1997 Theodore Ts'o. |
5 | | * |
6 | | * %Begin-Header% |
7 | | * This file may be redistributed under the terms of the GNU Library |
8 | | * General Public License, version 2. |
9 | | * %End-Header% |
10 | | */ |
11 | | |
12 | | #if HAVE_SYS_STAT_H |
13 | | #include <sys/stat.h> |
14 | | #endif |
15 | | |
16 | | #include "ext2fs.h" |
17 | | |
18 | | #define EXT2FS_MAX_NESTED_LINKS 8 |
19 | | |
20 | | static inline int ext2fsP_is_disk_device(mode_t mode) |
21 | 1.46k | { |
22 | | #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) |
23 | | return S_ISBLK(mode) || S_ISCHR(mode); |
24 | | #else |
25 | 1.46k | return S_ISBLK(mode); |
26 | 1.46k | #endif |
27 | 1.46k | } Unexecuted instantiation: closefs.c:ext2fsP_is_disk_device Unexecuted instantiation: dir_iterate.c:ext2fsP_is_disk_device Unexecuted instantiation: freefs.c:ext2fsP_is_disk_device Unexecuted instantiation: gen_bitmap64.c:ext2fsP_is_disk_device Unexecuted instantiation: get_num_dirs.c:ext2fsP_is_disk_device Unexecuted instantiation: inline_data.c:ext2fsP_is_disk_device Unexecuted instantiation: inode.c:ext2fsP_is_disk_device Unexecuted instantiation: mkjournal.c:ext2fsP_is_disk_device unix_io.c:ext2fsP_is_disk_device Line | Count | Source | 21 | 1.46k | { | 22 | | #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) | 23 | | return S_ISBLK(mode) || S_ISCHR(mode); | 24 | | #else | 25 | 1.46k | return S_ISBLK(mode); | 26 | 1.46k | #endif | 27 | 1.46k | } |
Unexecuted instantiation: badblocks.c:ext2fsP_is_disk_device Unexecuted instantiation: bitmaps.c:ext2fsP_is_disk_device Unexecuted instantiation: blkmap64_ba.c:ext2fsP_is_disk_device Unexecuted instantiation: blkmap64_rb.c:ext2fsP_is_disk_device Unexecuted instantiation: bmap.c:ext2fsP_is_disk_device Unexecuted instantiation: ext_attr.c:ext2fsP_is_disk_device Unexecuted instantiation: extent.c:ext2fsP_is_disk_device Unexecuted instantiation: fileio.c:ext2fsP_is_disk_device Unexecuted instantiation: gen_bitmap.c:ext2fsP_is_disk_device Unexecuted instantiation: ismounted.c:ext2fsP_is_disk_device Unexecuted instantiation: nls_utf8.c:ext2fsP_is_disk_device Unexecuted instantiation: punch.c:ext2fsP_is_disk_device Unexecuted instantiation: link.c:ext2fsP_is_disk_device Unexecuted instantiation: dirhash.c:ext2fsP_is_disk_device |
28 | | |
29 | | static inline time_t ext2fsP_get_time(ext2_filsys fs) |
30 | 0 | { |
31 | 0 | if (fs->now || (fs->flags2 & EXT2_FLAG2_USE_FAKE_TIME)) |
32 | 0 | return fs->now; |
33 | 0 | return time(NULL); |
34 | 0 | } Unexecuted instantiation: closefs.c:ext2fsP_get_time Unexecuted instantiation: dir_iterate.c:ext2fsP_get_time Unexecuted instantiation: freefs.c:ext2fsP_get_time Unexecuted instantiation: gen_bitmap64.c:ext2fsP_get_time Unexecuted instantiation: get_num_dirs.c:ext2fsP_get_time Unexecuted instantiation: inline_data.c:ext2fsP_get_time Unexecuted instantiation: inode.c:ext2fsP_get_time Unexecuted instantiation: mkjournal.c:ext2fsP_get_time Unexecuted instantiation: unix_io.c:ext2fsP_get_time Unexecuted instantiation: badblocks.c:ext2fsP_get_time Unexecuted instantiation: bitmaps.c:ext2fsP_get_time Unexecuted instantiation: blkmap64_ba.c:ext2fsP_get_time Unexecuted instantiation: blkmap64_rb.c:ext2fsP_get_time Unexecuted instantiation: bmap.c:ext2fsP_get_time Unexecuted instantiation: ext_attr.c:ext2fsP_get_time Unexecuted instantiation: extent.c:ext2fsP_get_time Unexecuted instantiation: fileio.c:ext2fsP_get_time Unexecuted instantiation: gen_bitmap.c:ext2fsP_get_time Unexecuted instantiation: ismounted.c:ext2fsP_get_time Unexecuted instantiation: nls_utf8.c:ext2fsP_get_time Unexecuted instantiation: punch.c:ext2fsP_get_time Unexecuted instantiation: link.c:ext2fsP_get_time Unexecuted instantiation: dirhash.c:ext2fsP_get_time |
35 | | |
36 | | /* |
37 | | * Badblocks list |
38 | | */ |
39 | | struct ext2_struct_u32_list { |
40 | | int magic; |
41 | | int num; |
42 | | int size; |
43 | | __u32 *list; |
44 | | int badblocks_flags; |
45 | | }; |
46 | | |
47 | | struct ext2_struct_u32_iterate { |
48 | | int magic; |
49 | | ext2_u32_list bb; |
50 | | int ptr; |
51 | | }; |
52 | | |
53 | | |
54 | | /* |
55 | | * Directory block iterator definition |
56 | | */ |
57 | | struct ext2_struct_dblist { |
58 | | int magic; |
59 | | ext2_filsys fs; |
60 | | unsigned long long size; |
61 | | unsigned long long count; |
62 | | int sorted; |
63 | | struct ext2_db_entry2 * list; |
64 | | }; |
65 | | |
66 | | /* |
67 | | * For directory iterators |
68 | | */ |
69 | | struct dir_context { |
70 | | ext2_ino_t dir; |
71 | | int flags; |
72 | | char *buf; |
73 | | unsigned int buflen; |
74 | | int (*func)(ext2_ino_t dir, |
75 | | int entry, |
76 | | struct ext2_dir_entry *dirent, |
77 | | int offset, |
78 | | int blocksize, |
79 | | char *buf, |
80 | | void *priv_data); |
81 | | void *priv_data; |
82 | | errcode_t errcode; |
83 | | }; |
84 | | |
85 | | /* |
86 | | * Inode cache structure |
87 | | */ |
88 | | struct ext2_inode_cache { |
89 | | void * buffer; |
90 | | blk64_t buffer_blk; |
91 | | int cache_last; |
92 | | unsigned int cache_size; |
93 | | int refcount; |
94 | | struct ext2_inode_cache_ent *cache; |
95 | | }; |
96 | | |
97 | | struct ext2_inode_cache_ent { |
98 | | ext2_ino_t ino; |
99 | | struct ext2_inode *inode; |
100 | | }; |
101 | | |
102 | | /* |
103 | | * NLS definitions |
104 | | */ |
105 | | struct ext2fs_nls_table { |
106 | | int version; |
107 | | const struct ext2fs_nls_ops *ops; |
108 | | }; |
109 | | |
110 | | struct ext2fs_nls_ops { |
111 | | int (*casefold)(const struct ext2fs_nls_table *charset, |
112 | | const unsigned char *str, size_t len, |
113 | | unsigned char *dest, size_t dlen); |
114 | | int (*validate)(const struct ext2fs_nls_table *table, |
115 | | char *s, size_t len, char **pos); |
116 | | int (*casefold_cmp)(const struct ext2fs_nls_table *table, |
117 | | const unsigned char *str1, size_t len1, |
118 | | const unsigned char *str2, size_t len2); |
119 | | }; |
120 | | |
121 | | /* Function prototypes */ |
122 | | |
123 | | extern int ext2fs_process_dir_block(ext2_filsys fs, |
124 | | blk64_t *blocknr, |
125 | | e2_blkcnt_t blockcnt, |
126 | | blk64_t ref_block, |
127 | | int ref_offset, |
128 | | void *priv_data); |
129 | | |
130 | | extern errcode_t ext2fs_inline_data_ea_remove(ext2_filsys fs, ext2_ino_t ino); |
131 | | extern errcode_t ext2fs_inline_data_expand(ext2_filsys fs, ext2_ino_t ino); |
132 | | extern int ext2fs_inline_data_dir_iterate(ext2_filsys fs, |
133 | | ext2_ino_t ino, |
134 | | void *priv_data); |
135 | | |
136 | | /* Generic numeric progress meter */ |
137 | | |
138 | | struct ext2fs_numeric_progress_struct { |
139 | | __u64 max; |
140 | | int log_max; |
141 | | int skip_progress; |
142 | | }; |
143 | | |
144 | | /* |
145 | | * progress callback functions |
146 | | */ |
147 | | struct ext2fs_progress_ops { |
148 | | void (*init)(ext2_filsys fs, |
149 | | struct ext2fs_numeric_progress_struct * progress, |
150 | | const char *label, __u64 max); |
151 | | void (*update)(ext2_filsys fs, |
152 | | struct ext2fs_numeric_progress_struct * progress, |
153 | | __u64 val); |
154 | | void (*close)(ext2_filsys fs, |
155 | | struct ext2fs_numeric_progress_struct * progress, |
156 | | const char *message); |
157 | | }; |
158 | | |
159 | | extern struct ext2fs_progress_ops ext2fs_numeric_progress_ops; |
160 | | |
161 | | extern void ext2fs_numeric_progress_init(ext2_filsys fs, |
162 | | struct ext2fs_numeric_progress_struct * progress, |
163 | | const char *label, __u64 max); |
164 | | extern void ext2fs_numeric_progress_update(ext2_filsys fs, |
165 | | struct ext2fs_numeric_progress_struct * progress, |
166 | | __u64 val); |
167 | | extern void ext2fs_numeric_progress_close(ext2_filsys fs, |
168 | | struct ext2fs_numeric_progress_struct * progress, |
169 | | const char *message); |
170 | | |
171 | | /* |
172 | | * 64-bit bitmap support |
173 | | */ |
174 | | |
175 | | extern errcode_t ext2fs_alloc_generic_bmap(ext2_filsys fs, errcode_t magic, |
176 | | int type, __u64 start, __u64 end, |
177 | | __u64 real_end, |
178 | | const char * description, |
179 | | ext2fs_generic_bitmap *bmap); |
180 | | |
181 | | extern void ext2fs_free_generic_bmap(ext2fs_generic_bitmap bmap); |
182 | | |
183 | | extern errcode_t ext2fs_copy_generic_bmap(ext2fs_generic_bitmap src, |
184 | | ext2fs_generic_bitmap *dest); |
185 | | |
186 | | extern errcode_t ext2fs_resize_generic_bmap(ext2fs_generic_bitmap bmap, |
187 | | __u64 new_end, |
188 | | __u64 new_real_end); |
189 | | extern errcode_t ext2fs_fudge_generic_bmap_end(ext2fs_generic_bitmap bitmap, |
190 | | errcode_t neq, |
191 | | __u64 end, __u64 *oend); |
192 | | extern int ext2fs_mark_generic_bmap(ext2fs_generic_bitmap bitmap, |
193 | | __u64 arg); |
194 | | extern int ext2fs_unmark_generic_bmap(ext2fs_generic_bitmap bitmap, |
195 | | __u64 arg); |
196 | | extern int ext2fs_test_generic_bmap(ext2fs_generic_bitmap bitmap, |
197 | | __u64 arg); |
198 | | extern errcode_t ext2fs_set_generic_bmap_range(ext2fs_generic_bitmap bitmap, |
199 | | __u64 start, unsigned int num, |
200 | | void *in); |
201 | | extern errcode_t ext2fs_get_generic_bmap_range(ext2fs_generic_bitmap bitmap, |
202 | | __u64 start, unsigned int num, |
203 | | void *out); |
204 | | extern void ext2fs_warn_bitmap32(ext2fs_generic_bitmap bitmap,const char *func); |
205 | | |
206 | | extern int ext2fs_mem_is_zero(const char *mem, size_t len); |
207 | | |
208 | | extern int ext2fs_file_block_offset_too_big(ext2_filsys fs, |
209 | | struct ext2_inode *inode, |
210 | | blk64_t offset); |
211 | | |
212 | | /* atexit support */ |
213 | | typedef void (*ext2_exit_fn)(void *); |
214 | | errcode_t ext2fs_add_exit_fn(ext2_exit_fn fn, void *data); |
215 | | errcode_t ext2fs_remove_exit_fn(ext2_exit_fn fn, void *data); |
216 | | |
217 | | #define EXT2FS_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2*!!(cond)])) |