]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blame - e2fsck/e2fsck.h
Many files:
[thirdparty/e2fsprogs.git] / e2fsck / e2fsck.h
CommitLineData
3839e657
TT
1/*
2 * e2fsck.h
3 *
4 * Copyright (C) 1993, 1994 Theodore Ts'o. This file may be
5 * redistributed under the terms of the GNU Public License.
6 *
7 */
8
9#include <stdio.h>
10#include <string.h>
11#include <unistd.h>
12#include <stdlib.h>
13#include <sys/stat.h>
14#include <sys/types.h>
15#include <sys/time.h>
16
17#include <linux/fs.h>
18#include <linux/ext2_fs.h>
19
20#include "ext2fs/ext2fs.h"
21
22#ifdef __STDC__
23#define NOARGS void
24#else
25#define NOARGS
26#define const
27#endif
28
29/*
30 * Exit codes used by fsck-type programs
31 */
32#define FSCK_OK 0 /* No errors */
33#define FSCK_NONDESTRUCT 1 /* File system errors corrected */
34#define FSCK_REBOOT 2 /* System should be rebooted */
35#define FSCK_UNCORRECTED 4 /* File system errors left uncorrected */
36#define FSCK_ERROR 8 /* Operational error */
37#define FSCK_USAGE 16 /* Usage or syntax error */
38#define FSCK_LIBRARY 128 /* Shared library error */
39
40/*
41 * Inode count arrays
42 */
43extern unsigned short * inode_count;
44extern unsigned short * inode_link_info;
45
46/*
47 * The directory information structure; stores directory information
48 * collected in earlier passes, to avoid disk i/o in fetching the
49 * directoryt information.
50 */
51struct dir_info {
52 ino_t ino; /* Inode number */
53 ino_t dotdot; /* Parent according to '..' */
54 ino_t parent; /* Parent according to treewalk */
55};
56
57struct dir_block_struct {
58 ino_t ino;
59 blk_t blk;
60 int blockcnt;
61};
62
63struct dir_block_struct *dir_blocks;
64int dir_block_count;
65int dir_block_size;
66
67/*
68 * This structure is used for keeping track of how much resources have
69 * been used for a particular pass of e2fsck.
70 */
71struct resource_track {
72 struct timeval time_start;
73 struct timeval user_start;
74 struct timeval system_start;
75 void *brk_start;
76};
77
78/*
79 * Variables
80 */
81extern const char * program_name;
82extern const char * device_name;
83
84extern char * inode_used_map; /* Inodes which are in use */
85extern char * inode_bad_map; /* Inodes which are bad in some way */
86extern char * inode_dir_map; /* Inodes which are directories */
87
88extern char * block_found_map; /* Blocks which are used by an inode */
89extern char * block_dup_map; /* Blocks which are used by more than once */
90
91extern const char *fix_msg[2]; /* Fixed or ignored! */
92extern const char *clear_msg[2]; /* Cleared or ignored! */
93
94/* Command line options */
95extern int nflag;
96extern int yflag;
97extern int tflag;
98extern int preen;
99extern int verbose;
100extern int list;
101extern int debug;
102extern int force;
103
104extern int rwflag;
105
106extern int inode_buffer_blocks;
107extern int process_inode_size;
108extern int directory_blocks;
109
110extern int no_bad_inode;
111extern int no_lpf;
112extern int lpf_corrupted;
113
114/* Files counts */
115extern int fs_directory_count;
116extern int fs_regular_count;
117extern int fs_blockdev_count;
118extern int fs_chardev_count;
119extern int fs_links_count;
120extern int fs_symlinks_count;
121extern int fs_fast_symlinks_count;
122extern int fs_fifo_count;
123extern int fs_total_count;
124extern int fs_badblocks_count;
125extern int fs_sockets_count;
126
127extern struct resource_track global_rtrack;
128
129/*
130 * Procedure declarations
131 */
132
133extern void pass1(ext2_filsys fs);
134extern void pass1_dupblocks(ext2_filsys fs, char *block_buf);
135extern void pass2(ext2_filsys fs);
136extern void pass3(ext2_filsys fs);
137extern void pass4(ext2_filsys fs);
138extern void pass5(ext2_filsys fs);
139
140/* badblock.c */
141extern void read_bad_blocks_file(ext2_filsys fs, const char *bad_blocks_file,
142 int replace_bad_blocks);
143extern void test_disk(ext2_filsys fs);
144
145/* dirinfo.c */
146extern void add_dir_info(ext2_filsys fs, ino_t ino, ino_t parent,
147 struct ext2_inode *inode);
148extern struct dir_info *get_dir_info(ino_t ino);
149extern void free_dir_info(ext2_filsys fs);
150extern int get_num_dirs(ext2_filsys fs);
151
152/* ehandler.c */
153extern const char *ehandler_operation(const char *op);
154extern void ehandler_init(io_channel channel);
155
156/* util.c */
157extern void *allocate_memory(int size, const char *description);
158extern int ask(const char * string, int def);
159extern int ask_yn(const char * string, int def);
160extern void fatal_error (const char * fmt_string);
161extern void read_bitmaps(ext2_filsys fs);
162extern void write_bitmaps(ext2_filsys fs);
163extern void preenhalt(NOARGS);
164extern void print_resource_track(struct resource_track *track);
165extern void init_resource_track(struct resource_track *track);
166extern int inode_has_valid_blocks(struct ext2_inode *inode);
167#ifdef MTRACE
168extern void mtrace_print(char *mesg);
169#endif
170
171#define die(str) fatal_error(str)
172
173/*
174 * pass3.c
175 */
176extern int reconnect_file(ext2_filsys fs, ino_t inode);