diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-12-26 01:30:59 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-12-26 01:30:59 +0000 |
commit | c4f623ef2a7980a63de7c9f1d539a656b83f10e7 (patch) | |
tree | a294e28b0112052cb9d58b403554b3390e76f50c /e2fsprogs/old_e2fsprogs/ext2fs/alloc_stats.c | |
parent | 64c54025842f205ad722675105b88044a5b6845a (diff) | |
download | busybox-w32-c4f623ef2a7980a63de7c9f1d539a656b83f10e7.tar.gz busybox-w32-c4f623ef2a7980a63de7c9f1d539a656b83f10e7.tar.bz2 busybox-w32-c4f623ef2a7980a63de7c9f1d539a656b83f10e7.zip |
put small subset of e2fsprogs back in the tree:
lsattr, chattr, fsck. Old e2fsprogs tree is in
e2fsprogs/old_e2fsprogs/*.
Diffstat (limited to 'e2fsprogs/old_e2fsprogs/ext2fs/alloc_stats.c')
-rw-r--r-- | e2fsprogs/old_e2fsprogs/ext2fs/alloc_stats.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/alloc_stats.c b/e2fsprogs/old_e2fsprogs/ext2fs/alloc_stats.c new file mode 100644 index 000000000..f3ab06a23 --- /dev/null +++ b/e2fsprogs/old_e2fsprogs/ext2fs/alloc_stats.c | |||
@@ -0,0 +1,53 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | ||
2 | /* | ||
3 | * alloc_stats.c --- Update allocation statistics for ext2fs | ||
4 | * | ||
5 | * Copyright (C) 2001 Theodore Ts'o. | ||
6 | * | ||
7 | * %Begin-Header% | ||
8 | * This file may be redistributed under the terms of the GNU Public | ||
9 | * License. | ||
10 | * %End-Header% | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #include <stdio.h> | ||
15 | |||
16 | #include "ext2_fs.h" | ||
17 | #include "ext2fs.h" | ||
18 | |||
19 | void ext2fs_inode_alloc_stats2(ext2_filsys fs, ext2_ino_t ino, | ||
20 | int inuse, int isdir) | ||
21 | { | ||
22 | int group = ext2fs_group_of_ino(fs, ino); | ||
23 | |||
24 | if (inuse > 0) | ||
25 | ext2fs_mark_inode_bitmap(fs->inode_map, ino); | ||
26 | else | ||
27 | ext2fs_unmark_inode_bitmap(fs->inode_map, ino); | ||
28 | fs->group_desc[group].bg_free_inodes_count -= inuse; | ||
29 | if (isdir) | ||
30 | fs->group_desc[group].bg_used_dirs_count += inuse; | ||
31 | fs->super->s_free_inodes_count -= inuse; | ||
32 | ext2fs_mark_super_dirty(fs); | ||
33 | ext2fs_mark_ib_dirty(fs); | ||
34 | } | ||
35 | |||
36 | void ext2fs_inode_alloc_stats(ext2_filsys fs, ext2_ino_t ino, int inuse) | ||
37 | { | ||
38 | ext2fs_inode_alloc_stats2(fs, ino, inuse, 0); | ||
39 | } | ||
40 | |||
41 | void ext2fs_block_alloc_stats(ext2_filsys fs, blk_t blk, int inuse) | ||
42 | { | ||
43 | int group = ext2fs_group_of_blk(fs, blk); | ||
44 | |||
45 | if (inuse > 0) | ||
46 | ext2fs_mark_block_bitmap(fs->block_map, blk); | ||
47 | else | ||
48 | ext2fs_unmark_block_bitmap(fs->block_map, blk); | ||
49 | fs->group_desc[group].bg_free_blocks_count -= inuse; | ||
50 | fs->super->s_free_blocks_count -= inuse; | ||
51 | ext2fs_mark_super_dirty(fs); | ||
52 | ext2fs_mark_bb_dirty(fs); | ||
53 | } | ||