diff options
Diffstat (limited to 'e2fsprogs/ext2fs/ext2fs_inline.c')
-rw-r--r-- | e2fsprogs/ext2fs/ext2fs_inline.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/e2fsprogs/ext2fs/ext2fs_inline.c b/e2fsprogs/ext2fs/ext2fs_inline.c index f14e7b22f..2fa9a9ed2 100644 --- a/e2fsprogs/ext2fs/ext2fs_inline.c +++ b/e2fsprogs/ext2fs/ext2fs_inline.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * ext2fs.h --- ext2fs | 2 | * ext2fs.h --- ext2fs |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -36,7 +36,7 @@ errcode_t ext2fs_free_mem(void *ptr) | |||
36 | *pp = 0; | 36 | *pp = 0; |
37 | return 0; | 37 | return 0; |
38 | } | 38 | } |
39 | 39 | ||
40 | /* | 40 | /* |
41 | * Resize memory | 41 | * Resize memory |
42 | */ | 42 | */ |
@@ -154,7 +154,7 @@ blk_t ext2fs_inode_data_blocks(ext2_filsys fs, | |||
154 | struct ext2_inode *inode) | 154 | struct ext2_inode *inode) |
155 | { | 155 | { |
156 | return inode->i_blocks - | 156 | return inode->i_blocks - |
157 | (inode->i_file_acl ? fs->blocksize >> 9 : 0); | 157 | (inode->i_file_acl ? fs->blocksize >> 9 : 0); |
158 | } | 158 | } |
159 | 159 | ||
160 | 160 | ||
@@ -179,7 +179,7 @@ __u32 ext2fs_swab32(__u32 val) | |||
179 | int ext2fs_find_first_bit_set(void * addr, unsigned size) | 179 | int ext2fs_find_first_bit_set(void * addr, unsigned size) |
180 | { | 180 | { |
181 | char *cp = (unsigned char *) addr; | 181 | char *cp = (unsigned char *) addr; |
182 | int res = 0, d0; | 182 | int res = 0, d0; |
183 | 183 | ||
184 | if (!size) | 184 | if (!size) |
185 | return 0; | 185 | return 0; |
@@ -191,7 +191,7 @@ int ext2fs_find_first_bit_set(void * addr, unsigned size) | |||
191 | d0 = ffs(*cp); | 191 | d0 = ffs(*cp); |
192 | if (d0 == 0) | 192 | if (d0 == 0) |
193 | return size; | 193 | return size; |
194 | 194 | ||
195 | return res + d0 - 1; | 195 | return res + d0 - 1; |
196 | } | 196 | } |
197 | 197 | ||
@@ -199,10 +199,10 @@ int ext2fs_find_next_bit_set (void * addr, int size, int offset) | |||
199 | { | 199 | { |
200 | unsigned char * p; | 200 | unsigned char * p; |
201 | int set = 0, bit = offset & 7, res = 0, d0; | 201 | int set = 0, bit = offset & 7, res = 0, d0; |
202 | 202 | ||
203 | res = offset >> 3; | 203 | res = offset >> 3; |
204 | p = ((unsigned char *) addr) + res; | 204 | p = ((unsigned char *) addr) + res; |
205 | 205 | ||
206 | if (bit) { | 206 | if (bit) { |
207 | set = ffs(*p & ~((1 << bit) - 1)); | 207 | set = ffs(*p & ~((1 << bit) - 1)); |
208 | if (set) | 208 | if (set) |
@@ -245,35 +245,35 @@ int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap, | |||
245 | int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap, | 245 | int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap, |
246 | blk_t block) | 246 | blk_t block) |
247 | { | 247 | { |
248 | return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, | 248 | return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, |
249 | block); | 249 | block); |
250 | } | 250 | } |
251 | 251 | ||
252 | int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, | 252 | int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, |
253 | blk_t block) | 253 | blk_t block) |
254 | { | 254 | { |
255 | return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, | 255 | return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, |
256 | block); | 256 | block); |
257 | } | 257 | } |
258 | 258 | ||
259 | int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, | 259 | int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, |
260 | ext2_ino_t inode) | 260 | ext2_ino_t inode) |
261 | { | 261 | { |
262 | return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, | 262 | return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, |
263 | inode); | 263 | inode); |
264 | } | 264 | } |
265 | 265 | ||
266 | int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap, | 266 | int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap, |
267 | ext2_ino_t inode) | 267 | ext2_ino_t inode) |
268 | { | 268 | { |
269 | return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, | 269 | return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, |
270 | inode); | 270 | inode); |
271 | } | 271 | } |
272 | 272 | ||
273 | int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, | 273 | int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, |
274 | ext2_ino_t inode) | 274 | ext2_ino_t inode) |
275 | { | 275 | { |
276 | return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, | 276 | return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, |
277 | inode); | 277 | inode); |
278 | } | 278 | } |
279 | 279 | ||
@@ -286,7 +286,7 @@ void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap, | |||
286 | bitmap->description); | 286 | bitmap->description); |
287 | return; | 287 | return; |
288 | } | 288 | } |
289 | #endif | 289 | #endif |
290 | ext2fs_set_bit(block - bitmap->start, bitmap->bitmap); | 290 | ext2fs_set_bit(block - bitmap->start, bitmap->bitmap); |
291 | } | 291 | } |
292 | 292 | ||
@@ -415,7 +415,7 @@ void ext2fs_mark_block_bitmap_range(ext2fs_block_bitmap bitmap, | |||
415 | blk_t block, int num) | 415 | blk_t block, int num) |
416 | { | 416 | { |
417 | int i; | 417 | int i; |
418 | 418 | ||
419 | if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { | 419 | if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { |
420 | ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block, | 420 | ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block, |
421 | bitmap->description); | 421 | bitmap->description); |
@@ -429,14 +429,14 @@ void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap, | |||
429 | blk_t block, int num) | 429 | blk_t block, int num) |
430 | { | 430 | { |
431 | int i; | 431 | int i; |
432 | 432 | ||
433 | #ifdef EXT2FS_DEBUG_FAST_OPS | 433 | #ifdef EXT2FS_DEBUG_FAST_OPS |
434 | if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { | 434 | if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { |
435 | ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block, | 435 | ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block, |
436 | bitmap->description); | 436 | bitmap->description); |
437 | return; | 437 | return; |
438 | } | 438 | } |
439 | #endif | 439 | #endif |
440 | for (i=0; i < num; i++) | 440 | for (i=0; i < num; i++) |
441 | ext2fs_set_bit(block + i - bitmap->start, bitmap->bitmap); | 441 | ext2fs_set_bit(block + i - bitmap->start, bitmap->bitmap); |
442 | } | 442 | } |
@@ -445,7 +445,7 @@ void ext2fs_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap, | |||
445 | blk_t block, int num) | 445 | blk_t block, int num) |
446 | { | 446 | { |
447 | int i; | 447 | int i; |
448 | 448 | ||
449 | if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { | 449 | if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { |
450 | ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block, | 450 | ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block, |
451 | bitmap->description); | 451 | bitmap->description); |
@@ -459,14 +459,14 @@ void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap, | |||
459 | blk_t block, int num) | 459 | blk_t block, int num) |
460 | { | 460 | { |
461 | int i; | 461 | int i; |
462 | 462 | ||
463 | #ifdef EXT2FS_DEBUG_FAST_OPS | 463 | #ifdef EXT2FS_DEBUG_FAST_OPS |
464 | if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { | 464 | if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { |
465 | ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block, | 465 | ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block, |
466 | bitmap->description); | 466 | bitmap->description); |
467 | return; | 467 | return; |
468 | } | 468 | } |
469 | #endif | 469 | #endif |
470 | for (i=0; i < num; i++) | 470 | for (i=0; i < num; i++) |
471 | ext2fs_clear_bit(block + i - bitmap->start, bitmap->bitmap); | 471 | ext2fs_clear_bit(block + i - bitmap->start, bitmap->bitmap); |
472 | } | 472 | } |