summaryrefslogtreecommitdiff
path: root/sbin/fsck_ffs
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2007-06-25 19:59:56 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2007-06-25 19:59:56 +0000
commit4b0d7fdaf11cb688a43c7321cbcfe263c9d7d011 (patch)
tree95ad9abbff7cce4341c289d7a508cf037a0b3a77 /sbin/fsck_ffs
parent63beb6614aaf6997d30c6ef6819a1f95f288bac0 (diff)
Teach fsck_ffs about 64-bit block addresses. ok (and help) moritz@ pedro@
Diffstat (limited to 'sbin/fsck_ffs')
-rw-r--r--sbin/fsck_ffs/dir.c10
-rw-r--r--sbin/fsck_ffs/extern.h12
-rw-r--r--sbin/fsck_ffs/fsck.h22
-rw-r--r--sbin/fsck_ffs/inode.c28
-rw-r--r--sbin/fsck_ffs/main.c16
-rw-r--r--sbin/fsck_ffs/pass1.c10
-rw-r--r--sbin/fsck_ffs/pass1b.c6
-rw-r--r--sbin/fsck_ffs/pass2.c16
-rw-r--r--sbin/fsck_ffs/pass4.c6
-rw-r--r--sbin/fsck_ffs/pass5.c8
-rw-r--r--sbin/fsck_ffs/utilities.c30
11 files changed, 86 insertions, 78 deletions
diff --git a/sbin/fsck_ffs/dir.c b/sbin/fsck_ffs/dir.c
index 9a408abd944..173528ecccc 100644
--- a/sbin/fsck_ffs/dir.c
+++ b/sbin/fsck_ffs/dir.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dir.c,v 1.20 2007/04/10 16:08:17 millert Exp $ */
+/* $OpenBSD: dir.c,v 1.21 2007/06/25 19:59:55 otto Exp $ */
/* $NetBSD: dir.c,v 1.20 1996/09/27 22:45:11 christos Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)dir.c 8.5 (Berkeley) 12/8/94";
#else
-static const char rcsid[] = "$OpenBSD: dir.c,v 1.20 2007/04/10 16:08:17 millert Exp $";
+static const char rcsid[] = "$OpenBSD: dir.c,v 1.21 2007/06/25 19:59:55 otto Exp $";
#endif
#endif /* not lint */
@@ -67,7 +67,7 @@ struct odirtemplate odirhead = {
static int expanddir(union dinode *, char *);
static void freedir(ino_t, ino_t);
static struct direct *fsck_readdir(struct inodesc *);
-static struct bufarea *getdirblk(daddr_t, long);
+static struct bufarea *getdirblk(daddr64_t, long);
static int lftempname(char *, ino_t);
static int mkentry(struct inodesc *);
static int chgino(struct inodesc *);
@@ -553,7 +553,7 @@ makeentry(ino_t parent, ino_t ino, char *name)
static int
expanddir(union dinode *dp, char *name)
{
- daddr_t lastbn, newblk;
+ daddr64_t lastbn, newblk;
struct bufarea *bp;
char *cp, firstblk[DIRBLKSIZ];
u_int64_t dis;
@@ -718,7 +718,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(daddr64_t blkno, long size)
{
if (pdirbp != 0)
diff --git a/sbin/fsck_ffs/extern.h b/sbin/fsck_ffs/extern.h
index 090edc73910..fea3f42337c 100644
--- a/sbin/fsck_ffs/extern.h
+++ b/sbin/fsck_ffs/extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: extern.h,v 1.9 2007/04/10 16:08:17 millert Exp $ */
+/* $OpenBSD: extern.h,v 1.10 2007/06/25 19:59:55 otto Exp $ */
/* $NetBSD: extern.h,v 1.6 1996/09/27 22:45:12 christos Exp $ */
/*
@@ -28,14 +28,14 @@
void adjust(struct inodesc *, short);
int allocblk(long);
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 *, daddr64_t);
+int bread(int, char *, daddr64_t, long);
void bufinit(void);
-void bwrite(int, char *, daddr_t, long);
+void bwrite(int, char *, daddr64_t, long);
void cacheino(union dinode *, ino_t);
int changeino(ino_t, char *, ino_t);
struct fstab;
-int chkrange(daddr_t, int);
+int chkrange(daddr64_t, int);
void ckfini(int);
int ckinode(union 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, long);
+void freeblk(daddr64_t, long);
void freeino(ino_t);
void freeinodebuf(void);
int ftypeok(union dinode *);
diff --git a/sbin/fsck_ffs/fsck.h b/sbin/fsck_ffs/fsck.h
index e9a49e73c2f..b9136c673c5 100644
--- a/sbin/fsck_ffs/fsck.h
+++ b/sbin/fsck_ffs/fsck.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: fsck.h,v 1.20 2007/06/01 23:42:35 pedro Exp $ */
+/* $OpenBSD: fsck.h,v 1.21 2007/06/25 19:59:55 otto Exp $ */
/* $NetBSD: fsck.h,v 1.13 1996/10/11 20:15:46 thorpej Exp $ */
/*
@@ -79,7 +79,7 @@ union dinode {
struct bufarea {
struct bufarea *b_next; /* free list queue */
struct bufarea *b_prev; /* free list queue */
- daddr_t b_bno;
+ daddr64_t b_bno;
int b_size;
int b_errs;
int b_flags;
@@ -115,12 +115,12 @@ struct bufarea asblk; /* alternate file system superblock */
struct bufarea cgblk; /* cylinder group blocks */
struct bufarea *pdirbp; /* current directory contents */
struct bufarea *pbp; /* current inode block */
-struct bufarea *getdatablk(daddr_t, long);
+struct bufarea *getdatablk(daddr64_t, long);
#define dirty(bp) (bp)->b_dirty = 1
#define initbarea(bp) \
(bp)->b_dirty = 0; \
- (bp)->b_bno = (daddr_t)-1; \
+ (bp)->b_bno = (daddr64_t)-1; \
(bp)->b_flags = 0;
#define sbdirty() sblk.b_dirty = 1
@@ -136,7 +136,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 */
+ daddr64_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 */
@@ -172,7 +172,7 @@ struct inodesc {
*/
struct dups {
struct dups *next;
- daddr_t dup;
+ daddr64_t dup;
};
struct dups *duplist; /* head of dup list */
struct dups *muldup; /* end of unique duplicate dup block numbers */
@@ -197,7 +197,7 @@ struct inoinfo {
ino_t i_dotdot; /* inode number of `..' */
size_t i_isize; /* size of inode */
u_int i_numblks; /* size of block array in bytes */
- daddr_t i_blks[1]; /* actually longer */
+ daddr64_t i_blks[1]; /* actually longer */
} **inphead, **inpsort;
extern long numdirs, listmax, inplast;
@@ -222,7 +222,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 */
+daddr64_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 */
@@ -234,8 +234,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 */
+daddr64_t n_blks; /* number of blocks in use */
+daddr64_t n_files; /* number of files in use */
long *cginosused; /* # of allocated inodes in each cg */
#define clearinode(dp) \
@@ -260,7 +260,7 @@ struct ufs2_dinode ufs2_zino;
union dinode *ginode(ino_t);
struct inoinfo *getinoinfo(ino_t);
-void getblk(struct bufarea *, daddr_t, long);
+void getblk(struct bufarea *, daddr64_t, long);
ino_t allocino(ino_t, int);
int (*info_fn)(char *, size_t);
diff --git a/sbin/fsck_ffs/inode.c b/sbin/fsck_ffs/inode.c
index 500fe3997b0..355b687a097 100644
--- a/sbin/fsck_ffs/inode.c
+++ b/sbin/fsck_ffs/inode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inode.c,v 1.29 2007/04/10 16:08:17 millert Exp $ */
+/* $OpenBSD: inode.c,v 1.30 2007/06/25 19:59:55 otto Exp $ */
/* $NetBSD: inode.c,v 1.23 1996/10/11 20:15:47 thorpej Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)inode.c 8.5 (Berkeley) 2/8/95";
#else
-static const char rcsid[] = "$OpenBSD: inode.c,v 1.29 2007/04/10 16:08:17 millert Exp $";
+static const char rcsid[] = "$OpenBSD: inode.c,v 1.30 2007/06/25 19:59:55 otto Exp $";
#endif
#endif /* not lint */
@@ -237,7 +237,7 @@ iblock(struct inodesc *idesc, long ilevel, off_t isize)
* Return 0 if in range, 1 if out of range.
*/
int
-chkrange(daddr_t blk, int cnt)
+chkrange(daddr64_t blk, int cnt)
{
int c;
@@ -247,17 +247,17 @@ chkrange(daddr_t blk, int cnt)
if (cnt > sblock.fs_frag ||
fragnum(&sblock, blk) + cnt > sblock.fs_frag) {
if (debug)
- printf("bad size: blk %ld, offset %i, size %d\n",
- (long)blk, (int)fragnum(&sblock, blk), cnt);
+ printf("bad size: blk %lld, offset %lld, size %d\n",
+ blk, fragnum(&sblock, blk), cnt);
return (1);
}
c = dtog(&sblock, blk);
if (blk < cgdmin(&sblock, c)) {
if ((blk + cnt) > cgsblock(&sblock, c)) {
if (debug) {
- printf("blk %d < cgdmin %d;",
+ printf("blk %lld < cgdmin %lld;",
blk, cgdmin(&sblock, c));
- printf(" blk + cnt %d > cgsbase %d\n",
+ printf(" blk + cnt %lld > cgsbase %lld\n",
blk + cnt, cgsblock(&sblock, c));
}
return (1);
@@ -265,9 +265,9 @@ chkrange(daddr_t blk, int cnt)
} else {
if ((blk + cnt) > cgbase(&sblock, c+1)) {
if (debug) {
- printf("blk %d >= cgdmin %d;",
+ printf("blk %lld >= cgdmin %lld;",
blk, cgdmin(&sblock, c));
- printf(" blk + cnt %d > sblock.fs_fpg %d\n",
+ printf(" blk + cnt %lld > sblock.fs_fpg %d\n",
blk+cnt, sblock.fs_fpg);
}
return (1);
@@ -282,7 +282,7 @@ chkrange(daddr_t blk, int cnt)
union dinode *
ginode(ino_t inumber)
{
- daddr_t iblk;
+ daddr64_t iblk;
if (inumber < ROOTINO || inumber > maxino)
errexit("bad inode number %d to ginode\n", inumber);
@@ -312,7 +312,7 @@ union dinode *
getnextinode(ino_t inumber)
{
long size;
- daddr_t dblk;
+ daddr64_t dblk;
union dinode *dp;
static caddr_t nextinop;
@@ -401,7 +401,7 @@ cacheino(union dinode *dp, ino_t inumber)
blks = howmany(DIP(dp, di_size), sblock.fs_bsize);
if (blks > NDADDR)
blks = NDADDR + NIADDR;
- inp = malloc(sizeof(*inp) + (blks ? blks - 1 : 0) * sizeof(daddr_t));
+ inp = malloc(sizeof(*inp) + (blks ? blks - 1 : 0) * sizeof(daddr64_t));
if (inp == NULL)
errexit("cannot allocate memory for inode cache\n");
inpp = &inphead[inumber % numdirs];
@@ -550,10 +550,10 @@ pinode(ino_t ino)
}
void
-blkerror(ino_t ino, char *type, daddr_t blk)
+blkerror(ino_t ino, char *type, daddr64_t blk)
{
- pfatal("%d %s I=%u", blk, type, ino);
+ pfatal("%lld %s I=%u", blk, type, ino);
printf("\n");
switch (statemap[ino]) {
diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c
index fe8c02dc678..65c8ec2be9e 100644
--- a/sbin/fsck_ffs/main.c
+++ b/sbin/fsck_ffs/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.31 2007/04/10 16:08:17 millert Exp $ */
+/* $OpenBSD: main.c,v 1.32 2007/06/25 19:59:55 otto Exp $ */
/* $NetBSD: main.c,v 1.22 1996/10/11 20:15:48 thorpej Exp $ */
/*
@@ -40,7 +40,7 @@ static const char copyright[] =
#if 0
static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 1/23/94";
#else
-static const char rcsid[] = "$OpenBSD: main.c,v 1.31 2007/04/10 16:08:17 millert Exp $";
+static const char rcsid[] = "$OpenBSD: main.c,v 1.32 2007/06/25 19:59:55 otto Exp $";
#endif
#endif /* not lint */
@@ -179,7 +179,7 @@ docheck(struct fstab *fsp)
int
checkfilesys(char *filesys, char *mntpt, long auxdata, int child)
{
- daddr_t n_ffree, n_bfree;
+ daddr64_t n_ffree, n_bfree;
struct dups *dp;
struct zlncnt *zlnp;
int cylno;
@@ -267,25 +267,25 @@ checkfilesys(char *filesys, char *mntpt, long auxdata, int child)
*/
n_ffree = sblock.fs_cstotal.cs_nffree;
n_bfree = sblock.fs_cstotal.cs_nbfree;
- pwarn("%d files, %d used, %d free ",
+ pwarn("%lld files, %lld used, %lld free ",
n_files, n_blks, n_ffree + sblock.fs_frag * n_bfree);
- printf("(%d frags, %d blocks, %lld.%lld%% fragmentation)\n",
+ printf("(%lld frags, %lld blocks, %lld.%lld%% fragmentation)\n",
n_ffree, n_bfree, (n_ffree * 100) / sblock.fs_dsize,
((n_ffree * 1000 + sblock.fs_dsize / 2) / sblock.fs_dsize) % 10);
if (debug &&
(n_files -= maxino - ROOTINO - sblock.fs_cstotal.cs_nifree))
- printf("%d files missing\n", n_files);
+ printf("%lld files missing\n", n_files);
if (debug) {
n_blks += sblock.fs_ncg *
(cgdmin(&sblock, 0) - cgsblock(&sblock, 0));
n_blks += cgsblock(&sblock, 0) - cgbase(&sblock, 0);
n_blks += howmany(sblock.fs_cssize, sblock.fs_fsize);
if (n_blks -= maxfsblock - (n_ffree + sblock.fs_frag * n_bfree))
- printf("%d blocks missing\n", n_blks);
+ printf("%lld blocks missing\n", n_blks);
if (duplist != NULL) {
printf("The following duplicate blocks remain:");
for (dp = duplist; dp; dp = dp->next)
- printf(" %d,", dp->dup);
+ printf(" %lld,", dp->dup);
printf("\n");
}
if (zlnhead != NULL) {
diff --git a/sbin/fsck_ffs/pass1.c b/sbin/fsck_ffs/pass1.c
index d6a4b85288f..8485704056e 100644
--- a/sbin/fsck_ffs/pass1.c
+++ b/sbin/fsck_ffs/pass1.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pass1.c,v 1.25 2007/06/01 23:42:35 pedro Exp $ */
+/* $OpenBSD: pass1.c,v 1.26 2007/06/25 19:59:55 otto Exp $ */
/* $NetBSD: pass1.c,v 1.16 1996/09/27 22:45:15 christos Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)pass1.c 8.1 (Berkeley) 6/5/93";
#else
-static const char rcsid[] = "$OpenBSD: pass1.c,v 1.25 2007/06/01 23:42:35 pedro Exp $";
+static const char rcsid[] = "$OpenBSD: pass1.c,v 1.26 2007/06/25 19:59:55 otto Exp $";
#endif
#endif /* not lint */
@@ -52,8 +52,8 @@ static const char rcsid[] = "$OpenBSD: pass1.c,v 1.25 2007/06/01 23:42:35 pedro
#include "extern.h"
#include "fsutil.h"
-static daddr_t badblk;
-static daddr_t dupblk;
+static daddr64_t badblk;
+static daddr64_t dupblk;
static void checkinode(ino_t, struct inodesc *);
static ino_t info_inumber;
@@ -310,7 +310,7 @@ pass1check(struct inodesc *idesc)
{
int res = KEEPON;
int anyout, nfrags;
- daddr_t blkno = idesc->id_blkno;
+ daddr64_t blkno = idesc->id_blkno;
struct dups *dlp;
struct dups *new;
diff --git a/sbin/fsck_ffs/pass1b.c b/sbin/fsck_ffs/pass1b.c
index fce77a44561..2b505240156 100644
--- a/sbin/fsck_ffs/pass1b.c
+++ b/sbin/fsck_ffs/pass1b.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pass1b.c,v 1.14 2007/04/10 16:08:17 millert Exp $ */
+/* $OpenBSD: pass1b.c,v 1.15 2007/06/25 19:59:55 otto Exp $ */
/* $NetBSD: pass1b.c,v 1.10 1996/09/23 16:18:37 christos Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)pass1b.c 8.1 (Berkeley) 6/5/93";
#else
-static const char rcsid[] = "$OpenBSD: pass1b.c,v 1.14 2007/04/10 16:08:17 millert Exp $";
+static const char rcsid[] = "$OpenBSD: pass1b.c,v 1.15 2007/06/25 19:59:55 otto Exp $";
#endif
#endif /* not lint */
@@ -96,7 +96,7 @@ pass1bcheck(struct inodesc *idesc)
{
struct dups *dlp;
int nfrags, res = KEEPON;
- daddr_t blkno = idesc->id_blkno;
+ daddr64_t blkno = idesc->id_blkno;
for (nfrags = idesc->id_numfrags; nfrags > 0; blkno++, nfrags--) {
if (chkrange(blkno, 1))
diff --git a/sbin/fsck_ffs/pass2.c b/sbin/fsck_ffs/pass2.c
index eee093c6e44..8c7e3ce184f 100644
--- a/sbin/fsck_ffs/pass2.c
+++ b/sbin/fsck_ffs/pass2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pass2.c,v 1.26 2007/04/10 16:08:17 millert Exp $ */
+/* $OpenBSD: pass2.c,v 1.27 2007/06/25 19:59:55 otto Exp $ */
/* $NetBSD: pass2.c,v 1.17 1996/09/27 22:45:15 christos Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)pass2.c 8.6 (Berkeley) 10/27/94";
#else
-static const char rcsid[] = "$OpenBSD: pass2.c,v 1.26 2007/04/10 16:08:17 millert Exp $";
+static const char rcsid[] = "$OpenBSD: pass2.c,v 1.27 2007/06/25 19:59:55 otto Exp $";
#endif
#endif /* not lint */
@@ -508,6 +508,14 @@ again:
static int
blksort(const void *inpp1, const void *inpp2)
{
- return ((* (struct inoinfo **) inpp1)->i_blks[0] -
- (* (struct inoinfo **) inpp2)->i_blks[0]);
+ daddr64_t d;
+
+ d = (* (struct inoinfo **) inpp1)->i_blks[0] -
+ (* (struct inoinfo **) inpp2)->i_blks[0];
+ if (d < 0)
+ return (-1);
+ else if (d > 0)
+ return (1);
+ else
+ return (0);
}
diff --git a/sbin/fsck_ffs/pass4.c b/sbin/fsck_ffs/pass4.c
index 2092a3da564..69b60a48fa3 100644
--- a/sbin/fsck_ffs/pass4.c
+++ b/sbin/fsck_ffs/pass4.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pass4.c,v 1.16 2007/04/10 16:08:17 millert Exp $ */
+/* $OpenBSD: pass4.c,v 1.17 2007/06/25 19:59:55 otto Exp $ */
/* $NetBSD: pass4.c,v 1.11 1996/09/27 22:45:17 christos Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)pass4.c 8.1 (Berkeley) 6/5/93";
#else
-static const char rcsid[] = "$OpenBSD: pass4.c,v 1.16 2007/04/10 16:08:17 millert Exp $";
+static const char rcsid[] = "$OpenBSD: pass4.c,v 1.17 2007/06/25 19:59:55 otto Exp $";
#endif
#endif /* not lint */
@@ -130,7 +130,7 @@ pass4check(struct inodesc *idesc)
{
struct dups *dlp;
int nfrags, res = KEEPON;
- daddr_t blkno = idesc->id_blkno;
+ daddr64_t blkno = idesc->id_blkno;
for (nfrags = idesc->id_numfrags; nfrags > 0; blkno++, nfrags--) {
if (chkrange(blkno, 1)) {
diff --git a/sbin/fsck_ffs/pass5.c b/sbin/fsck_ffs/pass5.c
index 1efb1a02bd3..9fffe04531b 100644
--- a/sbin/fsck_ffs/pass5.c
+++ b/sbin/fsck_ffs/pass5.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pass5.c,v 1.33 2007/06/01 14:26:08 otto Exp $ */
+/* $OpenBSD: pass5.c,v 1.34 2007/06/25 19:59:55 otto Exp $ */
/* $NetBSD: pass5.c,v 1.16 1996/09/27 22:45:18 christos Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)pass5.c 8.6 (Berkeley) 11/30/94";
#else
-static const char rcsid[] = "$OpenBSD: pass5.c,v 1.33 2007/06/01 14:26:08 otto Exp $";
+static const char rcsid[] = "$OpenBSD: pass5.c,v 1.34 2007/06/25 19:59:55 otto Exp $";
#endif
#endif /* not lint */
@@ -71,8 +71,8 @@ pass5(void)
int inomapsize, blkmapsize;
struct fs *fs = &sblock;
struct cg *cg = &cgrp;
- daddr_t dbase, dmax;
- daddr_t d;
+ daddr64_t dbase, dmax;
+ daddr64_t d;
long i, j, k;
struct csum *cs;
struct csum_total cstotal;
diff --git a/sbin/fsck_ffs/utilities.c b/sbin/fsck_ffs/utilities.c
index ea366ea57d6..664d4d13bbd 100644
--- a/sbin/fsck_ffs/utilities.c
+++ b/sbin/fsck_ffs/utilities.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: utilities.c,v 1.33 2007/04/10 16:08:17 millert Exp $ */
+/* $OpenBSD: utilities.c,v 1.34 2007/06/25 19:59:55 otto Exp $ */
/* $NetBSD: utilities.c,v 1.18 1996/09/27 22:45:20 christos Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)utilities.c 8.1 (Berkeley) 6/5/93";
#else
-static const char rcsid[] = "$OpenBSD: utilities.c,v 1.33 2007/04/10 16:08:17 millert Exp $";
+static const char rcsid[] = "$OpenBSD: utilities.c,v 1.34 2007/06/25 19:59:55 otto Exp $";
#endif
#endif /* not lint */
@@ -61,7 +61,7 @@ static const char rcsid[] = "$OpenBSD: utilities.c,v 1.33 2007/04/10 16:08:17 mi
long diskreads, totalreads; /* Disk cache statistics */
-static void rwerror(char *, daddr_t);
+static void rwerror(char *, daddr64_t);
int
ftypeok(union dinode *dp)
@@ -168,7 +168,7 @@ bufinit(void)
* Manage a cache of directory blocks.
*/
struct bufarea *
-getdatablk(daddr_t blkno, long size)
+getdatablk(daddr64_t blkno, long size)
{
struct bufarea *bp;
@@ -195,9 +195,9 @@ foundit:
}
void
-getblk(struct bufarea *bp, daddr_t blk, long size)
+getblk(struct bufarea *bp, daddr64_t blk, long size)
{
- daddr_t dblk;
+ daddr64_t dblk;
dblk = fsbtodb(&sblock, blk);
if (bp->b_bno != dblk) {
@@ -217,7 +217,7 @@ flush(int fd, struct bufarea *bp)
if (!bp->b_dirty)
return;
if (bp->b_errs != 0)
- pfatal("WRITING %sZERO'ED BLOCK %d TO DISK\n",
+ pfatal("WRITING %sZERO'ED BLOCK %lld TO DISK\n",
(bp->b_errs == bp->b_size / dev_bsize) ? "" : "PARTIALLY ",
bp->b_bno);
bp->b_dirty = 0;
@@ -234,12 +234,12 @@ flush(int fd, struct bufarea *bp)
}
static void
-rwerror(char *mesg, daddr_t blk)
+rwerror(char *mesg, daddr64_t blk)
{
if (preen == 0)
printf("\n");
- pfatal("CANNOT %s: BLK %d", mesg, blk);
+ pfatal("CANNOT %s: BLK %lld", mesg, blk);
if (reply("CONTINUE") == 0)
errexit("Program terminated\n");
}
@@ -320,7 +320,7 @@ ckfini(int markclean)
}
int
-bread(int fd, char *buf, daddr_t blk, long size)
+bread(int fd, char *buf, daddr64_t blk, long size)
{
char *cp;
int i, errs;
@@ -342,11 +342,11 @@ bread(int fd, char *buf, daddr_t blk, long size)
if (read(fd, cp, (int)secsize) != secsize) {
(void)lseek(fd, offset + i + secsize, SEEK_SET);
if (secsize != dev_bsize && dev_bsize != 1)
- printf(" %ld (%ld),",
+ printf(" %lld (%lld),",
(blk * dev_bsize + i) / secsize,
blk + i / dev_bsize);
else
- printf(" %ld,", blk + i / dev_bsize);
+ printf(" %lld,", blk + i / dev_bsize);
errs++;
}
}
@@ -355,7 +355,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, daddr64_t blk, long size)
{
int i;
char *cp;
@@ -378,7 +378,7 @@ bwrite(int fd, char *buf, daddr_t blk, long size)
for (cp = buf, i = 0; i < size; i += dev_bsize, cp += dev_bsize)
if (write(fd, cp, (int)dev_bsize) != dev_bsize) {
(void)lseek(fd, offset + i + dev_bsize, SEEK_SET);
- printf(" %ld,", blk + i / dev_bsize);
+ printf(" %lld,", blk + i / dev_bsize);
}
printf("\n");
return;
@@ -431,7 +431,7 @@ allocblk(long frags)
* Free a previously allocated block
*/
void
-freeblk(daddr_t blkno, long frags)
+freeblk(daddr64_t blkno, long frags)
{
struct inodesc idesc;