summaryrefslogtreecommitdiff
path: root/sbin/fsck_ext2fs
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2011-03-12 17:50:49 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2011-03-12 17:50:49 +0000
commitf842ead901ce4d71629b6c571804465018cc4ff5 (patch)
treeda9fbf56a67f9c0c0ec624e4717156fd4703735e /sbin/fsck_ext2fs
parenta5d4226ce777c2ed322ff8770686daab6f7af054 (diff)
These utilities can currently only operate with a 32-bit block number range,
so use daddr32_t ok jasper
Diffstat (limited to 'sbin/fsck_ext2fs')
-rw-r--r--sbin/fsck_ext2fs/dir.c8
-rw-r--r--sbin/fsck_ext2fs/extern.h12
-rw-r--r--sbin/fsck_ext2fs/fsck.h26
-rw-r--r--sbin/fsck_ext2fs/inode.c18
-rw-r--r--sbin/fsck_ext2fs/main.c4
-rw-r--r--sbin/fsck_ext2fs/pass1.c10
-rw-r--r--sbin/fsck_ext2fs/pass1b.c4
-rw-r--r--sbin/fsck_ext2fs/pass4.c4
-rw-r--r--sbin/fsck_ext2fs/pass5.c6
-rw-r--r--sbin/fsck_ext2fs/setup.c6
-rw-r--r--sbin/fsck_ext2fs/utilities.c18
11 files changed, 58 insertions, 58 deletions
diff --git a/sbin/fsck_ext2fs/dir.c b/sbin/fsck_ext2fs/dir.c
index 1550ce7275d..e851aba8845 100644
--- a/sbin/fsck_ext2fs/dir.c
+++ b/sbin/fsck_ext2fs/dir.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dir.c,v 1.14 2006/03/20 21:35:37 dhill Exp $ */
+/* $OpenBSD: dir.c,v 1.15 2011/03/12 17:50:46 deraadt Exp $ */
/* $NetBSD: dir.c,v 1.5 2000/01/28 16:01:46 bouyer Exp $ */
/*
@@ -60,7 +60,7 @@ struct ext2fs_dirtemplate dirhead = {
static int expanddir(struct ext2fs_dinode *, char *);
static void freedir(ino_t, ino_t);
static struct ext2fs_direct *fsck_readdir(struct inodesc *);
-static struct bufarea *getdirblk(daddr_t, long);
+static struct bufarea *getdirblk(daddr32_t, long);
static int lftempname(char *, ino_t);
static int mkentry(struct inodesc *);
static int chgino(struct inodesc *);
@@ -511,7 +511,7 @@ makeentry(ino_t parent, ino_t ino, char *name)
static int
expanddir(struct ext2fs_dinode *dp, char *name)
{
- daddr_t lastbn, newblk;
+ daddr32_t lastbn, newblk;
struct bufarea *bp;
char *firstblk;
@@ -671,7 +671,7 @@ lftempname(char *bufp, ino_t ino)
* Insure that it is held until another is requested.
*/
static struct bufarea *
-getdirblk(daddr_t blkno, long size)
+getdirblk(daddr32_t blkno, long size)
{
if (pdirbp != 0)
diff --git a/sbin/fsck_ext2fs/extern.h b/sbin/fsck_ext2fs/extern.h
index 091af9875d7..3240d250eb0 100644
--- a/sbin/fsck_ext2fs/extern.h
+++ b/sbin/fsck_ext2fs/extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: extern.h,v 1.6 2005/04/30 13:56:16 niallo Exp $ */
+/* $OpenBSD: extern.h,v 1.7 2011/03/12 17:50:47 deraadt Exp $ */
/* $NetBSD: extern.h,v 1.1 1997/06/11 11:21:46 bouyer Exp $ */
/*
@@ -29,13 +29,13 @@
void adjust(struct inodesc *, short);
int allocblk(void);
int allocdir(ino_t, ino_t, int);
-void blkerror(ino_t, char *, daddr_t);
-int bread(int, char *, daddr_t, long);
+void blkerror(ino_t, char *, daddr32_t);
+int bread(int, char *, daddr32_t, long);
void bufinit(void);
-void bwrite(int, char *, daddr_t, long);
+void bwrite(int, char *, daddr32_t, long);
void cacheino(struct ext2fs_dinode *, ino_t);
int changeino(ino_t, char *, ino_t);
-int chkrange(daddr_t, int);
+int chkrange(daddr32_t, int);
void ckfini(int);
int ckinode(struct ext2fs_dinode *, struct inodesc *);
void clri(struct inodesc *, char *, int);
@@ -47,7 +47,7 @@ void fileerror(ino_t, ino_t, char *);
int findino(struct inodesc *);
int findname(struct inodesc *);
void flush(int, struct bufarea *);
-void freeblk(daddr_t);
+void freeblk(daddr32_t);
void freeino(ino_t);
void freeinodebuf(void);
int ftypeok(struct ext2fs_dinode *);
diff --git a/sbin/fsck_ext2fs/fsck.h b/sbin/fsck_ext2fs/fsck.h
index 88a54cd1f6c..8b469c925b1 100644
--- a/sbin/fsck_ext2fs/fsck.h
+++ b/sbin/fsck_ext2fs/fsck.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: fsck.h,v 1.9 2005/04/30 13:56:16 niallo Exp $ */
+/* $OpenBSD: fsck.h,v 1.10 2011/03/12 17:50:47 deraadt Exp $ */
/* $NetBSD: fsck.h,v 1.1 1997/06/11 11:21:47 bouyer Exp $ */
/*
@@ -55,13 +55,13 @@
struct bufarea {
struct bufarea *b_next; /* free list queue */
struct bufarea *b_prev; /* free list queue */
- daddr_t b_bno;
+ daddr32_t b_bno;
int b_size;
int b_errs;
int b_flags;
union {
char *b_buf; /* buffer space */
- daddr_t *b_indir; /* indirect block */
+ daddr32_t *b_indir; /* indirect block */
struct ext2fs *b_fs; /* super block */
struct ext2_gd *b_cgd; /* cylinder group descriptor */
struct ext2fs_dinode *b_dinode; /* inode block */
@@ -77,13 +77,13 @@ struct bufarea sblk; /* file system superblock */
struct bufarea asblk; /* first alternate superblock */
struct bufarea *pdirbp; /* current directory contents */
struct bufarea *pbp; /* current inode block */
-struct bufarea *getdatablk(daddr_t, long);
+struct bufarea *getdatablk(daddr32_t, long);
struct m_ext2fs sblock;
#define dirty(bp) (bp)->b_dirty = 1
#define initbarea(bp) \
(bp)->b_dirty = 0; \
- (bp)->b_bno = (daddr_t)-1; \
+ (bp)->b_bno = (daddr32_t)-1; \
(bp)->b_flags = 0;
#define sbdirty() copyback_sb(&sblk); sblk.b_dirty = 1
@@ -96,7 +96,7 @@ struct inodesc {
(struct inodesc *);
ino_t id_number; /* inode number described */
ino_t id_parent; /* for DATA nodes, their parent */
- daddr_t id_blkno; /* current block number being examined */
+ daddr32_t id_blkno; /* current block number being examined */
int id_numfrags; /* number of frags contained in block */
quad_t id_filesize; /* for DATA nodes, the size of the directory */
int id_loc; /* for DATA nodes, current location in dir */
@@ -132,7 +132,7 @@ struct inodesc {
*/
struct dups {
struct dups *next;
- daddr_t dup;
+ daddr32_t dup;
};
struct dups *duplist; /* head of dup list */
struct dups *muldup; /* end of unique duplicate dup block numbers */
@@ -157,7 +157,7 @@ struct inoinfo {
ino_t i_dotdot; /* inode number of `..' */
u_int64_t i_isize; /* size of inode */
u_int i_numblks; /* size of block array in bytes */
- daddr_t i_blks[1]; /* actually longer */
+ daddr32_t i_blks[1]; /* actually longer */
} **inphead, **inpsort;
long numdirs, listmax, inplast;
@@ -175,7 +175,7 @@ int fsreadfd; /* file descriptor for reading file system */
int fswritefd; /* file descriptor for writing file system */
int rerun; /* rerun fsck. Only used in non-preen mode */
-daddr_t maxfsblock; /* number of blocks in the file system */
+daddr32_t maxfsblock; /* number of blocks in the file system */
char *blockmap; /* ptr to primary blk allocation map */
ino_t maxino; /* number of inodes in file system */
ino_t lastino; /* last inode in use */
@@ -187,8 +187,8 @@ ino_t lfdir; /* lost & found directory inode number */
char *lfname; /* lost & found directory name */
int lfmode; /* lost & found directory creation mode */
-daddr_t n_blks; /* number of blocks in use */
-daddr_t n_files; /* number of files in use */
+daddr32_t n_blks; /* number of blocks in use */
+daddr32_t n_files; /* number of files in use */
#define clearinode(dp) (*(dp) = zino)
struct ext2fs_dinode zino;
@@ -205,7 +205,7 @@ struct ext2fs_dinode zino;
struct ext2fs_dinode *ginode(ino_t);
struct inoinfo *getinoinfo(ino_t);
-void getblk(struct bufarea *, daddr_t, long);
+void getblk(struct bufarea *, daddr32_t, long);
ino_t allocino(ino_t, int);
void copyback_sb(struct bufarea*);
-daddr_t cgoverhead(int); /* overhead per cg */
+daddr32_t cgoverhead(int); /* overhead per cg */
diff --git a/sbin/fsck_ext2fs/inode.c b/sbin/fsck_ext2fs/inode.c
index 5d2419490b0..713f0fd7407 100644
--- a/sbin/fsck_ext2fs/inode.c
+++ b/sbin/fsck_ext2fs/inode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inode.c,v 1.16 2005/10/06 17:43:13 pedro Exp $ */
+/* $OpenBSD: inode.c,v 1.17 2011/03/12 17:50:47 deraadt Exp $ */
/* $NetBSD: inode.c,v 1.8 2000/01/28 16:01:46 bouyer Exp $ */
/*
@@ -198,8 +198,8 @@ ckinode(struct ext2fs_dinode *dp, struct inodesc *idesc)
static int
iblock(struct inodesc *idesc, long ilevel, u_int64_t isize)
{
- daddr_t *ap;
- daddr_t *aplim;
+ daddr32_t *ap;
+ daddr32_t *aplim;
struct bufarea *bp;
int i, n, (*func)(struct inodesc *), nif;
u_int64_t sizepb;
@@ -281,7 +281,7 @@ iblock(struct inodesc *idesc, long ilevel, u_int64_t isize)
* Return 0 if in range, 1 if out of range.
*/
int
-chkrange(daddr_t blk, int cnt)
+chkrange(daddr32_t blk, int cnt)
{
int c, overh;
@@ -326,7 +326,7 @@ chkrange(daddr_t blk, int cnt)
struct ext2fs_dinode *
ginode(ino_t inumber)
{
- daddr_t iblk;
+ daddr32_t iblk;
if ((inumber < EXT2_FIRSTINO && inumber != EXT2_ROOTINO)
|| inumber > maxino)
@@ -354,7 +354,7 @@ struct ext2fs_dinode *
getnextinode(ino_t inumber)
{
long size;
- daddr_t dblk;
+ daddr32_t dblk;
static struct ext2fs_dinode *dp;
if (inumber != nextino++ || inumber > maxino)
@@ -429,7 +429,7 @@ cacheino(struct ext2fs_dinode *dp, ino_t inumber)
if (blks > NDADDR)
blks = NDADDR + NIADDR;
inp = (struct inoinfo *)
- malloc(sizeof(*inp) + (blks - 1) * sizeof(daddr_t));
+ malloc(sizeof(*inp) + (blks - 1) * sizeof(daddr32_t));
if (inp == NULL)
return;
inpp = &inphead[inumber % numdirs];
@@ -443,7 +443,7 @@ cacheino(struct ext2fs_dinode *dp, ino_t inumber)
inp->i_dotdot = (ino_t)0;
inp->i_number = inumber;
inp->i_isize = inosize(dp);
- inp->i_numblks = blks * sizeof(daddr_t);
+ inp->i_numblks = blks * sizeof(daddr32_t);
memcpy(&inp->i_blks[0], &dp->e2di_blocks[0], (size_t)inp->i_numblks);
if (inplast == listmax) {
listmax += 100;
@@ -579,7 +579,7 @@ pinode(ino_t ino)
}
void
-blkerror(ino_t ino, char *type, daddr_t blk)
+blkerror(ino_t ino, char *type, daddr32_t blk)
{
pfatal("%d %s I=%u", blk, type, ino);
diff --git a/sbin/fsck_ext2fs/main.c b/sbin/fsck_ext2fs/main.c
index e12aa0c1d1b..ed29021b76d 100644
--- a/sbin/fsck_ext2fs/main.c
+++ b/sbin/fsck_ext2fs/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.17 2010/08/12 15:26:34 jsing Exp $ */
+/* $OpenBSD: main.c,v 1.18 2011/03/12 17:50:47 deraadt Exp $ */
/* $NetBSD: main.c,v 1.1 1997/06/11 11:21:50 bouyer Exp $ */
/*
@@ -146,7 +146,7 @@ argtoi(int flag, char *req, char *str, int base)
static int
checkfilesys(char *filesys, char *mntpt, long auxdata, int child)
{
- daddr_t n_bfree;
+ daddr32_t n_bfree;
struct dups *dp;
struct zlncnt *zlnp;
int i;
diff --git a/sbin/fsck_ext2fs/pass1.c b/sbin/fsck_ext2fs/pass1.c
index e32a79030eb..eb414b741f6 100644
--- a/sbin/fsck_ext2fs/pass1.c
+++ b/sbin/fsck_ext2fs/pass1.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pass1.c,v 1.11 2005/04/30 13:56:16 niallo Exp $ */
+/* $OpenBSD: pass1.c,v 1.12 2011/03/12 17:50:47 deraadt Exp $ */
/* $NetBSD: pass1.c,v 1.9 2000/01/31 11:40:12 bouyer Exp $ */
/*
@@ -48,8 +48,8 @@
#include "extern.h"
#include "fsutil.h"
-static daddr_t badblk;
-static daddr_t dupblk;
+static daddr32_t badblk;
+static daddr32_t dupblk;
static void checkinode(ino_t, struct inodesc *);
void
@@ -57,7 +57,7 @@ pass1(void)
{
ino_t inumber;
int c, i;
- daddr_t dbase;
+ daddr32_t dbase;
struct inodesc idesc;
/*
@@ -289,7 +289,7 @@ pass1check(struct inodesc *idesc)
{
int res = KEEPON;
int anyout, nfrags;
- daddr_t blkno = idesc->id_blkno;
+ daddr32_t blkno = idesc->id_blkno;
struct dups *dlp;
struct dups *new;
diff --git a/sbin/fsck_ext2fs/pass1b.c b/sbin/fsck_ext2fs/pass1b.c
index dd4bc37d655..e650e2f4920 100644
--- a/sbin/fsck_ext2fs/pass1b.c
+++ b/sbin/fsck_ext2fs/pass1b.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pass1b.c,v 1.7 2003/06/11 06:22:13 deraadt Exp $ */
+/* $OpenBSD: pass1b.c,v 1.8 2011/03/12 17:50:47 deraadt Exp $ */
/* $NetBSD: pass1b.c,v 1.2 1997/09/14 14:27:26 lukem Exp $ */
/*
@@ -76,7 +76,7 @@ pass1bcheck(struct inodesc *idesc)
{
struct dups *dlp;
int nfrags, res = KEEPON;
- daddr_t blkno = idesc->id_blkno;
+ daddr32_t blkno = idesc->id_blkno;
for (nfrags = idesc->id_numfrags; nfrags > 0; blkno++, nfrags--) {
if (chkrange(blkno, 1))
diff --git a/sbin/fsck_ext2fs/pass4.c b/sbin/fsck_ext2fs/pass4.c
index 6c363d268c9..bfafea56085 100644
--- a/sbin/fsck_ext2fs/pass4.c
+++ b/sbin/fsck_ext2fs/pass4.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pass4.c,v 1.7 2005/04/30 13:56:16 niallo Exp $ */
+/* $OpenBSD: pass4.c,v 1.8 2011/03/12 17:50:47 deraadt Exp $ */
/* $NetBSD: pass4.c,v 1.2 1997/09/14 14:27:29 lukem Exp $ */
/*
@@ -108,7 +108,7 @@ pass4check(struct inodesc *idesc)
{
struct dups *dlp;
int nfrags, res = KEEPON;
- daddr_t blkno = idesc->id_blkno;
+ daddr32_t blkno = idesc->id_blkno;
for (nfrags = idesc->id_numfrags; nfrags > 0; blkno++, nfrags--) {
if (chkrange(blkno, 1)) {
diff --git a/sbin/fsck_ext2fs/pass5.c b/sbin/fsck_ext2fs/pass5.c
index a08e408ba6f..d21aaf34068 100644
--- a/sbin/fsck_ext2fs/pass5.c
+++ b/sbin/fsck_ext2fs/pass5.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pass5.c,v 1.13 2006/03/20 21:35:37 dhill Exp $ */
+/* $OpenBSD: pass5.c,v 1.14 2011/03/12 17:50:47 deraadt Exp $ */
/* $NetBSD: pass5.c,v 1.7 2000/01/28 16:01:46 bouyer Exp $ */
/*
@@ -53,8 +53,8 @@ pass5(void)
{
int c;
struct m_ext2fs *fs = &sblock;
- daddr_t dbase, dmax;
- daddr_t d;
+ daddr32_t dbase, dmax;
+ daddr32_t d;
long i, j;
struct inodesc idesc[3];
struct bufarea *ino_bitmap = NULL, *blk_bitmap = NULL;
diff --git a/sbin/fsck_ext2fs/setup.c b/sbin/fsck_ext2fs/setup.c
index f8cb851ae1f..678f767fe5a 100644
--- a/sbin/fsck_ext2fs/setup.c
+++ b/sbin/fsck_ext2fs/setup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: setup.c,v 1.17 2010/05/18 04:41:14 dlg Exp $ */
+/* $OpenBSD: setup.c,v 1.18 2011/03/12 17:50:47 deraadt Exp $ */
/* $NetBSD: setup.c,v 1.1 1997/06/11 11:22:01 bouyer Exp $ */
/*
@@ -253,7 +253,7 @@ badsblabel:
static int
readsb(int listerr)
{
- daddr_t super = bflag ? bflag : SBOFF / dev_bsize;
+ daddr32_t super = bflag ? bflag : SBOFF / dev_bsize;
if (bread(fsreadfd, (char *)sblk.b_un.b_fs, super, (long)SBSIZE) != 0)
return (0);
@@ -480,7 +480,7 @@ getdisklabel(char *s, int fd)
return (&lab);
}
-daddr_t
+daddr32_t
cgoverhead(int c)
{
int overh;
diff --git a/sbin/fsck_ext2fs/utilities.c b/sbin/fsck_ext2fs/utilities.c
index 1e5c735fd52..81f74d0521b 100644
--- a/sbin/fsck_ext2fs/utilities.c
+++ b/sbin/fsck_ext2fs/utilities.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: utilities.c,v 1.18 2009/12/10 16:01:50 deraadt Exp $ */
+/* $OpenBSD: utilities.c,v 1.19 2011/03/12 17:50:47 deraadt Exp $ */
/* $NetBSD: utilities.c,v 1.6 2001/02/04 21:19:34 christos Exp $ */
/*
@@ -50,7 +50,7 @@
long diskreads, totalreads; /* Disk cache statistics */
-static void rwerror(char *, daddr_t);
+static void rwerror(char *, daddr32_t);
int
ftypeok(struct ext2fs_dinode *dp)
@@ -149,7 +149,7 @@ bufinit(void)
* Manage a cache of directory blocks.
*/
struct bufarea *
-getdatablk(daddr_t blkno, long size)
+getdatablk(daddr32_t blkno, long size)
{
struct bufarea *bp;
@@ -177,9 +177,9 @@ foundit:
}
void
-getblk(struct bufarea *bp, daddr_t blk, long size)
+getblk(struct bufarea *bp, daddr32_t blk, long size)
{
- daddr_t dblk;
+ daddr32_t dblk;
dblk = fsbtodb(&sblock, blk);
if (bp->b_bno != dblk) {
@@ -216,7 +216,7 @@ flush(int fd, struct bufarea *bp)
}
static void
-rwerror(char *mesg, daddr_t blk)
+rwerror(char *mesg, daddr32_t blk)
{
if (preen == 0)
@@ -278,7 +278,7 @@ ckfini(int markclean)
}
int
-bread(int fd, char *buf, daddr_t blk, long size)
+bread(int fd, char *buf, daddr32_t blk, long size)
{
char *cp;
int i, errs;
@@ -313,7 +313,7 @@ bread(int fd, char *buf, daddr_t blk, long size)
}
void
-bwrite(int fd, char *buf, daddr_t blk, long size)
+bwrite(int fd, char *buf, daddr32_t blk, long size)
{
int i;
char *cp;
@@ -364,7 +364,7 @@ allocblk(void)
* Free a previously allocated block
*/
void
-freeblk(daddr_t blkno)
+freeblk(daddr32_t blkno)
{
struct inodesc idesc;