1994-05-26 06:35:07 +00:00
|
|
|
/*
|
2002-06-21 06:18:05 +00:00
|
|
|
* Copyright (c) 2002 Networks Associates Technology, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This software was developed for the FreeBSD Project by Marshall
|
|
|
|
* Kirk McKusick and Network Associates Laboratories, the Security
|
|
|
|
* Research Division of Network Associates, Inc. under DARPA/SPAWAR
|
|
|
|
* contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS
|
2003-02-14 21:08:14 +00:00
|
|
|
* research program.
|
2002-06-21 06:18:05 +00:00
|
|
|
*
|
1994-05-26 06:35:07 +00:00
|
|
|
* Copyright (c) 1980, 1986, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
1997-03-11 12:20:21 +00:00
|
|
|
* @(#)fsck.h 8.4 (Berkeley) 5/9/95
|
2000-01-10 08:18:18 +00:00
|
|
|
* $FreeBSD$
|
1994-05-26 06:35:07 +00:00
|
|
|
*/
|
|
|
|
|
1997-03-11 12:20:21 +00:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
1994-05-26 06:35:07 +00:00
|
|
|
#define MAXDUP 10 /* limit on dup blks (per inode) */
|
|
|
|
#define MAXBAD 10 /* limit on bad blks (per inode) */
|
|
|
|
#define MAXBUFSPACE 40*1024 /* maximum space to allocate to buffers */
|
|
|
|
#define INOBUFSIZE 56*1024 /* size of buffer to read inodes in pass1 */
|
|
|
|
|
2002-06-21 06:18:05 +00:00
|
|
|
union dinode {
|
|
|
|
struct ufs1_dinode dp1;
|
|
|
|
struct ufs2_dinode dp2;
|
|
|
|
};
|
|
|
|
#define DIP(dp, field) \
|
|
|
|
((sblock.fs_magic == FS_UFS1_MAGIC) ? \
|
|
|
|
(dp)->dp1.field : (dp)->dp2.field)
|
|
|
|
|
2004-09-01 05:48:06 +00:00
|
|
|
#define DIP_SET(dp, field, val) do { \
|
|
|
|
if (sblock.fs_magic == FS_UFS1_MAGIC) \
|
|
|
|
(dp)->dp1.field = (val); \
|
|
|
|
else \
|
|
|
|
(dp)->dp2.field = (val); \
|
|
|
|
} while (0)
|
|
|
|
|
1998-12-03 02:27:35 +00:00
|
|
|
/*
|
2002-08-21 18:11:48 +00:00
|
|
|
* Each inode on the file system is described by the following structure.
|
1998-12-03 02:27:35 +00:00
|
|
|
* The linkcnt is initially set to the value in the inode. Each time it
|
|
|
|
* is found during the descent in passes 2, 3, and 4 the count is
|
|
|
|
* decremented. Any inodes whose count is non-zero after pass 4 needs to
|
|
|
|
* have its link count adjusted by the value remaining in ino_linkcnt.
|
|
|
|
*/
|
|
|
|
struct inostat {
|
|
|
|
char ino_state; /* state of inode, see below */
|
|
|
|
char ino_type; /* type of inode */
|
|
|
|
short ino_linkcnt; /* number of links not found */
|
|
|
|
};
|
|
|
|
/*
|
|
|
|
* Inode states.
|
|
|
|
*/
|
1994-05-26 06:35:07 +00:00
|
|
|
#define USTATE 01 /* inode not allocated */
|
|
|
|
#define FSTATE 02 /* inode is file */
|
|
|
|
#define DSTATE 03 /* inode is directory */
|
|
|
|
#define DFOUND 04 /* directory found during descent */
|
|
|
|
#define DCLEAR 05 /* directory is to be cleared */
|
|
|
|
#define FCLEAR 06 /* file is to be cleared */
|
1998-12-03 02:27:35 +00:00
|
|
|
/*
|
|
|
|
* Inode state information is contained on per cylinder group lists
|
|
|
|
* which are described by the following structure.
|
|
|
|
*/
|
|
|
|
struct inostatlist {
|
|
|
|
long il_numalloced; /* number of inodes allocated in this cg */
|
|
|
|
struct inostat *il_stat;/* inostat info for this cylinder group */
|
|
|
|
} *inostathead;
|
1994-05-26 06:35:07 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* buffer cache structure.
|
|
|
|
*/
|
|
|
|
struct bufarea {
|
1997-03-11 12:20:21 +00:00
|
|
|
struct bufarea *b_next; /* free list queue */
|
|
|
|
struct bufarea *b_prev; /* free list queue */
|
2002-06-21 06:18:05 +00:00
|
|
|
ufs2_daddr_t b_bno;
|
1997-03-11 12:20:21 +00:00
|
|
|
int b_size;
|
|
|
|
int b_errs;
|
|
|
|
int b_flags;
|
1994-05-26 06:35:07 +00:00
|
|
|
union {
|
1997-03-11 12:20:21 +00:00
|
|
|
char *b_buf; /* buffer space */
|
2002-06-21 06:18:05 +00:00
|
|
|
ufs1_daddr_t *b_indir1; /* UFS1 indirect block */
|
|
|
|
ufs2_daddr_t *b_indir2; /* UFS2 indirect block */
|
1997-03-11 12:20:21 +00:00
|
|
|
struct fs *b_fs; /* super block */
|
|
|
|
struct cg *b_cg; /* cylinder group */
|
2002-06-21 06:18:05 +00:00
|
|
|
struct ufs1_dinode *b_dinode1; /* UFS1 inode block */
|
|
|
|
struct ufs2_dinode *b_dinode2; /* UFS2 inode block */
|
1994-05-26 06:35:07 +00:00
|
|
|
} b_un;
|
1997-03-11 12:20:21 +00:00
|
|
|
char b_dirty;
|
1994-05-26 06:35:07 +00:00
|
|
|
};
|
2004-09-01 05:48:06 +00:00
|
|
|
|
2002-06-21 06:18:05 +00:00
|
|
|
#define IBLK(bp, i) \
|
|
|
|
((sblock.fs_magic == FS_UFS1_MAGIC) ? \
|
|
|
|
(bp)->b_un.b_indir1[i] : (bp)->b_un.b_indir2[i])
|
1994-05-26 06:35:07 +00:00
|
|
|
|
2004-09-01 05:48:06 +00:00
|
|
|
#define IBLK_SET(bp, i, val) do { \
|
|
|
|
if (sblock.fs_magic == FS_UFS1_MAGIC) \
|
|
|
|
(bp)->b_un.b_indir1[i] = (val); \
|
|
|
|
else \
|
|
|
|
(bp)->b_un.b_indir2[i] = (val); \
|
|
|
|
} while (0)
|
|
|
|
|
1994-05-26 06:35:07 +00:00
|
|
|
#define B_INUSE 1
|
|
|
|
|
|
|
|
#define MINBUFS 5 /* minimum number of buffers required */
|
|
|
|
struct bufarea bufhead; /* head of list of other blks in filesys */
|
2002-08-21 18:11:48 +00:00
|
|
|
struct bufarea sblk; /* file system superblock */
|
1994-05-26 06:35:07 +00:00
|
|
|
struct bufarea cgblk; /* cylinder group blocks */
|
|
|
|
struct bufarea *pdirbp; /* current directory contents */
|
|
|
|
struct bufarea *pbp; /* current inode block */
|
|
|
|
|
2001-11-17 23:48:21 +00:00
|
|
|
#define dirty(bp) do { \
|
2001-03-21 09:48:03 +00:00
|
|
|
if (fswritefd < 0) \
|
|
|
|
pfatal("SETTING DIRTY FLAG IN READ_ONLY MODE\n"); \
|
|
|
|
else \
|
2001-11-17 23:48:21 +00:00
|
|
|
(bp)->b_dirty = 1; \
|
|
|
|
} while (0)
|
|
|
|
#define initbarea(bp) do { \
|
1994-05-26 06:35:07 +00:00
|
|
|
(bp)->b_dirty = 0; \
|
2002-06-21 06:18:05 +00:00
|
|
|
(bp)->b_bno = (ufs2_daddr_t)-1; \
|
2001-11-17 23:48:21 +00:00
|
|
|
(bp)->b_flags = 0; \
|
|
|
|
} while (0)
|
1994-05-26 06:35:07 +00:00
|
|
|
|
2001-03-21 09:48:03 +00:00
|
|
|
#define sbdirty() dirty(&sblk)
|
|
|
|
#define cgdirty() dirty(&cgblk)
|
1994-05-26 06:35:07 +00:00
|
|
|
#define sblock (*sblk.b_un.b_fs)
|
|
|
|
#define cgrp (*cgblk.b_un.b_cg)
|
|
|
|
|
|
|
|
enum fixstate {DONTKNOW, NOFIX, FIX, IGNORE};
|
2000-07-06 02:03:11 +00:00
|
|
|
ino_t cursnapshot;
|
1994-05-26 06:35:07 +00:00
|
|
|
|
|
|
|
struct inodesc {
|
|
|
|
enum fixstate id_fix; /* policy on fixing errors */
|
2002-07-30 13:01:25 +00:00
|
|
|
int (*id_func)(struct inodesc *);
|
|
|
|
/* function to be applied to blocks of inode */
|
1994-05-26 06:35:07 +00:00
|
|
|
ino_t id_number; /* inode number described */
|
|
|
|
ino_t id_parent; /* for DATA nodes, their parent */
|
2002-06-21 06:18:05 +00:00
|
|
|
ufs_lbn_t id_lbn; /* logical block number of current block */
|
|
|
|
ufs2_daddr_t id_blkno; /* current block number being examined */
|
1994-05-26 06:35:07 +00:00
|
|
|
int id_numfrags; /* number of frags contained in block */
|
2002-06-21 06:18:05 +00:00
|
|
|
off_t id_filesize; /* for DATA nodes, the size of the directory */
|
|
|
|
ufs2_daddr_t id_entryno;/* for DATA nodes, current entry number */
|
1994-05-26 06:35:07 +00:00
|
|
|
int id_loc; /* for DATA nodes, current location in dir */
|
|
|
|
struct direct *id_dirp; /* for DATA nodes, ptr to current entry */
|
|
|
|
char *id_name; /* for DATA nodes, name to find or enter */
|
|
|
|
char id_type; /* type of descriptor, DATA or ADDR */
|
|
|
|
};
|
|
|
|
/* file types */
|
2000-07-06 02:03:11 +00:00
|
|
|
#define DATA 1 /* a directory */
|
|
|
|
#define SNAP 2 /* a snapshot */
|
|
|
|
#define ADDR 3 /* anything but a directory or a snapshot */
|
1994-05-26 06:35:07 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Linked list of duplicate blocks.
|
1995-05-30 06:12:45 +00:00
|
|
|
*
|
1994-05-26 06:35:07 +00:00
|
|
|
* The list is composed of two parts. The first part of the
|
|
|
|
* list (from duplist through the node pointed to by muldup)
|
1995-05-30 06:12:45 +00:00
|
|
|
* contains a single copy of each duplicate block that has been
|
1994-05-26 06:35:07 +00:00
|
|
|
* found. The second part of the list (from muldup to the end)
|
|
|
|
* contains duplicate blocks that have been found more than once.
|
|
|
|
* To check if a block has been found as a duplicate it is only
|
1995-05-30 06:12:45 +00:00
|
|
|
* necessary to search from duplist through muldup. To find the
|
1994-05-26 06:35:07 +00:00
|
|
|
* total number of times that a block has been found as a duplicate
|
|
|
|
* the entire list must be searched for occurences of the block
|
|
|
|
* in question. The following diagram shows a sample list where
|
|
|
|
* w (found twice), x (found once), y (found three times), and z
|
|
|
|
* (found once) are duplicate block numbers:
|
|
|
|
*
|
|
|
|
* w -> y -> x -> z -> y -> w -> y
|
|
|
|
* ^ ^
|
|
|
|
* | |
|
|
|
|
* duplist muldup
|
|
|
|
*/
|
|
|
|
struct dups {
|
|
|
|
struct dups *next;
|
2002-06-21 06:18:05 +00:00
|
|
|
ufs2_daddr_t dup;
|
1994-05-26 06:35:07 +00:00
|
|
|
};
|
|
|
|
struct dups *duplist; /* head of dup list */
|
|
|
|
struct dups *muldup; /* end of unique duplicate dup block numbers */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Linked list of inodes with zero link counts.
|
|
|
|
*/
|
|
|
|
struct zlncnt {
|
|
|
|
struct zlncnt *next;
|
|
|
|
ino_t zlncnt;
|
|
|
|
};
|
|
|
|
struct zlncnt *zlnhead; /* head of zero link count list */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Inode cache data structures.
|
|
|
|
*/
|
|
|
|
struct inoinfo {
|
|
|
|
struct inoinfo *i_nexthash; /* next entry in hash chain */
|
|
|
|
ino_t i_number; /* inode number of this entry */
|
|
|
|
ino_t i_parent; /* inode number of parent */
|
|
|
|
ino_t i_dotdot; /* inode number of `..' */
|
|
|
|
size_t i_isize; /* size of inode */
|
|
|
|
u_int i_numblks; /* size of block array in bytes */
|
2002-06-21 06:18:05 +00:00
|
|
|
ufs2_daddr_t i_blks[1]; /* actually longer */
|
1994-05-26 06:35:07 +00:00
|
|
|
} **inphead, **inpsort;
|
2000-02-28 20:02:41 +00:00
|
|
|
long numdirs, dirhash, listmax, inplast;
|
1998-12-03 02:27:35 +00:00
|
|
|
long countdirs; /* number of directories we actually found */
|
1994-05-26 06:35:07 +00:00
|
|
|
|
2001-03-21 09:48:03 +00:00
|
|
|
#define MIBSIZE 3 /* size of fsck sysctl MIBs */
|
|
|
|
int adjrefcnt[MIBSIZE]; /* MIB command to adjust inode reference cnt */
|
|
|
|
int adjblkcnt[MIBSIZE]; /* MIB command to adjust inode block count */
|
|
|
|
int freefiles[MIBSIZE]; /* MIB command to free a set of files */
|
|
|
|
int freedirs[MIBSIZE]; /* MIB command to free a set of directories */
|
|
|
|
int freeblks[MIBSIZE]; /* MIB command to free a set of data blocks */
|
2002-08-21 18:11:48 +00:00
|
|
|
struct fsck_cmd cmd; /* sysctl file system update commands */
|
2001-03-21 09:48:03 +00:00
|
|
|
char snapname[BUFSIZ]; /* when doing snapshots, the name of the file */
|
1994-05-26 06:35:07 +00:00
|
|
|
char *cdevname; /* name of device being checked */
|
|
|
|
long dev_bsize; /* computed value of DEV_BSIZE */
|
|
|
|
long secsize; /* actual disk sector size */
|
|
|
|
char nflag; /* assume a no response */
|
|
|
|
char yflag; /* assume a yes response */
|
2001-03-21 09:48:03 +00:00
|
|
|
int bkgrdflag; /* use a snapshot to run on an active system */
|
1994-05-26 06:35:07 +00:00
|
|
|
int bflag; /* location of alternate super block */
|
|
|
|
int debug; /* output debugging info */
|
2002-08-21 18:11:48 +00:00
|
|
|
int cvtlevel; /* convert to newer file system format */
|
2001-04-24 22:38:08 +00:00
|
|
|
int bkgrdcheck; /* determine if background check is possible */
|
1998-03-08 09:59:44 +00:00
|
|
|
char usedsoftdep; /* just fix soft dependency inconsistencies */
|
1994-05-26 06:35:07 +00:00
|
|
|
char preen; /* just fix normal inconsistencies */
|
1998-12-03 02:27:35 +00:00
|
|
|
char rerun; /* rerun fsck. Only used in non-preen mode */
|
|
|
|
int returntosingle; /* 1 => return to single user mode on exit */
|
|
|
|
char resolved; /* cleared if unresolved changes => not clean */
|
1994-05-26 06:35:07 +00:00
|
|
|
char havesb; /* superblock has been read */
|
2002-08-21 18:11:48 +00:00
|
|
|
char skipclean; /* skip clean file systems if preening */
|
|
|
|
int fsmodified; /* 1 => write done to file system */
|
|
|
|
int fsreadfd; /* file descriptor for reading file system */
|
|
|
|
int fswritefd; /* file descriptor for writing file system */
|
1994-05-26 06:35:07 +00:00
|
|
|
|
2002-08-21 18:11:48 +00:00
|
|
|
ufs2_daddr_t maxfsblock; /* number of blocks in the file system */
|
1994-05-26 06:35:07 +00:00
|
|
|
char *blockmap; /* ptr to primary blk allocation map */
|
2002-08-21 18:11:48 +00:00
|
|
|
ino_t maxino; /* number of inodes in file system */
|
1994-05-26 06:35:07 +00:00
|
|
|
|
|
|
|
ino_t lfdir; /* lost & found directory inode number */
|
2002-07-30 13:01:25 +00:00
|
|
|
const char *lfname; /* lost & found directory name */
|
1994-05-26 06:35:07 +00:00
|
|
|
int lfmode; /* lost & found directory creation mode */
|
|
|
|
|
2002-06-21 06:18:05 +00:00
|
|
|
ufs2_daddr_t n_blks; /* number of blocks in use */
|
|
|
|
ino_t n_files; /* number of files in use */
|
1994-05-26 06:35:07 +00:00
|
|
|
|
2000-12-15 14:23:55 +00:00
|
|
|
int got_siginfo; /* received a SIGINFO */
|
2004-02-28 07:50:42 +00:00
|
|
|
int got_sigalarm; /* received a SIGALRM */
|
2000-12-15 14:23:55 +00:00
|
|
|
|
2002-06-21 06:18:05 +00:00
|
|
|
#define clearinode(dp) \
|
|
|
|
if (sblock.fs_magic == FS_UFS1_MAGIC) { \
|
|
|
|
(dp)->dp1 = ufs1_zino; \
|
|
|
|
} else { \
|
|
|
|
(dp)->dp2 = ufs2_zino; \
|
|
|
|
}
|
|
|
|
struct ufs1_dinode ufs1_zino;
|
|
|
|
struct ufs2_dinode ufs2_zino;
|
1994-05-26 06:35:07 +00:00
|
|
|
|
|
|
|
#define setbmap(blkno) setbit(blockmap, blkno)
|
|
|
|
#define testbmap(blkno) isset(blockmap, blkno)
|
|
|
|
#define clrbmap(blkno) clrbit(blockmap, blkno)
|
|
|
|
|
|
|
|
#define STOP 0x01
|
|
|
|
#define SKIP 0x02
|
|
|
|
#define KEEPON 0x04
|
|
|
|
#define ALTERED 0x08
|
|
|
|
#define FOUND 0x10
|
|
|
|
|
1997-03-11 12:20:21 +00:00
|
|
|
#define EEXIT 8 /* Standard error exit. */
|
|
|
|
|
|
|
|
struct fstab;
|
|
|
|
|
1998-12-03 02:27:35 +00:00
|
|
|
|
2002-03-20 22:57:10 +00:00
|
|
|
void adjust(struct inodesc *, int lcnt);
|
2002-06-21 06:18:05 +00:00
|
|
|
ufs2_daddr_t allocblk(long frags);
|
2002-03-20 22:57:10 +00:00
|
|
|
ino_t allocdir(ino_t parent, ino_t request, int mode);
|
|
|
|
ino_t allocino(ino_t request, int type);
|
2002-07-30 13:01:25 +00:00
|
|
|
void blkerror(ino_t ino, const char *type, ufs2_daddr_t blk);
|
2002-03-20 22:57:10 +00:00
|
|
|
char *blockcheck(char *name);
|
2002-06-21 06:18:05 +00:00
|
|
|
int bread(int fd, char *buf, ufs2_daddr_t blk, long size);
|
2002-03-20 22:57:10 +00:00
|
|
|
void bufinit(void);
|
2002-06-21 06:18:05 +00:00
|
|
|
void bwrite(int fd, char *buf, ufs2_daddr_t blk, long size);
|
|
|
|
void cacheino(union dinode *dp, ino_t inumber);
|
2002-03-20 22:57:10 +00:00
|
|
|
void catch(int);
|
|
|
|
void catchquit(int);
|
2002-07-30 13:01:25 +00:00
|
|
|
int changeino(ino_t dir, const char *name, ino_t newnum);
|
2002-06-21 06:18:05 +00:00
|
|
|
int chkrange(ufs2_daddr_t blk, int cnt);
|
2002-03-20 22:57:10 +00:00
|
|
|
void ckfini(int markclean);
|
2002-06-21 06:18:05 +00:00
|
|
|
int ckinode(union dinode *dp, struct inodesc *);
|
2002-07-30 13:01:25 +00:00
|
|
|
void clri(struct inodesc *, const char *type, int flag);
|
2002-03-20 22:57:10 +00:00
|
|
|
int clearentry(struct inodesc *);
|
2002-07-30 13:01:25 +00:00
|
|
|
void direrror(ino_t ino, const char *errmesg);
|
2002-03-20 22:57:10 +00:00
|
|
|
int dirscan(struct inodesc *);
|
2002-07-30 13:01:25 +00:00
|
|
|
int dofix(struct inodesc *, const char *msg);
|
2002-09-16 11:27:47 +00:00
|
|
|
int eascan(struct inodesc *, struct ufs2_dinode *dp);
|
2002-06-21 06:18:05 +00:00
|
|
|
void ffs_clrblock(struct fs *, u_char *, ufs1_daddr_t);
|
2002-03-20 22:57:10 +00:00
|
|
|
void ffs_fragacct(struct fs *, int, int32_t [], int);
|
2002-06-21 06:18:05 +00:00
|
|
|
int ffs_isblock(struct fs *, u_char *, ufs1_daddr_t);
|
|
|
|
void ffs_setblock(struct fs *, u_char *, ufs1_daddr_t);
|
2002-07-30 13:01:25 +00:00
|
|
|
void fileerror(ino_t cwd, ino_t ino, const char *errmesg);
|
2002-03-20 22:57:10 +00:00
|
|
|
int findino(struct inodesc *);
|
|
|
|
int findname(struct inodesc *);
|
|
|
|
void flush(int fd, struct bufarea *bp);
|
2002-06-21 06:18:05 +00:00
|
|
|
void freeblk(ufs2_daddr_t blkno, long frags);
|
2002-03-20 22:57:10 +00:00
|
|
|
void freeino(ino_t ino);
|
|
|
|
void freeinodebuf(void);
|
2002-06-21 06:18:05 +00:00
|
|
|
int ftypeok(union dinode *dp);
|
|
|
|
void getblk(struct bufarea *bp, ufs2_daddr_t blk, long size);
|
|
|
|
struct bufarea *getdatablk(ufs2_daddr_t blkno, long size);
|
2002-03-20 22:57:10 +00:00
|
|
|
struct inoinfo *getinoinfo(ino_t inumber);
|
2002-06-21 06:18:05 +00:00
|
|
|
union dinode *getnextinode(ino_t inumber);
|
2002-03-20 22:57:10 +00:00
|
|
|
void getpathname(char *namebuf, ino_t curdir, ino_t ino);
|
2002-06-21 06:18:05 +00:00
|
|
|
union dinode *ginode(ino_t inumber);
|
2002-03-20 22:57:10 +00:00
|
|
|
void infohandler(int sig);
|
2004-02-28 07:50:42 +00:00
|
|
|
void alarmhandler(int sig);
|
2002-03-20 22:57:10 +00:00
|
|
|
void inocleanup(void);
|
|
|
|
void inodirty(void);
|
|
|
|
struct inostat *inoinfo(ino_t inum);
|
|
|
|
int linkup(ino_t orphan, ino_t parentdir, char *name);
|
2002-07-30 13:01:25 +00:00
|
|
|
int makeentry(ino_t parent, ino_t ino, const char *name);
|
2002-03-20 22:57:10 +00:00
|
|
|
void panic(const char *fmt, ...) __printflike(1, 2);
|
|
|
|
void pass1(void);
|
|
|
|
void pass1b(void);
|
|
|
|
int pass1check(struct inodesc *);
|
|
|
|
void pass2(void);
|
|
|
|
void pass3(void);
|
|
|
|
void pass4(void);
|
|
|
|
int pass4check(struct inodesc *);
|
|
|
|
void pass5(void);
|
|
|
|
void pfatal(const char *fmt, ...) __printflike(1, 2);
|
|
|
|
void pinode(ino_t ino);
|
|
|
|
void propagate(void);
|
|
|
|
void pwarn(const char *fmt, ...) __printflike(1, 2);
|
|
|
|
int readsb(int listerr);
|
2002-07-30 13:01:25 +00:00
|
|
|
int reply(const char *question);
|
|
|
|
void rwerror(const char *mesg, ufs2_daddr_t blk);
|
2002-03-20 22:57:10 +00:00
|
|
|
void sblock_init(void);
|
|
|
|
void setinodebuf(ino_t);
|
|
|
|
int setup(char *dev);
|