aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author"Vladimir N. Oleynik" <dzo@simtreas.ru>2005-10-12 12:24:01 +0000
committer"Vladimir N. Oleynik" <dzo@simtreas.ru>2005-10-12 12:24:01 +0000
commit3ebb89521831fbce738ab3dfbb9f841c3a561d37 (patch)
tree33bd98af76c09bbeea66a99dd2452a82956ba428
parentab57f76e13c00830fb8c3fe32dc210158abc5e91 (diff)
downloadbusybox-w32-3ebb89521831fbce738ab3dfbb9f841c3a561d37.tar.gz
busybox-w32-3ebb89521831fbce738ab3dfbb9f841c3a561d37.tar.bz2
busybox-w32-3ebb89521831fbce738ab3dfbb9f841c3a561d37.zip
make fsck.h as common, e2fsck: includes correct
-rw-r--r--e2fsprogs/e2fsck.c92
-rw-r--r--e2fsprogs/fsck.c44
-rw-r--r--e2fsprogs/fsck.h43
3 files changed, 90 insertions, 89 deletions
diff --git a/e2fsprogs/e2fsck.c b/e2fsprogs/e2fsck.c
index 3af03f433..fc7e740ac 100644
--- a/e2fsprogs/e2fsck.c
+++ b/e2fsprogs/e2fsck.c
@@ -62,7 +62,7 @@
62#include <mntent.h> 62#include <mntent.h>
63#include <dirent.h> 63#include <dirent.h>
64 64
65#include "e2fsbb.h" 65#include "fsck.h"
66 66
67#include "ext2fs/ext2_fs.h" 67#include "ext2fs/ext2_fs.h"
68#include "ext2fs/ext2fs.h" 68#include "ext2fs/ext2fs.h"
@@ -1435,7 +1435,7 @@ static int check_bb_inode_blocks(ext2_filsys fs, blk_t *block_nr, int blockcnt,
1435 void *priv_data); 1435 void *priv_data);
1436 1436
1437 1437
1438static void invalid_block(ext2_filsys fs EXT2FS_ATTR((unused)), blk_t blk) 1438static void invalid_block(ext2_filsys fs FSCK_ATTR((unused)), blk_t blk)
1439{ 1439{
1440 printf(_("Bad block %u out of range; ignored.\n"), blk); 1440 printf(_("Bad block %u out of range; ignored.\n"), blk);
1441 return; 1441 return;
@@ -1533,8 +1533,8 @@ fatal:
1533 1533
1534static int check_bb_inode_blocks(ext2_filsys fs, 1534static int check_bb_inode_blocks(ext2_filsys fs,
1535 blk_t *block_nr, 1535 blk_t *block_nr,
1536 int blockcnt EXT2FS_ATTR((unused)), 1536 int blockcnt FSCK_ATTR((unused)),
1537 void *priv_data EXT2FS_ATTR((unused))) 1537 void *priv_data FSCK_ATTR((unused)))
1538{ 1538{
1539 if (!*block_nr) 1539 if (!*block_nr)
1540 return 0; 1540 return 0;
@@ -2663,8 +2663,8 @@ static const char *operation;
2663 2663
2664static errcode_t 2664static errcode_t
2665e2fsck_handle_read_error(io_channel channel, unsigned long block, int count, 2665e2fsck_handle_read_error(io_channel channel, unsigned long block, int count,
2666 void *data, size_t size EXT2FS_ATTR((unused)), 2666 void *data, size_t size FSCK_ATTR((unused)),
2667 int actual EXT2FS_ATTR((unused)), errcode_t error) 2667 int actual FSCK_ATTR((unused)), errcode_t error)
2668{ 2668{
2669 int i; 2669 int i;
2670 char *p; 2670 char *p;
@@ -2706,8 +2706,8 @@ e2fsck_handle_read_error(io_channel channel, unsigned long block, int count,
2706 2706
2707static errcode_t 2707static errcode_t
2708e2fsck_handle_write_error(io_channel channel, unsigned long block, int count, 2708e2fsck_handle_write_error(io_channel channel, unsigned long block, int count,
2709 const void *data, size_t size EXT2FS_ATTR((unused)), 2709 const void *data, size_t size FSCK_ATTR((unused)),
2710 int actual EXT2FS_ATTR((unused)), errcode_t error) 2710 int actual FSCK_ATTR((unused)), errcode_t error)
2711{ 2711{
2712 int i; 2712 int i;
2713 const char *p; 2713 const char *p;
@@ -5159,7 +5159,7 @@ endit:
5159 * glock group, call process_inodes. 5159 * glock group, call process_inodes.
5160 */ 5160 */
5161static errcode_t scan_callback(ext2_filsys fs, 5161static errcode_t scan_callback(ext2_filsys fs,
5162 ext2_inode_scan scan EXT2FS_ATTR((unused)), 5162 ext2_inode_scan scan FSCK_ATTR((unused)),
5163 dgrp_t group, void * priv_data) 5163 dgrp_t group, void * priv_data)
5164{ 5164{
5165 struct scan_callback_struct *scan_struct; 5165 struct scan_callback_struct *scan_struct;
@@ -5546,7 +5546,7 @@ clear_extattr:
5546 5546
5547/* Returns 1 if bad htree, 0 if OK */ 5547/* Returns 1 if bad htree, 0 if OK */
5548static int handle_htree(e2fsck_t ctx, struct problem_context *pctx, 5548static int handle_htree(e2fsck_t ctx, struct problem_context *pctx,
5549 ext2_ino_t ino EXT2FS_ATTR((unused)), 5549 ext2_ino_t ino FSCK_ATTR((unused)),
5550 struct ext2_inode *inode, 5550 struct ext2_inode *inode,
5551 char *block_buf) 5551 char *block_buf)
5552{ 5552{
@@ -5813,8 +5813,8 @@ static char *describe_illegal_block(ext2_filsys fs, blk_t block)
5813static int process_block(ext2_filsys fs, 5813static int process_block(ext2_filsys fs,
5814 blk_t *block_nr, 5814 blk_t *block_nr,
5815 e2_blkcnt_t blockcnt, 5815 e2_blkcnt_t blockcnt,
5816 blk_t ref_block EXT2FS_ATTR((unused)), 5816 blk_t ref_block FSCK_ATTR((unused)),
5817 int ref_offset EXT2FS_ATTR((unused)), 5817 int ref_offset FSCK_ATTR((unused)),
5818 void *priv_data) 5818 void *priv_data)
5819{ 5819{
5820 struct process_block_struct_1 *p; 5820 struct process_block_struct_1 *p;
@@ -5959,8 +5959,8 @@ mark_dir:
5959static int process_bad_block(ext2_filsys fs, 5959static int process_bad_block(ext2_filsys fs,
5960 blk_t *block_nr, 5960 blk_t *block_nr,
5961 e2_blkcnt_t blockcnt, 5961 e2_blkcnt_t blockcnt,
5962 blk_t ref_block EXT2FS_ATTR((unused)), 5962 blk_t ref_block FSCK_ATTR((unused)),
5963 int ref_offset EXT2FS_ATTR((unused)), 5963 int ref_offset FSCK_ATTR((unused)),
5964 void *priv_data) 5964 void *priv_data)
5965{ 5965{
5966 struct process_block_struct_1 *p; 5966 struct process_block_struct_1 *p;
@@ -6639,11 +6639,11 @@ static void pass1b(e2fsck_t ctx, char *block_buf)
6639 e2fsck_use_inode_shortcuts(ctx, 0); 6639 e2fsck_use_inode_shortcuts(ctx, 0);
6640} 6640}
6641 6641
6642static int process_pass1b_block(ext2_filsys fs EXT2FS_ATTR((unused)), 6642static int process_pass1b_block(ext2_filsys fs FSCK_ATTR((unused)),
6643 blk_t *block_nr, 6643 blk_t *block_nr,
6644 e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)), 6644 e2_blkcnt_t blockcnt FSCK_ATTR((unused)),
6645 blk_t ref_blk EXT2FS_ATTR((unused)), 6645 blk_t ref_blk FSCK_ATTR((unused)),
6646 int ref_offset EXT2FS_ATTR((unused)), 6646 int ref_offset FSCK_ATTR((unused)),
6647 void *priv_data) 6647 void *priv_data)
6648{ 6648{
6649 struct process_block_struct_1b *p; 6649 struct process_block_struct_1b *p;
@@ -6683,9 +6683,9 @@ struct search_dir_struct {
6683 6683
6684static int search_dirent_proc(ext2_ino_t dir, int entry, 6684static int search_dirent_proc(ext2_ino_t dir, int entry,
6685 struct ext2_dir_entry *dirent, 6685 struct ext2_dir_entry *dirent,
6686 int offset EXT2FS_ATTR((unused)), 6686 int offset FSCK_ATTR((unused)),
6687 int blocksize EXT2FS_ATTR((unused)), 6687 int blocksize FSCK_ATTR((unused)),
6688 char *buf EXT2FS_ATTR((unused)), 6688 char *buf FSCK_ATTR((unused)),
6689 void *priv_data) 6689 void *priv_data)
6690{ 6690{
6691 struct search_dir_struct *sd; 6691 struct search_dir_struct *sd;
@@ -6866,9 +6866,9 @@ static void decrement_badcount(e2fsck_t ctx, blk_t block, struct dup_block *p)
6866 6866
6867static int delete_file_block(ext2_filsys fs, 6867static int delete_file_block(ext2_filsys fs,
6868 blk_t *block_nr, 6868 blk_t *block_nr,
6869 e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)), 6869 e2_blkcnt_t blockcnt FSCK_ATTR((unused)),
6870 blk_t ref_block EXT2FS_ATTR((unused)), 6870 blk_t ref_block FSCK_ATTR((unused)),
6871 int ref_offset EXT2FS_ATTR((unused)), 6871 int ref_offset FSCK_ATTR((unused)),
6872 void *priv_data) 6872 void *priv_data)
6873{ 6873{
6874 struct process_block_struct_1b *pb; 6874 struct process_block_struct_1b *pb;
@@ -6968,8 +6968,8 @@ struct clone_struct {
6968static int clone_file_block(ext2_filsys fs, 6968static int clone_file_block(ext2_filsys fs,
6969 blk_t *block_nr, 6969 blk_t *block_nr,
6970 e2_blkcnt_t blockcnt, 6970 e2_blkcnt_t blockcnt,
6971 blk_t ref_block EXT2FS_ATTR((unused)), 6971 blk_t ref_block FSCK_ATTR((unused)),
6972 int ref_offset EXT2FS_ATTR((unused)), 6972 int ref_offset FSCK_ATTR((unused)),
6973 void *priv_data) 6973 void *priv_data)
6974{ 6974{
6975 struct dup_block *p; 6975 struct dup_block *p;
@@ -8217,9 +8217,9 @@ abort_free_dict:
8217 * functioned called by deallocate inode via ext2fs_iterate_block(). 8217 * functioned called by deallocate inode via ext2fs_iterate_block().
8218 */ 8218 */
8219static int deallocate_inode_block(ext2_filsys fs, blk_t *block_nr, 8219static int deallocate_inode_block(ext2_filsys fs, blk_t *block_nr,
8220 e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)), 8220 e2_blkcnt_t blockcnt FSCK_ATTR((unused)),
8221 blk_t ref_block EXT2FS_ATTR((unused)), 8221 blk_t ref_block FSCK_ATTR((unused)),
8222 int ref_offset EXT2FS_ATTR((unused)), 8222 int ref_offset FSCK_ATTR((unused)),
8223 void *priv_data) 8223 void *priv_data)
8224{ 8224{
8225 e2fsck_t ctx = (e2fsck_t) priv_data; 8225 e2fsck_t ctx = (e2fsck_t) priv_data;
@@ -8544,11 +8544,11 @@ static int allocate_dir_block(e2fsck_t ctx, struct ext2_db_entry *db,
8544/* 8544/*
8545 * This is a helper function for allocate_dir_block(). 8545 * This is a helper function for allocate_dir_block().
8546 */ 8546 */
8547static int update_dir_block(ext2_filsys fs EXT2FS_ATTR((unused)), 8547static int update_dir_block(ext2_filsys fs FSCK_ATTR((unused)),
8548 blk_t *block_nr, 8548 blk_t *block_nr,
8549 e2_blkcnt_t blockcnt, 8549 e2_blkcnt_t blockcnt,
8550 blk_t ref_block EXT2FS_ATTR((unused)), 8550 blk_t ref_block FSCK_ATTR((unused)),
8551 int ref_offset EXT2FS_ATTR((unused)), 8551 int ref_offset FSCK_ATTR((unused)),
8552 void *priv_data) 8552 void *priv_data)
8553{ 8553{
8554 struct ext2_db_entry *db; 8554 struct ext2_db_entry *db;
@@ -9161,9 +9161,9 @@ struct fix_dotdot_struct {
9161}; 9161};
9162 9162
9163static int fix_dotdot_proc(struct ext2_dir_entry *dirent, 9163static int fix_dotdot_proc(struct ext2_dir_entry *dirent,
9164 int offset EXT2FS_ATTR((unused)), 9164 int offset FSCK_ATTR((unused)),
9165 int blocksize EXT2FS_ATTR((unused)), 9165 int blocksize FSCK_ATTR((unused)),
9166 char *buf EXT2FS_ATTR((unused)), 9166 char *buf FSCK_ATTR((unused)),
9167 void *priv_data) 9167 void *priv_data)
9168{ 9168{
9169 struct fix_dotdot_struct *fp = (struct fix_dotdot_struct *) priv_data; 9169 struct fix_dotdot_struct *fp = (struct fix_dotdot_struct *) priv_data;
@@ -9241,8 +9241,8 @@ struct expand_dir_struct {
9241static int expand_dir_proc(ext2_filsys fs, 9241static int expand_dir_proc(ext2_filsys fs,
9242 blk_t *blocknr, 9242 blk_t *blocknr,
9243 e2_blkcnt_t blockcnt, 9243 e2_blkcnt_t blockcnt,
9244 blk_t ref_block EXT2FS_ATTR((unused)), 9244 blk_t ref_block FSCK_ATTR((unused)),
9245 int ref_offset EXT2FS_ATTR((unused)), 9245 int ref_offset FSCK_ATTR((unused)),
9246 void *priv_data) 9246 void *priv_data)
9247{ 9247{
9248 struct expand_dir_struct *es = (struct expand_dir_struct *) priv_data; 9248 struct expand_dir_struct *es = (struct expand_dir_struct *) priv_data;
@@ -12221,8 +12221,8 @@ struct out_dir {
12221static int fill_dir_block(ext2_filsys fs, 12221static int fill_dir_block(ext2_filsys fs,
12222 blk_t *block_nr, 12222 blk_t *block_nr,
12223 e2_blkcnt_t blockcnt, 12223 e2_blkcnt_t blockcnt,
12224 blk_t ref_block EXT2FS_ATTR((unused)), 12224 blk_t ref_block FSCK_ATTR((unused)),
12225 int ref_offset EXT2FS_ATTR((unused)), 12225 int ref_offset FSCK_ATTR((unused)),
12226 void *priv_data) 12226 void *priv_data)
12227{ 12227{
12228 struct fill_dir_struct *fd = (struct fill_dir_struct *) priv_data; 12228 struct fill_dir_struct *fd = (struct fill_dir_struct *) priv_data;
@@ -12731,8 +12731,8 @@ struct write_dir_struct {
12731static int write_dir_block(ext2_filsys fs, 12731static int write_dir_block(ext2_filsys fs,
12732 blk_t *block_nr, 12732 blk_t *block_nr,
12733 e2_blkcnt_t blockcnt, 12733 e2_blkcnt_t blockcnt,
12734 blk_t ref_block EXT2FS_ATTR((unused)), 12734 blk_t ref_block FSCK_ATTR((unused)),
12735 int ref_offset EXT2FS_ATTR((unused)), 12735 int ref_offset FSCK_ATTR((unused)),
12736 void *priv_data) 12736 void *priv_data)
12737{ 12737{
12738 struct write_dir_struct *wd = (struct write_dir_struct *) priv_data; 12738 struct write_dir_struct *wd = (struct write_dir_struct *) priv_data;
@@ -13326,8 +13326,8 @@ struct process_block_struct {
13326 13326
13327static int release_inode_block(ext2_filsys fs, blk_t *block_nr, 13327static int release_inode_block(ext2_filsys fs, blk_t *block_nr,
13328 e2_blkcnt_t blockcnt, 13328 e2_blkcnt_t blockcnt,
13329 blk_t ref_blk EXT2FS_ATTR((unused)), 13329 blk_t ref_blk FSCK_ATTR((unused)),
13330 int ref_offset EXT2FS_ATTR((unused)), 13330 int ref_offset FSCK_ATTR((unused)),
13331 void *priv_data) 13331 void *priv_data)
13332{ 13332{
13333 struct process_block_struct *pb; 13333 struct process_block_struct *pb;
@@ -15099,7 +15099,7 @@ static void reserve_stdio_fds(void)
15099 close(fd); 15099 close(fd);
15100} 15100}
15101 15101
15102static void signal_progress_on(int sig EXT2FS_ATTR((unused))) 15102static void signal_progress_on(int sig FSCK_ATTR((unused)))
15103{ 15103{
15104 e2fsck_t ctx = e2fsck_global_ctx; 15104 e2fsck_t ctx = e2fsck_global_ctx;
15105 15105
@@ -15110,7 +15110,7 @@ static void signal_progress_on(int sig EXT2FS_ATTR((unused)))
15110 ctx->progress_fd = 0; 15110 ctx->progress_fd = 0;
15111} 15111}
15112 15112
15113static void signal_progress_off(int sig EXT2FS_ATTR((unused))) 15113static void signal_progress_off(int sig FSCK_ATTR((unused)))
15114{ 15114{
15115 e2fsck_t ctx = e2fsck_global_ctx; 15115 e2fsck_t ctx = e2fsck_global_ctx;
15116 15116
@@ -15121,7 +15121,7 @@ static void signal_progress_off(int sig EXT2FS_ATTR((unused)))
15121 ctx->progress = 0; 15121 ctx->progress = 0;
15122} 15122}
15123 15123
15124static void signal_cancel(int sig EXT2FS_ATTR((unused))) 15124static void signal_cancel(int sig FSCK_ATTR((unused)))
15125{ 15125{
15126 e2fsck_t ctx = e2fsck_global_ctx; 15126 e2fsck_t ctx = e2fsck_global_ctx;
15127 15127
diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c
index ec0c38b0b..7799faec0 100644
--- a/e2fsprogs/fsck.c
+++ b/e2fsprogs/fsck.c
@@ -54,6 +54,50 @@
54#endif 54#endif
55 55
56/* 56/*
57 * fsck.h
58 */
59
60#ifndef DEFAULT_FSTYPE
61#define DEFAULT_FSTYPE "ext2"
62#endif
63
64#define MAX_DEVICES 32
65#define MAX_ARGS 32
66
67/*
68 * Internal structure for mount tabel entries.
69 */
70
71struct fs_info {
72 char *device;
73 char *mountpt;
74 char *type;
75 char *opts;
76 int freq;
77 int passno;
78 int flags;
79 struct fs_info *next;
80};
81
82#define FLAG_DONE 1
83#define FLAG_PROGRESS 2
84
85/*
86 * Structure to allow exit codes to be stored
87 */
88struct fsck_instance {
89 int pid;
90 int flags;
91 int exit_status;
92 time_t start_time;
93 char * prog;
94 char * type;
95 char * device;
96 char * base_device;
97 struct fsck_instance *next;
98};
99
100/*
57 * base_device.c 101 * base_device.c
58 * 102 *
59 * Return the "base device" given a particular device; this is used to 103 * Return the "base device" given a particular device; this is used to
diff --git a/e2fsprogs/fsck.h b/e2fsprogs/fsck.h
index 87914af3b..537b26619 100644
--- a/e2fsprogs/fsck.h
+++ b/e2fsprogs/fsck.h
@@ -2,18 +2,8 @@
2 * fsck.h 2 * fsck.h
3 */ 3 */
4 4
5#include <time.h>
6
7#define FSCK_ATTR(x) __attribute__(x) 5#define FSCK_ATTR(x) __attribute__(x)
8 6
9
10#ifndef DEFAULT_FSTYPE
11#define DEFAULT_FSTYPE "ext2"
12#endif
13
14#define MAX_DEVICES 32
15#define MAX_ARGS 32
16
17#define EXIT_OK 0 7#define EXIT_OK 0
18#define EXIT_NONDESTRUCT 1 8#define EXIT_NONDESTRUCT 1
19#define EXIT_DESTRUCT 2 9#define EXIT_DESTRUCT 2
@@ -21,36 +11,3 @@
21#define EXIT_ERROR 8 11#define EXIT_ERROR 8
22#define EXIT_USAGE 16 12#define EXIT_USAGE 16
23#define EXIT_LIBRARY 128 13#define EXIT_LIBRARY 128
24
25/*
26 * Internal structure for mount tabel entries.
27 */
28
29struct fs_info {
30 char *device;
31 char *mountpt;
32 char *type;
33 char *opts;
34 int freq;
35 int passno;
36 int flags;
37 struct fs_info *next;
38};
39
40#define FLAG_DONE 1
41#define FLAG_PROGRESS 2
42
43/*
44 * Structure to allow exit codes to be stored
45 */
46struct fsck_instance {
47 int pid;
48 int flags;
49 int exit_status;
50 time_t start_time;
51 char * prog;
52 char * type;
53 char * device;
54 char * base_device;
55 struct fsck_instance *next;
56};