Lines Matching +full:- +full:fs
2 * blknum.c --- Functions to handle blk64_t and high/low 64-bit block
8 * %Begin-Header%
11 * %End-Header%
20 dgrp_t ext2fs_group_of_blk2(ext2_filsys fs, blk64_t blk) in ext2fs_group_of_blk2() argument
22 return (blk - fs->super->s_first_data_block) / in ext2fs_group_of_blk2()
23 fs->super->s_blocks_per_group; in ext2fs_group_of_blk2()
29 blk64_t ext2fs_group_first_block2(ext2_filsys fs, dgrp_t group) in ext2fs_group_first_block2() argument
31 return fs->super->s_first_data_block + in ext2fs_group_first_block2()
32 EXT2_GROUPS_TO_BLOCKS(fs->super, group); in ext2fs_group_first_block2()
38 blk64_t ext2fs_group_last_block2(ext2_filsys fs, dgrp_t group) in ext2fs_group_last_block2() argument
40 return (group == fs->group_desc_count - 1 ? in ext2fs_group_last_block2()
41 ext2fs_blocks_count(fs->super) - 1 : in ext2fs_group_last_block2()
42 ext2fs_group_first_block2(fs, group) + in ext2fs_group_last_block2()
43 (fs->super->s_blocks_per_group - 1)); in ext2fs_group_last_block2()
49 int ext2fs_group_blocks_count(ext2_filsys fs, dgrp_t group) in ext2fs_group_blocks_count() argument
53 if (group == fs->group_desc_count - 1) { in ext2fs_group_blocks_count()
54 num_blocks = (ext2fs_blocks_count(fs->super) - in ext2fs_group_blocks_count()
55 fs->super->s_first_data_block) % in ext2fs_group_blocks_count()
56 fs->super->s_blocks_per_group; in ext2fs_group_blocks_count()
58 num_blocks = fs->super->s_blocks_per_group; in ext2fs_group_blocks_count()
60 num_blocks = fs->super->s_blocks_per_group; in ext2fs_group_blocks_count()
68 blk64_t ext2fs_inode_data_blocks2(ext2_filsys fs, in ext2fs_inode_data_blocks2() argument
71 return (inode->i_blocks | in ext2fs_inode_data_blocks2()
72 (ext2fs_has_feature_huge_file(fs->super) ? in ext2fs_inode_data_blocks2()
73 (__u64) inode->osd2.linux2.l_i_blocks_hi << 32 : 0)) - in ext2fs_inode_data_blocks2()
74 (inode->i_file_acl ? EXT2_CLUSTER_SIZE(fs->super) >> 9 : 0); in ext2fs_inode_data_blocks2()
80 blk64_t ext2fs_inode_i_blocks(ext2_filsys fs, in ext2fs_inode_i_blocks() argument
83 return (inode->i_blocks | in ext2fs_inode_i_blocks()
84 (ext2fs_has_feature_huge_file(fs->super) ? in ext2fs_inode_i_blocks()
85 (__u64)inode->osd2.linux2.l_i_blocks_hi << 32 : 0)); in ext2fs_inode_i_blocks()
89 * Return the fs block count
93 return super->s_blocks_count | in ext2fs_blocks_count()
95 (__u64) super->s_blocks_count_hi << 32 : 0); in ext2fs_blocks_count()
99 * Set the fs block count
103 super->s_blocks_count = blk; in ext2fs_blocks_count_set()
105 super->s_blocks_count_hi = (__u64) blk >> 32; in ext2fs_blocks_count_set()
109 * Add to the current fs block count
119 * Return the fs reserved block count
123 return super->s_r_blocks_count | in ext2fs_r_blocks_count()
125 (__u64) super->s_r_blocks_count_hi << 32 : 0); in ext2fs_r_blocks_count()
129 * Set the fs reserved block count
133 super->s_r_blocks_count = blk; in ext2fs_r_blocks_count_set()
135 super->s_r_blocks_count_hi = (__u64) blk >> 32; in ext2fs_r_blocks_count_set()
139 * Add to the current reserved fs block count
149 * Return the fs free block count
153 return super->s_free_blocks_count | in ext2fs_free_blocks_count()
155 (__u64) super->s_free_blocks_hi << 32 : 0); in ext2fs_free_blocks_count()
159 * Set the fs free block count
163 super->s_free_blocks_count = blk; in ext2fs_free_blocks_count_set()
165 super->s_free_blocks_hi = (__u64) blk >> 32; in ext2fs_free_blocks_count_set()
169 * Add to the current free fs block count
184 struct ext2_group_desc *ext2fs_group_desc(ext2_filsys fs, in ext2fs_group_desc() argument
188 int desc_size = EXT2_DESC_SIZE(fs->super) & ~7; in ext2fs_group_desc()
194 static struct ext4_group_desc *ext4fs_group_desc(ext2_filsys fs, in ext4fs_group_desc() argument
198 return (struct ext4_group_desc *)ext2fs_group_desc(fs, gdp, group); in ext4fs_group_desc()
204 __u32 ext2fs_block_bitmap_checksum(ext2_filsys fs, dgrp_t group) in ext2fs_block_bitmap_checksum() argument
209 gdp = ext4fs_group_desc(fs, fs->group_desc, group); in ext2fs_block_bitmap_checksum()
210 csum = gdp->bg_block_bitmap_csum_lo; in ext2fs_block_bitmap_checksum()
211 if (EXT2_DESC_SIZE(fs->super) >= EXT4_BG_BLOCK_BITMAP_CSUM_HI_LOCATION) in ext2fs_block_bitmap_checksum()
212 csum |= ((__u32)gdp->bg_block_bitmap_csum_hi << 16); in ext2fs_block_bitmap_checksum()
219 blk64_t ext2fs_block_bitmap_loc(ext2_filsys fs, dgrp_t group) in ext2fs_block_bitmap_loc() argument
223 gdp = ext4fs_group_desc(fs, fs->group_desc, group); in ext2fs_block_bitmap_loc()
224 return gdp->bg_block_bitmap | in ext2fs_block_bitmap_loc()
225 (ext2fs_has_feature_64bit(fs->super) ? in ext2fs_block_bitmap_loc()
226 (__u64)gdp->bg_block_bitmap_hi << 32 : 0); in ext2fs_block_bitmap_loc()
232 void ext2fs_block_bitmap_loc_set(ext2_filsys fs, dgrp_t group, blk64_t blk) in ext2fs_block_bitmap_loc_set() argument
236 gdp = ext4fs_group_desc(fs, fs->group_desc, group); in ext2fs_block_bitmap_loc_set()
237 gdp->bg_block_bitmap = blk; in ext2fs_block_bitmap_loc_set()
238 if (ext2fs_has_feature_64bit(fs->super)) in ext2fs_block_bitmap_loc_set()
239 gdp->bg_block_bitmap_hi = (__u64) blk >> 32; in ext2fs_block_bitmap_loc_set()
245 __u32 ext2fs_inode_bitmap_checksum(ext2_filsys fs, dgrp_t group) in ext2fs_inode_bitmap_checksum() argument
250 gdp = ext4fs_group_desc(fs, fs->group_desc, group); in ext2fs_inode_bitmap_checksum()
251 csum = gdp->bg_inode_bitmap_csum_lo; in ext2fs_inode_bitmap_checksum()
252 if (EXT2_DESC_SIZE(fs->super) >= EXT4_BG_INODE_BITMAP_CSUM_HI_END) in ext2fs_inode_bitmap_checksum()
253 csum |= ((__u32)gdp->bg_inode_bitmap_csum_hi << 16); in ext2fs_inode_bitmap_checksum()
260 blk64_t ext2fs_inode_bitmap_loc(ext2_filsys fs, dgrp_t group) in ext2fs_inode_bitmap_loc() argument
264 gdp = ext4fs_group_desc(fs, fs->group_desc, group); in ext2fs_inode_bitmap_loc()
265 return gdp->bg_inode_bitmap | in ext2fs_inode_bitmap_loc()
266 (ext2fs_has_feature_64bit(fs->super) ? in ext2fs_inode_bitmap_loc()
267 (__u64) gdp->bg_inode_bitmap_hi << 32 : 0); in ext2fs_inode_bitmap_loc()
273 void ext2fs_inode_bitmap_loc_set(ext2_filsys fs, dgrp_t group, blk64_t blk) in ext2fs_inode_bitmap_loc_set() argument
277 gdp = ext4fs_group_desc(fs, fs->group_desc, group); in ext2fs_inode_bitmap_loc_set()
278 gdp->bg_inode_bitmap = blk; in ext2fs_inode_bitmap_loc_set()
279 if (ext2fs_has_feature_64bit(fs->super)) in ext2fs_inode_bitmap_loc_set()
280 gdp->bg_inode_bitmap_hi = (__u64) blk >> 32; in ext2fs_inode_bitmap_loc_set()
286 blk64_t ext2fs_inode_table_loc(ext2_filsys fs, dgrp_t group) in ext2fs_inode_table_loc() argument
290 gdp = ext4fs_group_desc(fs, fs->group_desc, group); in ext2fs_inode_table_loc()
291 return gdp->bg_inode_table | in ext2fs_inode_table_loc()
292 (ext2fs_has_feature_64bit(fs->super) ? in ext2fs_inode_table_loc()
293 (__u64) gdp->bg_inode_table_hi << 32 : 0); in ext2fs_inode_table_loc()
299 void ext2fs_inode_table_loc_set(ext2_filsys fs, dgrp_t group, blk64_t blk) in ext2fs_inode_table_loc_set() argument
303 gdp = ext4fs_group_desc(fs, fs->group_desc, group); in ext2fs_inode_table_loc_set()
304 gdp->bg_inode_table = blk; in ext2fs_inode_table_loc_set()
305 if (ext2fs_has_feature_64bit(fs->super)) in ext2fs_inode_table_loc_set()
306 gdp->bg_inode_table_hi = (__u64) blk >> 32; in ext2fs_inode_table_loc_set()
312 __u32 ext2fs_bg_free_blocks_count(ext2_filsys fs, dgrp_t group) in ext2fs_bg_free_blocks_count() argument
316 gdp = ext4fs_group_desc(fs, fs->group_desc, group); in ext2fs_bg_free_blocks_count()
317 return gdp->bg_free_blocks_count | in ext2fs_bg_free_blocks_count()
318 (ext2fs_has_feature_64bit(fs->super) ? in ext2fs_bg_free_blocks_count()
319 (__u32) gdp->bg_free_blocks_count_hi << 16 : 0); in ext2fs_bg_free_blocks_count()
325 void ext2fs_bg_free_blocks_count_set(ext2_filsys fs, dgrp_t group, __u32 n) in ext2fs_bg_free_blocks_count_set() argument
329 gdp = ext4fs_group_desc(fs, fs->group_desc, group); in ext2fs_bg_free_blocks_count_set()
330 gdp->bg_free_blocks_count = n; in ext2fs_bg_free_blocks_count_set()
332 if (ext2fs_has_feature_64bit(fs->super)) in ext2fs_bg_free_blocks_count_set()
333 gdp->bg_free_blocks_count_hi = (__u32) n >> 16; in ext2fs_bg_free_blocks_count_set()
339 __u32 ext2fs_bg_free_inodes_count(ext2_filsys fs, dgrp_t group) in ext2fs_bg_free_inodes_count() argument
343 gdp = ext4fs_group_desc(fs, fs->group_desc, group); in ext2fs_bg_free_inodes_count()
344 return gdp->bg_free_inodes_count | in ext2fs_bg_free_inodes_count()
345 (ext2fs_has_feature_64bit(fs->super) ? in ext2fs_bg_free_inodes_count()
346 (__u32) gdp->bg_free_inodes_count_hi << 16 : 0); in ext2fs_bg_free_inodes_count()
352 void ext2fs_bg_free_inodes_count_set(ext2_filsys fs, dgrp_t group, __u32 n) in ext2fs_bg_free_inodes_count_set() argument
356 gdp = ext4fs_group_desc(fs, fs->group_desc, group); in ext2fs_bg_free_inodes_count_set()
357 gdp->bg_free_inodes_count = n; in ext2fs_bg_free_inodes_count_set()
358 if (ext2fs_has_feature_64bit(fs->super)) in ext2fs_bg_free_inodes_count_set()
359 gdp->bg_free_inodes_count_hi = (__u32) n >> 16; in ext2fs_bg_free_inodes_count_set()
365 __u32 ext2fs_bg_used_dirs_count(ext2_filsys fs, dgrp_t group) in ext2fs_bg_used_dirs_count() argument
369 gdp = ext4fs_group_desc(fs, fs->group_desc, group); in ext2fs_bg_used_dirs_count()
370 return gdp->bg_used_dirs_count | in ext2fs_bg_used_dirs_count()
371 (ext2fs_has_feature_64bit(fs->super) ? in ext2fs_bg_used_dirs_count()
372 (__u32) gdp->bg_used_dirs_count_hi << 16 : 0); in ext2fs_bg_used_dirs_count()
378 void ext2fs_bg_used_dirs_count_set(ext2_filsys fs, dgrp_t group, __u32 n) in ext2fs_bg_used_dirs_count_set() argument
382 gdp = ext4fs_group_desc(fs, fs->group_desc, group); in ext2fs_bg_used_dirs_count_set()
383 gdp->bg_used_dirs_count = n; in ext2fs_bg_used_dirs_count_set()
384 if (ext2fs_has_feature_64bit(fs->super)) in ext2fs_bg_used_dirs_count_set()
385 gdp->bg_used_dirs_count_hi = (__u32) n >> 16; in ext2fs_bg_used_dirs_count_set()
391 __u32 ext2fs_bg_itable_unused(ext2_filsys fs, dgrp_t group) in ext2fs_bg_itable_unused() argument
395 gdp = ext4fs_group_desc(fs, fs->group_desc, group); in ext2fs_bg_itable_unused()
396 return gdp->bg_itable_unused | in ext2fs_bg_itable_unused()
397 (ext2fs_has_feature_64bit(fs->super) ? in ext2fs_bg_itable_unused()
398 (__u32) gdp->bg_itable_unused_hi << 16 : 0); in ext2fs_bg_itable_unused()
404 void ext2fs_bg_itable_unused_set(ext2_filsys fs, dgrp_t group, __u32 n) in ext2fs_bg_itable_unused_set() argument
408 gdp = ext4fs_group_desc(fs, fs->group_desc, group); in ext2fs_bg_itable_unused_set()
409 gdp->bg_itable_unused = n; in ext2fs_bg_itable_unused_set()
410 if (ext2fs_has_feature_64bit(fs->super)) in ext2fs_bg_itable_unused_set()
411 gdp->bg_itable_unused_hi = (__u32) n >> 16; in ext2fs_bg_itable_unused_set()
417 __u16 ext2fs_bg_flags(ext2_filsys fs, dgrp_t group) in ext2fs_bg_flags() argument
421 gdp = ext4fs_group_desc(fs, fs->group_desc, group); in ext2fs_bg_flags()
422 return gdp->bg_flags; in ext2fs_bg_flags()
428 void ext2fs_bg_flags_zap(ext2_filsys fs, dgrp_t group) in ext2fs_bg_flags_zap() argument
432 gdp = ext4fs_group_desc(fs, fs->group_desc, group); in ext2fs_bg_flags_zap()
433 gdp->bg_flags = 0; in ext2fs_bg_flags_zap()
440 int ext2fs_bg_flags_test(ext2_filsys fs, dgrp_t group, __u16 bg_flag) in ext2fs_bg_flags_test() argument
444 gdp = ext4fs_group_desc(fs, fs->group_desc, group); in ext2fs_bg_flags_test()
445 return gdp->bg_flags & bg_flag; in ext2fs_bg_flags_test()
451 void ext2fs_bg_flags_set(ext2_filsys fs, dgrp_t group, __u16 bg_flags) in ext2fs_bg_flags_set() argument
455 gdp = ext4fs_group_desc(fs, fs->group_desc, group); in ext2fs_bg_flags_set()
456 gdp->bg_flags |= bg_flags; in ext2fs_bg_flags_set()
463 void ext2fs_bg_flags_clear(ext2_filsys fs, dgrp_t group, __u16 bg_flags) in ext2fs_bg_flags_clear() argument
467 gdp = ext4fs_group_desc(fs, fs->group_desc, group); in ext2fs_bg_flags_clear()
468 gdp->bg_flags &= ~bg_flags; in ext2fs_bg_flags_clear()
475 __u16 ext2fs_bg_checksum(ext2_filsys fs, dgrp_t group) in ext2fs_bg_checksum() argument
479 gdp = ext4fs_group_desc(fs, fs->group_desc, group); in ext2fs_bg_checksum()
480 return gdp->bg_checksum; in ext2fs_bg_checksum()
486 void ext2fs_bg_checksum_set(ext2_filsys fs, dgrp_t group, __u16 checksum) in ext2fs_bg_checksum_set() argument
490 gdp = ext4fs_group_desc(fs, fs->group_desc, group); in ext2fs_bg_checksum_set()
491 gdp->bg_checksum = checksum; in ext2fs_bg_checksum_set()
498 blk64_t ext2fs_file_acl_block(ext2_filsys fs, const struct ext2_inode *inode) in ext2fs_file_acl_block() argument
500 blk64_t blk = inode->i_file_acl; in ext2fs_file_acl_block()
502 if (fs && ext2fs_has_feature_64bit(fs->super)) in ext2fs_file_acl_block()
503 blk |= ((__u64) inode->osd2.linux2.l_i_file_acl_high) << 32; in ext2fs_file_acl_block()
510 void ext2fs_file_acl_block_set(ext2_filsys fs, struct ext2_inode *inode, in ext2fs_file_acl_block_set() argument
513 inode->i_file_acl = blk; in ext2fs_file_acl_block_set()
514 if (fs && ext2fs_has_feature_64bit(fs->super)) in ext2fs_file_acl_block_set()
515 inode->osd2.linux2.l_i_file_acl_high = (__u64) blk >> 32; in ext2fs_file_acl_block_set()
521 errcode_t ext2fs_inode_size_set(ext2_filsys fs, struct ext2_inode *inode, in ext2fs_inode_size_set() argument
525 if (!LINUX_S_ISREG(inode->i_mode) && (size >> 32)) in ext2fs_inode_size_set()
529 if (LINUX_S_ISREG(inode->i_mode) && in ext2fs_inode_size_set()
531 (!ext2fs_has_feature_large_file(fs->super) || in ext2fs_inode_size_set()
532 fs->super->s_rev_level == EXT2_GOOD_OLD_REV)) { in ext2fs_inode_size_set()
533 ext2fs_set_feature_large_file(fs->super); in ext2fs_inode_size_set()
534 ext2fs_update_dynamic_rev(fs); in ext2fs_inode_size_set()
535 ext2fs_mark_super_dirty(fs); in ext2fs_inode_size_set()
538 inode->i_size = size & 0xffffffff; in ext2fs_inode_size_set()
539 inode->i_size_high = (size >> 32); in ext2fs_inode_size_set()