diff --git a/include/protocols/dumprestore.h b/include/protocols/dumprestore.h index 2234a7ca334d..e813d6334e11 100644 --- a/include/protocols/dumprestore.h +++ b/include/protocols/dumprestore.h @@ -1,4 +1,4 @@ -/* $NetBSD: dumprestore.h,v 1.9 2001/12/23 14:38:03 lukem Exp $ */ +/* $NetBSD: dumprestore.h,v 1.10 2003/01/24 21:55:03 fvdl Exp $ */ /* * Copyright (c) 1980, 1993 @@ -73,7 +73,7 @@ union u_spcl { int32_t c_date; /* date of this dump */ int32_t c_ddate; /* date of previous dump */ int32_t c_volume; /* dump volume number */ - daddr_t c_tapea; /* logical block of this record */ + int32_t c_tapea; /* logical block of this record */ ino_t c_inumber; /* number of inode */ int32_t c_magic; /* magic number (see above) */ int32_t c_checksum; /* record checksum */ diff --git a/include/util.h b/include/util.h index 31c2999425a7..8a840c53cb7b 100644 --- a/include/util.h +++ b/include/util.h @@ -1,4 +1,4 @@ -/* $NetBSD: util.h,v 1.29 2002/12/12 09:45:32 scw Exp $ */ +/* $NetBSD: util.h,v 1.30 2003/01/24 21:55:02 fvdl Exp $ */ /*- * Copyright (c) 1995 @@ -67,7 +67,7 @@ struct winsize; pid_t forkpty(int *, char *, struct termios *, struct winsize *); const char *getbootfile(void); off_t getlabeloffset(void); -daddr_t getlabelsector(void); +int getlabelsector(void); int getmaxpartitions(void); int getrawpartition(void); int humanize_number(char *, size_t, int64_t, const char *, int, diff --git a/lib/libutil/getlabelsector.c b/lib/libutil/getlabelsector.c index 137b9dbd748e..ad0801d2a954 100644 --- a/lib/libutil/getlabelsector.c +++ b/lib/libutil/getlabelsector.c @@ -1,4 +1,4 @@ -/* $NetBSD: getlabelsector.c,v 1.1 2002/12/12 09:45:33 scw Exp $ */ +/* $NetBSD: getlabelsector.c,v 1.2 2003/01/24 21:55:03 fvdl Exp $ */ /* * Copyright 2002 Wasabi Systems, Inc. @@ -37,14 +37,14 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: getlabelsector.c,v 1.1 2002/12/12 09:45:33 scw Exp $"); +__RCSID("$NetBSD: getlabelsector.c,v 1.2 2003/01/24 21:55:03 fvdl Exp $"); #endif #include #include #include -daddr_t +int getlabelsector(void) { int sector, mib[2]; @@ -56,7 +56,7 @@ getlabelsector(void) if (sysctl(mib, 2, §or, &varlen, NULL, 0) < 0) return (-1); - return ((daddr_t)sector); + return sector; } off_t diff --git a/libexec/lfs_cleanerd/clean.h b/libexec/lfs_cleanerd/clean.h index aee0eb551044..534fc7559c20 100644 --- a/libexec/lfs_cleanerd/clean.h +++ b/libexec/lfs_cleanerd/clean.h @@ -1,4 +1,4 @@ -/* $NetBSD: clean.h,v 1.14 2002/06/14 00:58:39 perseant Exp $ */ +/* $NetBSD: clean.h,v 1.15 2003/01/24 21:55:03 fvdl Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -152,11 +152,12 @@ int lfs_segclean(fsid_t *, u_long); int lfs_bmapv(fsid_t *, BLOCK_INFO_15 *, int); int lfs_markv(fsid_t *, BLOCK_INFO_15 *, int); -int dump_summary(struct lfs *, SEGSUM *, u_long, daddr_t **, daddr_t); +/* XXX ondisk32 */ +int dump_summary(struct lfs *, SEGSUM *, u_long, int32_t **, daddr_t); int fs_getmntinfo(struct statfs **, char *, const char *); void get(int, off_t, void *, size_t); struct dinode *get_dinode (FS_INFO *, ino_t); -int get_rawblock(FS_INFO *, char *, size_t, ufs_daddr_t); +int get_rawblock(FS_INFO *, char *, size_t, daddr_t); FS_INFO *get_fs_info(struct statfs *, int); int lfs_segmapv(FS_INFO *, int, caddr_t, BLOCK_INFO_15 **, int *); int mmap_segment(FS_INFO *, int, caddr_t *, int); diff --git a/libexec/lfs_cleanerd/cleanerd.c b/libexec/lfs_cleanerd/cleanerd.c index 10b5e53d7609..bf9fa7ca3b17 100644 --- a/libexec/lfs_cleanerd/cleanerd.c +++ b/libexec/lfs_cleanerd/cleanerd.c @@ -1,4 +1,4 @@ -/* $NetBSD: cleanerd.c,v 1.40 2002/12/15 07:25:37 yamt Exp $ */ +/* $NetBSD: cleanerd.c,v 1.41 2003/01/24 21:55:04 fvdl Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\ #if 0 static char sccsid[] = "@(#)cleanerd.c 8.5 (Berkeley) 6/10/95"; #else -__RCSID("$NetBSD: cleanerd.c,v 1.40 2002/12/15 07:25:37 yamt Exp $"); +__RCSID("$NetBSD: cleanerd.c,v 1.41 2003/01/24 21:55:04 fvdl Exp $"); #endif #endif /* not lint */ @@ -737,23 +737,24 @@ add_segment(FS_INFO *fsp, struct seglist *slp, SEGS_AND_BLOCKS *sbp) syslog(LOG_DEBUG,"segment %d is empty, as claimed", id); } /* XXX KS - check for misplaced blocks */ + /* XXX ondisk32 */ for(i=0; ifi_lfs), tba[i].bi_daddr) == id) { - syslog(LOG_ERR, "bi_daddr = 0x%x = %db; %p - %p = %ld", + syslog(LOG_ERR, "bi_daddr = 0x%x = %lldb; %p - %p = %ld", tba[i].bi_daddr, - fsbtob(lfsp, tba[i].bi_daddr - seg_addr), + (long long)fsbtob(lfsp, tba[i].bi_daddr - seg_addr), tba[i].bi_bp, seg_buf, (long)(((char *)(tba[i].bi_bp) - seg_buf))); - syslog(LOG_ERR, "seg %d (0x%x), ino %d lbn %d, 0x%x != 0x%lx", - id, seg_addr, + syslog(LOG_ERR, "seg %d (0x%llx), ino %d lbn %d, 0x%x != 0x%llx", + id, (long long)seg_addr, tba[i].bi_inode, tba[i].bi_lbn, tba[i].bi_daddr, - (long)seg_addr + btofsb(lfsp, (char *)(tba[i].bi_bp) - seg_buf)); + seg_addr + btofsb(lfsp, (char *)(tba[i].bi_bp) - seg_buf)); error = EFAULT; goto out; @@ -763,6 +764,7 @@ add_segment(FS_INFO *fsp, struct seglist *slp, SEGS_AND_BLOCKS *sbp) * segment from where we thought, we need to reload * the *right* inode, not the first one in the block. */ + /* XXX ondisk32 */ if(tba[i].bi_lbn == LFS_UNUSED_LBN) { dip = (struct dinode *)(seg_buf + fsbtob(lfsp, tba[i].bi_daddr - seg_addr)); for(j=INOPB(lfsp)-1;j>=0;j--) { @@ -809,6 +811,7 @@ add_segment(FS_INFO *fsp, struct seglist *slp, SEGS_AND_BLOCKS *sbp) syslog(LOG_DEBUG, "BLOCK INFOS"); for (_bip = tba, i=0; i < num_blocks; ++_bip, ++i) { PRINT_BINFO(_bip); + /* XXX ondisk32? */ lp = (u_long *)_bip->bi_bp; } } diff --git a/libexec/lfs_cleanerd/coalesce.c b/libexec/lfs_cleanerd/coalesce.c index 4b9f2cd37b61..c536938cf0e5 100644 --- a/libexec/lfs_cleanerd/coalesce.c +++ b/libexec/lfs_cleanerd/coalesce.c @@ -1,4 +1,4 @@ -/* $NetBSD: coalesce.c,v 1.5 2002/12/15 08:38:17 yamt Exp $ */ +/* $NetBSD: coalesce.c,v 1.6 2003/01/24 21:55:04 fvdl Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -125,7 +125,7 @@ int clean_inode(struct fs_info *fsp, ino_t ino) BLOCK_INFO_15 *bip = NULL, *tbip; struct dinode *dip; int nb, onb, noff; - ufs_daddr_t toff; + daddr_t toff; struct lfs *lfsp; int bps; SEGUSE *sup; @@ -204,7 +204,8 @@ int clean_inode(struct fs_info *fsp, ino_t ino) goto out; } else if (debug) syslog(LOG_DEBUG, "ino %d total discontinuity " - "%d (%d) for %d blocks", ino, noff, toff, nb); + "%d (%lld) for %d blocks", ino, noff, + (long long)toff, nb); /* Search for blocks in active segments; don't move them. */ for (i = 0; i < nb; i++) { diff --git a/libexec/lfs_cleanerd/library.c b/libexec/lfs_cleanerd/library.c index d7fb26d48379..99105c1680be 100644 --- a/libexec/lfs_cleanerd/library.c +++ b/libexec/lfs_cleanerd/library.c @@ -1,4 +1,4 @@ -/* $NetBSD: library.c,v 1.31 2002/12/05 02:03:56 yamt Exp $ */ +/* $NetBSD: library.c,v 1.32 2003/01/24 21:55:04 fvdl Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)library.c 8.3 (Berkeley) 5/24/95"; #else -__RCSID("$NetBSD: library.c,v 1.31 2002/12/05 02:03:56 yamt Exp $"); +__RCSID("$NetBSD: library.c,v 1.32 2003/01/24 21:55:04 fvdl Exp $"); #endif #endif /* not lint */ @@ -175,7 +175,7 @@ getdevfd(FS_INFO *fsp) * Read a block from disk. */ int -get_rawblock(FS_INFO *fsp, char *buf, size_t size, ufs_daddr_t daddr) +get_rawblock(FS_INFO *fsp, char *buf, size_t size, daddr_t daddr) { return pread(getdevfd(fsp), buf, size, fsbtob(&fsp->fi_lfs, (off_t)daddr)); @@ -433,13 +433,14 @@ lfs_segmapv(FS_INFO *fsp, int seg, caddr_t seg_buf, BLOCK_INFO_15 **blocks, int if (fsbtob(lfsp, pseg_addr) < LFS_LABELPAD + LFS_SBPAD) { pseg_addr = btofsb(lfsp, LFS_LABELPAD + LFS_SBPAD); s = seg_buf + LFS_LABELPAD + LFS_SBPAD; - syslog(LOG_DEBUG, "adj segment 0 offset to 0x%x\n", - pseg_addr); + syslog(LOG_DEBUG, "adj segment 0 offset to 0x%llx\n", + (long long)pseg_addr); } } if(debug > 1) - syslog(LOG_DEBUG, "\tsegment buffer at: %p\tseg_addr 0x%x", s, seg_addr); + syslog(LOG_DEBUG, "\tsegment buffer at: %p\tseg_addr 0x%llx", s, + (long long)seg_addr); *bcount = 0; @@ -448,8 +449,8 @@ lfs_segmapv(FS_INFO *fsp, int seg, caddr_t seg_buf, BLOCK_INFO_15 **blocks, int nblocks = pseg_valid(fsp, sp, pseg_addr); if (nblocks <= 0) { - syslog(LOG_DEBUG, "Warning: invalid segment summary at 0x%x", - pseg_addr); + syslog(LOG_DEBUG, "Warning: invalid segment summary at 0x%llx", + (long long)pseg_addr); goto err0; } @@ -525,7 +526,8 @@ add_blocks(FS_INFO *fsp, BLOCK_INFO_15 *bip, int *countp, SEGSUM *sp, IFILE *ifp; FINFO *fip; caddr_t bp; - daddr_t *dp, *iaddrp; + /* XXX ondisk32 */ + int32_t *dp, *iaddrp; int fsb_per_block, fsb_per_iblock, i, j; int fsb_frag, iblks_seen; u_long iblk_size, blk_size; @@ -542,7 +544,8 @@ add_blocks(FS_INFO *fsp, BLOCK_INFO_15 *bip, int *countp, SEGSUM *sp, bp = seg_buf + fsbtob(lfsp, psegaddr - segaddr) + lfsp->lfs_sumsize; bip += *countp; psegaddr += btofsb(lfsp, lfsp->lfs_sumsize); - iaddrp = (daddr_t *)((caddr_t)sp + lfsp->lfs_sumsize); + /* XXX ondisk32 */ + iaddrp = (int32_t *)((caddr_t)sp + lfsp->lfs_sumsize); --iaddrp; if (lfsp->lfs_version == 1) fip = (FINFO *)(((char *)sp) + sizeof(SEGSUM_V1)); diff --git a/libexec/lfs_cleanerd/print.c b/libexec/lfs_cleanerd/print.c index 3ecf35e2f6d0..60f691707abd 100644 --- a/libexec/lfs_cleanerd/print.c +++ b/libexec/lfs_cleanerd/print.c @@ -1,4 +1,4 @@ -/* $NetBSD: print.c,v 1.12 2002/04/30 00:28:58 perseant Exp $ */ +/* $NetBSD: print.c,v 1.13 2003/01/24 21:55:05 fvdl Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "from: @(#)print.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: print.c,v 1.12 2002/04/30 00:28:58 perseant Exp $"); +__RCSID("$NetBSD: print.c,v 1.13 2003/01/24 21:55:05 fvdl Exp $"); #endif #endif /* not lint */ @@ -66,11 +66,13 @@ extern u_long cksum(void *, size_t); /* XXX */ * Returns a pointer to the array of inode addresses. */ +/* XXX ondisk32 */ int -dump_summary(struct lfs *lfsp, SEGSUM *sp, u_long flags, daddr_t **iaddrp, daddr_t addr) +dump_summary(struct lfs *lfsp, SEGSUM *sp, u_long flags, int32_t **iaddrp, daddr_t addr) { int i, j, blk, numblocks, accino=0; - daddr_t *dp, ddp, *idp; + /* XXX ondisk32 */ + int32_t *dp, ddp, *idp; u_int32_t *datap; int size; FINFO *fp; @@ -110,7 +112,8 @@ dump_summary(struct lfs *lfsp, SEGSUM *sp, u_long flags, daddr_t **iaddrp, daddr if (flags & DUMP_INODE_ADDRS) syslog(LOG_DEBUG, " Inode addresses:"); - idp = dp = (daddr_t *)((caddr_t)sp + lfsp->lfs_sumsize); + /* XXX ondisk32 */ + idp = dp = (int32_t *)((caddr_t)sp + lfsp->lfs_sumsize); --idp; for (--dp, i = 0; i < howmany(sp->ss_ninos,INOPB(lfsp)); --dp) { if (flags & DUMP_INODE_ADDRS) diff --git a/sbin/badsect/badsect.c b/sbin/badsect/badsect.c index ed31fc4e98c5..9e4421a04c34 100644 --- a/sbin/badsect/badsect.c +++ b/sbin/badsect/badsect.c @@ -1,4 +1,4 @@ -/* $NetBSD: badsect.c,v 1.20 2001/08/17 02:18:46 lukem Exp $ */ +/* $NetBSD: badsect.c,v 1.21 2003/01/24 21:55:05 fvdl Exp $ */ /* * Copyright (c) 1981, 1983, 1993 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1981, 1983, 1993\n\ #if 0 static char sccsid[] = "@(#)badsect.c 8.2 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: badsect.c,v 1.20 2001/08/17 02:18:46 lukem Exp $"); +__RCSID("$NetBSD: badsect.c,v 1.21 2003/01/24 21:55:05 fvdl Exp $"); #endif #endif /* not lint */ @@ -185,21 +185,22 @@ chkuse(blkno, cnt) fsbn = dbtofsb(fs, blkno); if ((unsigned)(fsbn+cnt) > fs->fs_size) { - warnx("block %d out of range of file system", blkno); + warnx("block %lld out of range of file system", + (long long)blkno); return (1); } cg = dtog(fs, fsbn); if (fsbn < cgdmin(fs, cg)) { if (cg == 0 || (fsbn+cnt) > cgsblock(fs, cg)) { - warnx("block %d in non-data area: cannot attach", - blkno); + warnx("block %lld in non-data area: cannot attach", + (long long)blkno); return (1); } } else { if ((fsbn+cnt) > cgbase(fs, cg+1)) { - warnx("block %d in non-data area: cannot attach", - blkno); + warnx("block %lld in non-data area: cannot attach", + (long long)blkno); return (1); } } @@ -215,7 +216,7 @@ chkuse(blkno, cnt) bn = dtogd(fs, fsbn); if (isclr(cg_blksfree(&acg, needswap), bn)) - warnx("Warning: sector %d is in use", blkno); + warnx("Warning: sector %lld is in use", (long long)blkno); return (0); } @@ -232,16 +233,16 @@ rdfs(bno, size, bf) int n; if (lseek(fsi, (off_t)bno * dev_bsize, SEEK_SET) == -1) - err(1, "seek error at block %d", bno); + err(1, "seek error at block %lld", (long long)bno); switch (n = read(fsi, bf, size)) { case -1: - err(1, "read error at block %d", bno); + err(1, "read error at block %lld", (long long)bno); break; default: if (n == size) return; - errx(1, "incomplete read at block %d", bno); + errx(1, "incomplete read at block %lld", (long long)bno); } } diff --git a/sbin/dump/dump.h b/sbin/dump/dump.h index 4cff42370ea2..183ccbf2b162 100644 --- a/sbin/dump/dump.h +++ b/sbin/dump/dump.h @@ -1,4 +1,4 @@ -/* $NetBSD: dump.h,v 1.33 2001/12/30 04:03:16 lukem Exp $ */ +/* $NetBSD: dump.h,v 1.34 2003/01/24 21:55:05 fvdl Exp $ */ /*- * Copyright (c) 1980, 1993 @@ -38,7 +38,8 @@ #include #define MAXINOPB (MAXBSIZE / sizeof(struct dinode)) -#define MAXNINDIR (MAXBSIZE / sizeof(daddr_t)) +/* XXX ondisk32 */ +#define MAXNINDIR (MAXBSIZE / sizeof(int32_t)) /* * Filestore-independent UFS data, so code can be more easily shared @@ -179,7 +180,8 @@ int mapfiles(ino_t, long *, char *, char * const *); int mapdirs(ino_t, long *); /* file dumping routines */ -void blksout(daddr_t *, int, ino_t); +/* XXX ondisk32 */ +void blksout(int32_t *, int, ino_t); void dumpino(struct dinode *, ino_t); void dumpmap(char *, int, ino_t); void writeheader(ino_t); diff --git a/sbin/dump/ffs_inode.c b/sbin/dump/ffs_inode.c index 042223157513..4ffe439b9e17 100644 --- a/sbin/dump/ffs_inode.c +++ b/sbin/dump/ffs_inode.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_inode.c,v 1.10 2001/12/23 12:54:53 lukem Exp $ */ +/* $NetBSD: ffs_inode.c,v 1.11 2003/01/24 21:55:06 fvdl Exp $ */ /*- * Copyright (c) 1980, 1991, 1993, 1994 @@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1991, 1993, 1994\n\ #endif /* not lint */ #ifndef lint -__RCSID("$NetBSD: ffs_inode.c,v 1.10 2001/12/23 12:54:53 lukem Exp $"); +__RCSID("$NetBSD: ffs_inode.c,v 1.11 2003/01/24 21:55:06 fvdl Exp $"); #endif /* not lint */ #include @@ -144,7 +144,7 @@ fs_maxino(void) struct dinode * getino(ino_t inum) { - static daddr_t minino, maxino; + static ino_t minino, maxino; static struct dinode inoblock[MAXINOPB]; int i; diff --git a/sbin/dump/rcache.c b/sbin/dump/rcache.c index cd5192048e04..afe20dffae58 100644 --- a/sbin/dump/rcache.c +++ b/sbin/dump/rcache.c @@ -1,4 +1,4 @@ -/* $NetBSD: rcache.c,v 1.11 2002/02/19 23:11:28 lukem Exp $ */ +/* $NetBSD: rcache.c,v 1.12 2003/01/24 21:55:06 fvdl Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -39,7 +39,7 @@ #include #ifndef lint -__RCSID("$NetBSD: rcache.c,v 1.11 2002/02/19 23:11:28 lukem Exp $"); +__RCSID("$NetBSD: rcache.c,v 1.12 2003/01/24 21:55:06 fvdl Exp $"); #endif /* not lint */ #include @@ -205,11 +205,11 @@ rawread(daddr_t blkno, char *buf, int size) goto loop; } if (cnt == -1) - msg("read error from %s: %s: [block %d]: count=%d\n", - disk, strerror(errno), blkno, size); + msg("read error from %s: %s: [block %lld]: count=%d\n", + disk, strerror(errno), (long long)blkno, size); else - msg("short read error from %s: [block %d]: count=%d, got=%d\n", - disk, blkno, size, cnt); + msg("short read error from %s: [block %lld]: count=%d, got=%d\n", + disk, (long long)blkno, size, cnt); err: if (++breaderrors > BREADEMAX) { msg("More than %d block read errors from %s\n", @@ -235,13 +235,13 @@ err: if ((cnt = read(diskfd, buf, (int)dev_bsize)) == dev_bsize) continue; if (cnt == -1) { - msg("read error from %s: %s: [sector %d]: count=%ld: " - "%s\n", disk, strerror(errno), blkno, dev_bsize, - strerror(errno)); + msg("read error from %s: %s: [sector %lld]: count=%ld: " + "%s\n", disk, strerror(errno), (long long)blkno, + dev_bsize, strerror(errno)); continue; } - msg("short read error from %s: [sector %d]: count=%ld, got=%d\n", - disk, blkno, dev_bsize, cnt); + msg("short read error from %s: [sector %lld]: count=%ld, got=%d\n", + disk, (long long)blkno, dev_bsize, cnt); } } diff --git a/sbin/dump/traverse.c b/sbin/dump/traverse.c index afabaae1f3ea..de8b28d519a0 100644 --- a/sbin/dump/traverse.c +++ b/sbin/dump/traverse.c @@ -1,4 +1,4 @@ -/* $NetBSD: traverse.c,v 1.35 2002/09/30 10:48:49 lukem Exp $ */ +/* $NetBSD: traverse.c,v 1.36 2003/01/24 21:55:06 fvdl Exp $ */ /*- * Copyright (c) 1980, 1988, 1991, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)traverse.c 8.7 (Berkeley) 6/15/95"; #else -__RCSID("$NetBSD: traverse.c,v 1.35 2002/09/30 10:48:49 lukem Exp $"); +__RCSID("$NetBSD: traverse.c,v 1.36 2003/01/24 21:55:06 fvdl Exp $"); #endif #endif /* not lint */ @@ -353,15 +353,16 @@ dirindir(ino_t ino, daddr_t blkno, int ind_level, long *filesize, { int ret = 0; int i; - daddr_t idblk[MAXNINDIR]; + /* XXX ondisk32 */ + int32_t idblk[MAXNINDIR]; - bread(fsatoda(ufsib, iswap32(blkno)), (char *)idblk, + bread(fsatoda(ufsib, iswap64(blkno)), (char *)idblk, (int)ufsib->ufs_bsize); if (ind_level <= 0) { for (i = 0; *filesize > 0 && i < ufsib->ufs_nindir; i++) { blkno = idblk[i]; if (blkno != 0) - ret |= searchdir(ino, iswap32(blkno), + ret |= searchdir(ino, iswap64(blkno), ufsib->ufs_bsize, *filesize, tape_size, nodump); if (ret & HASDUMPEDFILE) @@ -537,7 +538,8 @@ static void dmpindir(ino_t ino, daddr_t blk, int ind_level, fsizeT *size) { int i, cnt; - daddr_t idblk[MAXNINDIR]; + /* XXX ondisk32 */ + int32_t idblk[MAXNINDIR]; if (blk != 0) bread(fsatoda(ufsib, iswap32(blk)), (char *)idblk, @@ -564,10 +566,11 @@ dmpindir(ino_t ino, daddr_t blk, int ind_level, fsizeT *size) /* * Collect up the data into tape record sized buffers and output them. */ +/* XXX ondisk32 */ void -blksout(daddr_t *blkp, int frags, ino_t ino) +blksout(int32_t *blkp, int frags, ino_t ino) { - daddr_t *bp; + int32_t *bp; int i, j, count, blks, tbperdb; blks = howmany(frags * ufsib->ufs_fsize, TP_BSIZE); diff --git a/sbin/dump_lfs/lfs_inode.c b/sbin/dump_lfs/lfs_inode.c index 58ad88c0df93..64769519c628 100644 --- a/sbin/dump_lfs/lfs_inode.c +++ b/sbin/dump_lfs/lfs_inode.c @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_inode.c,v 1.5 2002/05/25 23:45:13 wiz Exp $ */ +/* $NetBSD: lfs_inode.c,v 1.6 2003/01/24 21:55:06 fvdl Exp $ */ /*- * Copyright (c) 1980, 1991, 1993, 1994 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1991, 1993, 1994\n\ #if 0 static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/1/95"; #else -__RCSID("$NetBSD: lfs_inode.c,v 1.5 2002/05/25 23:45:13 wiz Exp $"); +__RCSID("$NetBSD: lfs_inode.c,v 1.6 2003/01/24 21:55:06 fvdl Exp $"); #endif #endif /* not lint */ @@ -189,9 +189,9 @@ fs_maxino(void) #define T_UNITS (NINDIR(fs)*NINDIR(fs)) static daddr_t -lfs_bmap(struct lfs *fs, struct dinode *idinode, ufs_daddr_t lbn) +lfs_bmap(struct lfs *fs, struct dinode *idinode, daddr_t lbn) { - ufs_daddr_t residue, up; + daddr_t residue, up; int off=0; char bp[MAXBSIZE]; @@ -230,7 +230,8 @@ lfs_bmap(struct lfs *fs, struct dinode *idinode, ufs_daddr_t lbn) return UNASSIGNED; /* printf("lbn %d: parent is the triple\n", -lbn); */ bread(fsbtodb(sblock, up), bp, sblock->lfs_bsize); - return ((daddr_t *)bp)[off]; + /* XXX ondisk32 */ + return (daddr_t)((int32_t *)bp)[off]; } else /* residue == 0 */ { /* Single indirect. Two cases. */ if(lbn < BASE_TINDIR) { @@ -262,7 +263,8 @@ lfs_bmap(struct lfs *fs, struct dinode *idinode, ufs_daddr_t lbn) if(up == UNASSIGNED || up == LFS_UNUSED_DADDR) return UNASSIGNED; bread(fsbtodb(sblock, up), bp, sblock->lfs_bsize); - return ((daddr_t *)bp)[off]; + /* XXX ondisk32 */ + return (daddr_t)((int32_t *)bp)[off]; } static struct ifile * @@ -270,7 +272,7 @@ lfs_ientry(ino_t ino) { static struct ifile ifileblock[MAXIFPB]; static daddr_t ifblkno; - ufs_daddr_t lbn; + daddr_t lbn; daddr_t blkno; lbn = ino/sblock->lfs_ifpb + sblock->lfs_cleansz + sblock->lfs_segtabsz; diff --git a/sbin/fsck_ext2fs/fsck.h b/sbin/fsck_ext2fs/fsck.h index 1e59598e7438..8cda60444b5f 100644 --- a/sbin/fsck_ext2fs/fsck.h +++ b/sbin/fsck_ext2fs/fsck.h @@ -1,4 +1,4 @@ -/* $NetBSD: fsck.h,v 1.5 2001/02/04 21:19:34 christos Exp $ */ +/* $NetBSD: fsck.h,v 1.6 2003/01/24 21:55:07 fvdl Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. @@ -64,7 +64,8 @@ struct bufarea { int b_flags; union { char *b_buf; /* buffer space */ - daddr_t *b_indir; /* indirect block */ + /* XXX ondisk32 */ + int32_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 */ @@ -160,7 +161,8 @@ 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 */ + /* XXX ondisk32 */ + int32_t i_blks[1]; /* actually longer */ } **inphead, **inpsort; long numdirs, listmax, inplast; diff --git a/sbin/fsck_ext2fs/inode.c b/sbin/fsck_ext2fs/inode.c index 85642c3bd402..a9418ba33919 100644 --- a/sbin/fsck_ext2fs/inode.c +++ b/sbin/fsck_ext2fs/inode.c @@ -1,4 +1,4 @@ -/* $NetBSD: inode.c,v 1.8 2000/01/28 16:01:46 bouyer Exp $ */ +/* $NetBSD: inode.c,v 1.9 2003/01/24 21:55:07 fvdl Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)inode.c 8.5 (Berkeley) 2/8/95"; #else -__RCSID("$NetBSD: inode.c,v 1.8 2000/01/28 16:01:46 bouyer Exp $"); +__RCSID("$NetBSD: inode.c,v 1.9 2003/01/24 21:55:07 fvdl Exp $"); #endif #endif /* not lint */ @@ -168,8 +168,9 @@ iblock(idesc, ilevel, isize) long ilevel; u_int64_t isize; { - daddr_t *ap; - daddr_t *aplim; + /* XXX ondisk32 */ + int32_t *ap; + int32_t *aplim; struct bufarea *bp; int i, n, (*func) __P((struct inodesc *)), nif; u_int64_t sizepb; @@ -266,11 +267,13 @@ chkrange(blk, cnt) if ((blk + cnt) > sblock.e2fs.e2fs_bpg * c + overh + sblock.e2fs.e2fs_first_dblock) { if (debug) { - printf("blk %d < cgdmin %d;", - blk, sblock.e2fs.e2fs_bpg * c + overh + + printf("blk %lld < cgdmin %d;", + (long long)blk, + sblock.e2fs.e2fs_bpg * c + overh + sblock.e2fs.e2fs_first_dblock); - printf(" blk + cnt %d > cgsbase %d\n", - blk + cnt, sblock.e2fs.e2fs_bpg * c + + printf(" blk + cnt %lld > cgsbase %d\n", + (long long)(blk + cnt), + sblock.e2fs.e2fs_bpg * c + overh + sblock.e2fs.e2fs_first_dblock); } return (1); @@ -279,11 +282,13 @@ chkrange(blk, cnt) if ((blk + cnt) > sblock.e2fs.e2fs_bpg * (c + 1) + overh + sblock.e2fs.e2fs_first_dblock) { if (debug) { - printf("blk %d >= cgdmin %d;", - blk, sblock.e2fs.e2fs_bpg * c + overh + + printf("blk %lld >= cgdmin %d;", + (long long)blk, + sblock.e2fs.e2fs_bpg * c + overh + sblock.e2fs.e2fs_first_dblock); - printf(" blk + cnt %d > cgdmax %d\n", - blk+cnt, sblock.e2fs.e2fs_bpg * (c + 1) + + printf(" blk + cnt %lld > cgdmax %d\n", + (long long)(blk+cnt), + sblock.e2fs.e2fs_bpg * (c + 1) + overh + sblock.e2fs.e2fs_first_dblock); } return (1); @@ -404,8 +409,9 @@ cacheino(dp, inumber) blks = howmany(fs2h32(dp->e2di_size), sblock.e2fs_bsize); if (blks > NDADDR) blks = NDADDR + NIADDR; + /* XXX ondisk32 */ inp = (struct inoinfo *) - malloc(sizeof(*inp) + (blks - 1) * sizeof(daddr_t)); + malloc(sizeof(*inp) + (blks - 1) * sizeof(int32_t)); if (inp == NULL) return; inpp = &inphead[inumber % numdirs]; @@ -419,7 +425,8 @@ cacheino(dp, inumber) inp->i_dotdot = (ino_t)0; inp->i_number = inumber; inp->i_isize = fs2h32(dp->e2di_size); - inp->i_numblks = blks * sizeof(daddr_t); + /* XXX ondisk32 */ + inp->i_numblks = blks * sizeof(int32_t); memcpy(&inp->i_blks[0], &dp->e2di_blocks[0], (size_t)inp->i_numblks); if (inplast == listmax) { listmax += 100; @@ -566,7 +573,7 @@ blkerror(ino, type, blk) daddr_t blk; { - pfatal("%d %s I=%u", blk, type, ino); + pfatal("%lld %s I=%u", (long long)blk, type, ino); printf("\n"); switch (statemap[ino]) { diff --git a/sbin/fsck_ext2fs/main.c b/sbin/fsck_ext2fs/main.c index fd77c33745d8..9cfee37d87d4 100644 --- a/sbin/fsck_ext2fs/main.c +++ b/sbin/fsck_ext2fs/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.10 2001/02/19 22:56:19 cgd Exp $ */ +/* $NetBSD: main.c,v 1.11 2003/01/24 21:55:07 fvdl Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. @@ -44,7 +44,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1986, 1993\n\ #if 0 static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 1/23/94"; #else -__RCSID("$NetBSD: main.c,v 1.10 2001/02/19 22:56:19 cgd Exp $"); +__RCSID("$NetBSD: main.c,v 1.11 2003/01/24 21:55:07 fvdl Exp $"); #endif #endif /* not lint */ @@ -246,22 +246,22 @@ checkfilesys(filesys, mntpt, auxdata, child) */ n_bfree = sblock.e2fs.e2fs_fbcount; - pwarn("%d files, %d used, %d free\n", - n_files, n_blks, n_bfree); + pwarn("%lld files, %lld used, %lld free\n", + (long long)n_files, (long long)n_blks, (long long)n_bfree); if (debug && /* 9 reserved and unused inodes in FS */ (n_files -= maxino - 9 - sblock.e2fs.e2fs_ficount)) - printf("%d files missing\n", n_files); + printf("%lld files missing\n", (long long)n_files); if (debug) { for (i = 0; i < sblock.e2fs_ncg; i++) n_blks += cgoverhead(i); n_blks += sblock.e2fs.e2fs_first_dblock; if (n_blks -= maxfsblock - n_bfree) - printf("%d blocks missing\n", n_blks); + printf("%lld blocks missing\n", (long long)n_blks); if (duplist != NULL) { printf("The following duplicate blocks remain:"); for (dp = duplist; dp; dp = dp->next) - printf(" %d,", dp->dup); + printf(" %lld,", (long long)dp->dup); printf("\n"); } if (zlnhead != NULL) { diff --git a/sbin/fsck_ext2fs/utilities.c b/sbin/fsck_ext2fs/utilities.c index 72f836db5657..15da850eabce 100644 --- a/sbin/fsck_ext2fs/utilities.c +++ b/sbin/fsck_ext2fs/utilities.c @@ -1,4 +1,4 @@ -/* $NetBSD: utilities.c,v 1.6 2001/02/04 21:19:34 christos Exp $ */ +/* $NetBSD: utilities.c,v 1.7 2003/01/24 21:55:07 fvdl Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)utilities.c 8.1 (Berkeley) 6/5/93"; #else -__RCSID("$NetBSD: utilities.c,v 1.6 2001/02/04 21:19:34 christos Exp $"); +__RCSID("$NetBSD: utilities.c,v 1.7 2003/01/24 21:55:07 fvdl Exp $"); #endif #endif /* not lint */ @@ -214,9 +214,9 @@ flush(fd, 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); + (long long)bp->b_bno); bp->b_dirty = 0; bp->b_errs = 0; bwrite(fd, bp->b_un.b_buf, bp->b_bno, (long)bp->b_size); @@ -238,7 +238,7 @@ rwerror(mesg, blk) if (preen == 0) printf("\n"); - pfatal("CANNOT %s: BLK %d", mesg, blk); + pfatal("CANNOT %s: BLK %lld", mesg, (long long)blk); if (reply("CONTINUE") == 0) errexit("Program terminated\n"); } @@ -322,11 +322,12 @@ bread(fd, buf, blk, size) if (read(fd, cp, (int)secsize) != secsize) { (void)lseek(fd, offset + i + secsize, 0); if (secsize != dev_bsize && dev_bsize != 1) - printf(" %ld (%ld),", - (blk * dev_bsize + i) / secsize, - blk + i / dev_bsize); + printf(" %lld (%lld),", + (long long)((blk*dev_bsize + i) / secsize), + (long long)(blk + i / dev_bsize)); else - printf(" %ld,", blk + i / dev_bsize); + printf(" %lld,", (long long)(blk + + i / dev_bsize)); errs++; } } @@ -362,7 +363,7 @@ bwrite(fd, buf, blk, 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, 0); - printf(" %ld,", blk + i / dev_bsize); + printf(" %lld,", (long long)(blk + i / dev_bsize)); } printf("\n"); return; diff --git a/sbin/fsck_ffs/dir.c b/sbin/fsck_ffs/dir.c index 26fb379d679b..cdf6f2c928cc 100644 --- a/sbin/fsck_ffs/dir.c +++ b/sbin/fsck_ffs/dir.c @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.34 2002/09/28 20:11:05 dbj Exp $ */ +/* $NetBSD: dir.c,v 1.35 2003/01/24 21:55:07 fvdl Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)dir.c 8.8 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: dir.c,v 1.34 2002/09/28 20:11:05 dbj Exp $"); +__RCSID("$NetBSD: dir.c,v 1.35 2003/01/24 21:55:07 fvdl Exp $"); #endif #endif /* not lint */ @@ -654,7 +654,7 @@ expanddir(dp, name) struct dinode *dp; char *name; { - ufs_daddr_t lastbn, newblk; + daddr_t lastbn, newblk; struct bufarea *bp; char *cp; #if DIRBLKSIZ > APPLEUFS_DIRBLKSIZ @@ -822,7 +822,7 @@ lftempname(bufp, ino) */ static struct bufarea * getdirblk(blkno, size) - ufs_daddr_t blkno; + daddr_t blkno; long size; { diff --git a/sbin/fsck_ffs/extern.h b/sbin/fsck_ffs/extern.h index c23ef9cc03bc..bb0f08e14b96 100644 --- a/sbin/fsck_ffs/extern.h +++ b/sbin/fsck_ffs/extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.14 2002/05/06 03:17:43 lukem Exp $ */ +/* $NetBSD: extern.h,v 1.15 2003/01/24 21:55:08 fvdl Exp $ */ /* * Copyright (c) 1994 James A. Jegers @@ -25,18 +25,18 @@ */ void adjust __P((struct inodesc *, int)); -ufs_daddr_t allocblk __P((long)); +daddr_t allocblk __P((long)); ino_t allocdir __P((ino_t, ino_t, int)); ino_t allocino __P((ino_t request, int type)); -void blkerror __P((ino_t, char *, ufs_daddr_t)); -int bread __P((int, char *, ufs_daddr_t, long)); +void blkerror __P((ino_t, char *, daddr_t)); +int bread __P((int, char *, daddr_t, long)); void bufinit __P((void)); -void bwrite __P((int, char *, ufs_daddr_t, long)); +void bwrite __P((int, char *, daddr_t, long)); void cacheino __P((struct dinode *, ino_t)); void catch __P((int)); void catchquit __P((int)); int changeino __P((ino_t, char *, ino_t)); -int chkrange __P((ufs_daddr_t, int)); +int chkrange __P((daddr_t, int)); void ckfini __P((void)); int ckinode __P((struct dinode *, struct inodesc *)); void clri __P((struct inodesc *, char *, int)); @@ -49,12 +49,12 @@ void fileerror __P((ino_t, ino_t, char *)); int findino __P((struct inodesc *)); int findname __P((struct inodesc *)); void flush __P((int, struct bufarea *)); -void freeblk __P((ufs_daddr_t, long)); +void freeblk __P((daddr_t, long)); void freeino __P((ino_t)); void freeinodebuf __P((void)); int ftypeok __P((struct dinode *)); -void getblk __P((struct bufarea *, ufs_daddr_t, long)); -struct bufarea *getdatablk __P((ufs_daddr_t, long)); +void getblk __P((struct bufarea *, daddr_t, long)); +struct bufarea *getdatablk __P((daddr_t, long)); struct inoinfo *getinoinfo __P((ino_t)); struct dinode *ginode __P((ino_t)); void getpathname __P((char *, ino_t, ino_t)); diff --git a/sbin/fsck_ffs/fsck.h b/sbin/fsck_ffs/fsck.h index e7ba99ce97e3..3f1c2ce47b10 100644 --- a/sbin/fsck_ffs/fsck.h +++ b/sbin/fsck_ffs/fsck.h @@ -1,4 +1,4 @@ -/* $NetBSD: fsck.h,v 1.29 2002/09/28 20:11:06 dbj Exp $ */ +/* $NetBSD: fsck.h,v 1.30 2003/01/24 21:55:08 fvdl Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -61,13 +61,14 @@ struct bufarea { struct bufarea *b_next; /* free list queue */ struct bufarea *b_prev; /* free list queue */ - ufs_daddr_t b_bno; + daddr_t b_bno; int b_size; int b_errs; int b_flags; union { char *b_buf; /* buffer space */ - ufs_daddr_t *b_indir; /* indirect block */ + /* XXX ondisk32 */ + int32_t *b_indir; /* indirect block */ struct fs *b_fs; /* super block */ struct cg *b_cg; /* cylinder group */ struct appleufslabel *b_appleufs; /* Apple UFS volume label */ @@ -89,7 +90,7 @@ struct bufarea *pbp; /* current inode block */ #define dirty(bp) (bp)->b_dirty = 1 #define initbarea(bp) \ (bp)->b_dirty = 0; \ - (bp)->b_bno = (ufs_daddr_t)-1; \ + (bp)->b_bno = (daddr_t)-1; \ (bp)->b_flags = 0; struct fs *sblock; @@ -120,7 +121,7 @@ struct inodesc { __P((struct inodesc *)); ino_t id_number; /* inode number described */ ino_t id_parent; /* for DATA nodes, their parent */ - ufs_daddr_t id_blkno; /* current block number being examined */ + daddr_t id_blkno; /* current block number being examined */ int id_numfrags; /* number of frags contained in block */ int64_t id_filesize; /* for DATA nodes, the size of the directory */ int id_loc; /* for DATA nodes, current location in dir */ @@ -156,7 +157,7 @@ struct inodesc { */ struct dups { struct dups *next; - ufs_daddr_t dup; + daddr_t dup; }; struct dups *duplist; /* head of dup list */ struct dups *muldup; /* end of unique duplicate dup block numbers */ @@ -181,7 +182,8 @@ 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 */ - ufs_daddr_t i_blks[1]; /* actually longer */ + /* XXX ondisk32 */ + int32_t i_blks[1]; /* actually longer */ } **inphead, **inpsort; long numdirs, listmax, inplast; @@ -213,7 +215,7 @@ int rerun; /* rerun fsck. Only used in non-preen mode */ char resolved; /* cleared if unresolved changes => not clean */ int isappleufs; /* filesystem is Apple UFS */ -ufs_daddr_t maxfsblock; /* number of blocks in the file system */ +daddr_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 */ @@ -227,8 +229,8 @@ extern ino_t lfdir; /* lost & found directory inode number */ extern char *lfname; /* lost & found directory name */ extern int lfmode; /* lost & found directory creation mode */ -ufs_daddr_t n_blks; /* number of blocks in use */ -ufs_daddr_t n_files; /* number of files in use */ +daddr_t n_blks; /* number of blocks in use */ +ino_t n_files; /* number of files in use */ int got_siginfo; /* received a SIGINFO */ diff --git a/sbin/fsck_ffs/inode.c b/sbin/fsck_ffs/inode.c index 1eedacb62d30..f3d5b1fc5830 100644 --- a/sbin/fsck_ffs/inode.c +++ b/sbin/fsck_ffs/inode.c @@ -1,4 +1,4 @@ -/* $NetBSD: inode.c,v 1.35 2002/09/28 20:11:06 dbj Exp $ */ +/* $NetBSD: inode.c,v 1.36 2003/01/24 21:55:08 fvdl Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)inode.c 8.8 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: inode.c,v 1.35 2002/09/28 20:11:06 dbj Exp $"); +__RCSID("$NetBSD: inode.c,v 1.36 2003/01/24 21:55:08 fvdl Exp $"); #endif #endif /* not lint */ @@ -73,7 +73,8 @@ ckinode(dp, idesc) struct dinode *dp; struct inodesc *idesc; { - ufs_daddr_t *ap; + /* XXX ondisk32 */ + int32_t *ap; long ret, n, ndb, offset; struct dinode dino; u_int64_t sizepb; @@ -169,8 +170,9 @@ iblock(idesc, ilevel, isize) long ilevel; u_int64_t isize; { - ufs_daddr_t *ap; - ufs_daddr_t *aplim; + /* XXX ondisk32 */ + int32_t *ap; + int32_t *aplim; struct bufarea *bp; int i, n, (*func) __P((struct inodesc *)), nif; u_int64_t sizepb; @@ -261,7 +263,7 @@ iblock(idesc, ilevel, isize) */ int chkrange(blk, cnt) - ufs_daddr_t blk; + daddr_t blk; int cnt; { int c; @@ -272,20 +274,23 @@ chkrange(blk, cnt) if (blk < cgdmin(sblock, c)) { if ((blk + cnt) > cgsblock(sblock, c)) { if (debug) { - printf("blk %d < cgdmin %d;", - blk, cgdmin(sblock, c)); - printf(" blk + cnt %d > cgsbase %d\n", - blk + cnt, cgsblock(sblock, c)); + printf("blk %lld < cgdmin %lld;", + (long long)blk, + (long long)cgdmin(sblock, c)); + printf(" blk + cnt %lld > cgsbase %lld\n", + (long long)(blk + cnt), + (long long)cgsblock(sblock, c)); } return (1); } } else { if ((blk + cnt) > cgbase(sblock, c+1)) { if (debug) { - printf("blk %d >= cgdmin %d;", - blk, cgdmin(sblock, c)); - printf(" blk + cnt %d > sblock->fs_fpg %d\n", - blk+cnt, sblock->fs_fpg); + printf("blk %lld >= cgdmin %lld;", + (long long)blk, + (long long)cgdmin(sblock, c)); + printf(" blk + cnt %lld > sblock->fs_fpg %d\n", + (long long)(blk+cnt), sblock->fs_fpg); } return (1); } @@ -300,7 +305,7 @@ struct dinode * ginode(inumber) ino_t inumber; { - ufs_daddr_t iblk; + daddr_t iblk; int blkoff; if (inumber < ROOTINO || inumber > maxino) @@ -330,7 +335,7 @@ getnextinode(inumber) ino_t inumber; { long size; - ufs_daddr_t dblk; + daddr_t dblk; static struct dinode *dp; if (inumber != nextino++ || inumber > maxino) @@ -419,8 +424,9 @@ cacheino(dp, inumber) blks = howmany(iswap64(dp->di_size), sblock->fs_bsize); if (blks > NDADDR) blks = NDADDR + NIADDR; + /* XXX ondisk32 */ if (blks > 0) - extra = (blks - 1) * sizeof(ufs_daddr_t); + extra = (blks - 1) * sizeof(int32_t); else extra = 0; inp = (struct inoinfo *) malloc(sizeof(*inp) + extra); @@ -437,7 +443,8 @@ cacheino(dp, inumber) inp->i_dotdot = (ino_t)0; inp->i_number = inumber; inp->i_isize = iswap64(dp->di_size); - inp->i_numblks = blks * sizeof(ufs_daddr_t); + /* XXX ondisk32 */ + inp->i_numblks = blks * sizeof(int32_t); memmove(&inp->i_blks[0], &dp->di_db[0], (size_t)inp->i_numblks); if (inplast == listmax) { listmax += 100; @@ -578,10 +585,10 @@ void blkerror(ino, type, blk) ino_t ino; char *type; - ufs_daddr_t blk; + daddr_t blk; { - pfatal("%d %s I=%u", blk, type, ino); + pfatal("%lld %s I=%u", (long long)blk, type, ino); printf("\n"); switch (statemap[ino]) { diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c index cfca7530705a..3fc4c14f87a3 100644 --- a/sbin/fsck_ffs/main.c +++ b/sbin/fsck_ffs/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.42 2002/09/28 20:11:06 dbj Exp $ */ +/* $NetBSD: main.c,v 1.43 2003/01/24 21:55:08 fvdl Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1986, 1993\n\ #if 0 static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14/95"; #else -__RCSID("$NetBSD: main.c,v 1.42 2002/09/28 20:11:06 dbj Exp $"); +__RCSID("$NetBSD: main.c,v 1.43 2003/01/24 21:55:08 fvdl Exp $"); #endif #endif /* not lint */ @@ -208,7 +208,7 @@ checkfilesys(filesys, mntpt, auxdata, child) long auxdata; int child; { - ufs_daddr_t n_ffree, n_bfree; + daddr_t n_ffree, n_bfree; struct dups *dp; struct zlncnt *zlnp; #ifdef LITE2BORKEN @@ -289,11 +289,14 @@ checkfilesys(filesys, mntpt, auxdata, child) */ n_ffree = sblock->fs_cstotal.cs_nffree; n_bfree = sblock->fs_cstotal.cs_nbfree; - pwarn("%d files, %d used, %d free ", - n_files, n_blks, n_ffree + sblock->fs_frag * n_bfree); - printf("(%d frags, %d blocks, %d.%d%% fragmentation)\n", - n_ffree, n_bfree, (n_ffree * 100) / sblock->fs_dsize, - ((n_ffree * 1000 + sblock->fs_dsize / 2) / sblock->fs_dsize) % 10); + pwarn("%d files, %lld used, %lld free ", + n_files, (long long)n_blks, + (long long)n_ffree + sblock->fs_frag * n_bfree); + printf("(%lld frags, %lld blocks, %lld.%lld%% fragmentation)\n", + (long long)n_ffree, (long long)n_bfree, + (long long)(n_ffree * 100) / (daddr_t)sblock->fs_dsize, + (long long)((n_ffree * 1000 + (daddr_t)sblock->fs_dsize / 2) + / (daddr_t)sblock->fs_dsize) % 10); if (debug && (n_files -= maxino - ROOTINO - sblock->fs_cstotal.cs_nifree)) printf("%d files missing\n", n_files); @@ -303,11 +306,11 @@ checkfilesys(filesys, mntpt, auxdata, child) 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", (long long)n_blks); if (duplist != NULL) { printf("The following duplicate blocks remain:"); for (dp = duplist; dp; dp = dp->next) - printf(" %d,", dp->dup); + printf(" %lld,", (long long)dp->dup); printf("\n"); } if (zlnhead != NULL) { diff --git a/sbin/fsck_ffs/pass1.c b/sbin/fsck_ffs/pass1.c index 57543b68d83c..e63d5d0abec0 100644 --- a/sbin/fsck_ffs/pass1.c +++ b/sbin/fsck_ffs/pass1.c @@ -1,4 +1,4 @@ -/* $NetBSD: pass1.c,v 1.25 2002/09/28 20:11:06 dbj Exp $ */ +/* $NetBSD: pass1.c,v 1.26 2003/01/24 21:55:08 fvdl Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)pass1.c 8.6 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: pass1.c,v 1.25 2002/09/28 20:11:06 dbj Exp $"); +__RCSID("$NetBSD: pass1.c,v 1.26 2003/01/24 21:55:08 fvdl Exp $"); #endif #endif /* not lint */ @@ -58,8 +58,8 @@ __RCSID("$NetBSD: pass1.c,v 1.25 2002/09/28 20:11:06 dbj Exp $"); #include "extern.h" #include "fsutil.h" -static ufs_daddr_t badblk; -static ufs_daddr_t dupblk; +static daddr_t badblk; +static daddr_t dupblk; static void checkinode __P((ino_t, struct inodesc *)); void @@ -128,10 +128,11 @@ checkinode(inumber, idesc) mode = iswap16(dp->di_mode) & IFMT; size = iswap64(dp->di_size); if (mode == 0) { + /* XXX ondisk32 */ if (memcmp(dp->di_db, zino.di_db, - NDADDR * sizeof(ufs_daddr_t)) || + NDADDR * sizeof(int32_t)) || memcmp(dp->di_ib, zino.di_ib, - NIADDR * sizeof(ufs_daddr_t)) || + NIADDR * sizeof(int32_t)) || dp->di_mode || dp->di_size) { pfatal("PARTIALLY ALLOCATED INODE I=%u", inumber); if (reply("CLEAR") == 1) { @@ -201,7 +202,8 @@ checkinode(inumber, idesc) if (size < sblock->fs_maxsymlinklen || (isappleufs && (size < APPLEUFS_MAXSYMLINKLEN)) || (sblock->fs_maxsymlinklen == 0 && dp->di_blocks == 0)) { - ndb = howmany(size, sizeof(daddr_t)); + /* XXX ondisk32 */ + ndb = howmany(size, sizeof(int32_t)); if (ndb > NDADDR) { j = ndb - NDADDR; for (ndb = 1; j > 1; j--) @@ -300,7 +302,7 @@ pass1check(idesc) { int res = KEEPON; int anyout, nfrags; - ufs_daddr_t blkno = idesc->id_blkno; + daddr_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 4ec0091ff4b7..c16abd3b1f11 100644 --- a/sbin/fsck_ffs/pass1b.c +++ b/sbin/fsck_ffs/pass1b.c @@ -1,4 +1,4 @@ -/* $NetBSD: pass1b.c,v 1.14 2002/05/06 03:17:43 lukem Exp $ */ +/* $NetBSD: pass1b.c,v 1.15 2003/01/24 21:55:08 fvdl Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)pass1b.c 8.4 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: pass1b.c,v 1.14 2002/05/06 03:17:43 lukem Exp $"); +__RCSID("$NetBSD: pass1b.c,v 1.15 2003/01/24 21:55:08 fvdl Exp $"); #endif #endif /* not lint */ @@ -98,7 +98,7 @@ pass1bcheck(idesc) { struct dups *dlp; int nfrags, res = KEEPON; - ufs_daddr_t blkno = idesc->id_blkno; + daddr_t blkno = idesc->id_blkno; for (nfrags = idesc->id_numfrags; nfrags > 0; blkno++, nfrags--) { if (chkrange(blkno, 1)) diff --git a/sbin/fsck_ffs/pass4.c b/sbin/fsck_ffs/pass4.c index eb59a2072187..4bf5359924e1 100644 --- a/sbin/fsck_ffs/pass4.c +++ b/sbin/fsck_ffs/pass4.c @@ -1,4 +1,4 @@ -/* $NetBSD: pass4.c,v 1.15 2002/05/06 03:17:43 lukem Exp $ */ +/* $NetBSD: pass4.c,v 1.16 2003/01/24 21:55:08 fvdl Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)pass4.c 8.4 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: pass4.c,v 1.15 2002/05/06 03:17:43 lukem Exp $"); +__RCSID("$NetBSD: pass4.c,v 1.16 2003/01/24 21:55:08 fvdl Exp $"); #endif #endif /* not lint */ @@ -128,7 +128,7 @@ pass4check(idesc) { struct dups *dlp; int nfrags, res = KEEPON; - ufs_daddr_t blkno = idesc->id_blkno; + daddr_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 92f01f90cd57..6bb993951663 100644 --- a/sbin/fsck_ffs/pass5.c +++ b/sbin/fsck_ffs/pass5.c @@ -1,4 +1,4 @@ -/* $NetBSD: pass5.c,v 1.31 2002/09/28 20:11:06 dbj Exp $ */ +/* $NetBSD: pass5.c,v 1.32 2003/01/24 21:55:09 fvdl Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)pass5.c 8.9 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: pass5.c,v 1.31 2002/09/28 20:11:06 dbj Exp $"); +__RCSID("$NetBSD: pass5.c,v 1.32 2003/01/24 21:55:09 fvdl Exp $"); #endif #endif /* not lint */ @@ -67,8 +67,8 @@ pass5() int32_t savednpsect, savedinterleave; int inomapsize, blkmapsize; struct fs *fs = sblock; - ufs_daddr_t dbase, dmax; - ufs_daddr_t d; + daddr_t dbase, dmax; + daddr_t d; long i, j, k; struct csum *cs; struct csum cstotal; diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c index c63360e922f8..e42f2bb3fa96 100644 --- a/sbin/fsck_ffs/setup.c +++ b/sbin/fsck_ffs/setup.c @@ -1,4 +1,4 @@ -/* $NetBSD: setup.c,v 1.55 2002/11/05 05:18:50 dbj Exp $ */ +/* $NetBSD: setup.c,v 1.56 2003/01/24 21:55:09 fvdl Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)setup.c 8.10 (Berkeley) 5/9/95"; #else -__RCSID("$NetBSD: setup.c,v 1.55 2002/11/05 05:18:50 dbj Exp $"); +__RCSID("$NetBSD: setup.c,v 1.56 2003/01/24 21:55:09 fvdl Exp $"); #endif #endif /* not lint */ @@ -471,7 +471,7 @@ badsblabel: static int readappleufs() { - ufs_daddr_t label = APPLEUFS_LABEL_OFFSET / dev_bsize; + daddr_t label = APPLEUFS_LABEL_OFFSET / dev_bsize; struct appleufslabel *appleufs; int i; @@ -577,7 +577,7 @@ static int readsb(listerr) int listerr; { - ufs_daddr_t super = bflag ? bflag : SBOFF / dev_bsize; + daddr_t super = bflag ? bflag : SBOFF / dev_bsize; struct fs *fs; if (bread(fsreadfd, (char *)sblk.b_un.b_fs, super, (long)SBSIZE) != 0) diff --git a/sbin/fsck_ffs/utilities.c b/sbin/fsck_ffs/utilities.c index a8ff554db48b..764eacb0fcc9 100644 --- a/sbin/fsck_ffs/utilities.c +++ b/sbin/fsck_ffs/utilities.c @@ -1,4 +1,4 @@ -/* $NetBSD: utilities.c,v 1.34 2002/09/28 20:11:06 dbj Exp $ */ +/* $NetBSD: utilities.c,v 1.35 2003/01/24 21:55:09 fvdl Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)utilities.c 8.6 (Berkeley) 5/19/95"; #else -__RCSID("$NetBSD: utilities.c,v 1.34 2002/09/28 20:11:06 dbj Exp $"); +__RCSID("$NetBSD: utilities.c,v 1.35 2003/01/24 21:55:09 fvdl Exp $"); #endif #endif /* not lint */ @@ -64,7 +64,7 @@ __RCSID("$NetBSD: utilities.c,v 1.34 2002/09/28 20:11:06 dbj Exp $"); long diskreads, totalreads; /* Disk cache statistics */ -static void rwerror __P((char *, ufs_daddr_t)); +static void rwerror __P((char *, daddr_t)); extern int returntosingle; @@ -176,7 +176,7 @@ bufinit() */ struct bufarea * getdatablk(blkno, size) - ufs_daddr_t blkno; + daddr_t blkno; long size; { struct bufarea *bp; @@ -206,10 +206,10 @@ foundit: void getblk(bp, blk, size) struct bufarea *bp; - ufs_daddr_t blk; + daddr_t blk; long size; { - ufs_daddr_t dblk; + daddr_t dblk; dblk = fsbtodb(sblock, blk); if (bp->b_bno != dblk) { @@ -232,9 +232,9 @@ flush(fd, 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); + (long long)bp->b_bno); bp->b_dirty = 0; bp->b_errs = 0; bwrite(fd, bp->b_un.b_buf, bp->b_bno, (long)bp->b_size); @@ -257,12 +257,12 @@ flush(fd, bp) static void rwerror(mesg, blk) char *mesg; - ufs_daddr_t blk; + daddr_t blk; { if (preen == 0) printf("\n"); - pfatal("CANNOT %s: BLK %d", mesg, blk); + pfatal("CANNOT %s: BLK %lld", mesg, (long long)blk); if (reply("CONTINUE") == 0) exit(EEXIT); } @@ -330,7 +330,7 @@ int bread(fd, buf, blk, size) int fd; char *buf; - ufs_daddr_t blk; + daddr_t blk; long size; { char *cp; @@ -353,11 +353,12 @@ bread(fd, buf, blk, size) if (read(fd, cp, (int)secsize) != secsize) { (void)lseek(fd, offset + i + secsize, 0); if (secsize != dev_bsize && dev_bsize != 1) - printf(" %ld (%ld),", - (blk * dev_bsize + i) / secsize, - blk + i / dev_bsize); + printf(" %lld (%lld),", + (long long)((blk*dev_bsize + i) / secsize), + (long long)(blk + i / dev_bsize)); else - printf(" %ld,", blk + i / dev_bsize); + printf(" %lld,", + (long long)(blk + i / dev_bsize)); errs++; } } @@ -369,7 +370,7 @@ void bwrite(fd, buf, blk, size) int fd; char *buf; - ufs_daddr_t blk; + daddr_t blk; long size; { int i; @@ -393,7 +394,7 @@ bwrite(fd, buf, blk, 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, 0); - printf(" %ld,", blk + i / dev_bsize); + printf(" %lld,", (long long)(blk + i / dev_bsize)); } printf("\n"); return; @@ -402,7 +403,7 @@ bwrite(fd, buf, blk, size) /* * allocate a data block with the specified number of fragments */ -ufs_daddr_t +daddr_t allocblk(frags) long frags; { @@ -452,7 +453,7 @@ allocblk(frags) */ void freeblk(blkno, frags) - ufs_daddr_t blkno; + daddr_t blkno; long frags; { struct inodesc idesc; diff --git a/sbin/fsck_lfs/fsck.h b/sbin/fsck_lfs/fsck.h index b2294c174d68..e367bbce27a0 100644 --- a/sbin/fsck_lfs/fsck.h +++ b/sbin/fsck_lfs/fsck.h @@ -1,4 +1,4 @@ -/* $NetBSD: fsck.h,v 1.6 2002/05/23 04:05:11 perseant Exp $ */ +/* $NetBSD: fsck.h,v 1.7 2003/01/24 21:55:09 fvdl Exp $ */ /* * Copyright (c) 1997 @@ -72,7 +72,8 @@ struct bufarea { int b_flags; union { char *b_buf; /* buffer space */ - daddr_t *b_indir; /* indirect block */ + /* XXX ondisk32 */ + int32_t *b_indir; /* indirect block */ struct lfs *b_fs; /* super block */ struct cg *b_cg; /* cylinder group */ struct dinode *b_dinode; /* inode block */ @@ -172,7 +173,8 @@ 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 */ + /* XXX ondisk32 */ + int32_t i_blks[1]; /* actually longer */ } **inphead, **inpsort; #define clearinode(dp) (*(dp) = zino) diff --git a/sbin/fsck_lfs/fsck_vars.h b/sbin/fsck_lfs/fsck_vars.h index 86187317af0c..b4636a8eaf5b 100644 --- a/sbin/fsck_lfs/fsck_vars.h +++ b/sbin/fsck_lfs/fsck_vars.h @@ -1,4 +1,4 @@ -/* $NetBSD: fsck_vars.h,v 1.4 2000/06/14 18:43:58 perseant Exp $ */ +/* $NetBSD: fsck_vars.h,v 1.5 2003/01/24 21:55:09 fvdl Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -91,6 +91,6 @@ extern char *lfname; /* lost & found directory name */ extern int lfmode; /* lost & found directory creation mode */ extern daddr_t n_blks; /* number of blocks in use */ -extern daddr_t n_files; /* number of files in use */ +extern ino_t n_files; /* number of files in use */ extern struct dinode zino; diff --git a/sbin/fsck_lfs/inode.c b/sbin/fsck_lfs/inode.c index 0132af944404..6bdd1253fe9f 100644 --- a/sbin/fsck_lfs/inode.c +++ b/sbin/fsck_lfs/inode.c @@ -1,4 +1,4 @@ -/* $NetBSD: inode.c,v 1.13 2002/05/23 04:05:11 perseant Exp $ */ +/* $NetBSD: inode.c,v 1.14 2003/01/24 21:55:10 fvdl Exp $ */ /* * Copyright (c) 1997, 1998 @@ -113,12 +113,12 @@ blksreqd(struct lfs * fs, int blkno) #define D_UNITS (NINDIR(fs)) #define T_UNITS (NINDIR(fs)*NINDIR(fs)) -ufs_daddr_t lfs_bmap(struct lfs *, struct dinode *, ufs_daddr_t); +daddr_t lfs_bmap(struct lfs *, struct dinode *, daddr_t); -ufs_daddr_t -lfs_bmap(struct lfs * fs, struct dinode * idinode, ufs_daddr_t lbn) +daddr_t +lfs_bmap(struct lfs * fs, struct dinode * idinode, daddr_t lbn) { - ufs_daddr_t residue, up, off = 0; + daddr_t residue, up, off = 0; struct bufarea *bp; if (lbn > 0 && lbn > (idinode->di_size - 1) / dev_bsize) { @@ -156,7 +156,7 @@ lfs_bmap(struct lfs * fs, struct dinode * idinode, ufs_daddr_t lbn) /* printf("lbn %d: parent is the triple\n", -lbn); */ bp = getddblk(up, sblock.lfs_bsize); bp->b_flags &= ~B_INUSE; - return ((daddr_t *)(bp->b_un.b_buf))[off]; + return (daddr_t)(((int32_t *)(bp->b_un.b_buf))[off]); } else { /* residue == 0 */ /* Single indirect. Two cases. */ if (lbn < BASE_TINDIR) { @@ -195,7 +195,8 @@ lfs_bmap(struct lfs * fs, struct dinode * idinode, ufs_daddr_t lbn) return UNASSIGNED; bp = getddblk(up, sblock.lfs_bsize); bp->b_flags &= ~B_INUSE; - return ((daddr_t *)(bp->b_un.b_buf))[off]; + /* XXX ondisk32 */ + return (daddr_t)(((int32_t *)(bp->b_un.b_buf))[off]); } /* @@ -209,7 +210,7 @@ struct bufarea * getfileblk(struct lfs * fs, struct dinode * idinode, ino_t lbn) { struct bufarea *bp; - ufs_daddr_t blkno; + daddr_t blkno; static char empty_buf[65536]; empty.b_un.b_buf = &(empty_buf[0]); @@ -386,7 +387,8 @@ ino_to_fsba(struct lfs * fs, ino_t ino) int ckinode(struct dinode *dp, struct inodesc *idesc) { - register ufs_daddr_t *ap; + /* XXX ondisk32 */ + register int32_t *ap; long ret, n, ndb, offset; struct dinode dino; u_int64_t remsize, sizepb; @@ -478,7 +480,8 @@ ckinode(struct dinode *dp, struct inodesc *idesc) static int iblock(struct inodesc * idesc, long ilevel, u_int64_t isize) { - daddr_t *ap, *aplim; + /* XXX ondisk32 */ + int32_t *ap, *aplim; struct bufarea *bp; int i, n, (*func)(struct inodesc *), nif; u_int64_t sizepb; @@ -602,8 +605,9 @@ cacheino(struct dinode *dp, ino_t inumber) blks = howmany(dp->di_size, sblock.lfs_bsize); if (blks > NDADDR) blks = NDADDR + NIADDR; + /* XXX ondisk32 */ inp = (struct inoinfo *) - malloc(sizeof(*inp) + (blks - 1) * sizeof(daddr_t)); + malloc(sizeof(*inp) + (blks - 1) * sizeof(int32_t)); if (inp == NULL) return; inpp = &inphead[inumber % numdirs]; @@ -617,7 +621,8 @@ cacheino(struct dinode *dp, ino_t inumber) inp->i_dotdot = (ino_t)0; inp->i_number = inumber; inp->i_isize = dp->di_size; - inp->i_numblks = blks * sizeof(daddr_t); + /* XXX ondisk32 */ + inp->i_numblks = blks * sizeof(int32_t); memcpy(&inp->i_blks[0], &dp->di_db[0], (size_t)inp->i_numblks); if (inplast == listmax) { listmax += 100; @@ -763,7 +768,7 @@ void blkerror(ino_t ino, char *type, daddr_t blk) { - pfatal("%d %s I=%u", blk, type, ino); + pfatal("%lld %s I=%u", (long long)blk, type, ino); printf("\n"); if (exitonfail) exit(1); diff --git a/sbin/fsck_lfs/main.c b/sbin/fsck_lfs/main.c index a0ba225c8f80..4ea6e34fa6b1 100644 --- a/sbin/fsck_lfs/main.c +++ b/sbin/fsck_lfs/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.10 2001/08/18 17:10:06 ad Exp $ */ +/* $NetBSD: main.c,v 1.11 2003/01/24 21:55:10 fvdl Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -257,15 +257,16 @@ checkfilesys(const char *filesys, char *mntpt, long auxdata, int child) /* * print out summary statistics */ - pwarn("%d files, %d used, %d free ", - n_files, n_blks, n_ffree + sblock.lfs_frag * n_bfree); + pwarn("%d files, %lld used, %lld free ", + n_files, (long long)n_blks, + (long long)n_ffree + sblock.lfs_frag * n_bfree); putchar('\n'); } if (debug) { if (duplist != NULL) { printf("The following duplicate blocks remain:"); for (dp = duplist; dp; dp = dp->next) - printf(" %d,", dp->dup); + printf(" %lld,", (long long)dp->dup); printf("\n"); } if (zlnhead != NULL) { diff --git a/sbin/fsck_lfs/pass0.c b/sbin/fsck_lfs/pass0.c index 320d017a7b8f..30913dfedd0f 100644 --- a/sbin/fsck_lfs/pass0.c +++ b/sbin/fsck_lfs/pass0.c @@ -1,4 +1,4 @@ -/* $NetBSD: pass0.c,v 1.11 2002/02/04 23:41:28 perseant Exp $ */ +/* $NetBSD: pass0.c,v 1.12 2003/01/24 21:55:10 fvdl Exp $ */ /* * Copyright (c) 1998 Konrad E. Schroder. @@ -111,8 +111,8 @@ pass0() daddr = ifp->if_daddr; bp->b_flags &= ~B_INUSE; if (daddr) { - pwarn("! Ino %d with daddr 0x%x is on the free list!\n", - ino, daddr); + pwarn("! Ino %d with daddr 0x%llx is on the free list!\n", + ino, (long long)daddr); if (preen || reply("FIX") == 1) { if (plastino == 0) { sblock.lfs_free = nextino; @@ -157,7 +157,7 @@ pass0() static void dump_segsum(SEGSUM * sump, daddr_t addr) { - printf("Dump partial summary block 0x%x\n", addr); + printf("Dump partial summary block 0x%llx\n", (long long)addr); printf("\tsumsum: %x (%d)\n", sump->ss_sumsum, sump->ss_sumsum); printf("\tdatasum: %x (%d)\n", sump->ss_datasum, sump->ss_datasum); printf("\tnext: %x (%d)\n", sump->ss_next, sump->ss_next); @@ -291,7 +291,9 @@ check_summary(struct lfs * fs, SEGSUM * sp, daddr_t pseg_addr) FINFO *fp; int bc; /* Bytes in partial segment */ int nblocks; - daddr_t seg_addr, *dp, *idp, daddr; + daddr_t seg_addr, daddr; + /* XXX ondisk32 */ + int32_t *dp, *idp; struct bufarea *bp; int i, j, k, datac, len; long sn; @@ -320,8 +322,9 @@ check_summary(struct lfs * fs, SEGSUM * sp, daddr_t pseg_addr) datap = (u_long *)malloc(nblocks * sizeof(*datap)); datac = 0; - dp = (daddr_t *)sp; - dp += sblock.lfs_sumsize / sizeof(daddr_t); + /* XXX ondisk32 */ + dp = (int32_t *)sp; + dp += sblock.lfs_sumsize / sizeof(int32_t); dp--; idp = dp; @@ -330,11 +333,12 @@ check_summary(struct lfs * fs, SEGSUM * sp, daddr_t pseg_addr) for (i = 0, j = 0; i < sp->ss_nfinfo || j < howmany(sp->ss_ninos, INOPB(fs)); i++) { /* printf("*idp=%x, daddr=%x\n", *idp, daddr); */ if (i >= sp->ss_nfinfo && *idp != daddr) { - pwarn("Not enough inode blocks in pseg at 0x%x: found %d, wanted %d\n", - pseg_addr, j, howmany(sp->ss_ninos, INOPB(fs))); - pwarn("*idp=%x, daddr=%x\n", *idp, daddr); + pwarn("Not enough inode blocks in pseg at 0x%llx: found %d, wanted %d\n", + (long long)pseg_addr, j, howmany(sp->ss_ninos, INOPB(fs))); + pwarn("*idp=%x, daddr=%llx\n", *idp, (long long)daddr); break; } + /* XXX ondisk32 */ while (j < howmany(sp->ss_ninos, INOPB(fs)) && *idp == daddr) { bp = getddblk(daddr, fs->lfs_ibsize); datap[datac++] = ((u_long *)(bp->b_un.b_buf))[0]; @@ -358,14 +362,14 @@ check_summary(struct lfs * fs, SEGSUM * sp, daddr_t pseg_addr) } if (datac != nblocks) { - pwarn("Partial segment at 0x%x expected %d blocks counted %d\n", - pseg_addr, nblocks, datac); + pwarn("Partial segment at 0x%llx expected %d blocks counted %d\n", + (long long)pseg_addr, nblocks, datac); } ccksum = cksum(datap, nblocks * sizeof(u_long)); /* Check the data checksum */ if (ccksum != sp->ss_datasum) { - pwarn("Partial segment at 0x%x data checksum mismatch: got 0x%x, expected 0x%x\n", - pseg_addr, sp->ss_datasum, ccksum); + pwarn("Partial segment at 0x%llx data checksum mismatch: got 0x%x, expected 0x%x\n", + (long long)pseg_addr, sp->ss_datasum, ccksum); /* return 0; */ } return bc; diff --git a/sbin/fsck_lfs/pass1.c b/sbin/fsck_lfs/pass1.c index 67b671ac639a..afbc78260571 100644 --- a/sbin/fsck_lfs/pass1.c +++ b/sbin/fsck_lfs/pass1.c @@ -1,4 +1,4 @@ -/* $NetBSD: pass1.c,v 1.12 2001/09/25 00:03:25 wiz Exp $ */ +/* $NetBSD: pass1.c,v 1.13 2003/01/24 21:55:10 fvdl Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -197,8 +197,9 @@ checkinode(ino_t inumber, struct inodesc * idesc) /* XXX - LFS doesn't have this particular problem (?) */ if (mode == 0) { - if (memcmp(dp->di_db, zino.di_db, NDADDR * sizeof(daddr_t)) || - memcmp(dp->di_ib, zino.di_ib, NIADDR * sizeof(daddr_t)) || + /* XXX ondisk32 */ + if (memcmp(dp->di_db, zino.di_db, NDADDR * sizeof(int32_t)) || + memcmp(dp->di_ib, zino.di_ib, NIADDR * sizeof(int32_t)) || dp->di_mode || dp->di_size) { pwarn("mode=o%o, ifmt=o%o\n", dp->di_mode, mode); pfatal("PARTIALLY ALLOCATED INODE I=%u", inumber); @@ -266,7 +267,8 @@ checkinode(ino_t inumber, struct inodesc * idesc) */ if (dp->di_size < sblock.lfs_maxsymlinklen || (sblock.lfs_maxsymlinklen == 0 && dp->di_blocks == 0)) { - ndb = howmany(dp->di_size, sizeof(daddr_t)); + /* XXX ondisk32 */ + ndb = howmany(dp->di_size, sizeof(int32_t)); if (ndb > NDADDR) { j = ndb - NDADDR; for (ndb = 1; j > 1; j--) diff --git a/sbin/fsck_lfs/setup.c b/sbin/fsck_lfs/setup.c index cb9593b70244..c4559070f9c6 100644 --- a/sbin/fsck_lfs/setup.c +++ b/sbin/fsck_lfs/setup.c @@ -1,4 +1,4 @@ -/* $NetBSD: setup.c,v 1.11 2002/02/04 23:43:43 perseant Exp $ */ +/* $NetBSD: setup.c,v 1.12 2003/01/24 21:55:10 fvdl Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -356,12 +356,13 @@ setup(const char *dev) iblk.b_un.b_buf = malloc(sblock.lfs_ibsize); if (bread(fsreadfd, (char *)iblk.b_un.b_buf, fsbtodb(&sblock, idaddr), (long)sblock.lfs_ibsize) != 0) { - printf("Couldn't read disk block %d\n", idaddr); + printf("Couldn't read disk block %lld\n", (long long)idaddr); exit(1); } idinode = lfs_difind(&sblock, sblock.lfs_ifile, &ifblock); if (idinode == NULL) { - printf("Ifile inode not found at daddr 0x%x\n", idaddr); + printf("Ifile inode not found at daddr 0x%llx\n", + (unsigned long long)idaddr); exit(1); /* XXX find it in the segment summaries */ } diff --git a/sbin/fsck_lfs/utilities.c b/sbin/fsck_lfs/utilities.c index 27a1ae8502c9..bbc40bc92ecc 100644 --- a/sbin/fsck_lfs/utilities.c +++ b/sbin/fsck_lfs/utilities.c @@ -1,4 +1,4 @@ -/* $NetBSD: utilities.c,v 1.9 2002/05/23 04:05:11 perseant Exp $ */ +/* $NetBSD: utilities.c,v 1.10 2003/01/24 21:55:10 fvdl Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -214,9 +214,9 @@ 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); + (long long)bp->b_bno); bp->b_dirty = 0; bp->b_errs = 0; bwrite(fd, bp->b_un.b_buf, bp->b_bno, (long)bp->b_size); @@ -238,7 +238,7 @@ rwerror(char *mesg, daddr_t blk) if (preen == 0) printf("\n"); - pfatal("CANNOT %s: BLK %d", mesg, blk); + pfatal("CANNOT %s: BLK %lld", mesg, (long long)blk); if (reply("CONTINUE") == 0) errexit("Program terminated\n"); } @@ -342,11 +342,12 @@ bread(int fd, char *buf, daddr_t blk, long size) if (read(fd, cp, (int)secsize) != secsize) { (void)lseek(fd, offset + i + secsize, 0); if (secsize != dev_bsize && dev_bsize != 1) - printf(" %ld (%ld),", - (blk * dev_bsize + i) / secsize, - blk + i / dev_bsize); + printf(" %lld (%lld),", + (long long)((blk*dev_bsize + i) / secsize), + (long long)(blk + i / dev_bsize)); else - printf(" %ld,", blk + i / dev_bsize); + printf(" %lld,", + (long long)(blk + i / dev_bsize)); errs++; } } @@ -378,7 +379,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, 0); - printf(" %ld,", blk + i / dev_bsize); + printf(" %lld,", (long long)(blk + i / dev_bsize)); } printf("\n"); return; diff --git a/sbin/fsck_lfs/vars.c b/sbin/fsck_lfs/vars.c index 9ec31526d41b..f3c80ab05dd7 100644 --- a/sbin/fsck_lfs/vars.c +++ b/sbin/fsck_lfs/vars.c @@ -1,4 +1,4 @@ -/* $NetBSD: vars.c,v 1.5 2001/02/04 21:52:04 christos Exp $ */ +/* $NetBSD: vars.c,v 1.6 2003/01/24 21:55:10 fvdl Exp $ */ #include #include @@ -63,6 +63,6 @@ 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 */ +ino_t n_files; /* number of files in use */ struct dinode zino; diff --git a/sbin/fsdb/fsdb.c b/sbin/fsdb/fsdb.c index 1b00111e8719..64111538dd57 100644 --- a/sbin/fsdb/fsdb.c +++ b/sbin/fsdb/fsdb.c @@ -1,4 +1,4 @@ -/* $NetBSD: fsdb.c,v 1.21 2002/07/20 08:36:26 grant Exp $ */ +/* $NetBSD: fsdb.c,v 1.22 2003/01/24 21:55:11 fvdl Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include #ifndef lint -__RCSID("$NetBSD: fsdb.c,v 1.21 2002/07/20 08:36:26 grant Exp $"); +__RCSID("$NetBSD: fsdb.c,v 1.22 2003/01/24 21:55:11 fvdl Exp $"); #endif /* not lint */ #include @@ -77,7 +77,8 @@ static int dolookup __P((char *)); static int chinumfunc __P((struct inodesc *)); static int chnamefunc __P((struct inodesc *)); static int dotime __P((char *, int32_t *, int32_t *)); -static void print_blks __P((ufs_daddr_t *buf, int size, int *blknum)); +/* XXX ondisk32 */ +static void print_blks __P((int32_t *buf, int size, int *blknum)); static void print_indirblks __P((daddr_t blk, int ind_level, int *blknum)); int returntosingle = 0; @@ -465,7 +466,8 @@ CMDFUNCSTART(blks) static void print_blks(buf, size, blknum) - ufs_daddr_t *buf; + /* XXX ondisk32 */ + int32_t *buf; int size; int *blknum; { @@ -498,18 +500,22 @@ print_indirblks(blk,ind_level, blknum) int ind_level; int *blknum; { -#define MAXNINDIR (MAXBSIZE / sizeof(daddr_t)) - daddr_t idblk[MAXNINDIR]; +/* XXX ondisk32 */ +#define MAXNINDIR (MAXBSIZE / sizeof(int32_t)) + int32_t idblk[MAXNINDIR]; int i; - printf("Indirect block %d (level %d):\n", blk, ind_level+1); + printf("Indirect block %lld (level %d):\n", (long long)blk, + ind_level+1); bread(fsreadfd, (char *)idblk, fsbtodb(sblock, blk), (int)sblock->fs_bsize); if (ind_level <= 0) { - print_blks(idblk, sblock->fs_bsize / sizeof(daddr_t), blknum); + /* XXX ondisk32 */ + print_blks(idblk, sblock->fs_bsize / sizeof(int32_t), blknum); } else { ind_level--; - for (i = 0; i < sblock->fs_bsize / sizeof(daddr_t); i++) { + /* XXX ondisk32 */ + for (i = 0; i < sblock->fs_bsize / sizeof(int32_t); i++) { if(idblk[i] != 0) print_indirblks(iswap32(idblk[i]), ind_level, blknum); diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c index 83ec0ebcd277..b8679e27b828 100644 --- a/sbin/newfs/mkfs.c +++ b/sbin/newfs/mkfs.c @@ -1,4 +1,4 @@ -/* $NetBSD: mkfs.c,v 1.65 2002/09/28 20:11:07 dbj Exp $ */ +/* $NetBSD: mkfs.c,v 1.66 2003/01/24 21:55:11 fvdl Exp $ */ /* * Copyright (c) 1980, 1989, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95"; #else -__RCSID("$NetBSD: mkfs.c,v 1.65 2002/09/28 20:11:07 dbj Exp $"); +__RCSID("$NetBSD: mkfs.c,v 1.66 2003/01/24 21:55:11 fvdl Exp $"); #endif #endif /* not lint */ @@ -244,7 +244,8 @@ mkfs(struct partition *pp, const char *fsys, int fi, int fo, exit(21); } sblock.fs_nrpos = nrpos; - sblock.fs_nindir = sblock.fs_bsize / sizeof(daddr_t); + /* XXX ondisk32 */ + sblock.fs_nindir = sblock.fs_bsize / sizeof(int32_t); sblock.fs_inopb = sblock.fs_bsize / DINODE_SIZE; sblock.fs_nspf = sblock.fs_fsize / sectorsize; for (sblock.fs_fsbtodb = 0, i = NSPF(&sblock); i > 1; i >>= 1) @@ -510,10 +511,10 @@ next: sblock.fs_dblkno = sblock.fs_iblkno + sblock.fs_ipg / INOPF(&sblock); i = MIN(~sblock.fs_cgmask, sblock.fs_ncg - 1); if (cgdmin(&sblock, i) - cgbase(&sblock, i) >= sblock.fs_fpg) { - printf("inode blocks/cyl group (%d) >= data blocks (%d)\n", - cgdmin(&sblock, i) - - (cgbase(&sblock, i) >> sblock.fs_fragshift), - sblock.fs_fpg >> sblock.fs_fragshift); + printf("inode blocks/cyl group (%lld) >= data blocks (%lld)\n", + (long long)cgdmin(&sblock, i) - + (long long)(cgbase(&sblock, i) >> sblock.fs_fragshift), + (long long)(sblock.fs_fpg >> sblock.fs_fragshift)); printf("number of cylinders per cylinder group (%d) %s.\n", sblock.fs_cpg, "must be increased"); exit(29); @@ -522,14 +523,14 @@ next: if ((i = fssize - j * sblock.fs_fpg) < sblock.fs_fpg && cgdmin(&sblock, j) - cgbase(&sblock, j) > i) { if (j == 0) { - printf("File system must have at least %d sectors\n", - NSPF(&sblock) * - (cgdmin(&sblock, 0) + (3 << sblock.fs_fragshift))); + printf("File system must have at least %lld sectors\n", + (long long)(NSPF(&sblock) * + (cgdmin(&sblock, 0) + (3 << sblock.fs_fragshift)))); exit(30); } - printf("Warning: inode blocks/cyl group (%d) >= " + printf("Warning: inode blocks/cyl group (%lld) >= " "data blocks (%d) in last\n", - (cgdmin(&sblock, j) - + (long long)(cgdmin(&sblock, j) - cgbase(&sblock, j)) >> sblock.fs_fragshift, i >> sblock.fs_fragshift); printf(" cylinder group. This implies %d sector(s) " @@ -615,8 +616,8 @@ next: continue; if (cylno % nprintcols == 0) printf("\n"); - printf(" %*d,", printcolwidth, - fsbtodb(&sblock, cgsblock(&sblock, cylno))); + printf(" %*lld,", printcolwidth, + (long long)fsbtodb(&sblock, cgsblock(&sblock, cylno))); fflush(stdout); } if (!mfs) @@ -1130,14 +1131,14 @@ rdfs(daddr_t bno, int size, void *bf) offset = bno; offset *= sectorsize; if (lseek(fsi, offset, SEEK_SET) < 0) { - printf("rdfs: seek error for sector %d: %s\n", - bno, strerror(errno)); + printf("rdfs: seek error for sector %lld: %s\n", + (long long)bno, strerror(errno)); exit(33); } n = read(fsi, bf, size); if (n != size) { - printf("rdfs: read error for sector %d: %s\n", - bno, strerror(errno)); + printf("rdfs: read error for sector %lld: %s\n", + (long long)bno, strerror(errno)); exit(34); } } @@ -1162,14 +1163,14 @@ wtfs(daddr_t bno, int size, void *bf) offset = bno; offset *= sectorsize; if (lseek(fso, offset, SEEK_SET) < 0) { - printf("wtfs: seek error for sector %d: %s\n", - bno, strerror(errno)); + printf("wtfs: seek error for sector %lld: %s\n", + (long long)bno, strerror(errno)); exit(35); } n = write(fso, bf, size); if (n != size) { - printf("wtfs: write error for sector %d: %s\n", - bno, strerror(errno)); + printf("wtfs: write error for sector %lld: %s\n", + (long long)bno, strerror(errno)); exit(36); } } diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c index 8b25eaa3befd..701fdb7f3d0a 100644 --- a/sbin/newfs/newfs.c +++ b/sbin/newfs/newfs.c @@ -1,4 +1,4 @@ -/* $NetBSD: newfs.c,v 1.62 2002/12/12 11:40:17 scw Exp $ */ +/* $NetBSD: newfs.c,v 1.63 2003/01/24 21:55:12 fvdl Exp $ */ /* * Copyright (c) 1983, 1989, 1993, 1994 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1989, 1993, 1994\n\ #if 0 static char sccsid[] = "@(#)newfs.c 8.13 (Berkeley) 5/1/95"; #else -__RCSID("$NetBSD: newfs.c,v 1.62 2002/12/12 11:40:17 scw Exp $"); +__RCSID("$NetBSD: newfs.c,v 1.63 2003/01/24 21:55:12 fvdl Exp $"); #endif #endif /* not lint */ @@ -148,7 +148,8 @@ int main(int, char *[]); * placed in a single cylinder group. The default is one indirect * block worth of data blocks. */ -#define MAXBLKPG(bsize) ((bsize) / sizeof(daddr_t)) +/* XXX ondisk32 */ +#define MAXBLKPG(bsize) ((bsize) / sizeof(int32_t)) /* * Each file system has a number of inodes statically allocated. diff --git a/sbin/newfs_lfs/extern.h b/sbin/newfs_lfs/extern.h index cbd87694ec7f..3227bf18466c 100644 --- a/sbin/newfs_lfs/extern.h +++ b/sbin/newfs_lfs/extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.5 2001/07/13 20:30:20 perseant Exp $ */ +/* $NetBSD: extern.h,v 1.6 2003/01/24 21:55:12 fvdl Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -44,7 +44,7 @@ void fatal(const char *fmt, ...) __attribute__((__format__(__printf__,1,2))); u_int log2(u_int); int make_lfs(int, struct disklabel *, struct partition *, int, - int, int, int, int, int, int, int, int, u_int32_t); + int, int, int, int, int, daddr_t, int, int, u_int32_t); extern char *progname; extern char *special; diff --git a/sbin/newfs_lfs/lfs.c b/sbin/newfs_lfs/lfs.c index 8a5423fe26f4..e0d9a8cbbbdd 100644 --- a/sbin/newfs_lfs/lfs.c +++ b/sbin/newfs_lfs/lfs.c @@ -1,4 +1,4 @@ -/* $NetBSD: lfs.c,v 1.23 2001/07/13 21:09:55 thorpej Exp $ */ +/* $NetBSD: lfs.c,v 1.24 2003/01/24 21:55:12 fvdl Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)lfs.c 8.5 (Berkeley) 5/24/95"; #else -__RCSID("$NetBSD: lfs.c,v 1.23 2001/07/13 21:09:55 thorpej Exp $"); +__RCSID("$NetBSD: lfs.c,v 1.24 2003/01/24 21:55:12 fvdl Exp $"); #endif #endif /* not lint */ @@ -66,7 +66,8 @@ __RCSID("$NetBSD: lfs.c,v 1.23 2001/07/13 21:09:55 thorpej Exp $"); #include "extern.h" extern int Nflag; /* Don't write anything */ -daddr_t **ifibp = NULL; /* Ifile single indirect blocks */ +/* XXX ondisk32 */ +int32_t **ifibp = NULL; /* Ifile single indirect blocks */ int ifibc; /* Number of indirect blocks */ /* @@ -130,7 +131,8 @@ static struct lfs lfs_default = { /* dlfs_inopb */ DFL_LFSBLOCK/sizeof(struct dinode), /* dlfs_ifpb */ DFL_LFSBLOCK/sizeof(IFILE), /* dlfs_sepb */ DFL_LFSBLOCK/sizeof(SEGUSE), - /* dlfs_nindir */ DFL_LFSBLOCK/sizeof(daddr_t), + /* XXX ondisk32 */ + /* dlfs_nindir */ DFL_LFSBLOCK/sizeof(int32_t), /* dlfs_nseg */ 0, /* dlfs_nspf */ 0, /* dlfs_cleansz */ 0, @@ -220,7 +222,8 @@ make_lfs(int fd, struct disklabel *lp, struct partition *partp, int minfree, daddr_t seg_addr; /* Address of current segment */ char *ipagep; /* Pointer to the page we use to write stuff */ char *sump; /* Used to copy stuff into segment buffer */ - ufs_daddr_t *block_array; /* Array of logical block nos to put in sum */ + /* XXX ondisk32 */ + int32_t *block_array; /* Array of logical block nos to put in sum */ u_long blocks_used; /* Number of blocks in first segment */ u_long *dp; /* Used to computed checksum on data */ u_long *datasump; /* Used to computed checksum on data */ @@ -312,7 +315,8 @@ make_lfs(int fd, struct disklabel *lp, struct partition *partp, int minfree, lfsp->lfs_fbmask = lfsp->lfs_frag - 1; lfsp->lfs_fbshift = log2(lfsp->lfs_frag); lfsp->lfs_ifpb = bsize / sizeof(IFILE); - lfsp->lfs_nindir = bsize / sizeof(daddr_t); + /* XXX ondisk32 */ + lfsp->lfs_nindir = bsize / sizeof(int32_t); } if (lfsp->lfs_version == 1) { @@ -657,8 +661,8 @@ make_lfs(int fd, struct disklabel *lp, struct partition *partp, int minfree, fprintf(stderr, "trying size %d.\n", ssize); goto tryagain; } - fatal("Can't fit %d bytes into one segment sized %d", - fsbtob(lfsp, sb_addr), ssize); + fatal("Can't fit %lld bytes into one segment sized %d", + (long long)fsbtob(lfsp, sb_addr), ssize); } /* Now, write the segment */ @@ -790,8 +794,9 @@ make_lfs(int fd, struct disklabel *lp, struct partition *partp, int minfree, * address. */ sum_size = (version == 1 ? sizeof(SEGSUM_V1) : sizeof(SEGSUM)); - sum_size += 3 * sizeof(FINFO) + 2 * sizeof(daddr_t) + - (lfsp->lfs_cleansz + lfsp->lfs_segtabsz) * sizeof(ufs_daddr_t); + /* XXX ondisk32 */ + sum_size += 3 * sizeof(FINFO) + 2 * sizeof(int32_t) + + (lfsp->lfs_cleansz + lfsp->lfs_segtabsz) * sizeof(int32_t); if (sum_size > lfsp->lfs_sumsize) fatal("Multiple summary blocks in segment 0 " @@ -825,10 +830,11 @@ make_lfs(int fd, struct disklabel *lp, struct partition *partp, int minfree, file_info.fi_lastlength = lfsp->lfs_bsize; file_info.fi_ino = LFS_IFILE_INUM; - memmove(sump, &file_info, sizeof(FINFO) - sizeof(ufs_daddr_t)); - sump += sizeof(FINFO) - sizeof(ufs_daddr_t); - memmove(sump, block_array, sizeof(ufs_daddr_t) * file_info.fi_nblocks); - sump += sizeof(ufs_daddr_t) * file_info.fi_nblocks; + /* XXX ondisk32 */ + memmove(sump, &file_info, sizeof(FINFO) - sizeof(int32_t)); + sump += sizeof(FINFO) - sizeof(int32_t); + memmove(sump, block_array, sizeof(int32_t) * file_info.fi_nblocks); + sump += sizeof(int32_t) * file_info.fi_nblocks; /* Now, add the root directory */ dip = ((struct dinode *)dpagep) + 1; @@ -846,7 +852,8 @@ make_lfs(int fd, struct disklabel *lp, struct partition *partp, int minfree, file_info.fi_lastlength = dblksize(lfsp, dip, 0); memmove(sump, &file_info, sizeof(FINFO)); - ((daddr_t *)ipagep)[lfsp->lfs_sumsize / sizeof(daddr_t) - 1] = + /* XXX ondisk32 */ + ((int32_t *)ipagep)[lfsp->lfs_sumsize / sizeof(int32_t) - 1] = lfsp->lfs_idaddr; ((SEGSUM *)ipagep)->ss_sumsum = cksum(ipagep+sizeof(summary.ss_sumsum), lfsp->lfs_sumsize - sizeof(summary.ss_sumsum)); @@ -875,7 +882,7 @@ make_lfs(int fd, struct disklabel *lp, struct partition *partp, int minfree, for (i = 0; i < LFS_MAXNUMSB; i++) { seg_addr = lfsp->lfs_sboffs[i]; - sprintf(tbuf, "%d%s ", fsbtodb(lfsp, seg_addr), + sprintf(tbuf, "%lld%s ", (long long)fsbtodb(lfsp, seg_addr), (i == LFS_MAXNUMSB - 1 ? "" : ",")); ww = strlen(tbuf); curw += ww; @@ -954,9 +961,9 @@ make_dinode(ino_t ino, struct dinode *dip, int nfrags, daddr_t saddr, struct lfs --bb; } /* printf("using %d indirect blocks for inode %d\n", ifibc, ino); */ - ifibp = (daddr_t **)malloc(ifibc * sizeof(daddr_t *)); + ifibp = (int32_t **)malloc(ifibc * sizeof(int32_t *)); for (i = 0; i < ifibc ; i++) { - ifibp[i] = (daddr_t *)malloc(lfsp->lfs_bsize); + ifibp[i] = (int32_t *)malloc(lfsp->lfs_bsize); memset(ifibp[i], 0, lfsp->lfs_bsize); } dip->di_blocks += fragstofsb(lfsp, blkstofrags(lfsp, ifibc)); diff --git a/sys/arch/i386/stand/installboot/installboot.c b/sys/arch/i386/stand/installboot/installboot.c index 3e7b2956f267..e3aa9b939868 100644 --- a/sys/arch/i386/stand/installboot/installboot.c +++ b/sys/arch/i386/stand/installboot/installboot.c @@ -1,4 +1,4 @@ -/* $NetBSD: installboot.c,v 1.16 2002/07/20 08:36:18 grant Exp $ */ +/* $NetBSD: installboot.c,v 1.17 2003/01/24 21:55:13 fvdl Exp $ */ /* * Copyright (c) 1994 Paul Kranenburg @@ -187,7 +187,8 @@ add_fsblk(fs, blk, blcnt) nblk = blcnt; if (verbose) - (void) fprintf(stderr, "dblk: %d, num: %d\n", blk, nblk); + (void) fprintf(stderr, "dblk: %lld, num: %lld\n", + (long long)blk, (long long)nblk); /* start new entry or append to previous? */ if (!fraglist->numentries || @@ -221,7 +222,9 @@ setup_ffs_blks(diskdev, inode) int devfd = -1; struct fs *fs; char *buf = 0; - daddr_t blk, *ap; + daddr_t blk; + /* XXX ondisk32 */ + int32_t *ap; struct dinode *ip; int i, ndb; int allok = 0; @@ -274,7 +277,8 @@ setup_ffs_blks(diskdev, inode) if (devread(devfd, buf, blk, (size_t)fs->fs_bsize, "indirect block")) goto out; - ap = (daddr_t *) buf; + /* XXX ondisk32 */ + ap = (int32_t *) buf; for (; i < NINDIR(fs) && *ap && ndb > 0; i++, ap++) { ndb = add_fsblk(fs, *ap, ndb); } diff --git a/sys/arch/mipsco/stand/common/saio.c b/sys/arch/mipsco/stand/common/saio.c index fe3a18edf574..4cca5092a7e6 100644 --- a/sys/arch/mipsco/stand/common/saio.c +++ b/sys/arch/mipsco/stand/common/saio.c @@ -1,4 +1,4 @@ -/* $NetBSD: saio.c,v 1.4 2002/11/16 08:51:28 wdk Exp $ */ +/* $NetBSD: saio.c,v 1.5 2003/01/24 21:55:13 fvdl Exp $ */ /* * Copyright (c) 1992, 1993 @@ -90,7 +90,8 @@ struct sa_iob { char *i_ma; /* memory address of i/o buffer */ int i_cc; /* character count of transfer */ int32_t i_offset; /* seek offset in file */ - daddr_t i_bn; /* 1st block # of next read */ + /* XXX ondisk32 */ + int32_t i_bn; /* 1st block # of next read */ int i_fstype; /* file system type */ int i_errno; /* error # return */ unsigned int i_devaddr; /* csr address */ diff --git a/sys/arch/mvme68k/stand/bootxx/bootxx.c b/sys/arch/mvme68k/stand/bootxx/bootxx.c index 791d9e1a0230..07fc4d2aa217 100644 --- a/sys/arch/mvme68k/stand/bootxx/bootxx.c +++ b/sys/arch/mvme68k/stand/bootxx/bootxx.c @@ -1,4 +1,4 @@ -/* $NetBSD: bootxx.c,v 1.8 2002/05/05 20:11:37 jdolecek Exp $ */ +/* $NetBSD: bootxx.c,v 1.9 2003/01/24 21:55:13 fvdl Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -66,7 +66,8 @@ int copyboot __P((struct open_file *, u_long *)); extern int block_size; extern int block_count; /* length of table */ -extern daddr_t block_table[]; +/* XXX ondisk32 */ +extern int32_t block_table[]; extern char bootprog_name[], bootprog_rev[]; diff --git a/sys/arch/mvme68k/stand/installboot/installboot.c b/sys/arch/mvme68k/stand/installboot/installboot.c index e8d0709b113a..5853801ced13 100644 --- a/sys/arch/mvme68k/stand/installboot/installboot.c +++ b/sys/arch/mvme68k/stand/installboot/installboot.c @@ -1,4 +1,4 @@ -/* $NetBSD: installboot.c,v 1.7 2000/12/09 22:33:24 scw Exp $ */ +/* $NetBSD: installboot.c,v 1.8 2003/01/24 21:55:14 fvdl Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -76,7 +76,8 @@ struct nlist nl[] = { int *block_size_p; /* block size var. in prototype image */ int *block_count_p; /* block count var. in prototype image */ -daddr_t *block_table; /* block number array in prototype image */ +/* XXX ondisk32 */ +int32_t *block_table; /* block number array in prototype image */ int maxblocknum; /* size of this array */ @@ -215,7 +216,8 @@ loadprotoblocks(fname, size) /* Calculate the symbols' locations within the proto file */ block_size_p = (int *) (bp + (nl[X_BLOCK_SIZE ].n_value - offs)); block_count_p = (int *) (bp + (nl[X_BLOCK_COUNT].n_value - offs)); - block_table = (daddr_t *) (bp + (nl[X_BLOCK_TABLE].n_value - offs)); + /* XXX ondisk32 */ + block_table = (int32_t *) (bp + (nl[X_BLOCK_TABLE].n_value - offs)); maxblocknum = *block_count_p; if (verbose) { @@ -339,7 +341,8 @@ int devfd; */ blk = fsbtodb(fs, ip->di_ib[0]); devread(devfd, buf, blk, fs->fs_bsize, "indirect block"); - ap = (daddr_t *)buf; + /* XXX ondisk32 */ + ap = (int32_t *)buf; for (; i < NINDIR(fs) && *ap && ndb; i++, ap++, ndb--) { blk = fsbtodb(fs, *ap); if (verbose) diff --git a/sys/arch/sparc/dev/fd.c b/sys/arch/sparc/dev/fd.c index 0cc39aa96d27..ed25dde8ee7b 100644 --- a/sys/arch/sparc/dev/fd.c +++ b/sys/arch/sparc/dev/fd.c @@ -1,4 +1,4 @@ -/* $NetBSD: fd.c,v 1.100 2003/01/01 02:20:47 thorpej Exp $ */ +/* $NetBSD: fd.c,v 1.101 2003/01/24 21:55:14 fvdl Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -843,8 +843,9 @@ fdstrategy(bp) #ifdef FD_DEBUG if (fdc_debug > 1) - printf("fdstrategy: b_blkno %d b_bcount %ld blkno %d cylin %ld\n", - bp->b_blkno, bp->b_bcount, fd->sc_blkno, bp->b_cylinder); + printf("fdstrategy: b_blkno %lld b_bcount %ld blkno %lld cylin %ld\n", + (long long)bp->b_blkno, bp->b_bcount, + (long long)fd->sc_blkno, bp->b_cylinder); #endif /* Queue transfer on drive, activate drive and controller if idle. */ @@ -1650,8 +1651,8 @@ loop: fdcstatus(fdc, bp->b_flags & B_READ ? "read failed" : "write failed"); - printf("blkno %d nblks %d nstat %d tc %d\n", - fd->sc_blkno, fd->sc_nblks, + printf("blkno %lld nblks %d nstat %d tc %d\n", + (long long)fd->sc_blkno, fd->sc_nblks, fdc->sc_nstat, fdc->sc_tc); } #endif @@ -2133,8 +2134,8 @@ fdformat(dev, finfo, p) if (fdc_debug) { int i; - printf("fdformat: blkno 0x%x count %ld\n", - bp->b_blkno, bp->b_bcount); + printf("fdformat: blkno 0x%llx count %ld\n", + (unsigned long long)bp->b_blkno, bp->b_bcount); printf("\tcyl:\t%d\n", finfo->cyl); printf("\thead:\t%d\n", finfo->head); diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c index c71f2e989676..e5189daa3559 100644 --- a/sys/arch/sparc64/sparc64/machdep.c +++ b/sys/arch/sparc64/sparc64/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.137 2003/01/18 06:55:24 thorpej Exp $ */ +/* $NetBSD: machdep.c,v 1.138 2003/01/24 21:55:15 fvdl Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -1046,7 +1046,7 @@ dumpsys() error = pmap_dumpmmu(dump, blkno); blkno += pmap_dumpsize(); -printf("starting dump, blkno %d\n", blkno); +printf("starting dump, blkno %lld\n", (long long)blkno); for (mp = mem; mp->size; mp++) { unsigned i = 0, n; paddr_t maddr = mp->start; diff --git a/sys/arch/x68k/stand/boot_ufs/readufs.c b/sys/arch/x68k/stand/boot_ufs/readufs.c index 6b4d00debe78..d64cee7e0ed9 100644 --- a/sys/arch/x68k/stand/boot_ufs/readufs.c +++ b/sys/arch/x68k/stand/boot_ufs/readufs.c @@ -18,8 +18,8 @@ #define fs ufs_info -static void raw_read_queue __P((void *buf, ufs_daddr_t blkpos, size_t bytelen)); -static int ufs_read_indirect __P((ufs_daddr_t blk, int level, caddr_t *buf, +static void raw_read_queue __P((void *buf, daddr_t blkpos, size_t bytelen)); +static int ufs_read_indirect __P((daddr_t blk, int level, caddr_t *buf, unsigned *poff, size_t count)); #ifdef DEBUG_WITH_STDIO @@ -33,7 +33,7 @@ int fd; void RAW_READ(buf, blkpos, bytelen) void *buf; - ufs_daddr_t blkpos; + daddr_t blkpos; size_t bytelen; { if (pread(fd, buf, bytelen, (off_t)dbtob(blkpos)) != (ssize_t) bytelen) @@ -51,10 +51,10 @@ static size_t rq_len; static void raw_read_queue(buf, blkpos, bytelen) void *buf; - ufs_daddr_t blkpos; + daddr_t blkpos; size_t bytelen; /* must be DEV_BSIZE aligned */ { - static ufs_daddr_t rq_start; + static daddr_t rq_start; static char *rq_buf; if (rq_len) { @@ -131,14 +131,15 @@ ufs_read(di, buf, off, count) static int ufs_read_indirect(blk, level, buf, poff, count) - ufs_daddr_t blk; + daddr_t blk; int level; caddr_t *buf; unsigned *poff; /* position in block */ size_t count; { size_t bsize = fs.bsize; - ufs_daddr_t *idbuf = alloca(bsize); + /* XXX ondisk32 */ + int32_t *idbuf = alloca(bsize); unsigned off = *poff; unsigned b; diff --git a/sys/arch/x68k/stand/boot_ufs/readufs.h b/sys/arch/x68k/stand/boot_ufs/readufs.h index 870b6ce4ea73..13c1c9aa2f47 100644 --- a/sys/arch/x68k/stand/boot_ufs/readufs.h +++ b/sys/arch/x68k/stand/boot_ufs/readufs.h @@ -29,7 +29,7 @@ struct ufs_info { union { #ifdef USE_FFS struct { - ufs_daddr_t iblkno; /* inode-block offset */ + int32_t iblkno; /* inode-block offset */ int32_t cgoffset; /* cylinder group offset */ int32_t cgmask; /* cylinder group mask */ int32_t fragshift; /* block to fragmentation */ @@ -41,7 +41,7 @@ struct ufs_info { #ifdef USE_LFS struct { u_int32_t version; /* LFS version # */ - ufs_daddr_t idaddr; /* ifile inode disk address */ + int32_t idaddr; /* ifile inode disk address */ u_int32_t inopb; /* inodes per block (v1) */ /* inodes per frag (v2) */ u_int32_t ifpb; /* inode addrs / ifile block */ @@ -56,7 +56,7 @@ struct ufs_info { extern struct ufs_info ufs_info; #define ufs_get_inode(ino, di) ((*ufs_info.get_inode)((ino), (di))) -void RAW_READ __P((void *buf, ufs_daddr_t blkpos, size_t bytelen)); +void RAW_READ __P((void *buf, daddr_t blkpos, size_t bytelen)); size_t ufs_read __P((struct dinode *di, void *buf, unsigned off, size_t count)); ino_t ufs_lookup __P((ino_t dirino, const char *fn)); diff --git a/sys/arch/x68k/stand/boot_ufs/readufs_lfs.c b/sys/arch/x68k/stand/boot_ufs/readufs_lfs.c index ce554b53c00f..1e1e0e89e2b8 100644 --- a/sys/arch/x68k/stand/boot_ufs/readufs_lfs.c +++ b/sys/arch/x68k/stand/boot_ufs/readufs_lfs.c @@ -35,7 +35,7 @@ try_lfs() struct ufs_info *ufsinfo = &ufs_info; struct dlfs sblk, sblk2; struct dlfs *s = &sblk; - ufs_daddr_t sbpos; + daddr_t sbpos; int fsbshift; #ifdef DEBUG_WITH_STDIO @@ -68,7 +68,7 @@ try_lfs() fsbshift = 0; break; } else { - ufs_daddr_t sbpos1; + daddr_t sbpos1; #if 0 fsbshift = sblk.dlfs_bshift - sblk.dlfs_blktodb + sblk.dlfs_fsbtodb - DEV_BSHIFT; #endif @@ -157,7 +157,7 @@ get_lfs_inode(ino, dibuf) struct dinode *dibuf; { struct ufs_info *ufsinfo = &ufs_info; - ufs_daddr_t daddr; + daddr_t daddr; char *buf = alloca(fsi.bsize); struct dinode *di, *diend; int i; @@ -179,7 +179,7 @@ get_lfs_inode(ino, dibuf) : ((IFILE *) buf + i)->if_daddr; } #ifdef DEBUG_WITH_STDIO - printf("LFS(%d): daddr: %d\n", ino, daddr); + printf("LFS(%d): daddr: %lld\n", ino, (long long)daddr); #endif if (daddr == LFS_UNUSED_DADDR) diff --git a/sys/compat/netbsd32/netbsd32_ioctl.c b/sys/compat/netbsd32/netbsd32_ioctl.c index 9cd5535a08bd..9f335192050e 100644 --- a/sys/compat/netbsd32/netbsd32_ioctl.c +++ b/sys/compat/netbsd32/netbsd32_ioctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_ioctl.c,v 1.16 2003/01/18 08:28:26 thorpej Exp $ */ +/* $NetBSD: netbsd32_ioctl.c,v 1.17 2003/01/24 21:55:16 fvdl Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.16 2003/01/18 08:28:26 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.17 2003/01/24 21:55:16 fvdl Exp $"); #include #include @@ -75,8 +75,10 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.16 2003/01/18 08:28:26 thorpej /* prototypes for the converters */ static __inline void netbsd32_to_partinfo(struct netbsd32_partinfo *, struct partinfo *, u_long); +#if 0 static __inline void netbsd32_to_format_op(struct netbsd32_format_op *, struct format_op *, u_long); +#endif static __inline void netbsd32_to_ifconf(struct netbsd32_ifconf *, struct ifconf *, u_long); static __inline void @@ -89,8 +91,10 @@ static __inline void netbsd32_to_sioc_sg_req(struct netbsd32_sioc_sg_req *, struct sioc_sg_req *, u_long); static __inline void netbsd32_from_partinfo(struct partinfo *, struct netbsd32_partinfo *); +#if 0 static __inline void netbsd32_from_format_op(struct format_op *, struct netbsd32_format_op *); +#endif static __inline void netbsd32_from_ifconf(struct ifconf *, struct netbsd32_ifconf *); static __inline void @@ -115,6 +119,7 @@ netbsd32_to_partinfo(s32p, p, cmd) p->part = (struct partition *)NETBSD32PTR64(s32p->part); } +#if 0 static __inline void netbsd32_to_format_op(s32p, p, cmd) struct netbsd32_format_op *s32p; @@ -127,6 +132,7 @@ netbsd32_to_format_op(s32p, p, cmd) p->df_startblk = s32p->df_startblk; memcpy(p->df_reg, s32p->df_reg, sizeof(s32p->df_reg)); } +#endif #if 0 /* XXX see below */ static __inline void @@ -222,6 +228,7 @@ netbsd32_from_partinfo(p, s32p) s32p->part = s32p->part; } +#if 0 static __inline void netbsd32_from_format_op(p, s32p) struct format_op *p; @@ -236,6 +243,7 @@ netbsd32_from_format_op(p, s32p) s32p->df_startblk = p->df_startblk; memcpy(s32p->df_reg, p->df_reg, sizeof(p->df_reg)); } +#endif #if 0 /* XXX see below */ static __inline void @@ -477,11 +485,12 @@ printf("netbsd32_ioctl(%d, %x, %x): %s group %c base %d len %d\n", case DIOCGPART32: IOCTL_STRUCT_CONV_TO(DIOCGPART, partinfo); - +#if 0 /* not implemented by anything */ case DIOCRFORMAT32: IOCTL_STRUCT_CONV_TO(DIOCRFORMAT, format_op); case DIOCWFORMAT32: IOCTL_STRUCT_CONV_TO(DIOCWFORMAT, format_op); +#endif /* * only a few ifreq syscalls need conversion and those are diff --git a/sys/compat/netbsd32/netbsd32_ioctl.h b/sys/compat/netbsd32/netbsd32_ioctl.h index 7323012c1373..51f60c00b7b3 100644 --- a/sys/compat/netbsd32/netbsd32_ioctl.h +++ b/sys/compat/netbsd32/netbsd32_ioctl.h @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_ioctl.h,v 1.10 2002/10/23 13:16:43 scw Exp $ */ +/* $NetBSD: netbsd32_ioctl.h,v 1.11 2003/01/24 21:55:16 fvdl Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -58,13 +58,13 @@ struct netbsd32_partinfo { #define DIOCGPART32 _IOW('d', 104, struct netbsd32_partinfo) /* get partition */ #endif +#if 0 /* not implemented by anything */ struct netbsd32_format_op { netbsd32_charp df_buf; int df_count; /* value-result */ daddr_t df_startblk; int df_reg[8]; /* result */ }; -#if 1 #define DIOCRFORMAT32 _IOWR('d', 105, struct netbsd32_format_op) #define DIOCWFORMAT32 _IOWR('d', 106, struct netbsd32_format_op) #endif diff --git a/sys/compat/sunos/sunos.h b/sys/compat/sunos/sunos.h index 89986ee33643..128e6d4b9f93 100644 --- a/sys/compat/sunos/sunos.h +++ b/sys/compat/sunos/sunos.h @@ -1,4 +1,4 @@ -/* $NetBSD: sunos.h,v 1.13 2002/07/04 23:32:12 thorpej Exp $ */ +/* $NetBSD: sunos.h,v 1.14 2003/01/24 21:55:17 fvdl Exp $ */ #ifndef _COMPAT_SUNOS_SUNOS_H_ #define _COMPAT_SUNOS_SUNOS_H_ @@ -54,7 +54,7 @@ struct sunos_nfs_args { struct sunos_ustat { - daddr_t f_tfree; /* total free */ + int32_t f_tfree; /* total free */ ino_t f_tinode; /* total inodes free */ char f_path[6]; /* filsys name */ char f_fpack[6]; /* filsys pack name */ diff --git a/sys/fs/adosfs/advnops.c b/sys/fs/adosfs/advnops.c index de0420642559..d4fa82b1d905 100644 --- a/sys/fs/adosfs/advnops.c +++ b/sys/fs/adosfs/advnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: advnops.c,v 1.2 2003/01/09 18:34:41 lonewolf Exp $ */ +/* $NetBSD: advnops.c,v 1.3 2003/01/24 21:55:17 fvdl Exp $ */ /* * Copyright (c) 1994 Christian E. Hopps @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: advnops.c,v 1.2 2003/01/09 18:34:41 lonewolf Exp $"); +__KERNEL_RCSID(0, "$NetBSD: advnops.c,v 1.3 2003/01/24 21:55:17 fvdl Exp $"); #if defined(_KERNEL_OPT) #include "opt_quota.h" @@ -580,7 +580,7 @@ adosfs_bmap(v) reterr: #ifdef ADOSFS_DIAGNOSTIC if (error == 0 && bnp) - printf(" %d => %d", bn, *bnp); + printf(" %lld => %lld", (long long)bn, (long long)*bnp); printf(" %d)\n", error); #endif return(error); diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index d71737387610..66dfd5a6ae61 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_vnops.c,v 1.60 2002/12/11 18:25:04 atatat Exp $ */ +/* $NetBSD: vfs_vnops.c,v 1.61 2003/01/24 21:55:17 fvdl Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.60 2002/12/11 18:25:04 atatat Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.61 2003/01/24 21:55:17 fvdl Exp $"); #include "fs_union.h" @@ -687,6 +687,14 @@ vn_ioctl(fp, com, data, p) block = (daddr_t *)data; return (VOP_BMAP(vp, *block, NULL, block, NULL)); } + if (com == OFIOGETBMAP) { + daddr_t ibn, obn; + + ibn = (daddr_t)*(int32_t *)data; + error = VOP_BMAP(vp, ibn, NULL, &obn, NULL); + *(int32_t *)data = (int32_t)obn; + return error; + } if (com == FIONBIO || com == FIOASYNC) /* XXX */ return (0); /* XXX */ /* fall into ... */ diff --git a/sys/lib/libsa/lfs.c b/sys/lib/libsa/lfs.c index 3a51a44bd791..4a488722b125 100644 --- a/sys/lib/libsa/lfs.c +++ b/sys/lib/libsa/lfs.c @@ -1,4 +1,4 @@ -/* $NetBSD: lfs.c,v 1.7 2002/05/07 02:02:41 simonb Exp $ */ +/* $NetBSD: lfs.c,v 1.8 2003/01/24 21:55:18 fvdl Exp $ */ /*- * Copyright (c) 1993 @@ -133,7 +133,7 @@ struct file { }; static int find_inode_sector(ino_t inumber, struct open_file *f, - ufs_daddr_t *ibp); + daddr_t *ibp); static int read_inode __P((ino_t, struct open_file *)); static int block_map __P((struct open_file *, daddr_t, daddr_t *)); static int buf_read_file __P((struct open_file *, char **, size_t *)); @@ -143,11 +143,11 @@ static int search_directory __P((char *, struct open_file *, ino_t *)); * Find an inode's block. Look it up in the ifile. Whee! */ static int -find_inode_sector(ino_t inumber, struct open_file *f, ufs_daddr_t *isp) +find_inode_sector(ino_t inumber, struct open_file *f, daddr_t *isp) { struct file *fp = (struct file *)f->f_fsdata; struct fs *fs = fp->f_fs; - ufs_daddr_t ifileent_blkno; + daddr_t ifileent_blkno; char *ent_in_buf; size_t buf_after_ent; int rc; @@ -189,7 +189,7 @@ read_inode(inumber, f) struct file *fp = (struct file *)f->f_fsdata; struct fs *fs = fp->f_fs; struct dinode *dip; - ufs_daddr_t inode_sector; + daddr_t inode_sector; size_t rsize; char *buf; int rc, cnt; @@ -259,7 +259,8 @@ block_map(f, file_block, disk_block_p) int level; int idx; daddr_t ind_block_num; - daddr_t *ind_p; + /* XXX ondisk32 */ + int32_t *ind_p; int rc; /* @@ -340,7 +341,8 @@ block_map(f, file_block, disk_block_p) fp->f_blkno[level] = ind_block_num; } - ind_p = (daddr_t *)fp->f_blk[level]; + /* XXX ondisk32 */ + ind_p = (int32_t *)fp->f_blk[level]; if (level > 0) { idx = file_block / fp->f_nindir[level - 1]; diff --git a/sys/lib/libsa/ufs.c b/sys/lib/libsa/ufs.c index 8cec71bfa345..b5890983c53c 100644 --- a/sys/lib/libsa/ufs.c +++ b/sys/lib/libsa/ufs.c @@ -1,4 +1,4 @@ -/* $NetBSD: ufs.c,v 1.30 2000/03/30 12:19:49 augustss Exp $ */ +/* $NetBSD: ufs.c,v 1.31 2003/01/24 21:55:18 fvdl Exp $ */ /*- * Copyright (c) 1993 @@ -195,7 +195,8 @@ block_map(f, file_block, disk_block_p) int level; int idx; daddr_t ind_block_num; - daddr_t *ind_p; + /* XXX ondisk32 */ + int32_t *ind_p; int rc; /* @@ -272,7 +273,8 @@ block_map(f, file_block, disk_block_p) fp->f_blkno[level] = ind_block_num; } - ind_p = (daddr_t *)fp->f_blk[level]; + /* XXX ondisk32 */ + ind_p = (int32_t *)fp->f_blk[level]; if (level > 0) { idx = file_block / fp->f_nindir[level - 1]; diff --git a/sys/sys/disklabel.h b/sys/sys/disklabel.h index 90588bf0dfe3..3a2a6d89937d 100644 --- a/sys/sys/disklabel.h +++ b/sys/sys/disklabel.h @@ -1,4 +1,4 @@ -/* $NetBSD: disklabel.h,v 1.77 2002/10/04 18:26:31 elric Exp $ */ +/* $NetBSD: disklabel.h,v 1.78 2003/01/24 21:55:18 fvdl Exp $ */ /* * Copyright (c) 1987, 1988, 1993 @@ -470,7 +470,7 @@ static const char *const mountnames[] = { /* * Structure used to perform a format or other raw operation, * returning data and/or register values. Register identification - * and format are device- and driver-dependent. + * and format are device- and driver-dependent. Currently unused. */ struct format_op { char *df_buf; diff --git a/sys/sys/filio.h b/sys/sys/filio.h index 4519dde7bd1f..8e94d4693da9 100644 --- a/sys/sys/filio.h +++ b/sys/sys/filio.h @@ -1,4 +1,4 @@ -/* $NetBSD: filio.h,v 1.6 2002/12/11 18:25:03 atatat Exp $ */ +/* $NetBSD: filio.h,v 1.7 2003/01/24 21:55:19 fvdl Exp $ */ /*- * Copyright (c) 1982, 1986, 1990, 1993, 1994 @@ -53,6 +53,7 @@ #define FIOASYNC _IOW('f', 125, int) /* set/clear async i/o */ #define FIOSETOWN _IOW('f', 124, int) /* set owner */ #define FIOGETOWN _IOR('f', 123, int) /* get owner */ +#define OFIOGETBMAP _IOWR('f', 122, uint32_t) /* get underlying block no. */ #define FIOGETBMAP _IOWR('f', 122, daddr_t) /* get underlying block no. */ /* Ugly symbol for compatibility with other operating systems */ diff --git a/sys/sys/mtio.h b/sys/sys/mtio.h index 8d3cf87b8142..623222cd2e4d 100644 --- a/sys/sys/mtio.h +++ b/sys/sys/mtio.h @@ -1,4 +1,4 @@ -/* $NetBSD: mtio.h,v 1.19 2002/04/08 12:09:09 simonb Exp $ */ +/* $NetBSD: mtio.h,v 1.20 2003/01/24 21:55:19 fvdl Exp $ */ /* * Copyright (c) 1982, 1986, 1993 @@ -45,7 +45,7 @@ /* structure for MTIOCTOP - mag tape op command */ struct mtop { short mt_op; /* operations defined below */ - daddr_t mt_count; /* how many of them */ + int32_t mt_count; /* how many of them */ }; /* operations */ @@ -78,13 +78,13 @@ struct mtget { /* end device-dependent registers */ short mt_resid; /* residual count */ /* the following two are not yet implemented by most tape drivers */ - daddr_t mt_fileno; /* file number of current position */ - daddr_t mt_blkno; /* block number of current position */ + int32_t mt_fileno; /* file number of current position */ + int32_t mt_blkno; /* block number of current position */ /* end not yet implemented */ - daddr_t mt_blksiz; /* current block size */ - daddr_t mt_density; /* current density code */ - daddr_t mt_mblksiz[4]; /* block size for different modes */ - daddr_t mt_mdensity[4]; /* density codes for different modes */ + int32_t mt_blksiz; /* current block size */ + int32_t mt_density; /* current density code */ + int32_t mt_mblksiz[4]; /* block size for different modes */ + int32_t mt_mdensity[4]; /* density codes for different modes */ }; /* diff --git a/sys/sys/types.h b/sys/sys/types.h index 4989dac84c12..e747b80bbb98 100644 --- a/sys/sys/types.h +++ b/sys/sys/types.h @@ -1,4 +1,4 @@ -/* $NetBSD: types.h,v 1.54 2003/01/20 20:05:27 christos Exp $ */ +/* $NetBSD: types.h,v 1.55 2003/01/24 21:55:19 fvdl Exp $ */ /*- * Copyright (c) 1982, 1986, 1991, 1993, 1994 @@ -138,7 +138,7 @@ typedef __caddr_t caddr_t; /* core address */ #define caddr_t __caddr_t #endif -typedef int32_t daddr_t; /* disk address */ +typedef int64_t daddr_t; /* disk address */ typedef uint32_t dev_t; /* device number */ typedef uint32_t fixpt_t; /* fixed point number */ diff --git a/sys/ufs/ext2fs/ext2fs.h b/sys/ufs/ext2fs/ext2fs.h index 082f235ed7b1..1be59b480f91 100644 --- a/sys/ufs/ext2fs/ext2fs.h +++ b/sys/ufs/ext2fs/ext2fs.h @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs.h,v 1.11 2002/12/01 00:12:06 matt Exp $ */ +/* $NetBSD: ext2fs.h,v 1.12 2003/01/24 21:55:19 fvdl Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. @@ -61,8 +61,8 @@ #define SBSIZE 1024 #define BBOFF ((off_t)(0)) #define SBOFF ((off_t)(BBOFF + BBSIZE)) -#define BBLOCK ((ufs_daddr_t)(0)) -#define SBLOCK ((ufs_daddr_t)(BBLOCK + BBSIZE / DEV_BSIZE)) +#define BBLOCK ((daddr_t)(0)) +#define SBLOCK ((daddr_t)(BBLOCK + BBSIZE / DEV_BSIZE)) /* * Addresses stored in inodes are capable of addressing blocks @@ -247,8 +247,10 @@ cg_has_sb(i) #if BYTE_ORDER == LITTLE_ENDIAN # define h2fs16(x) (x) # define h2fs32(x) (x) +# define h2fs64(x) (x) # define fs2h16(x) (x) # define fs2h32(x) (x) +# define fs2h64(x) (x) # define e2fs_sbload(old, new) memcpy((new), (old), SBSIZE); # define e2fs_cgload(old, new, size) memcpy((new), (old), (size)); # define e2fs_sbsave(old, new) memcpy((new), (old), SBSIZE); @@ -258,8 +260,10 @@ void e2fs_sb_bswap __P((struct ext2fs *, struct ext2fs *)); void e2fs_cg_bswap __P((struct ext2_gd *, struct ext2_gd *, int)); # define h2fs16(x) bswap16(x) # define h2fs32(x) bswap32(x) +# define h2fs64(x) bswap64(x) # define fs2h16(x) bswap16(x) # define fs2h32(x) bswap32(x) +# define fs2h64(x) bswap64(x) # define e2fs_sbload(old, new) e2fs_sb_bswap((old), (new)) # define e2fs_cgload(old, new, size) e2fs_cg_bswap((old), (new), (size)); # define e2fs_sbsave(old, new) e2fs_sb_bswap((old), (new)) diff --git a/sys/ufs/ext2fs/ext2fs_alloc.c b/sys/ufs/ext2fs/ext2fs_alloc.c index 5c18f639c396..02acd57e4ec5 100644 --- a/sys/ufs/ext2fs/ext2fs_alloc.c +++ b/sys/ufs/ext2fs/ext2fs_alloc.c @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs_alloc.c,v 1.14 2002/09/27 15:38:02 provos Exp $ */ +/* $NetBSD: ext2fs_alloc.c,v 1.15 2003/01/24 21:55:19 fvdl Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ext2fs_alloc.c,v 1.14 2002/09/27 15:38:02 provos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ext2fs_alloc.c,v 1.15 2003/01/24 21:55:19 fvdl Exp $"); #include #include @@ -57,14 +57,14 @@ __KERNEL_RCSID(0, "$NetBSD: ext2fs_alloc.c,v 1.14 2002/09/27 15:38:02 provos Exp u_long ext2gennumber; -static ufs_daddr_t ext2fs_alloccg __P((struct inode *, int, ufs_daddr_t, int)); +static daddr_t ext2fs_alloccg __P((struct inode *, int, daddr_t, int)); static u_long ext2fs_dirpref __P((struct m_ext2fs *)); static void ext2fs_fserr __P((struct m_ext2fs *, u_int, char *)); static u_long ext2fs_hashalloc __P((struct inode *, int, long, int, - ufs_daddr_t (*)(struct inode *, int, ufs_daddr_t, + daddr_t (*)(struct inode *, int, daddr_t, int))); -static ufs_daddr_t ext2fs_nodealloccg __P((struct inode *, int, ufs_daddr_t, int)); -static ufs_daddr_t ext2fs_mapsearch __P((struct m_ext2fs *, char *, ufs_daddr_t)); +static daddr_t ext2fs_nodealloccg __P((struct inode *, int, daddr_t, int)); +static daddr_t ext2fs_mapsearch __P((struct m_ext2fs *, char *, daddr_t)); /* * Allocate a block in the file system. @@ -86,12 +86,12 @@ static ufs_daddr_t ext2fs_mapsearch __P((struct m_ext2fs *, char *, ufs_daddr_t) int ext2fs_alloc(ip, lbn, bpref, cred, bnp) struct inode *ip; - ufs_daddr_t lbn, bpref; + daddr_t lbn, bpref; struct ucred *cred; - ufs_daddr_t *bnp; + daddr_t *bnp; { struct m_ext2fs *fs; - ufs_daddr_t bno; + daddr_t bno; int cg; *bnp = 0; @@ -110,7 +110,7 @@ ext2fs_alloc(ip, lbn, bpref, cred, bnp) cg = ino_to_cg(fs, ip->i_number); else cg = dtog(fs, bpref); - bno = (ufs_daddr_t)ext2fs_hashalloc(ip, cg, bpref, fs->e2fs_bsize, + bno = (daddr_t)ext2fs_hashalloc(ip, cg, bpref, fs->e2fs_bsize, ext2fs_alloccg); if (bno > 0) { ip->i_e2fs_nblock += btodb(fs->e2fs_bsize); @@ -235,12 +235,12 @@ ext2fs_dirpref(fs) * contigously. The two fields of the ext2 inode extension (see * ufs/ufs/inode.h) help this. */ -ufs_daddr_t +daddr_t ext2fs_blkpref(ip, lbn, indx, bap) struct inode *ip; - ufs_daddr_t lbn; + daddr_t lbn; int indx; - ufs_daddr_t *bap; + int32_t *bap; /* XXX ondisk32 */ { struct m_ext2fs *fs; int cg, i; @@ -288,7 +288,7 @@ ext2fs_hashalloc(ip, cg, pref, size, allocator) int cg; long pref; int size; /* size for data blocks, mode for inodes */ - ufs_daddr_t (*allocator) __P((struct inode *, int, ufs_daddr_t, int)); + daddr_t (*allocator) __P((struct inode *, int, daddr_t, int)); { struct m_ext2fs *fs; long result; @@ -336,16 +336,17 @@ ext2fs_hashalloc(ip, cg, pref, size, allocator) * and if it is, allocate it. */ -static ufs_daddr_t +static daddr_t ext2fs_alloccg(ip, cg, bpref, size) struct inode *ip; int cg; - ufs_daddr_t bpref; + daddr_t bpref; int size; { struct m_ext2fs *fs; char *bbp; struct buf *bp; + /* XXX ondisk32 */ int error, bno, start, end, loc; fs = ip->i_e2fs; @@ -401,13 +402,13 @@ ext2fs_alloccg(ip, cg, bpref, size) return (0); gotit: #ifdef DIAGNOSTIC - if (isset(bbp, (long)bno)) { + if (isset(bbp, (daddr_t)bno)) { printf("ext2fs_alloccgblk: cg=%d bno=%d fs=%s\n", cg, bno, fs->e2fs_fsmnt); panic("ext2fs_alloccg: dup alloc"); } #endif - setbit(bbp, (long)bno); + setbit(bbp, (daddr_t)bno); fs->e2fs.e2fs_fbcount--; fs->e2fs_gd[cg].ext2bgd_nbfree--; fs->e2fs_fmod = 1; @@ -424,11 +425,11 @@ gotit: * 2) allocate the next available inode after the requested * inode in the specified cylinder group. */ -static ufs_daddr_t +static daddr_t ext2fs_nodealloccg(ip, cg, ipref, mode) struct inode *ip; int cg; - ufs_daddr_t ipref; + daddr_t ipref; int mode; { struct m_ext2fs *fs; @@ -461,8 +462,8 @@ ext2fs_nodealloccg(ip, cg, ipref, mode) start = 0; loc = skpc(0xff, len, &ibp[0]); if (loc == 0) { - printf("cg = %d, ipref = %d, fs = %s\n", - cg, ipref, fs->e2fs_fsmnt); + printf("cg = %d, ipref = %lld, fs = %s\n", + cg, (long long)ipref, fs->e2fs_fsmnt); panic("ext2fs_nodealloccg: map corrupted"); /* NOTREACHED */ } @@ -499,7 +500,7 @@ gotit: void ext2fs_blkfree(ip, bno) struct inode *ip; - ufs_daddr_t bno; + daddr_t bno; { struct m_ext2fs *fs; char *bbp; @@ -509,7 +510,8 @@ ext2fs_blkfree(ip, bno) fs = ip->i_e2fs; cg = dtog(fs, bno); if ((u_int)bno >= fs->e2fs.e2fs_bcount) { - printf("bad block %d, ino %d\n", bno, ip->i_number); + printf("bad block %lld, ino %d\n", (long long)bno, + ip->i_number); ext2fs_fserr(fs, ip->i_e2fs_uid, "bad block"); return; } @@ -523,8 +525,8 @@ ext2fs_blkfree(ip, bno) bbp = (char *)bp->b_data; bno = dtogd(fs, bno); if (isclr(bbp, bno)) { - printf("dev = 0x%x, block = %d, fs = %s\n", - ip->i_dev, bno, fs->e2fs_fsmnt); + printf("dev = 0x%x, block = %lld, fs = %s\n", + ip->i_dev, (long long)bno, fs->e2fs_fsmnt); panic("blkfree: freeing free block"); } clrbit(bbp, bno); @@ -595,13 +597,13 @@ ext2fs_vfree(v) * available. */ -static ufs_daddr_t +static daddr_t ext2fs_mapsearch(fs, bbp, bpref) struct m_ext2fs *fs; char *bbp; - ufs_daddr_t bpref; + daddr_t bpref; { - ufs_daddr_t bno; + daddr_t bno; int start, len, loc, i, map; /* diff --git a/sys/ufs/ext2fs/ext2fs_balloc.c b/sys/ufs/ext2fs/ext2fs_balloc.c index a9ea14f665ca..09d1262abb7a 100644 --- a/sys/ufs/ext2fs/ext2fs_balloc.c +++ b/sys/ufs/ext2fs/ext2fs_balloc.c @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs_balloc.c,v 1.18 2002/09/26 11:06:36 jdolecek Exp $ */ +/* $NetBSD: ext2fs_balloc.c,v 1.19 2003/01/24 21:55:19 fvdl Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ext2fs_balloc.c,v 1.18 2002/09/26 11:06:36 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ext2fs_balloc.c,v 1.19 2003/01/24 21:55:19 fvdl Exp $"); #if defined(_KERNEL_OPT) #include "opt_uvmhist.h" @@ -68,21 +68,23 @@ __KERNEL_RCSID(0, "$NetBSD: ext2fs_balloc.c,v 1.18 2002/09/26 11:06:36 jdolecek int ext2fs_balloc(ip, bn, size, cred, bpp, flags) struct inode *ip; - ufs_daddr_t bn; + daddr_t bn; int size; struct ucred *cred; struct buf **bpp; int flags; { struct m_ext2fs *fs; - ufs_daddr_t nb; + daddr_t nb; struct buf *bp, *nbp; struct vnode *vp = ITOV(ip); struct indir indirs[NIADDR + 2]; - ufs_daddr_t newb, lbn, *bap, pref; + daddr_t newb, lbn, pref; + int32_t *bap; /* XXX ondisk32 */ int num, i, error; u_int deallocated; - ufs_daddr_t *allocib, *blkp, *allocblk, allociblk[NIADDR + 1]; + daddr_t *blkp, *allocblk, allociblk[NIADDR + 1]; + int32_t *allocib; /* XXX ondisk32 */ int unwindidx = -1; UVMHIST_FUNC("ext2fs_balloc"); UVMHIST_CALLED(ubchist); @@ -100,6 +102,7 @@ ext2fs_balloc(ip, bn, size, cred, bpp, flags) * The first NDADDR blocks are direct blocks */ if (bn < NDADDR) { + /* XXX ondisk32 */ nb = fs2h32(ip->i_e2fs_blocks[bn]); if (nb != 0) { @@ -130,7 +133,8 @@ ext2fs_balloc(ip, bn, size, cred, bpp, flags) return (error); ip->i_e2fs_last_lblk = lbn; ip->i_e2fs_last_blk = newb; - ip->i_e2fs_blocks[bn] = h2fs32(newb); + /* XXX ondisk32 */ + ip->i_e2fs_blocks[bn] = h2fs32((int32_t)newb); ip->i_flag |= IN_CHANGE | IN_UPDATE; if (bpp != NULL) { bp = getblk(vp, bn, fs->e2fs_bsize, 0, 0); @@ -155,11 +159,12 @@ ext2fs_balloc(ip, bn, size, cred, bpp, flags) * Fetch the first indirect block allocating if necessary. */ --num; + /* XXX ondisk32 */ nb = fs2h32(ip->i_e2fs_blocks[NDADDR + indirs[0].in_off]); allocib = NULL; allocblk = allociblk; if (nb == 0) { - pref = ext2fs_blkpref(ip, lbn, 0, (ufs_daddr_t *)0); + pref = ext2fs_blkpref(ip, lbn, 0, (int32_t *)0); error = ext2fs_alloc(ip, lbn, pref, cred, &newb); if (error) return (error); @@ -177,7 +182,8 @@ ext2fs_balloc(ip, bn, size, cred, bpp, flags) goto fail; unwindidx = 0; allocib = &ip->i_e2fs_blocks[NDADDR + indirs[0].in_off]; - *allocib = h2fs32(newb); + /* XXX ondisk32 */ + *allocib = h2fs32((int32_t)newb); ip->i_flag |= IN_CHANGE | IN_UPDATE; } /* @@ -190,7 +196,7 @@ ext2fs_balloc(ip, bn, size, cred, bpp, flags) brelse(bp); goto fail; } - bap = (ufs_daddr_t *)bp->b_data; + bap = (int32_t *)bp->b_data; /* XXX ondisk32 */ nb = fs2h32(bap[indirs[i].in_off]); if (i == num) break; @@ -199,7 +205,7 @@ ext2fs_balloc(ip, bn, size, cred, bpp, flags) brelse(bp); continue; } - pref = ext2fs_blkpref(ip, lbn, 0, (ufs_daddr_t *)0); + pref = ext2fs_blkpref(ip, lbn, 0, (int32_t *)0); error = ext2fs_alloc(ip, lbn, pref, cred, &newb); if (error) { brelse(bp); @@ -221,7 +227,8 @@ ext2fs_balloc(ip, bn, size, cred, bpp, flags) } if (unwindidx < 0) unwindidx = i - 1; - bap[indirs[i - 1].in_off] = h2fs32(nb); + /* XXX ondisk32 */ + bap[indirs[i - 1].in_off] = h2fs32((int32_t)nb); /* * If required, write synchronously, otherwise use * delayed write. @@ -246,7 +253,8 @@ ext2fs_balloc(ip, bn, size, cred, bpp, flags) *allocblk++ = nb; ip->i_e2fs_last_lblk = lbn; ip->i_e2fs_last_blk = newb; - bap[indirs[num].in_off] = h2fs32(nb); + /* XXX ondisk32 */ + bap[indirs[num].in_off] = h2fs32((int32_t)nb); /* * If required, write synchronously, otherwise use * delayed write. @@ -302,7 +310,7 @@ fail: panic("Could not unwind indirect block, error %d", r); brelse(bp); } else { - bap = (ufs_daddr_t *)bp->b_data; + bap = (int32_t *)bp->b_data; /* XXX ondisk32 */ bap[indirs[unwindidx].in_off] = 0; if (flags & B_SYNC) bwrite(bp); diff --git a/sys/ufs/ext2fs/ext2fs_bmap.c b/sys/ufs/ext2fs/ext2fs_bmap.c index 2ffc8f6bc09b..d3a16ccb5e5f 100644 --- a/sys/ufs/ext2fs/ext2fs_bmap.c +++ b/sys/ufs/ext2fs/ext2fs_bmap.c @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs_bmap.c,v 1.9 2001/11/10 17:46:23 chs Exp $ */ +/* $NetBSD: ext2fs_bmap.c,v 1.10 2003/01/24 21:55:20 fvdl Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. @@ -43,7 +43,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ext2fs_bmap.c,v 1.9 2001/11/10 17:46:23 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ext2fs_bmap.c,v 1.10 2003/01/24 21:55:20 fvdl Exp $"); #include #include @@ -62,7 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: ext2fs_bmap.c,v 1.9 2001/11/10 17:46:23 chs Exp $"); #include #include -static int ext2fs_bmaparray __P((struct vnode *, ufs_daddr_t, ufs_daddr_t *, +static int ext2fs_bmaparray __P((struct vnode *, daddr_t, daddr_t *, struct indir *, int *, int *)); /* @@ -111,8 +111,8 @@ ext2fs_bmap(v) int ext2fs_bmaparray(vp, bn, bnp, ap, nump, runp) struct vnode *vp; - ufs_daddr_t bn; - ufs_daddr_t *bnp; + daddr_t bn; + daddr_t *bnp; struct indir *ap; int *nump; int *runp; @@ -122,8 +122,8 @@ ext2fs_bmaparray(vp, bn, bnp, ap, nump, runp) struct ufsmount *ump; struct mount *mp; struct indir a[NIADDR+1], *xap; - ufs_daddr_t daddr; - long metalbn; + daddr_t daddr; + daddr_t metalbn; int error, maxrun = 0, num; ip = VTOI(vp); @@ -146,13 +146,15 @@ ext2fs_bmaparray(vp, bn, bnp, ap, nump, runp) } if (bn >= 0 && bn < NDADDR) { - *bnp = blkptrtodb(ump, fs2h32(ip->i_e2fs_blocks[bn])); + /* XXX ondisk32 */ + *bnp = blkptrtodb(ump, (daddr_t)fs2h32(ip->i_e2fs_blocks[bn])); if (*bnp == 0) *bnp = -1; else if (runp) + /* XXX ondisk32 */ for (++bn; bn < NDADDR && *runp < maxrun && - is_sequential(ump, fs2h32(ip->i_e2fs_blocks[bn - 1]), - fs2h32(ip->i_e2fs_blocks[bn])); + is_sequential(ump, (daddr_t)fs2h32(ip->i_e2fs_blocks[bn - 1]), + (daddr_t)fs2h32(ip->i_e2fs_blocks[bn])); ++bn, ++*runp); return (0); } @@ -166,6 +168,7 @@ ext2fs_bmaparray(vp, bn, bnp, ap, nump, runp) num = *nump; /* Get disk address out of indirect block array */ + /* XXX ondisk32 */ daddr = fs2h32(ip->i_e2fs_blocks[NDADDR + xap->in_off]); #ifdef DIAGNOSTIC @@ -212,12 +215,14 @@ ext2fs_bmaparray(vp, bn, bnp, ap, nump, runp) } } - daddr = fs2h32(((ufs_daddr_t *)bp->b_data)[xap->in_off]); + /* XXX ondisk32 */ + daddr = fs2h32(((int32_t *)bp->b_data)[xap->in_off]); if (num == 1 && daddr && runp) + /* XXX ondisk32 */ for (bn = xap->in_off + 1; bn < MNINDIR(ump) && *runp < maxrun && - is_sequential(ump, ((ufs_daddr_t *)bp->b_data)[bn - 1], - ((ufs_daddr_t *)bp->b_data)[bn]); + is_sequential(ump, ((int32_t *)bp->b_data)[bn - 1], + ((int32_t *)bp->b_data)[bn]); ++bn, ++*runp); } if (bp) diff --git a/sys/ufs/ext2fs/ext2fs_extern.h b/sys/ufs/ext2fs/ext2fs_extern.h index 30f38df119e8..6279f2d71841 100644 --- a/sys/ufs/ext2fs/ext2fs_extern.h +++ b/sys/ufs/ext2fs/ext2fs_extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs_extern.h,v 1.13 2002/12/01 00:12:07 matt Exp $ */ +/* $NetBSD: ext2fs_extern.h,v 1.14 2003/01/24 21:55:20 fvdl Exp $ */ /*- * Copyright (c) 1997 Manuel Bouyer. @@ -61,18 +61,19 @@ extern struct pool ext2fs_inode_pool; /* memory pool for inodes */ __BEGIN_DECLS /* ext2fs_alloc.c */ -int ext2fs_alloc __P((struct inode *, ufs_daddr_t, ufs_daddr_t , struct ucred *, - ufs_daddr_t *)); -int ext2fs_realloccg __P((struct inode *, ufs_daddr_t, ufs_daddr_t, int, int , +int ext2fs_alloc __P((struct inode *, daddr_t, daddr_t , struct ucred *, + daddr_t *)); +int ext2fs_realloccg __P((struct inode *, daddr_t, daddr_t, int, int , struct ucred *, struct buf **)); int ext2fs_reallocblks __P((void *)); int ext2fs_valloc __P((void *)); -ufs_daddr_t ext2fs_blkpref __P((struct inode *, ufs_daddr_t, int, ufs_daddr_t *)); -void ext2fs_blkfree __P((struct inode *, ufs_daddr_t)); +/* XXX ondisk32 */ +daddr_t ext2fs_blkpref __P((struct inode *, daddr_t, int, int32_t *)); +void ext2fs_blkfree __P((struct inode *, daddr_t)); int ext2fs_vfree __P((void *)); /* ext2fs_balloc.c */ -int ext2fs_balloc __P((struct inode *, ufs_daddr_t, int, struct ucred *, +int ext2fs_balloc __P((struct inode *, daddr_t, int, struct ucred *, struct buf **, int)); int ext2fs_gop_alloc __P((struct vnode *, off_t, off_t, int, struct ucred *)); diff --git a/sys/ufs/ext2fs/ext2fs_inode.c b/sys/ufs/ext2fs/ext2fs_inode.c index e31410b39a29..fd18cf0f4de0 100644 --- a/sys/ufs/ext2fs/ext2fs_inode.c +++ b/sys/ufs/ext2fs/ext2fs_inode.c @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs_inode.c,v 1.28 2002/09/26 11:06:36 jdolecek Exp $ */ +/* $NetBSD: ext2fs_inode.c,v 1.29 2003/01/24 21:55:20 fvdl Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ext2fs_inode.c,v 1.28 2002/09/26 11:06:36 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ext2fs_inode.c,v 1.29 2003/01/24 21:55:20 fvdl Exp $"); #include #include @@ -61,8 +61,8 @@ __KERNEL_RCSID(0, "$NetBSD: ext2fs_inode.c,v 1.28 2002/09/26 11:06:36 jdolecek E extern int prtactive; -static int ext2fs_indirtrunc __P((struct inode *, ufs_daddr_t, ufs_daddr_t, - ufs_daddr_t, int, long *)); +static int ext2fs_indirtrunc __P((struct inode *, daddr_t, daddr_t, + daddr_t, int, long *)); /* * Last reference to an inode. If necessary, write or delete it. @@ -190,10 +190,10 @@ ext2fs_truncate(v) struct proc *a_p; } */ *ap = v; struct vnode *ovp = ap->a_vp; - ufs_daddr_t lastblock; + daddr_t lastblock; struct inode *oip; - ufs_daddr_t bn, lastiblock[NIADDR], indir_lbn[NIADDR]; - ufs_daddr_t oldblks[NDADDR + NIADDR], newblks[NDADDR + NIADDR]; + daddr_t bn, lastiblock[NIADDR], indir_lbn[NIADDR]; + daddr_t oldblks[NDADDR + NIADDR], newblks[NDADDR + NIADDR]; off_t length = ap->a_length; struct m_ext2fs *fs; int offset, size, level; @@ -309,6 +309,7 @@ ext2fs_truncate(v) indir_lbn[DOUBLE] = indir_lbn[SINGLE] - NINDIR(fs) -1; indir_lbn[TRIPLE] = indir_lbn[DOUBLE] - NINDIR(fs) * NINDIR(fs) - 1; for (level = TRIPLE; level >= SINGLE; level--) { + /* XXX ondisk32 */ bn = fs2h32(oip->i_e2fs_blocks[NDADDR + level]); if (bn != 0) { error = ext2fs_indirtrunc(oip, indir_lbn[level], @@ -330,6 +331,7 @@ ext2fs_truncate(v) * All whole direct blocks or frags. */ for (i = NDADDR - 1; i > lastblock; i--) { + /* XXX ondisk32 */ bn = fs2h32(oip->i_e2fs_blocks[i]); if (bn == 0) continue; @@ -373,17 +375,18 @@ done: static int ext2fs_indirtrunc(ip, lbn, dbn, lastbn, level, countp) struct inode *ip; - ufs_daddr_t lbn, lastbn; - ufs_daddr_t dbn; + daddr_t lbn, lastbn; + daddr_t dbn; int level; long *countp; { int i; struct buf *bp; struct m_ext2fs *fs = ip->i_e2fs; - ufs_daddr_t *bap; + int32_t *bap; /* XXX ondisk32 */ struct vnode *vp; - ufs_daddr_t *copy = NULL, nb, nlbn, last; + daddr_t nb, nlbn, last; + int32_t *copy = NULL; /* XXX ondisk32 */ long blkcount, factor; int nblocks, blocksreleased = 0; int error = 0, allerror = 0; @@ -429,9 +432,10 @@ ext2fs_indirtrunc(ip, lbn, dbn, lastbn, level, countp) return (error); } - bap = (ufs_daddr_t *)bp->b_data; + bap = (int32_t *)bp->b_data; /* XXX ondisk32 */ if (lastbn >= 0) { - MALLOC(copy, ufs_daddr_t *, fs->e2fs_bsize, M_TEMP, M_WAITOK); + /* XXX ondisk32 */ + MALLOC(copy, int32_t *, fs->e2fs_bsize, M_TEMP, M_WAITOK); memcpy((caddr_t)copy, (caddr_t)bap, (u_int)fs->e2fs_bsize); memset((caddr_t)&bap[last + 1], 0, (u_int)(NINDIR(fs) - (last + 1)) * sizeof (u_int32_t)); @@ -447,12 +451,13 @@ ext2fs_indirtrunc(ip, lbn, dbn, lastbn, level, countp) for (i = NINDIR(fs) - 1, nlbn = lbn + 1 - i * factor; i > last; i--, nlbn += factor) { + /* XXX ondisk32 */ nb = fs2h32(bap[i]); if (nb == 0) continue; if (level > SINGLE) { error = ext2fs_indirtrunc(ip, nlbn, fsbtodb(fs, nb), - (ufs_daddr_t)-1, level - 1, + (daddr_t)-1, level - 1, &blkcount); if (error) allerror = error; @@ -467,6 +472,7 @@ ext2fs_indirtrunc(ip, lbn, dbn, lastbn, level, countp) */ if (level > SINGLE && lastbn >= 0) { last = lastbn % factor; + /* XXX ondisk32 */ nb = fs2h32(bap[i]); if (nb != 0) { error = ext2fs_indirtrunc(ip, nlbn, fsbtodb(fs, nb), diff --git a/sys/ufs/ext2fs/ext2fs_readwrite.c b/sys/ufs/ext2fs/ext2fs_readwrite.c index 7d75f970d6b1..1aa9504b20be 100644 --- a/sys/ufs/ext2fs/ext2fs_readwrite.c +++ b/sys/ufs/ext2fs/ext2fs_readwrite.c @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs_readwrite.c,v 1.26 2002/10/23 09:15:04 jdolecek Exp $ */ +/* $NetBSD: ext2fs_readwrite.c,v 1.27 2003/01/24 21:55:20 fvdl Exp $ */ /*- * Copyright (c) 1997 Manuel Bouyer. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ext2fs_readwrite.c,v 1.26 2002/10/23 09:15:04 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ext2fs_readwrite.c,v 1.27 2003/01/24 21:55:20 fvdl Exp $"); #include #include @@ -83,7 +83,7 @@ ext2fs_read(v) struct buf *bp; void *win; vsize_t bytelen; - ufs_daddr_t lbn, nextlbn; + daddr_t lbn, nextlbn; off_t bytesinfile; long size, xfersize, blkoffset; int error; @@ -205,7 +205,7 @@ ext2fs_write(v) struct m_ext2fs *fs; struct buf *bp; struct proc *p; - ufs_daddr_t lbn; + daddr_t lbn; off_t osize; int blkoffset, error, flags, ioflag, resid, xfersize; vsize_t bytelen; diff --git a/sys/ufs/ext2fs/ext2fs_subr.c b/sys/ufs/ext2fs/ext2fs_subr.c index 69dd6340f482..a0ce4801dd5e 100644 --- a/sys/ufs/ext2fs/ext2fs_subr.c +++ b/sys/ufs/ext2fs/ext2fs_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs_subr.c,v 1.6 2001/11/08 02:39:07 lukem Exp $ */ +/* $NetBSD: ext2fs_subr.c,v 1.7 2003/01/24 21:55:20 fvdl Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ext2fs_subr.c,v 1.6 2001/11/08 02:39:07 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ext2fs_subr.c,v 1.7 2003/01/24 21:55:20 fvdl Exp $"); #include #include @@ -66,7 +66,7 @@ ext2fs_blkatoff(v) struct inode *ip; struct m_ext2fs *fs; struct buf *bp; - ufs_daddr_t lbn; + daddr_t lbn; int error; ip = VTOI(ap->a_vp); @@ -91,7 +91,7 @@ ext2fs_checkoverlap(bp, ip) struct inode *ip; { struct buf *ebp, *ep; - ufs_daddr_t start, last; + daddr_t start, last; struct vnode *vp; ebp = &buf[nbuf]; @@ -101,7 +101,7 @@ ext2fs_checkoverlap(bp, ip) if (ep == bp || (ep->b_flags & B_INVAL) || ep->b_vp == NULLVP) continue; - if (VOP_BMAP(ep->b_vp, (ufs_daddr_t)0, &vp, (ufs_daddr_t)0, NULL)) + if (VOP_BMAP(ep->b_vp, (daddr_t)0, &vp, (daddr_t)0, NULL)) continue; if (vp != ip->i_devvp) continue; diff --git a/sys/ufs/ext2fs/ext2fs_vfsops.c b/sys/ufs/ext2fs/ext2fs_vfsops.c index 0954420860bf..4034b23caa87 100644 --- a/sys/ufs/ext2fs/ext2fs_vfsops.c +++ b/sys/ufs/ext2fs/ext2fs_vfsops.c @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs_vfsops.c,v 1.52 2002/09/21 18:14:49 christos Exp $ */ +/* $NetBSD: ext2fs_vfsops.c,v 1.53 2003/01/24 21:55:20 fvdl Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.52 2002/09/21 18:14:49 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.53 2003/01/24 21:55:20 fvdl Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -410,7 +410,7 @@ ext2fs_reload(mountp, cred, p) size = DEV_BSIZE; else size = dpart.disklab->d_secsize; - error = bread(devvp, (ufs_daddr_t)(SBOFF / size), SBSIZE, NOCRED, &bp); + error = bread(devvp, (daddr_t)(SBOFF / size), SBSIZE, NOCRED, &bp); if (error) { brelse(bp); return (error); diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index bd4b2078fd92..9d82e5f06f3d 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_alloc.c,v 1.57 2002/12/27 16:07:13 hannken Exp $ */ +/* $NetBSD: ffs_alloc.c,v 1.58 2003/01/24 21:55:21 fvdl Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.57 2002/12/27 16:07:13 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.58 2003/01/24 21:55:21 fvdl Exp $"); #if defined(_KERNEL_OPT) #include "opt_ffs.h" @@ -61,22 +61,22 @@ __KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.57 2002/12/27 16:07:13 hannken Exp $ #include #include -static ufs_daddr_t ffs_alloccg __P((struct inode *, int, ufs_daddr_t, int)); -static ufs_daddr_t ffs_alloccgblk __P((struct inode *, struct buf *, ufs_daddr_t)); +static daddr_t ffs_alloccg __P((struct inode *, int, daddr_t, int)); +static daddr_t ffs_alloccgblk __P((struct inode *, struct buf *, daddr_t)); #ifdef XXXUBC -static ufs_daddr_t ffs_clusteralloc __P((struct inode *, int, ufs_daddr_t, int)); +static daddr_t ffs_clusteralloc __P((struct inode *, int, daddr_t, int)); #endif static ino_t ffs_dirpref __P((struct inode *)); -static ufs_daddr_t ffs_fragextend __P((struct inode *, int, long, int, int)); +static daddr_t ffs_fragextend __P((struct inode *, int, daddr_t, int, int)); static void ffs_fserr __P((struct fs *, u_int, char *)); -static u_long ffs_hashalloc __P((struct inode *, int, long, int, - ufs_daddr_t (*)(struct inode *, int, ufs_daddr_t, int))); -static ufs_daddr_t ffs_nodealloccg __P((struct inode *, int, ufs_daddr_t, int)); -static ufs_daddr_t ffs_mapsearch __P((struct fs *, struct cg *, - ufs_daddr_t, int)); +static daddr_t ffs_hashalloc __P((struct inode *, int, daddr_t, int, + daddr_t (*)(struct inode *, int, daddr_t, int))); +static daddr_t ffs_nodealloccg __P((struct inode *, int, daddr_t, int)); +static daddr_t ffs_mapsearch __P((struct fs *, struct cg *, + daddr_t, int)); #if defined(DIAGNOSTIC) || defined(DEBUG) #ifdef XXXUBC -static int ffs_checkblk __P((struct inode *, ufs_daddr_t, long size)); +static int ffs_checkblk __P((struct inode *, daddr_t, long size)); #endif #endif @@ -109,13 +109,13 @@ extern const u_char * const fragtbl[]; int ffs_alloc(ip, lbn, bpref, size, cred, bnp) struct inode *ip; - ufs_daddr_t lbn, bpref; + daddr_t lbn, bpref; int size; struct ucred *cred; - ufs_daddr_t *bnp; + daddr_t *bnp; { struct fs *fs = ip->i_fs; - ufs_daddr_t bno; + daddr_t bno; int cg; #ifdef QUOTA int error; @@ -165,7 +165,7 @@ ffs_alloc(ip, lbn, bpref, size, cred, bnp) cg = ino_to_cg(fs, ip->i_number); else cg = dtog(fs, bpref); - bno = (ufs_daddr_t)ffs_hashalloc(ip, cg, (long)bpref, size, + bno = ffs_hashalloc(ip, cg, (long)bpref, size, ffs_alloccg); if (bno > 0) { ip->i_ffs_blocks += btodb(size); @@ -196,17 +196,17 @@ nospace: int ffs_realloccg(ip, lbprev, bpref, osize, nsize, cred, bpp, blknop) struct inode *ip; - ufs_daddr_t lbprev; - ufs_daddr_t bpref; + daddr_t lbprev; + daddr_t bpref; int osize, nsize; struct ucred *cred; struct buf **bpp; - ufs_daddr_t *blknop; + daddr_t *blknop; { struct fs *fs = ip->i_fs; struct buf *bp; int cg, request, error; - ufs_daddr_t bprev, bno; + daddr_t bprev, bno; #ifdef UVM_PAGE_TRKOWN if (ITOV(ip)->v_type == VREG) { @@ -240,9 +240,10 @@ ffs_realloccg(ip, lbprev, bpref, osize, nsize, cred, bpp, blknop) #endif /* DIAGNOSTIC */ if (cred->cr_uid != 0 && freespace(fs, fs->fs_minfree) <= 0) goto nospace; + /* XXX ondisk32 */ if ((bprev = ufs_rw32(ip->i_ffs_db[lbprev], UFS_FSNEEDSWAP(fs))) == 0) { - printf("dev = 0x%x, bsize = %d, bprev = %d, fs = %s\n", - ip->i_dev, fs->fs_bsize, bprev, fs->fs_fsmnt); + printf("dev = 0x%x, bsize = %d, bprev = %lld, fs = %s\n", + ip->i_dev, fs->fs_bsize, (long long)bprev, fs->fs_fsmnt); panic("ffs_realloccg: bad bprev"); } /* @@ -340,8 +341,7 @@ ffs_realloccg(ip, lbprev, bpref, osize, nsize, cred, bpp, blknop) panic("ffs_realloccg: bad optim"); /* NOTREACHED */ } - bno = (ufs_daddr_t)ffs_hashalloc(ip, cg, (long)bpref, request, - ffs_alloccg); + bno = ffs_hashalloc(ip, cg, bpref, request, ffs_alloccg); if (bno > 0) { if (!DOINGSOFTDEP(ITOV(ip))) ffs_blkfree(ip, bprev, (long)osize); @@ -418,9 +418,9 @@ ffs_reallocblks(v) struct inode *ip; struct vnode *vp; struct buf *sbp, *ebp; - ufs_daddr_t *bap, *sbap, *ebap = NULL; + int32_t *bap, *ebap = NULL, *sbap; /* XXX ondisk32 */ struct cluster_save *buflist; - ufs_daddr_t start_lbn, end_lbn, soff, newblk, blkno; + daddr_t start_lbn, end_lbn, soff, newblk, blkno; struct indir start_ap[NIADDR + 1], end_ap[NIADDR + 1], *idp; int i, len, start_lvl, end_lvl, pref, ssize; #endif /* XXXUBC */ @@ -467,7 +467,7 @@ ffs_reallocblks(v) * Get the starting offset and block map for the first block. */ if (start_lvl == 0) { - sbap = &ip->i_ffs_db[0]; + sbap = &ip->i_ffs_db[0]; /* XXX ondisk32 */ soff = start_lbn; } else { idp = &start_ap[start_lvl - 1]; @@ -475,7 +475,7 @@ ffs_reallocblks(v) brelse(sbp); return (ENOSPC); } - sbap = (ufs_daddr_t *)sbp->b_data; + sbap = (int32_t *)sbp->b_data; /* XXX ondisk32 */ soff = idp->in_off; } /* @@ -495,12 +495,12 @@ ffs_reallocblks(v) ssize = len - (idp->in_off + 1); if (bread(vp, idp->in_lbn, (int)fs->fs_bsize, NOCRED, &ebp)) goto fail; - ebap = (ufs_daddr_t *)ebp->b_data; + ebap = (int32_t *)ebp->b_data; /* XXX ondisk32 */ } /* * Search the block map looking for an allocation of the desired size. */ - if ((newblk = (ufs_daddr_t)ffs_hashalloc(ip, dtog(fs, pref), (long)pref, + if ((newblk = (daddr_t)ffs_hashalloc(ip, dtog(fs, pref), (long)pref, len, ffs_clusteralloc)) == 0) goto fail; /* @@ -517,12 +517,13 @@ ffs_reallocblks(v) #endif blkno = newblk; for (bap = &sbap[soff], i = 0; i < len; i++, blkno += fs->fs_frag) { - ufs_daddr_t ba; + daddr_t ba; if (i == ssize) { bap = ebap; soff = -i; } + /* XXX ondisk32 */ ba = ufs_rw32(*bap, UFS_FSNEEDSWAP(fs)); #ifdef DIAGNOSTIC if (!ffs_checkblk(ip, @@ -545,7 +546,8 @@ ffs_reallocblks(v) i < ssize ? sbp : ebp, soff + i, blkno, ba, buflist->bs_children[i]); } - *bap++ = ufs_rw32(blkno, UFS_FSNEEDSWAP(fs)); + /* XXX ondisk32 */ + *bap++ = ufs_rw32((int32_t)blkno, UFS_FSNEEDSWAP(fs)); } /* * Next we must write out the modified inode and indirect blocks. @@ -839,17 +841,17 @@ ffs_dirpref(pip) * fs_rotdelay milliseconds. This is to allow time for the processor to * schedule another I/O transfer. */ -ufs_daddr_t +daddr_t ffs_blkpref(ip, lbn, indx, bap) struct inode *ip; - ufs_daddr_t lbn; + daddr_t lbn; int indx; - ufs_daddr_t *bap; + int32_t *bap; /* XXX ondisk32 */ { struct fs *fs; int cg; int avgbfree, startcg; - ufs_daddr_t nextblk; + daddr_t nextblk; fs = ip->i_fs; if (indx % fs->fs_maxbpg == 0 || bap[indx - 1] == 0) { @@ -885,6 +887,7 @@ ffs_blkpref(ip, lbn, indx, bap) * next block is requested contiguously, otherwise it is * requested rotationally delayed by fs_rotdelay milliseconds. */ + /* XXX ondisk32 */ nextblk = ufs_rw32(bap[indx - 1], UFS_FSNEEDSWAP(fs)) + fs->fs_frag; if (indx < fs->fs_maxcontig || ufs_rw32(bap[indx - fs->fs_maxcontig], UFS_FSNEEDSWAP(fs)) + @@ -911,16 +914,16 @@ ffs_blkpref(ip, lbn, indx, bap) * 3) brute force search for a free block. */ /*VARARGS5*/ -static u_long +static daddr_t ffs_hashalloc(ip, cg, pref, size, allocator) struct inode *ip; int cg; - long pref; + daddr_t pref; int size; /* size for data blocks, mode for inodes */ - ufs_daddr_t (*allocator) __P((struct inode *, int, ufs_daddr_t, int)); + daddr_t (*allocator) __P((struct inode *, int, daddr_t, int)); { struct fs *fs; - long result; + daddr_t result; int i, icg = cg; fs = ip->i_fs; @@ -964,17 +967,17 @@ ffs_hashalloc(ip, cg, pref, size, allocator) * Check to see if the necessary fragments are available, and * if they are, allocate them. */ -static ufs_daddr_t +static daddr_t ffs_fragextend(ip, cg, bprev, osize, nsize) struct inode *ip; int cg; - long bprev; + daddr_t bprev; int osize, nsize; { struct fs *fs; struct cg *cgp; struct buf *bp; - long bno; + daddr_t bno; int frags, bbase; int i, error; @@ -1036,16 +1039,16 @@ ffs_fragextend(ip, cg, bprev, osize, nsize) * Check to see if a block of the appropriate size is available, * and if it is, allocate it. */ -static ufs_daddr_t +static daddr_t ffs_alloccg(ip, cg, bpref, size) struct inode *ip; int cg; - ufs_daddr_t bpref; + daddr_t bpref; int size; { struct cg *cgp; struct buf *bp; - ufs_daddr_t bno, blkno; + daddr_t bno, blkno; int error, frags, allocsiz, i; struct fs *fs = ip->i_fs; #ifdef FFS_EI @@ -1107,7 +1110,7 @@ ffs_alloccg(ip, cg, bpref, size) #if 0 /* * XXX fvdl mapsearch will panic, and never return -1 - * also: returning NULL as ufs_daddr_t ? + * also: returning NULL as daddr_t ? */ if (bno < 0) { brelse(bp); @@ -1141,14 +1144,14 @@ ffs_alloccg(ip, cg, bpref, size) * Note that this routine only allocates fs_bsize blocks; these * blocks may be fragmented by the routine that allocates them. */ -static ufs_daddr_t +static daddr_t ffs_alloccgblk(ip, bp, bpref) struct inode *ip; struct buf *bp; - ufs_daddr_t bpref; + daddr_t bpref; { struct cg *cgp; - ufs_daddr_t bno, blkno; + daddr_t bno, blkno; int cylno, pos, delta; short *cylbp; int i; @@ -1158,6 +1161,7 @@ ffs_alloccgblk(ip, bp, bpref) #endif cgp = (struct cg *)bp->b_data; + /* XXX ondisk32 */ if (bpref == 0 || dtog(fs, bpref) != ufs_rw32(cgp->cg_cgx, needswap)) { bpref = ufs_rw32(cgp->cg_rotor, needswap); goto norot; @@ -1237,7 +1241,8 @@ norot: bno = ffs_mapsearch(fs, cgp, bpref, (int)fs->fs_frag); if (bno < 0) return (0); - cgp->cg_rotor = ufs_rw32(bno, needswap); + /* XXX ondisk32 */ + cgp->cg_rotor = ufs_rw32((int32_t)bno, needswap); gotit: blkno = fragstoblks(fs, bno); ffs_clrblock(fs, cg_blksfree(cgp, needswap), (long)blkno); @@ -1250,6 +1255,7 @@ gotit: needswap); ufs_add32(cg_blktot(cgp, needswap)[cylno], -1, needswap); fs->fs_fmod = 1; + /* XXX ondisk32 */ blkno = ufs_rw32(cgp->cg_cgx, needswap) * fs->fs_fpg + bno; if (DOINGSOFTDEP(ITOV(ip))) softdep_setup_blkmapdep(bp, fs, blkno); @@ -1264,11 +1270,11 @@ gotit: * are multiple choices in the same cylinder group. Instead we just * take the first one that we find following bpref. */ -static ufs_daddr_t +static daddr_t ffs_clusteralloc(ip, cg, bpref, len) struct inode *ip; int cg; - ufs_daddr_t bpref; + daddr_t bpref; int len; { struct fs *fs; @@ -1380,11 +1386,11 @@ fail: * 2) allocate the next available inode after the requested * inode in the specified cylinder group. */ -static ufs_daddr_t +static daddr_t ffs_nodealloccg(ip, cg, ipref, mode) struct inode *ip; int cg; - ufs_daddr_t ipref; + daddr_t ipref; int mode; { struct cg *cgp; @@ -1469,25 +1475,28 @@ gotit: void ffs_blkfree(ip, bno, size) struct inode *ip; - ufs_daddr_t bno; + daddr_t bno; long size; { struct cg *cgp; struct buf *bp; - ufs_daddr_t blkno; + daddr_t blkno; int i, error, cg, blk, frags, bbase; struct fs *fs = ip->i_fs; const int needswap = UFS_FSNEEDSWAP(fs); if ((u_int)size > fs->fs_bsize || fragoff(fs, size) != 0 || fragnum(fs, bno) + numfrags(fs, size) > fs->fs_frag) { - printf("dev = 0x%x, bno = %u bsize = %d, size = %ld, fs = %s\n", - ip->i_dev, bno, fs->fs_bsize, size, fs->fs_fsmnt); + printf("dev = 0x%x, bno = %lld bsize = %d, " + "size = %ld, fs = %s\n", + ip->i_dev, (long long)bno, fs->fs_bsize, size, + fs->fs_fsmnt); panic("blkfree: bad size"); } cg = dtog(fs, bno); if ((u_int)bno >= fs->fs_size) { - printf("bad block %d, ino %d\n", bno, ip->i_number); + printf("bad block %lld, ino %d\n", (long long)bno, + ip->i_number); ffs_fserr(fs, ip->i_ffs_uid, "bad block"); return; } @@ -1507,8 +1516,8 @@ ffs_blkfree(ip, bno, size) if (size == fs->fs_bsize) { blkno = fragstoblks(fs, bno); if (!ffs_isfreeblock(fs, cg_blksfree(cgp, needswap), blkno)) { - printf("dev = 0x%x, block = %d, fs = %s\n", - ip->i_dev, bno, fs->fs_fsmnt); + printf("dev = 0x%x, block = %lld, fs = %s\n", + ip->i_dev, (long long)bno, fs->fs_fsmnt); panic("blkfree: freeing free block"); } ffs_setblock(fs, cg_blksfree(cgp, needswap), blkno); @@ -1533,8 +1542,9 @@ ffs_blkfree(ip, bno, size) frags = numfrags(fs, size); for (i = 0; i < frags; i++) { if (isset(cg_blksfree(cgp, needswap), bno + i)) { - printf("dev = 0x%x, block = %d, fs = %s\n", - ip->i_dev, bno + i, fs->fs_fsmnt); + printf("dev = 0x%x, block = %lld, fs = %s\n", + ip->i_dev, (long long)(bno + i), + fs->fs_fsmnt); panic("blkfree: freeing free frag"); } setbit(cg_blksfree(cgp, needswap), bno + i); @@ -1579,7 +1589,7 @@ ffs_blkfree(ip, bno, size) static int ffs_checkblk(ip, bno, size) struct inode *ip; - ufs_daddr_t bno; + daddr_t bno; long size; { struct fs *fs; @@ -1593,7 +1603,7 @@ ffs_checkblk(ip, bno, size) fs->fs_bsize, size, fs->fs_fsmnt); panic("checkblk: bad size"); } - if ((u_int)bno >= fs->fs_size) + if ((int32_t)bno >= fs->fs_size) panic("checkblk: bad block %d", bno); error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, dtog(fs, bno))), (int)fs->fs_cgsize, NOCRED, &bp); @@ -1712,14 +1722,14 @@ ffs_freefile(v) * It is a panic if a request is made to find a block if none are * available. */ -static ufs_daddr_t +static daddr_t ffs_mapsearch(fs, cgp, bpref, allocsiz) struct fs *fs; struct cg *cgp; - ufs_daddr_t bpref; + daddr_t bpref; int allocsiz; { - ufs_daddr_t bno; + daddr_t bno; int start, len, loc, i; int blk, field, subfield, pos; int ostart, olen; @@ -1777,9 +1787,9 @@ ffs_mapsearch(fs, cgp, bpref, allocsiz) subfield <<= 1; } } - printf("bno = %d, fs = %s\n", bno, fs->fs_fsmnt); + printf("bno = %lld, fs = %s\n", (long long)bno, fs->fs_fsmnt); panic("ffs_alloccg: block not in map"); - return (-1); + /* return (-1); */ } /* @@ -1791,7 +1801,7 @@ void ffs_clusteracct(fs, cgp, blkno, cnt) struct fs *fs; struct cg *cgp; - ufs_daddr_t blkno; + daddr_t blkno; int cnt; { int32_t *sump; diff --git a/sys/ufs/ffs/ffs_balloc.c b/sys/ufs/ffs/ffs_balloc.c index 46246a49aaa0..2fbf51182c9f 100644 --- a/sys/ufs/ffs/ffs_balloc.c +++ b/sys/ufs/ffs/ffs_balloc.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_balloc.c,v 1.30 2002/06/05 05:23:51 chs Exp $ */ +/* $NetBSD: ffs_balloc.c,v 1.31 2003/01/24 21:55:21 fvdl Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ffs_balloc.c,v 1.30 2002/06/05 05:23:51 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ffs_balloc.c,v 1.31 2003/01/24 21:55:21 fvdl Exp $"); #if defined(_KERNEL_OPT) #include "opt_quota.h" @@ -78,19 +78,21 @@ ffs_balloc(v) int a_flags; struct buf **a_bpp; } */ *ap = v; - ufs_daddr_t lbn; + daddr_t lbn; int size; struct ucred *cred; int flags; - ufs_daddr_t nb; + daddr_t nb; struct buf *bp, *nbp; struct vnode *vp = ap->a_vp; struct inode *ip = VTOI(vp); struct fs *fs = ip->i_fs; struct indir indirs[NIADDR + 2]; - ufs_daddr_t newb, *bap, pref; + daddr_t newb, pref; + int32_t *bap; /* XXX ondisk32 */ int deallocated, osize, nsize, num, i, error; - ufs_daddr_t *allocib, *blkp, *allocblk, allociblk[NIADDR + 1]; + daddr_t *blkp, *allocblk, allociblk[NIADDR + 1]; + int32_t *allocib; /* XXX ondisk32 */ int unwindidx = -1; struct buf **bpp = ap->a_bpp; #ifdef FFS_EI @@ -134,7 +136,8 @@ ffs_balloc(v) fs->fs_bsize, osize, bpp ? *bpp : NULL); ip->i_ffs_size = lblktosize(fs, nb + 1); uvm_vnp_setsize(vp, ip->i_ffs_size); - ip->i_ffs_db[nb] = ufs_rw32(newb, needswap); + /* XXX ondisk32 */ + ip->i_ffs_db[nb] = ufs_rw32((int32_t)newb, needswap); ip->i_flag |= IN_CHANGE | IN_UPDATE; if (bpp) { if (flags & B_SYNC) @@ -150,6 +153,7 @@ ffs_balloc(v) */ if (lbn < NDADDR) { + /* XXX ondisk32 */ nb = ufs_rw32(ip->i_ffs_db[lbn], needswap); if (nb != 0 && ip->i_ffs_size >= lblktosize(fs, lbn + 1)) { @@ -241,7 +245,8 @@ ffs_balloc(v) nsize, 0, bpp ? *bpp : NULL); } } - ip->i_ffs_db[lbn] = ufs_rw32(newb, needswap); + /* XXX ondisk32 */ + ip->i_ffs_db[lbn] = ufs_rw32((int32_t)newb, needswap); ip->i_flag |= IN_CHANGE | IN_UPDATE; return (0); } @@ -263,7 +268,7 @@ ffs_balloc(v) allocib = NULL; allocblk = allociblk; if (nb == 0) { - pref = ffs_blkpref(ip, lbn, 0, (ufs_daddr_t *)0); + pref = ffs_blkpref(ip, lbn, 0, (int32_t *)0); error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, cred, &newb); if (error) @@ -289,7 +294,8 @@ ffs_balloc(v) } unwindidx = 0; allocib = &ip->i_ffs_ib[indirs[0].in_off]; - *allocib = ufs_rw32(nb, needswap); + /* XXX ondisk32 */ + *allocib = ufs_rw32((int32_t)nb, needswap); ip->i_flag |= IN_CHANGE | IN_UPDATE; } @@ -304,7 +310,7 @@ ffs_balloc(v) brelse(bp); goto fail; } - bap = (ufs_daddr_t *)bp->b_data; + bap = (int32_t *)bp->b_data; /* XXX ondisk32 */ nb = ufs_rw32(bap[indirs[i].in_off], needswap); if (i == num) break; @@ -314,7 +320,7 @@ ffs_balloc(v) continue; } if (pref == 0) - pref = ffs_blkpref(ip, lbn, 0, (ufs_daddr_t *)0); + pref = ffs_blkpref(ip, lbn, 0, (int32_t *)0); error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, cred, &newb); if (error) { @@ -344,7 +350,8 @@ ffs_balloc(v) } if (unwindidx < 0) unwindidx = i - 1; - bap[indirs[i - 1].in_off] = ufs_rw32(nb, needswap); + /* XXX ondisk32 */ + bap[indirs[i - 1].in_off] = ufs_rw32((int32_t)nb, needswap); /* * If required, write synchronously, otherwise use @@ -382,7 +389,8 @@ ffs_balloc(v) if (DOINGSOFTDEP(vp)) softdep_setup_allocindir_page(ip, lbn, bp, indirs[num].in_off, nb, 0, bpp ? *bpp : NULL); - bap[indirs[num].in_off] = ufs_rw32(nb, needswap); + /* XXX ondisk32 */ + bap[indirs[num].in_off] = ufs_rw32((int32_t)nb, needswap); if (allocib == NULL && unwindidx < 0) { unwindidx = i - 1; } @@ -477,7 +485,7 @@ fail: panic("Could not unwind indirect block, error %d", r); brelse(bp); } else { - bap = (ufs_daddr_t *)bp->b_data; + bap = (int32_t *)bp->b_data; /* XXX ondisk32 */ bap[indirs[unwindidx].in_off] = 0; bwrite(bp); } diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h index 587597cdeb27..d3f0722fb020 100644 --- a/sys/ufs/ffs/ffs_extern.h +++ b/sys/ufs/ffs/ffs_extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_extern.h,v 1.24 2002/12/01 00:12:09 matt Exp $ */ +/* $NetBSD: ffs_extern.h,v 1.25 2003/01/24 21:55:22 fvdl Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -79,16 +79,17 @@ extern struct pool ffs_inode_pool; /* memory pool for inodes */ __BEGIN_DECLS /* ffs_alloc.c */ -int ffs_alloc __P((struct inode *, ufs_daddr_t, ufs_daddr_t , int, struct ucred *, - ufs_daddr_t *)); -int ffs_realloccg __P((struct inode *, ufs_daddr_t, ufs_daddr_t, int, int , - struct ucred *, struct buf **, ufs_daddr_t *)); +int ffs_alloc __P((struct inode *, daddr_t, daddr_t , int, struct ucred *, + daddr_t *)); +int ffs_realloccg __P((struct inode *, daddr_t, daddr_t, int, int , + struct ucred *, struct buf **, daddr_t *)); int ffs_reallocblks __P((void *)); int ffs_valloc __P((void *)); -ufs_daddr_t ffs_blkpref __P((struct inode *, ufs_daddr_t, int, ufs_daddr_t *)); -void ffs_blkfree __P((struct inode *, ufs_daddr_t, long)); +/* XXX ondisk32 */ +daddr_t ffs_blkpref __P((struct inode *, daddr_t, int, int32_t *)); +void ffs_blkfree __P((struct inode *, daddr_t, long)); int ffs_vfree __P((void *)); -void ffs_clusteracct __P((struct fs *, struct cg *, ufs_daddr_t, int)); +void ffs_clusteracct __P((struct fs *, struct cg *, daddr_t, int)); /* ffs_balloc.c */ int ffs_balloc __P((void *)); @@ -110,10 +111,10 @@ void ffs_fragacct __P((struct fs *, int, int32_t[], int, int)); #ifdef DIAGNOSTIC void ffs_checkoverlap __P((struct buf *, struct inode *)); #endif -int ffs_isblock __P((struct fs *, u_char *, ufs_daddr_t)); -int ffs_isfreeblock __P((struct fs *, u_char *, ufs_daddr_t)); -void ffs_clrblock __P((struct fs *, u_char *, ufs_daddr_t)); -void ffs_setblock __P((struct fs *, u_char *, ufs_daddr_t)); +int ffs_isblock __P((struct fs *, u_char *, daddr_t)); +int ffs_isfreeblock __P((struct fs *, u_char *, daddr_t)); +void ffs_clrblock __P((struct fs *, u_char *, daddr_t)); +void ffs_setblock __P((struct fs *, u_char *, daddr_t)); /* ffs_vfsops.c */ void ffs_init __P((void)); @@ -167,13 +168,13 @@ void softdep_load_inodeblock __P((struct inode *)); void softdep_freefile __P((void *)); void softdep_setup_freeblocks __P((struct inode *, off_t)); void softdep_setup_inomapdep __P((struct buf *, struct inode *, ino_t)); -void softdep_setup_blkmapdep __P((struct buf *, struct fs *, ufs_daddr_t)); -void softdep_setup_allocdirect __P((struct inode *, ufs_lbn_t, ufs_daddr_t, - ufs_daddr_t, long, long, struct buf *)); +void softdep_setup_blkmapdep __P((struct buf *, struct fs *, daddr_t)); +void softdep_setup_allocdirect __P((struct inode *, daddr_t, daddr_t, + daddr_t, long, long, struct buf *)); void softdep_setup_allocindir_meta __P((struct buf *, struct inode *, - struct buf *, int, ufs_daddr_t)); -void softdep_setup_allocindir_page __P((struct inode *, ufs_lbn_t, - struct buf *, int, ufs_daddr_t, ufs_daddr_t, struct buf *)); + struct buf *, int, daddr_t)); +void softdep_setup_allocindir_page __P((struct inode *, daddr_t, + struct buf *, int, daddr_t, daddr_t, struct buf *)); void softdep_fsync_mountdev __P((struct vnode *)); int softdep_sync_metadata __P((void *)); diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index 5b71554e77b2..63b6179739c5 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_inode.c,v 1.52 2002/09/26 21:35:27 simonb Exp $ */ +/* $NetBSD: ffs_inode.c,v 1.53 2003/01/24 21:55:22 fvdl Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ffs_inode.c,v 1.52 2002/09/26 21:35:27 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ffs_inode.c,v 1.53 2003/01/24 21:55:22 fvdl Exp $"); #if defined(_KERNEL_OPT) #include "opt_ffs.h" @@ -64,8 +64,8 @@ __KERNEL_RCSID(0, "$NetBSD: ffs_inode.c,v 1.52 2002/09/26 21:35:27 simonb Exp $" #include #include -static int ffs_indirtrunc __P((struct inode *, ufs_daddr_t, ufs_daddr_t, - ufs_daddr_t, int, long *)); +static int ffs_indirtrunc __P((struct inode *, daddr_t, daddr_t, + daddr_t, int, long *)); /* * Update the access, modified, and inode change times as specified @@ -172,10 +172,10 @@ ffs_truncate(v) } */ *ap = v; struct vnode *ovp = ap->a_vp; struct genfs_node *gp = VTOG(ovp); - ufs_daddr_t lastblock; + daddr_t lastblock; struct inode *oip; - ufs_daddr_t bn, lastiblock[NIADDR], indir_lbn[NIADDR]; - ufs_daddr_t oldblks[NDADDR + NIADDR], newblks[NDADDR + NIADDR]; + daddr_t bn, lastiblock[NIADDR], indir_lbn[NIADDR]; + daddr_t oldblks[NDADDR + NIADDR], newblks[NDADDR + NIADDR]; off_t length = ap->a_length; struct fs *fs; int offset, size, level; @@ -467,17 +467,18 @@ done: static int ffs_indirtrunc(ip, lbn, dbn, lastbn, level, countp) struct inode *ip; - ufs_daddr_t lbn, lastbn; - ufs_daddr_t dbn; + daddr_t lbn, lastbn; + daddr_t dbn; int level; long *countp; { int i; struct buf *bp; struct fs *fs = ip->i_fs; - ufs_daddr_t *bap; + int32_t *bap; /* XXX ondisk32 */ struct vnode *vp; - ufs_daddr_t *copy = NULL, nb, nlbn, last; + daddr_t nb, nlbn, last; + int32_t *copy = NULL; /* XXX ondisk32 */ long blkcount, factor; int nblocks, blocksreleased = 0; int error = 0, allerror = 0; @@ -523,12 +524,13 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, level, countp) return (error); } - bap = (ufs_daddr_t *)bp->b_data; + bap = (int32_t *)bp->b_data; /* XXX ondisk32 */ if (lastbn >= 0) { - copy = (ufs_daddr_t *) malloc(fs->fs_bsize, M_TEMP, M_WAITOK); + copy = (int32_t *) malloc(fs->fs_bsize, M_TEMP, M_WAITOK); memcpy((caddr_t)copy, (caddr_t)bap, (u_int)fs->fs_bsize); + /* XXX ondisk32 */ memset((caddr_t)&bap[last + 1], 0, - (u_int)(NINDIR(fs) - (last + 1)) * sizeof (ufs_daddr_t)); + (u_int)(NINDIR(fs) - (last + 1)) * sizeof (int32_t)); error = bwrite(bp); if (error) allerror = error; @@ -545,7 +547,7 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, level, countp) continue; if (level > SINGLE) { error = ffs_indirtrunc(ip, nlbn, fsbtodb(fs, nb), - (ufs_daddr_t)-1, level - 1, + (daddr_t)-1, level - 1, &blkcount); if (error) allerror = error; diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index e566d0e55e6b..035ab82b4d38 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_softdep.c,v 1.38 2003/01/01 23:08:56 chs Exp $ */ +/* $NetBSD: ffs_softdep.c,v 1.39 2003/01/24 21:55:22 fvdl Exp $ */ /* * Copyright 1998 Marshall Kirk McKusick. All Rights Reserved. @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ffs_softdep.c,v 1.38 2003/01/01 23:08:56 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ffs_softdep.c,v 1.39 2003/01/24 21:55:22 fvdl Exp $"); #include #include @@ -145,7 +145,7 @@ static struct dirrem *newdirrem __P((struct buf *, struct inode *, static void free_diradd __P((struct diradd *)); static void free_allocindir __P((struct allocindir *, struct inodedep *)); static void free_newdirblk __P((struct newdirblk *)); -static int indir_trunc __P((struct inode *, ufs_daddr_t, int, ufs_lbn_t, +static int indir_trunc __P((struct inode *, daddr_t, int, daddr_t, long *)); static void deallocate_dependencies __P((struct buf *, struct inodedep *)); static void free_allocdirect __P((struct allocdirectlst *, @@ -156,32 +156,32 @@ static void handle_workitem_freeblocks __P((struct freeblks *)); static void merge_inode_lists __P((struct inodedep *)); static void setup_allocindir_phase2 __P((struct buf *, struct inode *, struct allocindir *)); -static struct allocindir *newallocindir __P((struct inode *, int, ufs_daddr_t, - ufs_daddr_t)); +static struct allocindir *newallocindir __P((struct inode *, int, daddr_t, + daddr_t)); static void handle_workitem_freefrag __P((struct freefrag *)); -static struct freefrag *newfreefrag __P((struct inode *, ufs_daddr_t, long)); +static struct freefrag *newfreefrag __P((struct inode *, daddr_t, long)); static void allocdirect_merge __P((struct allocdirectlst *, struct allocdirect *, struct allocdirect *)); static struct bmsafemap *bmsafemap_lookup __P((struct buf *)); -static int newblk_lookup __P((struct fs *, ufs_daddr_t, int, +static int newblk_lookup __P((struct fs *, daddr_t, int, struct newblk **)); static int inodedep_lookup __P((struct fs *, ino_t, int, struct inodedep **)); -static int pagedep_lookup __P((struct inode *, ufs_lbn_t, int, +static int pagedep_lookup __P((struct inode *, daddr_t, int, struct pagedep **)); static void pause_timer __P((void *)); static int request_cleanup __P((int, int)); static void add_to_worklist __P((struct worklist *)); -static struct buf *softdep_setup_pagecache __P((struct inode *, ufs_lbn_t, +static struct buf *softdep_setup_pagecache __P((struct inode *, daddr_t, long)); static void softdep_collect_pagecache __P((struct inode *)); static void softdep_free_pagecache __P((struct inode *)); static struct vnode *softdep_lookupvp(struct fs *, ino_t); -static struct buf *softdep_lookup_pcbp __P((struct vnode *, ufs_lbn_t)); +static struct buf *softdep_lookup_pcbp __P((struct vnode *, daddr_t)); #ifdef UVMHIST void softdep_pageiodone1 __P((struct buf *)); #endif void softdep_pageiodone __P((struct buf *)); -void softdep_flush_vnode __P((struct vnode *, ufs_lbn_t)); +void softdep_flush_vnode __P((struct vnode *, daddr_t)); static void softdep_trackbufs(int, boolean_t); /* @@ -855,7 +855,7 @@ static struct sema pagedep_in_progress; static int pagedep_lookup(ip, lbn, flags, pagedeppp) struct inode *ip; - ufs_lbn_t lbn; + daddr_t lbn; int flags; struct pagedep **pagedeppp; { @@ -1007,7 +1007,7 @@ static struct sema newblk_in_progress; static int newblk_lookup(fs, newblkno, flags, newblkpp) struct fs *fs; - ufs_daddr_t newblkno; + daddr_t newblkno; int flags; struct newblk **newblkpp; { @@ -1270,7 +1270,7 @@ void softdep_setup_blkmapdep(bp, fs, newblkno) struct buf *bp; /* buffer for cylgroup block with block map */ struct fs *fs; /* filesystem doing allocation */ - ufs_daddr_t newblkno; /* number of newly allocated block */ + daddr_t newblkno; /* number of newly allocated block */ { struct newblk *newblk; struct bmsafemap *bmsafemap; @@ -1354,9 +1354,9 @@ bmsafemap_lookup(bp) void softdep_setup_allocdirect(ip, lbn, newblkno, oldblkno, newsize, oldsize, bp) struct inode *ip; /* inode to which block is being added */ - ufs_lbn_t lbn; /* block pointer within inode */ - ufs_daddr_t newblkno; /* disk block number being added */ - ufs_daddr_t oldblkno; /* previous block number, 0 unless frag */ + daddr_t lbn; /* block pointer within inode */ + daddr_t newblkno; /* disk block number being added */ + daddr_t oldblkno; /* previous block number, 0 unless frag */ long newsize; /* size of new block */ long oldsize; /* size of new block */ struct buf *bp; /* bp for allocated block */ @@ -1489,9 +1489,10 @@ allocdirect_merge(adphead, newadp, oldadp) if (newadp->ad_oldblkno != oldadp->ad_newblkno || newadp->ad_oldsize != oldadp->ad_newsize || newadp->ad_lbn >= NDADDR) - panic("allocdirect_merge: ob %d != nb %d || lbn %d >= %d ||\n" - "osize %lu != nsize %lu", - newadp->ad_oldblkno, oldadp->ad_newblkno, + panic("allocdirect_merge: ob %lld != nb %lld || " + "lbn %d >= %d ||\nosize %lu != nsize %lu", + (long long)newadp->ad_oldblkno, + (long long)oldadp->ad_newblkno, (int)newadp->ad_lbn, NDADDR, (unsigned long)newadp->ad_oldsize, (unsigned long)oldadp->ad_newsize); @@ -1538,7 +1539,7 @@ allocdirect_merge(adphead, newadp, oldadp) static struct freefrag * newfreefrag(ip, blkno, size) struct inode *ip; - ufs_daddr_t blkno; + daddr_t blkno; long size; { struct freefrag *freefrag; @@ -1618,8 +1619,8 @@ static struct allocindir * newallocindir(ip, ptrno, newblkno, oldblkno) struct inode *ip; /* inode for file being extended */ int ptrno; /* offset of pointer in indirect block */ - ufs_daddr_t newblkno; /* disk block number being added */ - ufs_daddr_t oldblkno; /* previous block number, 0 if none */ + daddr_t newblkno; /* disk block number being added */ + daddr_t oldblkno; /* previous block number, 0 if none */ { struct allocindir *aip; @@ -1641,11 +1642,11 @@ newallocindir(ip, ptrno, newblkno, oldblkno) void softdep_setup_allocindir_page(ip, lbn, bp, ptrno, newblkno, oldblkno, nbp) struct inode *ip; /* inode for file being extended */ - ufs_lbn_t lbn; /* allocated block number within file */ + daddr_t lbn; /* allocated block number within file */ struct buf *bp; /* buffer with indirect blk referencing page */ int ptrno; /* offset of pointer in indirect block */ - ufs_daddr_t newblkno; /* disk block number being added */ - ufs_daddr_t oldblkno; /* previous block number, 0 if none */ + daddr_t newblkno; /* disk block number being added */ + daddr_t oldblkno; /* previous block number, 0 if none */ struct buf *nbp; /* buffer holding allocated page */ { struct allocindir *aip; @@ -1680,7 +1681,7 @@ softdep_setup_allocindir_meta(nbp, ip, bp, ptrno, newblkno) struct inode *ip; /* inode for file being extended */ struct buf *bp; /* indirect block referencing allocated block */ int ptrno; /* offset of pointer in indirect block */ - ufs_daddr_t newblkno; /* disk block number being added */ + daddr_t newblkno; /* disk block number being added */ { struct allocindir *aip; @@ -1766,7 +1767,8 @@ setup_allocindir_phase2(bp, ip, aip) free_allocindir(oldaip, NULL); } LIST_INSERT_HEAD(&indirdep->ir_deplisthd, aip, ai_next); - ((ufs_daddr_t *)indirdep->ir_savebp->b_data) + /* XXX ondisk32 */ + ((int32_t *)indirdep->ir_savebp->b_data) [aip->ai_offset] = aip->ai_oldblkno; FREE_LOCK(&lk); if (freefrag != NULL) @@ -2290,12 +2292,12 @@ handle_workitem_freeblocks(freeblks) { struct inode tip; struct vnode vp; - ufs_daddr_t bn; + daddr_t bn; struct fs *fs; int i, level, bsize; long nblocks, blocksreleased = 0; int error, allerror = 0; - ufs_lbn_t baselbns[NIADDR], tmpval; + daddr_t baselbns[NIADDR], tmpval; tip.i_number = freeblks->fb_previousinum; tip.i_devvp = freeblks->fb_devvp; @@ -2363,14 +2365,14 @@ handle_workitem_freeblocks(freeblks) static int indir_trunc(ip, dbn, level, lbn, countp) struct inode *ip; - ufs_daddr_t dbn; + daddr_t dbn; int level; - ufs_lbn_t lbn; + daddr_t lbn; long *countp; { struct buf *bp; - ufs_daddr_t *bap; - ufs_daddr_t nb; + int32_t *bap; /* XXX ondisk32 */ + daddr_t nb; struct fs *fs = ip->i_fs; struct worklist *wk; struct indirdep *indirdep; @@ -2418,7 +2420,7 @@ indir_trunc(ip, dbn, level, lbn, countp) /* * Recursively free indirect blocks. */ - bap = (ufs_daddr_t *)bp->b_data; + bap = (int32_t *)bp->b_data; /* XXX ondisk32 */ nblocks = btodb(fs->fs_bsize); for (i = NINDIR(fs) - 1; i >= 0; i--) { if ((nb = ufs_rw32(bap[i], needswap)) == 0) @@ -2501,7 +2503,7 @@ softdep_setup_directory_add(bp, dp, diroffset, newinum, newdirbp, isnewblk) int isnewblk; /* entry is in a newly allocated block */ { int offset; /* offset of new entry within directory block */ - ufs_lbn_t lbn; /* block in directory containing new entry */ + daddr_t lbn; /* block in directory containing new entry */ struct fs *fs; struct diradd *dap; struct allocdirect *adp; @@ -2656,7 +2658,7 @@ softdep_change_directoryentry_offset(dp, base, oldloc, newloc, entrysize) int offset, oldoffset, newoffset; struct pagedep *pagedep; struct diradd *dap; - ufs_lbn_t lbn; + daddr_t lbn; ACQUIRE_LOCK(&lk); lbn = lblkno(dp->i_fs, dp->i_offset); @@ -2815,7 +2817,7 @@ newdirrem(bp, dp, ip, isrmdir, prevdirremp) struct dirrem **prevdirremp; /* previously referenced inode, if any */ { int offset; - ufs_lbn_t lbn; + daddr_t lbn; struct diradd *dap; struct dirrem *dirrem; struct pagedep *pagedep; @@ -3372,7 +3374,7 @@ initiate_write_inodeblock(inodedep, bp) struct dinode *dp; struct fs *fs = inodedep->id_fs; #ifdef DIAGNOSTIC - ufs_lbn_t prevlbn = -1; + daddr_t prevlbn = -1; #endif int i, deplist; #ifdef FFS_EI @@ -3448,7 +3450,9 @@ initiate_write_inodeblock(inodedep, bp) lastadp = adp, adp = TAILQ_NEXT(adp, ad_next)) { if (adp->ad_lbn >= NDADDR) break; - dp->di_db[adp->ad_lbn] = ufs_rw32(adp->ad_oldblkno, needswap); + /* XXX ondisk32 */ + dp->di_db[adp->ad_lbn] = ufs_rw32((int32_t)adp->ad_oldblkno, + needswap); /* keep going until hitting a rollback to a frag */ if (adp->ad_oldsize == 0 || adp->ad_oldsize == fs->fs_bsize) continue; @@ -3725,7 +3729,8 @@ handle_allocindir_partdone(aip) LIST_INSERT_HEAD(&indirdep->ir_donehd, aip, ai_next); return; } - ((ufs_daddr_t *)indirdep->ir_savebp->b_data)[aip->ai_offset] = + /* XXX ondisk32 */ + ((int32_t *)indirdep->ir_savebp->b_data)[aip->ai_offset] = aip->ai_newblkno; LIST_REMOVE(aip, ai_next); if (aip->ai_freefrag != NULL) @@ -3786,13 +3791,14 @@ handle_written_inodeblock(inodedep, bp) if (adp->ad_lbn < NDADDR) { if (ufs_rw32(dp->di_db[adp->ad_lbn], needswap) != adp->ad_oldblkno) - panic("%s: %s #%d mismatch %d != %d", + panic("%s: %s #%d mismatch %d != %lld", "handle_written_inodeblock", "direct pointer", (int)adp->ad_lbn, ufs_rw32(dp->di_db[adp->ad_lbn], needswap), - adp->ad_oldblkno); + (long long)adp->ad_oldblkno); + /* XXX ondisk32 */ dp->di_db[adp->ad_lbn] = - ufs_rw32(adp->ad_newblkno, needswap); + ufs_rw32((int32_t)adp->ad_newblkno, needswap); } else { if (dp->di_ib[adp->ad_lbn - NDADDR] != 0) panic("%s: %s #%d allocated as %d", @@ -3801,8 +3807,9 @@ handle_written_inodeblock(inodedep, bp) (int)(adp->ad_lbn - NDADDR), ufs_rw32(dp->di_ib[adp->ad_lbn - NDADDR], needswap)); + /* XXX ondisk32 */ dp->di_ib[adp->ad_lbn - NDADDR] = - ufs_rw32(adp->ad_newblkno, needswap); + ufs_rw32((int32_t)adp->ad_newblkno, needswap); } adp->ad_state &= ~UNDONE; adp->ad_state |= ATTACHED; @@ -4212,7 +4219,7 @@ softdep_fsync(vp) struct proc *p = CURPROC; /* XXX */ int error, flushparent; ino_t parentino; - ufs_lbn_t lbn; + daddr_t lbn; ip = VTOI(vp); fs = ip->i_fs; @@ -5261,7 +5268,7 @@ softdep_error(func, error) static struct buf * softdep_setup_pagecache(ip, lbn, size) struct inode *ip; - ufs_lbn_t lbn; + daddr_t lbn; long size; { struct vnode *vp = ITOV(ip); @@ -5361,7 +5368,7 @@ softdep_trackbufs(int delta, boolean_t throttle) static struct buf * softdep_lookup_pcbp(vp, lbn) struct vnode *vp; - ufs_lbn_t lbn; + daddr_t lbn; { struct buf *bp; @@ -5400,7 +5407,7 @@ softdep_pageiodone1(bp) struct allocdirect *adp; struct allocindir *aip; struct worklist *wk; - ufs_lbn_t lbn; + daddr_t lbn; voff_t off; long iosize = bp->b_bcount; int size, asize, bshift, bsize; @@ -5440,9 +5447,10 @@ softdep_pageiodone1(bp) pcbp->b_resid -= size; if (pcbp->b_resid < 0) { panic("softdep_pageiodone: " - "resid < 0, vp %p lbn 0x%lx pcbp %p" + "resid < 0, vp %p lbn 0x%llx pcbp %p" " iosize %ld, size %d, asize %d, bsize %d", - vp, lbn, pcbp, iosize, size, asize, bsize); + vp, (long long)lbn, pcbp, iosize, size, + asize, bsize); } if (pcbp->b_resid > 0) { continue; diff --git a/sys/ufs/ffs/ffs_softdep.stub.c b/sys/ufs/ffs/ffs_softdep.stub.c index 06be000eaacc..1c3f17145222 100644 --- a/sys/ufs/ffs/ffs_softdep.stub.c +++ b/sys/ufs/ffs/ffs_softdep.stub.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_softdep.stub.c,v 1.8 2001/12/18 10:57:22 fvdl Exp $ */ +/* $NetBSD: ffs_softdep.stub.c,v 1.9 2003/01/24 21:55:23 fvdl Exp $ */ /* * Copyright 1997 Marshall Kirk McKusick. All Rights Reserved. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ffs_softdep.stub.c,v 1.8 2001/12/18 10:57:22 fvdl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ffs_softdep.stub.c,v 1.9 2003/01/24 21:55:23 fvdl Exp $"); #include #include @@ -93,7 +93,7 @@ void softdep_setup_blkmapdep(bp, fs, newblkno) struct buf *bp; struct fs *fs; - ufs_daddr_t newblkno; + daddr_t newblkno; { panic("softdep_setup_blkmapdep called"); @@ -102,9 +102,9 @@ softdep_setup_blkmapdep(bp, fs, newblkno) void softdep_setup_allocdirect(ip, lbn, newblkno, oldblkno, newsize, oldsize, bp) struct inode *ip; - ufs_lbn_t lbn; - ufs_daddr_t newblkno; - ufs_daddr_t oldblkno; + daddr_t lbn; + daddr_t newblkno; + daddr_t oldblkno; long newsize; long oldsize; struct buf *bp; @@ -116,11 +116,11 @@ softdep_setup_allocdirect(ip, lbn, newblkno, oldblkno, newsize, oldsize, bp) void softdep_setup_allocindir_page(ip, lbn, bp, ptrno, newblkno, oldblkno, nbp) struct inode *ip; - ufs_lbn_t lbn; + daddr_t lbn; struct buf *bp; int ptrno; - ufs_daddr_t newblkno; - ufs_daddr_t oldblkno; + daddr_t newblkno; + daddr_t oldblkno; struct buf *nbp; { @@ -133,7 +133,7 @@ softdep_setup_allocindir_meta(nbp, ip, bp, ptrno, newblkno) struct inode *ip; struct buf *bp; int ptrno; - ufs_daddr_t newblkno; + daddr_t newblkno; { panic("softdep_setup_allocindir_meta called"); diff --git a/sys/ufs/ffs/ffs_subr.c b/sys/ufs/ffs/ffs_subr.c index 7f9ab61e0453..709dfb9ffaaa 100644 --- a/sys/ufs/ffs/ffs_subr.c +++ b/sys/ufs/ffs/ffs_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_subr.c,v 1.24 2002/12/01 00:12:09 matt Exp $ */ +/* $NetBSD: ffs_subr.c,v 1.25 2003/01/24 21:55:23 fvdl Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ #include #if defined(__KERNEL_RCSID) -__KERNEL_RCSID(0, "$NetBSD: ffs_subr.c,v 1.24 2002/12/01 00:12:09 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ffs_subr.c,v 1.25 2003/01/24 21:55:23 fvdl Exp $"); #endif #if HAVE_CONFIG_H @@ -88,7 +88,7 @@ ffs_blkatoff(v) struct inode *ip; struct fs *fs; struct buf *bp; - ufs_daddr_t lbn; + daddr_t lbn; int bsize, error; ip = VTOI(ap->a_vp); @@ -153,7 +153,7 @@ ffs_checkoverlap(bp, ip) struct inode *ip; { struct buf *ebp, *ep; - ufs_daddr_t start, last; + daddr_t start, last; struct vnode *vp; ebp = &buf[nbuf]; @@ -189,7 +189,7 @@ int ffs_isblock(fs, cp, h) struct fs *fs; u_char *cp; - ufs_daddr_t h; + daddr_t h; { u_char mask; @@ -218,7 +218,7 @@ int ffs_isfreeblock(fs, cp, h) struct fs *fs; u_char *cp; - ufs_daddr_t h; + daddr_t h; { switch ((int)fs->fs_fragshift) { @@ -243,7 +243,7 @@ void ffs_clrblock(fs, cp, h) struct fs *fs; u_char *cp; - ufs_daddr_t h; + daddr_t h; { switch ((int)fs->fs_fragshift) { @@ -272,7 +272,7 @@ void ffs_setblock(fs, cp, h) struct fs *fs; u_char *cp; - ufs_daddr_t h; + daddr_t h; { switch ((int)fs->fs_fragshift) { diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 4f5bd9462bb0..c29089ef5428 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_vfsops.c,v 1.105 2002/12/01 00:12:09 matt Exp $ */ +/* $NetBSD: ffs_vfsops.c,v 1.106 2003/01/24 21:55:23 fvdl Exp $ */ /* * Copyright (c) 1989, 1991, 1993, 1994 @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.105 2002/12/01 00:12:09 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.106 2003/01/24 21:55:23 fvdl Exp $"); #if defined(_KERNEL_OPT) #include "opt_ffs.h" @@ -473,7 +473,7 @@ ffs_reload(mountp, cred, p) size = DEV_BSIZE; else size = dpart.disklab->d_secsize; - error = bread(devvp, (ufs_daddr_t)(SBOFF / size), SBSIZE, NOCRED, &bp); + error = bread(devvp, (daddr_t)(SBOFF / size), SBSIZE, NOCRED, &bp); if (error) { brelse(bp); return (error); @@ -522,7 +522,7 @@ ffs_reload(mountp, cred, p) /* Manually look for an apple ufs label, and if a valid one * is found, then treat it like an Apple UFS filesystem anyway */ - error = bread(devvp, (ufs_daddr_t)(APPLEUFS_LABEL_OFFSET / size), + error = bread(devvp, (daddr_t)(APPLEUFS_LABEL_OFFSET / size), APPLEUFS_LABEL_SIZE, cred, &bp); if (error) { brelse(bp); @@ -699,7 +699,7 @@ ffs_mountfs(devvp, mp, p) bp = NULL; ump = NULL; - error = bread(devvp, (ufs_daddr_t)(SBOFF / size), SBSIZE, cred, &bp); + error = bread(devvp, (daddr_t)(SBOFF / size), SBSIZE, cred, &bp); if (error) goto out; @@ -773,7 +773,7 @@ ffs_mountfs(devvp, mp, p) /* Manually look for an apple ufs label, and if a valid one * is found, then treat it like an Apple UFS filesystem anyway */ - error = bread(devvp, (ufs_daddr_t)(APPLEUFS_LABEL_OFFSET / size), + error = bread(devvp, (daddr_t)(APPLEUFS_LABEL_OFFSET / size), APPLEUFS_LABEL_SIZE, cred, &bp); if (error) goto out; diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index bbce44d0cf91..e15cca265731 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_vnops.c,v 1.51 2002/11/01 21:11:43 kristerw Exp $ */ +/* $NetBSD: ffs_vnops.c,v 1.52 2003/01/24 21:55:24 fvdl Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ffs_vnops.c,v 1.51 2002/11/01 21:11:43 kristerw Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ffs_vnops.c,v 1.52 2003/01/24 21:55:24 fvdl Exp $"); #include #include @@ -519,7 +519,7 @@ ffs_putpages(void *v) struct fs *fs = ip->i_fs; struct vm_page *pg; off_t off; - ufs_lbn_t lbn; + daddr_t lbn; if (!DOINGSOFTDEP(vp) || (ap->a_flags & PGO_CLEANIT) == 0) { return genfs_putpages(v); @@ -568,7 +568,7 @@ ffs_gop_size(struct vnode *vp, off_t size, off_t *eobp) { struct inode *ip = VTOI(vp); struct fs *fs = ip->i_fs; - ufs_lbn_t olbn, nlbn; + daddr_t olbn, nlbn; olbn = lblkno(fs, ip->i_ffs_size); nlbn = lblkno(fs, size); diff --git a/sys/ufs/ffs/fs.h b/sys/ufs/ffs/fs.h index 6a594e82239e..1b001e548b2d 100644 --- a/sys/ufs/ffs/fs.h +++ b/sys/ufs/ffs/fs.h @@ -1,4 +1,4 @@ -/* $NetBSD: fs.h,v 1.27 2002/11/04 16:59:37 wiz Exp $ */ +/* $NetBSD: fs.h,v 1.28 2003/01/24 21:55:24 fvdl Exp $ */ /* * Copyright (c) 1982, 1986, 1993 @@ -66,8 +66,8 @@ #define SBSIZE 8192 #define BBOFF ((off_t)(0)) #define SBOFF ((off_t)(BBOFF + BBSIZE)) -#define BBLOCK ((ufs_daddr_t)(0)) -#define SBLOCK ((ufs_daddr_t)(BBLOCK + BBSIZE / DEV_BSIZE)) +#define BBLOCK ((daddr_t)(0)) +#define SBLOCK ((daddr_t)(BBLOCK + BBSIZE / DEV_BSIZE)) /* * Addresses stored in inodes are capable of addressing fragments @@ -174,10 +174,10 @@ struct csum { struct fs { int32_t fs_firstfield; /* historic file system linked list, */ int32_t fs_unused_1; /* used for incore super blocks */ - ufs_daddr_t fs_sblkno; /* addr of super-block in filesys */ - ufs_daddr_t fs_cblkno; /* offset of cyl-block in filesys */ - ufs_daddr_t fs_iblkno; /* offset of inode-blocks in filesys */ - ufs_daddr_t fs_dblkno; /* offset of first data after cg */ + int32_t fs_sblkno; /* addr of super-block in filesys */ + int32_t fs_cblkno; /* offset of cyl-block in filesys */ + int32_t fs_iblkno; /* offset of inode-blocks in filesys */ + int32_t fs_dblkno; /* offset of first data after cg */ int32_t fs_cgoffset; /* cylinder group offset in cylinder */ int32_t fs_cgmask; /* used to calc mod fs_ntrak */ int32_t fs_time; /* last time written */ @@ -217,7 +217,7 @@ struct fs { /* fs_id takes the space of the unused fs_headswitch and fs_trkseek fields */ int32_t fs_id[2]; /* unique file system id */ /* sizes determined by number of cylinder groups and their sizes */ - ufs_daddr_t fs_csaddr; /* blk addr of cyl grp summary area */ + int32_t fs_csaddr; /* blk addr of cyl grp summary area */ int32_t fs_cssize; /* size of cyl grp summary area */ int32_t fs_cgsize; /* cylinder group size */ /* these fields are derived from the hardware */ @@ -441,7 +441,7 @@ struct ocg { * Cylinder group macros to locate things in cylinder groups. * They calc file system addresses of cylinder group data structures. */ -#define cgbase(fs, c) ((ufs_daddr_t)((fs)->fs_fpg * (c))) +#define cgbase(fs, c) ((daddr_t)((fs)->fs_fpg * (c))) #define cgdmin(fs, c) (cgstart(fs, c) + (fs)->fs_dblkno) /* 1st data */ #define cgimin(fs, c) (cgstart(fs, c) + (fs)->fs_iblkno) /* inode blk */ #define cgsblock(fs, c) (cgstart(fs, c) + (fs)->fs_sblkno) /* super blk */ @@ -457,7 +457,7 @@ struct ocg { */ #define ino_to_cg(fs, x) ((x) / (fs)->fs_ipg) #define ino_to_fsba(fs, x) \ - ((ufs_daddr_t)(cgimin(fs, ino_to_cg(fs, x)) + \ + ((daddr_t)(cgimin(fs, ino_to_cg(fs, x)) + \ (blkstofrags((fs), (((x) % (fs)->fs_ipg) / INOPB(fs)))))) #define ino_to_fsbo(fs, x) ((x) % INOPB(fs)) diff --git a/sys/ufs/ffs/softdep.h b/sys/ufs/ffs/softdep.h index f59d7069b9bd..0dff72d77022 100644 --- a/sys/ufs/ffs/softdep.h +++ b/sys/ufs/ffs/softdep.h @@ -1,4 +1,4 @@ -/* $NetBSD: softdep.h,v 1.5 2002/12/01 00:12:10 matt Exp $ */ +/* $NetBSD: softdep.h,v 1.6 2003/01/24 21:55:24 fvdl Exp $ */ /* * Copyright 1998 Marshall Kirk McKusick. All Rights Reserved. @@ -176,7 +176,7 @@ struct pagedep { LIST_ENTRY(pagedep) pd_hash; /* hashed lookup */ struct mount *pd_mnt; /* associated mount point */ ino_t pd_ino; /* associated file */ - ufs_lbn_t pd_lbn; /* block within file */ + daddr_t pd_lbn; /* block within file */ struct dirremhd pd_dirremhd; /* dirrem's waiting for page */ struct diraddhd pd_diraddhd[DAHASHSZ]; /* diradd dir entry updates */ struct diraddhd pd_pendinghd; /* directory entries awaiting write */ @@ -258,7 +258,7 @@ struct inodedep { struct newblk { LIST_ENTRY(newblk) nb_hash; /* hashed lookup */ struct fs *nb_fs; /* associated filesystem */ - ufs_daddr_t nb_newblkno; /* allocated block number */ + daddr_t nb_newblkno; /* allocated block number */ int nb_state; /* state of bitmap dependency */ LIST_ENTRY(newblk) nb_deps; /* bmsafemap's list of newblk's */ struct bmsafemap *nb_bmsafemap; /* associated bmsafemap */ @@ -314,9 +314,9 @@ struct allocdirect { struct worklist ad_list; /* buffer holding block */ # define ad_state ad_list.wk_state /* block pointer state */ TAILQ_ENTRY(allocdirect) ad_next; /* inodedep's list of allocdirect's */ - ufs_lbn_t ad_lbn; /* block within file */ - ufs_daddr_t ad_newblkno; /* new value of block pointer */ - ufs_daddr_t ad_oldblkno; /* old value of block pointer */ + daddr_t ad_lbn; /* block within file */ + daddr_t ad_newblkno; /* new value of block pointer */ + daddr_t ad_oldblkno; /* old value of block pointer */ long ad_newsize; /* size of new block */ long ad_oldsize; /* size of old block */ LIST_ENTRY(allocdirect) ad_deps; /* bmsafemap's list of allocdirect's */ @@ -370,8 +370,8 @@ struct allocindir { # define ai_state ai_list.wk_state /* indirect block pointer state */ LIST_ENTRY(allocindir) ai_next; /* indirdep's list of allocindir's */ int ai_offset; /* pointer offset in indirect block */ - ufs_daddr_t ai_newblkno; /* new block pointer value */ - ufs_daddr_t ai_oldblkno; /* old block pointer value */ + daddr_t ai_newblkno; /* new block pointer value */ + daddr_t ai_oldblkno; /* old block pointer value */ struct freefrag *ai_freefrag; /* block to be freed when complete */ struct indirdep *ai_indirdep; /* address of associated indirdep */ LIST_ENTRY(allocindir) ai_deps; /* bmsafemap's list of allocindir's */ @@ -393,7 +393,7 @@ struct freefrag { # define ff_state ff_list.wk_state /* owning user; should be uid_t */ struct vnode *ff_devvp; /* filesystem device vnode */ struct fs *ff_fs; /* addr of superblock */ - ufs_daddr_t ff_blkno; /* fragment physical block number */ + daddr_t ff_blkno; /* fragment physical block number */ long ff_fragsize; /* size of fragment being deleted */ ino_t ff_inum; /* owning inode number */ }; @@ -413,8 +413,8 @@ struct freeblks { off_t fb_newsize; /* new file size */ int fb_chkcnt; /* used to check cnt of blks released */ uid_t fb_uid; /* uid of previous owner of blocks */ - ufs_daddr_t fb_dblks[NDADDR]; /* direct blk ptrs to deallocate */ - ufs_daddr_t fb_iblks[NIADDR]; /* indirect blk ptrs to deallocate */ + daddr_t fb_dblks[NDADDR]; /* direct blk ptrs to deallocate */ + daddr_t fb_iblks[NIADDR]; /* indirect blk ptrs to deallocate */ }; /* diff --git a/sys/ufs/lfs/lfs.h b/sys/ufs/lfs/lfs.h index c0bafcc23f2c..3fbfc961e202 100644 --- a/sys/ufs/lfs/lfs.h +++ b/sys/ufs/lfs/lfs.h @@ -1,4 +1,4 @@ -/* $NetBSD: lfs.h,v 1.42 2002/12/01 00:12:10 matt Exp $ */ +/* $NetBSD: lfs.h,v 1.43 2003/01/24 21:55:25 fvdl Exp $ */ /*- * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. @@ -175,7 +175,7 @@ struct lfs_log_entry { char *op; char *file; int line; - ufs_daddr_t block; + daddr_t block; unsigned long flags; }; extern int lfs_lognum; @@ -281,7 +281,7 @@ struct finfo { u_int32_t fi_version; /* version number */ u_int32_t fi_ino; /* inode number */ u_int32_t fi_lastlength; /* length of last block in array */ - ufs_daddr_t fi_blocks[1]; /* array of logical block numbers */ + int32_t fi_blocks[1]; /* array of logical block numbers */ }; @@ -307,13 +307,13 @@ struct dlfs { u_int32_t dlfs_nfiles; /* 40: number of allocated inodes */ int32_t dlfs_avail; /* 44: blocks available for writing */ int32_t dlfs_uinodes; /* 48: inodes in cache not yet on disk */ - ufs_daddr_t dlfs_idaddr; /* 52: inode file disk address */ + int32_t dlfs_idaddr; /* 52: inode file disk address */ u_int32_t dlfs_ifile; /* 56: inode file inode number */ - ufs_daddr_t dlfs_lastseg; /* 60: address of last segment written */ - ufs_daddr_t dlfs_nextseg; /* 64: address of next segment to write */ - ufs_daddr_t dlfs_curseg; /* 68: current segment being written */ - ufs_daddr_t dlfs_offset; /* 72: offset in curseg for next partial */ - ufs_daddr_t dlfs_lastpseg; /* 76: address of last partial written */ + int32_t dlfs_lastseg; /* 60: address of last segment written */ + int32_t dlfs_nextseg; /* 64: address of next segment to write */ + int32_t dlfs_curseg; /* 68: current segment being written */ + int32_t dlfs_offset; /* 72: offset in curseg for next partial */ + int32_t dlfs_lastpseg; /* 76: address of last partial written */ u_int32_t dlfs_inopf; /* 80: v1: time stamp; v2: inodes per frag */ #define dlfs_otstamp dlfs_inopf @@ -345,7 +345,7 @@ struct dlfs { int32_t dlfs_maxsymlinklen; /* 184: max length of an internal symlink */ #define LFS_MIN_SBINTERVAL 5 /* minimum superblock segment spacing */ #define LFS_MAXNUMSB 10 /* 188: superblock disk offsets */ - ufs_daddr_t dlfs_sboffs[LFS_MAXNUMSB]; + int32_t dlfs_sboffs[LFS_MAXNUMSB]; u_int32_t dlfs_nclean; /* 228: Number of clean segments */ u_char dlfs_fsmnt[MNAMELEN]; /* 232: name mounted on */ @@ -356,7 +356,7 @@ struct dlfs { u_int32_t dlfs_sumsize; /* 332: size of summary blocks */ u_int64_t dlfs_serial; /* 336: serial number */ u_int32_t dlfs_ibsize; /* 344: size of inode blocks */ - ufs_daddr_t dlfs_start; /* 348: start of segment 0 */ + int32_t dlfs_start; /* 348: start of segment 0 */ u_int64_t dlfs_tstamp; /* 352: time stamp */ #define LFS_44INODEFMT 0 #define LFS_MAXINODEFMT 0 @@ -496,7 +496,7 @@ typedef struct ifile IFILE; struct ifile { u_int32_t if_version; /* inode version number */ #define LFS_UNUSED_DADDR 0 /* out-of-band daddr */ - ufs_daddr_t if_daddr; /* inode disk address */ + int32_t if_daddr; /* inode disk address */ ino_t if_nextfree; /* next-unallocated inode */ /* XXX - when inode format changes, this changes too */ u_int32_t if_atime_sec; /* Last access time, seconds */ @@ -506,7 +506,7 @@ struct ifile { typedef struct ifile_v1 IFILE_V1; struct ifile_v1 { u_int32_t if_version; /* inode version number */ - ufs_daddr_t if_daddr; /* inode disk address */ + int32_t if_daddr; /* inode disk address */ ino_t if_nextfree; /* next-unallocated inode */ #if LFS_ATIME_IFILE struct timespec if_atime; /* Last access time */ @@ -543,7 +543,7 @@ struct segsum_v1 { u_int32_t ss_datasum; /* 4: check sum of data */ u_int32_t ss_magic; /* 8: segment summary magic number */ #define SS_MAGIC 0x061561 - ufs_daddr_t ss_next; /* 12: next segment */ + int32_t ss_next; /* 12: next segment */ u_int32_t ss_create; /* 16: creation time stamp */ u_int16_t ss_nfinfo; /* 20: number of file info structures */ u_int16_t ss_ninos; /* 22: number of inodes in summary */ @@ -560,7 +560,7 @@ struct segsum { u_int32_t ss_sumsum; /* 0: check sum of summary block */ u_int32_t ss_datasum; /* 4: check sum of data */ u_int32_t ss_magic; /* 8: segment summary magic number */ - ufs_daddr_t ss_next; /* 12: next segment */ + int32_t ss_next; /* 12: next segment */ u_int32_t ss_ident; /* 16: roll-forward fsid */ #define ss_ocreate ss_ident /* ident is where create was in v1 */ u_int16_t ss_nfinfo; /* 20: number of file info structures */ @@ -630,13 +630,13 @@ struct segsum { #define dtosn(fs, daddr) /* block address to segment number */ \ (((daddr) - (fs)->lfs_start) / segtod((fs), 1)) #define sntod(fs, sn) /* segment number to disk address */ \ - ((ufs_daddr_t)(segtod((fs), (sn)) + (fs)->lfs_start)) + ((daddr_t)(segtod((fs), (sn)) + (fs)->lfs_start)) /* Read in the block with the cleaner info from the ifile. */ #define LFS_CLEANERINFO(CP, F, BP) do { \ VTOI((F)->lfs_ivnode)->i_flag |= IN_ACCESS; \ if (bread((F)->lfs_ivnode, \ - (ufs_daddr_t)0, (F)->lfs_bsize, NOCRED, &(BP))) \ + (daddr_t)0, (F)->lfs_bsize, NOCRED, &(BP))) \ panic("lfs: ifile read"); \ (CP) = (CLEANERINFO *)(BP)->b_data; \ } while(0) @@ -728,8 +728,9 @@ struct segsum { */ typedef struct block_info { ino_t bi_inode; /* inode # */ - ufs_daddr_t bi_lbn; /* logical block w/in file */ - ufs_daddr_t bi_daddr; /* disk address of block */ + /* XXX ondisk32 */ + int32_t bi_lbn; /* logical block w/in file */ + int32_t bi_daddr; /* disk address of block */ u_int64_t bi_segcreate; /* origin segment create time */ int bi_version; /* file version number */ void *bi_bp; /* data buffer */ @@ -739,8 +740,9 @@ typedef struct block_info { /* Compatibility for 1.5 binaries */ typedef struct block_info_15 { ino_t bi_inode; /* inode # */ - ufs_daddr_t bi_lbn; /* logical block w/in file */ - ufs_daddr_t bi_daddr; /* disk address of block */ + /* XXX ondisk32 */ + int32_t bi_lbn; /* logical block w/in file */ + int32_t bi_daddr; /* disk address of block */ u_int32_t bi_segcreate; /* origin segment create time */ int bi_version; /* file version number */ void *bi_bp; /* data buffer */ @@ -762,7 +764,8 @@ struct segment { u_int32_t seg_bytes_left; /* bytes left in segment */ u_int32_t sum_bytes_left; /* bytes left in summary block */ u_int32_t seg_number; /* number of this segment */ - ufs_daddr_t *start_lbp; /* beginning lbn for this set */ + /* XXX ondisk32 */ + int32_t *start_lbp; /* beginning lbn for this set */ #define SEGM_CKP 0x01 /* doing a checkpoint */ #define SEGM_CLEAN 0x02 /* cleaner call; don't sort */ diff --git a/sys/ufs/lfs/lfs_alloc.c b/sys/ufs/lfs/lfs_alloc.c index 1ed7c4b1b202..5ee88842427a 100644 --- a/sys/ufs/lfs/lfs_alloc.c +++ b/sys/ufs/lfs/lfs_alloc.c @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_alloc.c,v 1.58 2003/01/08 15:40:04 yamt Exp $ */ +/* $NetBSD: lfs_alloc.c,v 1.59 2003/01/24 21:55:25 fvdl Exp $ */ /*- * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. @@ -71,7 +71,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lfs_alloc.c,v 1.58 2003/01/08 15:40:04 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lfs_alloc.c,v 1.59 2003/01/24 21:55:25 fvdl Exp $"); #if defined(_KERNEL_OPT) #include "opt_quota.h" @@ -226,7 +226,7 @@ extend_ifile(struct lfs *fs, struct ucred *cred) IFILE_V1 *ifp_v1; struct buf *bp, *cbp; int error; - ufs_daddr_t i, blkno, max; + daddr_t i, blkno, max; ino_t oldlast; CLEANERINFO *cip; @@ -514,7 +514,7 @@ lfs_vfree(void *v) struct inode *ip; struct vnode *vp; struct lfs *fs; - ufs_daddr_t old_iaddr; + daddr_t old_iaddr; ino_t ino, otail; extern int lfs_dirvcount; int s; diff --git a/sys/ufs/lfs/lfs_balloc.c b/sys/ufs/lfs/lfs_balloc.c index d4ee7410c985..b0054b2d5f6c 100644 --- a/sys/ufs/lfs/lfs_balloc.c +++ b/sys/ufs/lfs/lfs_balloc.c @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_balloc.c,v 1.34 2002/12/11 13:34:14 yamt Exp $ */ +/* $NetBSD: lfs_balloc.c,v 1.35 2003/01/24 21:55:26 fvdl Exp $ */ /*- * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. @@ -71,7 +71,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lfs_balloc.c,v 1.34 2002/12/11 13:34:14 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lfs_balloc.c,v 1.35 2003/01/24 21:55:26 fvdl Exp $"); #if defined(_KERNEL_OPT) #include "opt_quota.h" @@ -96,7 +96,7 @@ __KERNEL_RCSID(0, "$NetBSD: lfs_balloc.c,v 1.34 2002/12/11 13:34:14 yamt Exp $") #include #include -int lfs_fragextend(struct vnode *, int, int, ufs_daddr_t, struct buf **, struct ucred *); +int lfs_fragextend(struct vnode *, int, int, daddr_t, struct buf **, struct ucred *); /* * Allocate a block, and to inode and filesystem block accounting for it @@ -131,7 +131,7 @@ lfs_balloc(void *v) struct inode *ip; struct lfs *fs; struct indir indirs[NIADDR+2], *idp; - ufs_daddr_t lbn, lastblock; + daddr_t lbn, lastblock; int bb, bcount; int error, frags, i, nsize, osize, num; @@ -265,10 +265,12 @@ lfs_balloc(void *v) * If that is the case mark it UNWRITTEN to keep * the accounting straight. */ - if (((daddr_t *)ibp->b_data)[indirs[i].in_off] == 0) - ((daddr_t *)ibp->b_data)[indirs[i].in_off] = + /* XXX ondisk32 */ + if (((int32_t *)ibp->b_data)[indirs[i].in_off] == 0) + ((int32_t *)ibp->b_data)[indirs[i].in_off] = UNWRITTEN; - idaddr = ((daddr_t *)ibp->b_data)[indirs[i].in_off]; + /* XXX ondisk32 */ + idaddr = ((int32_t *)ibp->b_data)[indirs[i].in_off]; if ((error = VOP_BWRITE(ibp))) { return error; } @@ -308,8 +310,10 @@ lfs_balloc(void *v) idp = &indirs[num - 1]; if (bread(vp, idp->in_lbn, fs->lfs_bsize, NOCRED, &ibp)) - panic("lfs_balloc: bread bno %d", idp->in_lbn); - ((ufs_daddr_t *)ibp->b_data)[idp->in_off] = UNWRITTEN; + panic("lfs_balloc: bread bno %lld", + (long long)idp->in_lbn); + /* XXX ondisk32 */ + ((int32_t *)ibp->b_data)[idp->in_off] = UNWRITTEN; VOP_BWRITE(ibp); } } else if (!(bp->b_flags & (B_DONE|B_DELWRI))) { @@ -337,7 +341,7 @@ lfs_balloc(void *v) /* VOP_BWRITE 1 time */ int -lfs_fragextend(struct vnode *vp, int osize, int nsize, ufs_daddr_t lbn, struct buf **bpp, struct ucred *cred) +lfs_fragextend(struct vnode *vp, int osize, int nsize, daddr_t lbn, struct buf **bpp, struct ucred *cred) { struct inode *ip; struct lfs *fs; diff --git a/sys/ufs/lfs/lfs_bio.c b/sys/ufs/lfs/lfs_bio.c index 1e248c059ef6..b4de5d20307d 100644 --- a/sys/ufs/lfs/lfs_bio.c +++ b/sys/ufs/lfs/lfs_bio.c @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_bio.c,v 1.55 2002/12/30 05:34:17 yamt Exp $ */ +/* $NetBSD: lfs_bio.c,v 1.56 2003/01/24 21:55:26 fvdl Exp $ */ /*- * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. @@ -71,7 +71,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lfs_bio.c,v 1.55 2002/12/30 05:34:17 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lfs_bio.c,v 1.56 2003/01/24 21:55:26 fvdl Exp $"); #include #include @@ -535,7 +535,7 @@ lfs_flush(struct lfs *fs, int flags) #define INOBYTES(fs) ((fs)->lfs_uinodes * DINODE_SIZE) int -lfs_check(struct vnode *vp, ufs_daddr_t blkno, int flags) +lfs_check(struct vnode *vp, daddr_t blkno, int flags) { int error; struct lfs *fs; @@ -616,11 +616,11 @@ lfs_check(struct vnode *vp, ufs_daddr_t blkno, int flags) #ifdef MALLOCLOG # define DOMALLOC(S, T, F) _malloc((S), (T), (F), file, line) struct buf * -lfs_newbuf_malloclog(struct lfs *fs, struct vnode *vp, ufs_daddr_t daddr, size_t size, char *file, int line) +lfs_newbuf_malloclog(struct lfs *fs, struct vnode *vp, daddr_t daddr, size_t size, char *file, int line) #else # define DOMALLOC(S, T, F) malloc((S), (T), (F)) struct buf * -lfs_newbuf(struct lfs *fs, struct vnode *vp, ufs_daddr_t daddr, size_t size) +lfs_newbuf(struct lfs *fs, struct vnode *vp, daddr_t daddr, size_t size) #endif { struct buf *bp; diff --git a/sys/ufs/lfs/lfs_debug.c b/sys/ufs/lfs/lfs_debug.c index ae961e8bdacd..8d9072c22768 100644 --- a/sys/ufs/lfs/lfs_debug.c +++ b/sys/ufs/lfs/lfs_debug.c @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_debug.c,v 1.16 2002/05/14 20:03:53 perseant Exp $ */ +/* $NetBSD: lfs_debug.c,v 1.17 2003/01/24 21:55:27 fvdl Exp $ */ /*- * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. @@ -73,7 +73,7 @@ #ifdef DEBUG #include -__KERNEL_RCSID(0, "$NetBSD: lfs_debug.c,v 1.16 2002/05/14 20:03:53 perseant Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lfs_debug.c,v 1.17 2003/01/24 21:55:27 fvdl Exp $"); #include #include #include @@ -215,7 +215,7 @@ lfs_check_segsum(struct lfs *fs, struct segment *sp, char *file, int line) if ((actual = i = 1) == 1) return; /* XXXX not checking this anymore, really */ - if (sp->sum_bytes_left >= sizeof(FINFO) - sizeof(ufs_daddr_t) + if (sp->sum_bytes_left >= sizeof(FINFO) - sizeof(daddr_t) && sp->fip->fi_nblocks > 512) { printf("%s:%d: fi_nblocks = %d\n",file,line,sp->fip->fi_nblocks); #ifdef DDB @@ -233,7 +233,7 @@ lfs_check_segsum(struct lfs *fs, struct segment *sp, char *file, int line) /* amount taken up by FINFOs */ - ((char *)&(sp->fip->fi_blocks[sp->fip->fi_nblocks]) - (char *)(sp->segsum)) /* amount taken up by inode blocks */ - - sizeof(ufs_daddr_t)*((sp->ninodes+INOPB(fs)-1) / INOPB(fs)); + - sizeof(daddr_t)*((sp->ninodes+INOPB(fs)-1) / INOPB(fs)); #if 0 if (actual - sp->sum_bytes_left < offset) { @@ -252,7 +252,7 @@ lfs_check_segsum(struct lfs *fs, struct segment *sp, char *file, int line) #endif if (sp->sum_bytes_left > 0 && ((char *)(sp->segsum))[fs->lfs_sumsize - - sizeof(ufs_daddr_t) * ((sp->ninodes+INOPB(fs)-1) / INOPB(fs)) + - sizeof(daddr_t) * ((sp->ninodes+INOPB(fs)-1) / INOPB(fs)) - sp->sum_bytes_left] != '\0') { printf("%s:%d: warning: segsum overwrite at %d (-%d => %d)\n", file, line, sp->sum_bytes_left, diff --git a/sys/ufs/lfs/lfs_extern.h b/sys/ufs/lfs/lfs_extern.h index 228a2f2038e9..6b652fe28b2d 100644 --- a/sys/ufs/lfs/lfs_extern.h +++ b/sys/ufs/lfs/lfs_extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_extern.h,v 1.34 2002/12/28 14:39:09 yamt Exp $ */ +/* $NetBSD: lfs_extern.h,v 1.35 2003/01/24 21:55:27 fvdl Exp $ */ /*- * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. @@ -123,16 +123,16 @@ int lfs_bwrite_ext(struct buf *, int); int lfs_fits(struct lfs *, int); void lfs_flush_fs(struct lfs *, int); void lfs_flush(struct lfs *, int); -int lfs_check(struct vnode *, ufs_daddr_t, int); +int lfs_check(struct vnode *, daddr_t, int); #ifdef MALLOCLOG void lfs_freebuf_malloclog(struct buf *, char *, int); struct buf *lfs_newbuf_malloclog(struct lfs *, struct vnode *, - ufs_daddr_t, size_t, char *, int); + daddr_t, size_t, char *, int); #define lfs_freebuf(BP) lfs_freebuf_malloclog((BP), __FILE__, __LINE__) #define lfs_newbuf(F, V, A, S) lfs_newbuf_malloclog((F),(V),(A),(S),__FILE__,__LINE__) #else void lfs_freebuf(struct buf *); -struct buf *lfs_newbuf(struct lfs *, struct vnode *, ufs_daddr_t, size_t); +struct buf *lfs_newbuf(struct lfs *, struct vnode *, daddr_t, size_t); #endif void lfs_countlocked(int *, long *, char *); int lfs_reserve(struct lfs *, struct vnode *, struct vnode *, int); @@ -174,7 +174,8 @@ int lfs_match_dindir(struct lfs *, struct buf *); int lfs_match_tindir(struct lfs *, struct buf *); void lfs_callback(struct buf *); void lfs_supercallback(struct buf *); -void lfs_shellsort(struct buf **, ufs_daddr_t *, int); +/* XXX ondisk32 */ +void lfs_shellsort(struct buf **, int32_t *, int); int lfs_vref(struct vnode *); void lfs_vunref(struct vnode *); void lfs_vunref_head(struct vnode *); @@ -184,7 +185,7 @@ void lfs_seglock(struct lfs *, unsigned long); void lfs_segunlock(struct lfs *); /* lfs_syscalls.c */ -int lfs_fastvget(struct mount *, ino_t, ufs_daddr_t, struct vnode **, struct dinode *); +int lfs_fastvget(struct mount *, ino_t, daddr_t, struct vnode **, struct dinode *); struct buf *lfs_fakebuf(struct lfs *, struct vnode *, int, size_t, caddr_t); /* lfs_vfsops.c */ diff --git a/sys/ufs/lfs/lfs_inode.c b/sys/ufs/lfs/lfs_inode.c index 2daaa168175e..19b7daa604ff 100644 --- a/sys/ufs/lfs/lfs_inode.c +++ b/sys/ufs/lfs/lfs_inode.c @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_inode.c,v 1.61 2002/12/28 14:39:09 yamt Exp $ */ +/* $NetBSD: lfs_inode.c,v 1.62 2003/01/24 21:55:27 fvdl Exp $ */ /*- * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. @@ -71,7 +71,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.61 2002/12/28 14:39:09 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.62 2003/01/24 21:55:27 fvdl Exp $"); #if defined(_KERNEL_OPT) #include "opt_quota.h" @@ -101,8 +101,8 @@ extern int locked_queue_count; extern long locked_queue_bytes; static int lfs_update_seguse(struct lfs *, long, size_t); -static int lfs_indirtrunc (struct inode *, ufs_daddr_t, ufs_daddr_t, - ufs_daddr_t, int, long *, long *, long *, size_t *, +static int lfs_indirtrunc (struct inode *, daddr_t, daddr_t, + daddr_t, int, long *, long *, long *, size_t *, struct proc *); static int lfs_blkfree (struct lfs *, daddr_t, size_t, long *, size_t *); static int lfs_vtruncbuf(struct vnode *, daddr_t, int, int); @@ -135,8 +135,9 @@ lfs_ifind(struct lfs *fs, ino_t ino, struct buf *bp) printf("searched %d entries\n", (int)(fin - dip)); printf("offset is 0x%x (seg %d)\n", fs->lfs_offset, dtosn(fs, fs->lfs_offset)); - printf("block is 0x%x (seg %d)\n", dbtofsb(fs, bp->b_blkno), - dtosn(fs, dbtofsb(fs, bp->b_blkno))); + printf("block is 0x%llx (seg %lld)\n", + (unsigned long long)dbtofsb(fs, bp->b_blkno), + (long long)dtosn(fs, dbtofsb(fs, bp->b_blkno))); return NULL; } @@ -230,10 +231,10 @@ lfs_truncate(void *v) struct proc *a_p; } */ *ap = v; struct vnode *ovp = ap->a_vp; - ufs_daddr_t lastblock; + daddr_t lastblock; struct inode *oip; - ufs_daddr_t bn, lbn, lastiblock[NIADDR], indir_lbn[NIADDR]; - ufs_daddr_t newblks[NDADDR + NIADDR]; + daddr_t bn, lbn, lastiblock[NIADDR], indir_lbn[NIADDR]; + daddr_t newblks[NDADDR + NIADDR]; off_t length = ap->a_length; struct lfs *fs; struct buf *bp; @@ -575,16 +576,17 @@ lfs_update_seguse(struct lfs *fs, long lastseg, size_t num) * NB: triple indirect blocks are untested. */ static int -lfs_indirtrunc(struct inode *ip, ufs_daddr_t lbn, daddr_t dbn, - ufs_daddr_t lastbn, int level, long *countp, +lfs_indirtrunc(struct inode *ip, daddr_t lbn, daddr_t dbn, + daddr_t lastbn, int level, long *countp, long *rcountp, long *lastsegp, size_t *bcp, struct proc *p) { int i; struct buf *bp; struct lfs *fs = ip->i_lfs; - ufs_daddr_t *bap; + int32_t *bap; /* XXX ondisk32 */ struct vnode *vp; - ufs_daddr_t *copy = NULL, nb, nlbn, last; + daddr_t nb, nlbn, last; + int32_t *copy = NULL; /* XXX ondisk32 */ long blkcount, rblkcount, factor; int nblocks, blocksreleased = 0, real_released = 0; int error = 0, allerror = 0; @@ -630,12 +632,13 @@ lfs_indirtrunc(struct inode *ip, ufs_daddr_t lbn, daddr_t dbn, return (error); } - bap = (ufs_daddr_t *)bp->b_data; + bap = (int32_t *)bp->b_data; /* XXX ondisk32 */ if (lastbn >= 0) { - MALLOC(copy, ufs_daddr_t *, fs->lfs_bsize, M_TEMP, M_WAITOK); + MALLOC(copy, int32_t *, fs->lfs_bsize, M_TEMP, M_WAITOK); memcpy((caddr_t)copy, (caddr_t)bap, (u_int)fs->lfs_bsize); memset((caddr_t)&bap[last + 1], 0, - (u_int)(NINDIR(fs) - (last + 1)) * sizeof (ufs_daddr_t)); + /* XXX ondisk32 */ + (u_int)(NINDIR(fs) - (last + 1)) * sizeof (int32_t)); error = VOP_BWRITE(bp); if (error) allerror = error; @@ -652,7 +655,7 @@ lfs_indirtrunc(struct inode *ip, ufs_daddr_t lbn, daddr_t dbn, continue; if (level > SINGLE) { error = lfs_indirtrunc(ip, nlbn, nb, - (ufs_daddr_t)-1, level - 1, + (daddr_t)-1, level - 1, &blkcount, &rblkcount, lastsegp, bcp, p); if (error) diff --git a/sys/ufs/lfs/lfs_segment.c b/sys/ufs/lfs/lfs_segment.c index 4a9504ff73e7..9c6119755dde 100644 --- a/sys/ufs/lfs/lfs_segment.c +++ b/sys/ufs/lfs/lfs_segment.c @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_segment.c,v 1.90 2003/01/08 17:16:52 yamt Exp $ */ +/* $NetBSD: lfs_segment.c,v 1.91 2003/01/24 21:55:27 fvdl Exp $ */ /*- * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. @@ -71,7 +71,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.90 2003/01/08 17:16:52 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.91 2003/01/24 21:55:27 fvdl Exp $"); #define ivndebug(vp,str) printf("ino %d: %s\n",VTOI(vp)->i_number,(str)) @@ -127,14 +127,15 @@ void lfs_callback(struct buf *); int lfs_gather(struct lfs *, struct segment *, struct vnode *, int (*)(struct lfs *, struct buf *)); int lfs_gatherblock(struct segment *, struct buf *, int *); -void lfs_iset(struct inode *, ufs_daddr_t, time_t); +void lfs_iset(struct inode *, daddr_t, time_t); int lfs_match_fake(struct lfs *, struct buf *); int lfs_match_data(struct lfs *, struct buf *); int lfs_match_dindir(struct lfs *, struct buf *); int lfs_match_indir(struct lfs *, struct buf *); int lfs_match_tindir(struct lfs *, struct buf *); void lfs_newseg(struct lfs *); -void lfs_shellsort(struct buf **, ufs_daddr_t *, int); +/* XXX ondisk32 */ +void lfs_shellsort(struct buf **, int32_t *, int); void lfs_supercallback(struct buf *); void lfs_updatemeta(struct segment *); int lfs_vref(struct vnode *); @@ -482,7 +483,7 @@ lfs_segwrite(struct mount *mp, int flags) struct segment *sp; struct vnode *vp; SEGUSE *segusep; - ufs_daddr_t ibno; + daddr_t ibno; int do_ckp, did_ckp, error, i; int writer_set = 0; int dirty; @@ -647,8 +648,9 @@ lfs_segwrite(struct mount *mp, int flags) printf("lfs_segwrite: ifile still has dirty blocks?!\n"); ++dopanic; ++warned; - printf("bp=%p, lbn %d, flags 0x%lx\n", - bp, bp->b_lblkno, bp->b_flags); + printf("bp=%p, lbn %lld, flags 0x%lx\n", + bp, (long long)bp->b_lblkno, + bp->b_flags); } } if (dopanic) @@ -711,7 +713,7 @@ lfs_writefile(struct lfs *fs, struct segment *sp, struct vnode *vp) sp->sum_bytes_left < sizeof(struct finfo)) (void) lfs_writeseg(fs, sp); - sp->sum_bytes_left -= sizeof(struct finfo) - sizeof(ufs_daddr_t); + sp->sum_bytes_left -= sizeof(struct finfo) - sizeof(daddr_t); ++((SEGSUM *)(sp->segsum))->ss_nfinfo; if (vp->v_flag & VDIROP) @@ -774,10 +776,10 @@ lfs_writefile(struct lfs *fs, struct segment *sp, struct vnode *vp) fip = sp->fip; if (fip->fi_nblocks != 0) { sp->fip = (FINFO*)((caddr_t)fip + sizeof(struct finfo) + - sizeof(ufs_daddr_t) * (fip->fi_nblocks-1)); + sizeof(daddr_t) * (fip->fi_nblocks-1)); sp->start_lbp = &sp->fip->fi_blocks[0]; } else { - sp->sum_bytes_left += sizeof(FINFO) - sizeof(ufs_daddr_t); + sp->sum_bytes_left += sizeof(FINFO) - sizeof(daddr_t); --((SEGSUM *)(sp->segsum))->ss_nfinfo; } } @@ -789,8 +791,8 @@ lfs_writeinode(struct lfs *fs, struct segment *sp, struct inode *ip) struct dinode *cdp; IFILE *ifp; SEGUSE *sup; - ufs_daddr_t daddr; - daddr_t *daddrp; + daddr_t daddr; + int32_t *daddrp; /* XXX ondisk32 */ ino_t ino; int error, i, ndx, fsb = 0; int redo_ifile = 0; @@ -804,7 +806,7 @@ lfs_writeinode(struct lfs *fs, struct segment *sp, struct inode *ip) if ((ip->i_number != LFS_IFILE_INUM || sp->idp == NULL) && sp->ibp == NULL) { /* Allocate a new segment if necessary. */ if (sp->seg_bytes_left < fs->lfs_ibsize || - sp->sum_bytes_left < sizeof(ufs_daddr_t)) + sp->sum_bytes_left < sizeof(daddr_t)) (void) lfs_writeseg(fs, sp); /* Get next inode block. */ @@ -823,10 +825,11 @@ lfs_writeinode(struct lfs *fs, struct segment *sp, struct inode *ip) fs->lfs_avail -= btofsb(fs, fs->lfs_ibsize); /* Set remaining space counters. */ sp->seg_bytes_left -= fs->lfs_ibsize; - sp->sum_bytes_left -= sizeof(ufs_daddr_t); - ndx = fs->lfs_sumsize / sizeof(ufs_daddr_t) - + sp->sum_bytes_left -= sizeof(daddr_t); + ndx = fs->lfs_sumsize / sizeof(daddr_t) - sp->ninodes / INOPB(fs) - 1; - ((ufs_daddr_t *)(sp->segsum))[ndx] = daddr; + /* fvdl -- not on disk, should be ok */ + ((daddr_t *)(sp->segsum))[ndx] = daddr; } /* Update the inode times and copy the inode onto the inode page. */ @@ -947,8 +950,8 @@ lfs_writeinode(struct lfs *fs, struct segment *sp, struct inode *ip) if (daddr >= fs->lfs_lastpseg && daddr <= dbtofsb(fs, bp->b_blkno)) { ++sp->ndupino; printf("lfs_writeinode: last inode addr in current pseg " - "(ino %d daddr 0x%x) ndupino=%d\n", ino, daddr, - sp->ndupino); + "(ino %d daddr 0x%llx) ndupino=%d\n", ino, + (long long)daddr, sp->ndupino); } /* * Account the inode: it no longer belongs to its former segment, @@ -1008,7 +1011,7 @@ lfs_gatherblock(struct segment *sp, struct buf *bp, int *sptr) panic ("lfs_gatherblock: Null vp in segment"); #endif fs = sp->fs; - if (sp->sum_bytes_left < sizeof(ufs_daddr_t) || + if (sp->sum_bytes_left < sizeof(daddr_t) || sp->seg_bytes_left < bp->b_bcount) { if (sptr) splx(*sptr); @@ -1022,7 +1025,7 @@ lfs_gatherblock(struct segment *sp, struct buf *bp, int *sptr) /* Add the current file to the segment summary. */ ++((SEGSUM *)(sp->segsum))->ss_nfinfo; sp->sum_bytes_left -= - sizeof(struct finfo) - sizeof(ufs_daddr_t); + sizeof(struct finfo) - sizeof(daddr_t); if (sptr) *sptr = splbio(); @@ -1043,7 +1046,7 @@ lfs_gatherblock(struct segment *sp, struct buf *bp, int *sptr) *sp->cbpp++ = bp; sp->fip->fi_blocks[sp->fip->fi_nblocks++] = bp->b_lblkno; - sp->sum_bytes_left -= sizeof(ufs_daddr_t); + sp->sum_bytes_left -= sizeof(daddr_t); sp->seg_bytes_left -= bp->b_bcount; return (0); } @@ -1136,7 +1139,7 @@ lfs_updatemeta(struct segment *sp) struct vnode *vp; struct indir a[NIADDR + 2], *ap; struct inode *ip; - ufs_daddr_t daddr, lbn, off; + daddr_t daddr, lbn, off; daddr_t ooff; int error, i, nblocks, num; int bb, osize, obb; @@ -1183,9 +1186,9 @@ lfs_updatemeta(struct segment *sp) sbp->b_blkno = fsbtodb(fs, fs->lfs_offset); off = fs->lfs_offset; if (sbp->b_blkno == sbp->b_lblkno) { - printf("lfs_updatemeta: ino %d blk %d" + printf("lfs_updatemeta: ino %d blk %lld" " has same lbn and daddr\n", - VTOI(vp)->i_number, off); + VTOI(vp)->i_number, (long long)off); } /* @@ -1241,10 +1244,11 @@ lfs_updatemeta(struct segment *sp) default: ap = &a[num - 1]; if (bread(vp, ap->in_lbn, fs->lfs_bsize, NOCRED, &bp)) - panic("lfs_updatemeta: bread bno %d", - ap->in_lbn); + panic("lfs_updatemeta: bread bno %lld", + (long long)ap->in_lbn); - ooff = ((ufs_daddr_t *)bp->b_data)[ap->in_off]; + /* XXX ondisk32 */ + ooff = ((int32_t *)bp->b_data)[ap->in_off]; #if DEBUG if (ooff == 0) { printf("lfs_updatemeta[3]: warning: writing " @@ -1254,7 +1258,8 @@ lfs_updatemeta(struct segment *sp) #endif if (ooff == UNWRITTEN) ip->i_ffs_blocks += bb; - ((ufs_daddr_t *)bp->b_data)[ap->in_off] = off; + /* XXX ondisk32 */ + ((int32_t *)bp->b_data)[ap->in_off] = off; (void) VOP_BWRITE(bp); } #ifdef DEBUG @@ -1577,7 +1582,7 @@ lfs_writeseg(struct lfs *fs, struct segment *sp) size_t pmsize; int use_pagemove; daddr_t pseg_daddr; - daddr_t *daddrp; + int32_t *daddrp; /* XXX ondisk32 */ int changed; #if defined(DEBUG) && defined(LFS_PROPELLER) static int propeller; @@ -1685,8 +1690,9 @@ lfs_writeseg(struct lfs *fs, struct segment *sp) *bpp = newbp; changed = 0; - for (daddrp = (daddr_t *)(newbp->b_data); - daddrp < (daddr_t *)(newbp->b_data + + /* XXX ondisk32 */ + for (daddrp = (int32_t *)(newbp->b_data); + daddrp < (int32_t *)(newbp->b_data + newbp->b_bcount); daddrp++) { if (*daddrp == UNWRITTEN) { ++changed; @@ -1756,9 +1762,9 @@ lfs_writeseg(struct lfs *fs, struct segment *sp) if (((*++bpp)->b_flags & (B_CALL|B_INVAL)) == (B_CALL|B_INVAL)) { if (copyin((*bpp)->b_saveaddr, dp, el_size)) panic("lfs_writeseg: copyin failed [1]: " - "ino %d blk %d", + "ino %d blk %lld", VTOI((*bpp)->b_vp)->i_number, - (*bpp)->b_lblkno); + (long long)(*bpp)->b_lblkno); } else memcpy(dp, (*bpp)->b_data, el_size); dp += el_size; @@ -2063,7 +2069,7 @@ lfs_match_data(struct lfs *fs, struct buf *bp) int lfs_match_indir(struct lfs *fs, struct buf *bp) { - ufs_daddr_t lbn; + daddr_t lbn; lbn = bp->b_lblkno; return (lbn < 0 && (-lbn - NDADDR) % NINDIR(fs) == 0); @@ -2072,7 +2078,7 @@ lfs_match_indir(struct lfs *fs, struct buf *bp) int lfs_match_dindir(struct lfs *fs, struct buf *bp) { - ufs_daddr_t lbn; + daddr_t lbn; lbn = bp->b_lblkno; return (lbn < 0 && (-lbn - NDADDR) % NINDIR(fs) == 1); @@ -2081,7 +2087,7 @@ lfs_match_dindir(struct lfs *fs, struct buf *bp) int lfs_match_tindir(struct lfs *fs, struct buf *bp) { - ufs_daddr_t lbn; + daddr_t lbn; lbn = bp->b_lblkno; return (lbn < 0 && (-lbn - NDADDR) % NINDIR(fs) == 2); @@ -2278,7 +2284,7 @@ lfs_supercallback(struct buf *bp) */ void -lfs_shellsort(struct buf **bp_array, ufs_daddr_t *lb_array, int nmemb) +lfs_shellsort(struct buf **bp_array, int32_t *lb_array, int nmemb) { static int __rsshell_increments[] = { 4, 1, 0 }; int incr, *incrp, t1, t2; diff --git a/sys/ufs/lfs/lfs_subr.c b/sys/ufs/lfs/lfs_subr.c index 3d21cdd8b207..7443d03b3aa0 100644 --- a/sys/ufs/lfs/lfs_subr.c +++ b/sys/ufs/lfs/lfs_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_subr.c,v 1.28 2002/07/11 21:09:00 perseant Exp $ */ +/* $NetBSD: lfs_subr.c,v 1.29 2003/01/24 21:55:28 fvdl Exp $ */ /*- * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. @@ -71,7 +71,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lfs_subr.c,v 1.28 2002/07/11 21:09:00 perseant Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lfs_subr.c,v 1.29 2003/01/24 21:55:28 fvdl Exp $"); #include #include @@ -103,7 +103,7 @@ lfs_blkatoff(void *v) struct lfs *fs; struct inode *ip; struct buf *bp; - ufs_daddr_t lbn; + daddr_t lbn; int bsize, error; ip = VTOI(ap->a_vp); @@ -150,7 +150,7 @@ lfs_seglock(struct lfs *fs, unsigned long flags) sp = fs->lfs_sp = malloc(sizeof(struct segment), M_SEGMENT, M_WAITOK); sp->bpp = malloc(((fs->lfs_sumsize - SEGSUM_SIZE(fs)) / - sizeof(ufs_daddr_t) + 1) * sizeof(struct buf *), + sizeof(daddr_t) + 1) * sizeof(struct buf *), M_SEGMENT, M_WAITOK); sp->seg_flags = flags; sp->vp = NULL; diff --git a/sys/ufs/lfs/lfs_syscalls.c b/sys/ufs/lfs/lfs_syscalls.c index a7711a2a828e..77e157bf1c1c 100644 --- a/sys/ufs/lfs/lfs_syscalls.c +++ b/sys/ufs/lfs/lfs_syscalls.c @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_syscalls.c,v 1.78 2003/01/18 09:38:19 thorpej Exp $ */ +/* $NetBSD: lfs_syscalls.c,v 1.79 2003/01/24 21:55:28 fvdl Exp $ */ /*- * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. @@ -71,7 +71,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.78 2003/01/18 09:38:19 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.79 2003/01/24 21:55:28 fvdl Exp $"); #define LFS /* for prototypes in syscallargs.h */ @@ -251,7 +251,7 @@ lfs_markv(struct proc *p, fsid_t *fsidp, BLOCK_INFO *blkiov, int blkcnt) int vputc = 0, iwritten = 0; #endif ino_t lastino; - ufs_daddr_t b_daddr, v_daddr; + daddr_t b_daddr, v_daddr; int cnt, error; int do_again = 0; int s; @@ -311,8 +311,9 @@ lfs_markv(struct proc *p, fsid_t *fsidp, BLOCK_INFO *blkiov, int blkcnt) for (blkp = blkiov; cnt--; ++blkp) { if (blkp->bi_daddr == LFS_FORCE_WRITE) - printf("lfs_markv: warning: force-writing ino %d lbn %d\n", - blkp->bi_inode, blkp->bi_lbn); + printf("lfs_markv: warning: force-writing ino %d " + "lbn %lld\n", + blkp->bi_inode, (long long)blkp->bi_lbn); /* Bounds-check incoming data, avoid panic for failed VGET */ if (blkp->bi_inode <= 0 || blkp->bi_inode >= maxino) { error = EINVAL; @@ -440,8 +441,8 @@ lfs_markv(struct proc *p, fsid_t *fsidp, BLOCK_INFO *blkiov, int blkcnt) if (dtosn(fs,dbtofsb(fs, b_daddr)) == dtosn(fs,blkp->bi_daddr)) { - printf("lfs_markv: wrong da same seg: %x vs %x\n", - blkp->bi_daddr, dbtofsb(fs, b_daddr)); + printf("lfs_markv: wrong da same seg: %llx vs %llx\n", + (long long)blkp->bi_daddr, (long long)dbtofsb(fs, b_daddr)); } do_again++; continue; @@ -462,8 +463,8 @@ lfs_markv(struct proc *p, fsid_t *fsidp, BLOCK_INFO *blkiov, int blkcnt) obsize = ip->i_lfs_fragsize[blkp->bi_lbn]; } if (obsize != blkp->bi_size) { - printf("lfs_markv: ino %d lbn %d wrong size (%ld != %d), try again\n", - blkp->bi_inode, blkp->bi_lbn, + printf("lfs_markv: ino %d lbn %lld wrong size (%ld != %d), try again\n", + blkp->bi_inode, (long long)blkp->bi_lbn, (long) obsize, blkp->bi_size); do_again++; continue; @@ -718,7 +719,7 @@ lfs_bmapv(struct proc *p, fsid_t *fsidp, BLOCK_INFO *blkiov, int blkcnt) struct ufsmount *ump; struct vnode *vp; ino_t lastino; - ufs_daddr_t v_daddr; + daddr_t v_daddr; int cnt, error; int numrefed = 0; @@ -823,14 +824,17 @@ lfs_bmapv(struct proc *p, fsid_t *fsidp, BLOCK_INFO *blkiov, int blkcnt) */ blkp->bi_daddr = v_daddr; } else { + daddr_t bi_daddr; + + /* XXX ondisk32 */ error = VOP_BMAP(vp, blkp->bi_lbn, NULL, - &(blkp->bi_daddr), NULL); + &bi_daddr, NULL); if (error) { blkp->bi_daddr = LFS_UNUSED_DADDR; continue; } - blkp->bi_daddr = dbtofsb(fs, blkp->bi_daddr); + blkp->bi_daddr = dbtofsb(fs, bi_daddr); /* Fill in the block size, too */ if (blkp->bi_lbn >= 0) blkp->bi_size = blksize(fs, ip, blkp->bi_lbn); @@ -1061,7 +1065,7 @@ lfs_fasthashget(dev_t dev, ino_t ino, struct vnode **vpp) } int -lfs_fastvget(struct mount *mp, ino_t ino, ufs_daddr_t daddr, struct vnode **vpp, struct dinode *dinp) +lfs_fastvget(struct mount *mp, ino_t ino, daddr_t daddr, struct vnode **vpp, struct dinode *dinp) { struct inode *ip; struct dinode *dip; diff --git a/sys/ufs/lfs/lfs_vfsops.c b/sys/ufs/lfs/lfs_vfsops.c index d4eb8148b579..b3db298733ac 100644 --- a/sys/ufs/lfs/lfs_vfsops.c +++ b/sys/ufs/lfs/lfs_vfsops.c @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_vfsops.c,v 1.84 2003/01/12 13:04:52 yamt Exp $ */ +/* $NetBSD: lfs_vfsops.c,v 1.85 2003/01/24 21:55:29 fvdl Exp $ */ /*- * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. @@ -71,7 +71,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.84 2003/01/12 13:04:52 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.85 2003/01/24 21:55:29 fvdl Exp $"); #if defined(_KERNEL_OPT) #include "opt_quota.h" @@ -354,7 +354,7 @@ lfs_mount(struct mount *mp, const char *path, void *data, struct nameidata *ndp, * Mark the block dirty. Do segment and avail accounting. */ static int -update_meta(struct lfs *fs, ino_t ino, int version, ufs_daddr_t lbn, +update_meta(struct lfs *fs, ino_t ino, int version, daddr_t lbn, daddr_t ndaddr, size_t size, struct proc *p) { int error; @@ -427,12 +427,15 @@ update_meta(struct lfs *fs, ino_t ino, int version, ufs_daddr_t lbn, default: ap = &a[num - 1]; if (bread(vp, ap->in_lbn, fs->lfs_bsize, NOCRED, &bp)) - panic("update_meta: bread bno %d", ap->in_lbn); - - ooff = ((ufs_daddr_t *)bp->b_data)[ap->in_off]; + panic("update_meta: bread bno %lld", + (long long)ap->in_lbn); + + /* XXX ondisk32 */ + ooff = ((int32_t *)bp->b_data)[ap->in_off]; if (ooff == UNWRITTEN) ip->i_ffs_blocks += btofsb(fs, size); - ((ufs_daddr_t *)bp->b_data)[ap->in_off] = ndaddr; + /* XXX ondisk32 */ + ((int32_t *)bp->b_data)[ap->in_off] = ndaddr; (void) VOP_BWRITE(bp); } LFS_SET_UINO(ip, IN_CHANGE | IN_MODIFIED | IN_UPDATE); @@ -568,7 +571,8 @@ check_segsum(struct lfs *fs, daddr_t offset, int error, nblocks, ninos, i, j; SEGSUM *ssp; u_long *dp, *datap; /* XXX u_int32_t */ - daddr_t *iaddr, oldoffset; + daddr_t oldoffset; + int32_t *iaddr; /* XXX ondisk32 */ FINFO *fip; SEGUSE *sup; size_t size; @@ -642,7 +646,8 @@ check_segsum(struct lfs *fs, daddr_t offset, offset += btofsb(fs, fs->lfs_sumsize); ninos = howmany(ssp->ss_ninos, INOPB(fs)); - iaddr = (daddr_t *)(bp->b_data + fs->lfs_sumsize - sizeof(daddr_t)); + /* XXX ondisk32 */ + iaddr = (int32_t *)(bp->b_data + fs->lfs_sumsize - sizeof(int32_t)); if (flags & CHECK_CKSUM) { /* Count blocks */ nblocks = 0; @@ -651,9 +656,10 @@ check_segsum(struct lfs *fs, daddr_t offset, nblocks += fip->fi_nblocks; if (fip->fi_nblocks <= 0) break; + /* XXX ondisk32 */ fip = (FINFO *)(((char *)fip) + sizeof(FINFO) + (fip->fi_nblocks - 1) * - sizeof(ufs_daddr_t)); + sizeof(int32_t)); } nblocks += ninos; /* Create the sum array */ @@ -716,8 +722,9 @@ check_segsum(struct lfs *fs, daddr_t offset, } offset += btofsb(fs, size); } + /* XXX ondisk32 */ fip = (FINFO *)(((char *)fip) + sizeof(FINFO) - + (fip->fi_nblocks - 1) * sizeof(ufs_daddr_t)); + + (fip->fi_nblocks - 1) * sizeof(int32_t)); } /* Checksum the array, compare */ if ((flags & CHECK_CKSUM) && @@ -857,9 +864,9 @@ lfs_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p) if (sb_addr != dfs->dlfs_sboffs[0] << dfs->dlfs_fsbtodb) { /* #ifdef DEBUG_LFS */ - printf("lfs_mountfs: sb daddr 0x%x is not right, trying 0x%x\n", - sb_addr, dfs->dlfs_sboffs[0] << - dfs->dlfs_fsbtodb); + printf("lfs_mountfs: sb daddr 0x%llx is not right, trying 0x%llx\n", + (long long)sb_addr, (long long)(dfs->dlfs_sboffs[0] << + dfs->dlfs_fsbtodb)); /* #endif */ sb_addr = dfs->dlfs_sboffs[0] << dfs->dlfs_fsbtodb; @@ -1108,8 +1115,8 @@ lfs_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p) * Finish: flush our changes to disk. */ lfs_segwrite(mp, SEGM_CKP | SEGM_SYNC); - printf("lfs_mountfs: roll forward recovered %d blocks\n", - lastgoodpseg - oldoffset); + printf("lfs_mountfs: roll forward recovered %lld blocks\n", + (long long)(lastgoodpseg - oldoffset)); } #ifdef DEBUG_LFS_RFW printf("LFS roll forward complete\n"); @@ -1342,7 +1349,7 @@ lfs_vget(struct mount *mp, ino_t ino, struct vnode **vpp) struct ifile *ifp; struct vnode *vp; struct ufsmount *ump; - ufs_daddr_t daddr; + daddr_t daddr; dev_t dev; int i, error, retries; struct timespec ts; diff --git a/sys/ufs/ufs/dinode.h b/sys/ufs/ufs/dinode.h index 92a0e48a3fde..5f76e2aab5dc 100644 --- a/sys/ufs/ufs/dinode.h +++ b/sys/ufs/ufs/dinode.h @@ -1,4 +1,4 @@ -/* $NetBSD: dinode.h,v 1.15 2003/01/06 20:30:39 wiz Exp $ */ +/* $NetBSD: dinode.h,v 1.16 2003/01/24 21:55:29 fvdl Exp $ */ /* * Copyright (c) 1982, 1989, 1993 @@ -66,9 +66,6 @@ * are defined by types with precise widths. */ -typedef int32_t ufs_daddr_t; -typedef long ufs_lbn_t; - #define NDADDR 12 /* Direct addresses in inode. */ #define NIADDR 3 /* Indirect addresses in inode. */ @@ -86,8 +83,8 @@ struct dinode { int32_t di_mtimensec; /* 28: Last modified time. */ int32_t di_ctime; /* 32: Last inode change time. */ int32_t di_ctimensec; /* 36: Last inode change time. */ - ufs_daddr_t di_db[NDADDR]; /* 40: Direct disk blocks. */ - ufs_daddr_t di_ib[NIADDR]; /* 88: Indirect disk blocks. */ + int32_t di_db[NDADDR]; /* 40: Direct disk blocks. */ + int32_t di_ib[NIADDR]; /* 88: Indirect disk blocks. */ u_int32_t di_flags; /* 100: Status flags (chflags). */ u_int32_t di_blocks; /* 104: Blocks actually held. */ int32_t di_gen; /* 108: Generation number. */ @@ -108,7 +105,7 @@ struct dinode { #define di_ouid di_u.oldids[0] #define di_rdev di_db[0] #define di_shortlink di_db -#define MAXSYMLINKLEN ((NDADDR + NIADDR) * sizeof(ufs_daddr_t)) +#define MAXSYMLINKLEN ((NDADDR + NIADDR) * sizeof(int32_t)) /* NeXT used to keep short symlinks in the inode even when using * FS_42INODEFMT. In that case fs->fs_maxsymlinklen is probably -1, diff --git a/sys/ufs/ufs/inode.h b/sys/ufs/ufs/inode.h index 5e47db1e3030..b7b8e4beba53 100644 --- a/sys/ufs/ufs/inode.h +++ b/sys/ufs/ufs/inode.h @@ -1,4 +1,4 @@ -/* $NetBSD: inode.h,v 1.31 2002/12/01 00:12:12 matt Exp $ */ +/* $NetBSD: inode.h,v 1.32 2003/01/24 21:55:29 fvdl Exp $ */ /* * Copyright (c) 1982, 1989, 1993 @@ -54,8 +54,8 @@ * Per-filesystem inode extensions. */ struct ext2fs_inode_ext { - ufs_daddr_t ext2fs_last_lblk; /* last logical block allocated */ - ufs_daddr_t ext2fs_last_blk; /* last block allocated on disk */ + daddr_t ext2fs_last_lblk; /* last logical block allocated */ + daddr_t ext2fs_last_blk; /* last block allocated on disk */ }; struct lfs_inode_ext { @@ -186,7 +186,7 @@ struct inode { * ufs_getlbns and used by truncate and bmap code. */ struct indir { - ufs_daddr_t in_lbn; /* Logical block number. */ + daddr_t in_lbn; /* Logical block number. */ int in_off; /* Offset in buffer. */ int in_exists; /* Flag if the block exists. */ }; diff --git a/sys/ufs/ufs/ufs_bmap.c b/sys/ufs/ufs/ufs_bmap.c index 3f3307de0e4b..7a0fb08f8422 100644 --- a/sys/ufs/ufs/ufs_bmap.c +++ b/sys/ufs/ufs/ufs_bmap.c @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_bmap.c,v 1.17 2002/05/11 12:23:53 enami Exp $ */ +/* $NetBSD: ufs_bmap.c,v 1.18 2003/01/24 21:55:30 fvdl Exp $ */ /* * Copyright (c) 1989, 1991, 1993 @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ufs_bmap.c,v 1.17 2002/05/11 12:23:53 enami Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ufs_bmap.c,v 1.18 2003/01/24 21:55:30 fvdl Exp $"); #include #include @@ -105,8 +105,8 @@ ufs_bmap(v) int ufs_bmaparray(vp, bn, bnp, ap, nump, runp) struct vnode *vp; - ufs_daddr_t bn; - ufs_daddr_t *bnp; + daddr_t bn; + daddr_t *bnp; struct indir *ap; int *nump; int *runp; @@ -116,8 +116,8 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp) struct ufsmount *ump; struct mount *mp; struct indir a[NIADDR + 1], *xap; - ufs_daddr_t daddr; - long metalbn; + daddr_t daddr; + daddr_t metalbn; int error, maxrun = 0, num; ip = VTOI(vp); @@ -216,15 +216,17 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp) return (error); } } - daddr = ufs_rw32(((ufs_daddr_t *)bp->b_data)[xap->in_off], + /* XXX ondisk32 */ + daddr = ufs_rw32(((int32_t *)bp->b_data)[xap->in_off], UFS_MPNEEDSWAP(mp)); + /* XXX ondisk32 */ if (num == 1 && daddr && runp) for (bn = xap->in_off + 1; bn < MNINDIR(ump) && *runp < maxrun && is_sequential(ump, - ufs_rw32(((ufs_daddr_t *)bp->b_data)[bn - 1], + ufs_rw32(((int32_t *)bp->b_data)[bn - 1], UFS_MPNEEDSWAP(mp)), - ufs_rw32(((ufs_daddr_t *)bp->b_data)[bn], + ufs_rw32(((int32_t *)bp->b_data)[bn], UFS_MPNEEDSWAP(mp))); ++bn, ++*runp); } @@ -248,11 +250,11 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp) int ufs_getlbns(vp, bn, ap, nump) struct vnode *vp; - ufs_daddr_t bn; + daddr_t bn; struct indir *ap; int *nump; { - long metalbn, realbn; + daddr_t metalbn, realbn; struct ufsmount *ump; int64_t blockcnt; int lbc; @@ -263,8 +265,8 @@ ufs_getlbns(vp, bn, ap, nump) *nump = 0; numlevels = 0; realbn = bn; - if ((long)bn < 0) - bn = -(long)bn; + if (bn < 0) + bn = -bn; KASSERT(bn >= NDADDR); /* diff --git a/sys/ufs/ufs/ufs_extern.h b/sys/ufs/ufs/ufs_extern.h index 960b3f687a29..b284a1bb4229 100644 --- a/sys/ufs/ufs/ufs_extern.h +++ b/sys/ufs/ufs/ufs_extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_extern.h,v 1.29 2002/12/01 00:12:12 matt Exp $ */ +/* $NetBSD: ufs_extern.h,v 1.30 2003/01/24 21:55:30 fvdl Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -102,9 +102,9 @@ int ufsfifo_write __P((void *)); int ufsfifo_close __P((void *)); /* ufs_bmap.c */ -int ufs_bmaparray __P((struct vnode *, ufs_daddr_t, ufs_daddr_t *, +int ufs_bmaparray __P((struct vnode *, daddr_t, daddr_t *, struct indir *, int *, int *)); -int ufs_getlbns __P((struct vnode *, ufs_daddr_t, struct indir *, int *)); +int ufs_getlbns __P((struct vnode *, daddr_t, struct indir *, int *)); /* ufs_ihash.c */ void ufs_ihashinit __P((void)); diff --git a/sys/ufs/ufs/ufs_readwrite.c b/sys/ufs/ufs/ufs_readwrite.c index cc745f34cae9..6a2b4b8add74 100644 --- a/sys/ufs/ufs/ufs_readwrite.c +++ b/sys/ufs/ufs/ufs_readwrite.c @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_readwrite.c,v 1.46 2002/12/28 14:39:10 yamt Exp $ */ +/* $NetBSD: ufs_readwrite.c,v 1.47 2003/01/24 21:55:30 fvdl Exp $ */ /*- * Copyright (c) 1993 @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: ufs_readwrite.c,v 1.46 2002/12/28 14:39:10 yamt Exp $"); +__KERNEL_RCSID(1, "$NetBSD: ufs_readwrite.c,v 1.47 2003/01/24 21:55:30 fvdl Exp $"); #ifdef LFS_READWRITE #define BLKSIZE(a, b, c) blksize(a, b, c) @@ -78,7 +78,7 @@ READ(void *v) void *win; vsize_t bytelen; struct buf *bp; - ufs_daddr_t lbn, nextlbn; + daddr_t lbn, nextlbn; off_t bytesinfile; long size, xfersize, blkoffset; int error; @@ -201,7 +201,7 @@ WRITE(void *v) struct buf *bp; struct proc *p; struct ucred *cred; - ufs_daddr_t lbn; + daddr_t lbn; off_t osize, origoff, oldoff, preallocoff, endallocoff, nsize; int blkoffset, error, flags, ioflag, resid, size, xfersize; int bsize, aflag; diff --git a/usr.sbin/bad144/bad144.c b/usr.sbin/bad144/bad144.c index d4fd6b0625fe..7d8d4ca88a8e 100644 --- a/usr.sbin/bad144/bad144.c +++ b/usr.sbin/bad144/bad144.c @@ -1,4 +1,4 @@ -/* $NetBSD: bad144.c,v 1.19 2002/06/13 15:27:09 wiz Exp $ */ +/* $NetBSD: bad144.c,v 1.20 2003/01/24 21:55:30 fvdl Exp $ */ /* * Copyright (c) 1980, 1986, 1988, 1993 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1986, 1988, 1993\n\ #if 0 static char sccsid[] = "@(#)bad144.c 8.2 (Berkeley) 4/27/95"; #else -__RCSID("$NetBSD: bad144.c,v 1.19 2002/06/13 15:27:09 wiz Exp $"); +__RCSID("$NetBSD: bad144.c,v 1.20 2003/01/24 21:55:30 fvdl Exp $"); #endif #endif /* not lint */ @@ -185,8 +185,8 @@ main(int argc, char *argv[]) argv++; if (argc == 0) { sn = getold(f, &oldbad); - printf("bad block information at sector %d in %s:\n", - sn, name); + printf("bad block information at sector %lld in %s:\n", + (long long)sn, name); printf("cartridge serial number: %d(10)\n", oldbad.bt_csn); switch (oldbad.bt_flag) { @@ -206,7 +206,8 @@ main(int argc, char *argv[]) bad = (bt->bt_cyl<<16) + bt->bt_trksec; if (bad < 0) break; - printf("sn=%d, cn=%d, tn=%d, sn=%d\n", badsn(bt), + printf("sn=%lld, cn=%d, tn=%d, sn=%d\n", + (long long)badsn(bt), bt->bt_cyl, bt->bt_trksec>>8, bt->bt_trksec&0xff); bt++; } @@ -250,8 +251,8 @@ main(int argc, char *argv[]) sn = atoi(*argv++); argc--; if (sn < 0 || sn >= size) { - printf("%d: out of range [0,%d) for disk %s\n", - sn, size, dp->d_typename); + printf("%lld: out of range [0,%lld) for disk %s\n", + (long long)sn, (long long)size, dp->d_typename); errs++; continue; } @@ -293,8 +294,8 @@ main(int argc, char *argv[]) SEEK_SET) < 0) err(4, "lseek"); if (verbose) - printf("write badsect file at %d\n", - size - dp->d_nsectors + i); + printf("write badsect file at %lld\n", + (long long)size - dp->d_nsectors + i); if (nflag == 0 && write(f, (caddr_t)&curbad, sizeof(curbad)) != sizeof(curbad)) err(4, "write bad sector file %d", i/2); @@ -341,7 +342,7 @@ getold(int f, struct dkbad *bad) printf("Using bad-sector file %d\n", i/2); return(sn); } - warn("read bad sector file at sn %d", sn); + warn("read bad sector file at sn %lld", (long long)sn); if (badfile != -1) break; } @@ -374,8 +375,8 @@ checkold(void) ((bt->bt_trksec >> 8) >= dp->d_ntracks) || ((bt->bt_trksec & 0xff) >= dp->d_nsectors)) { warnx("cyl/trk/sect out of range in existing entry: " - "sn=%d, cn=%d, tn=%d, sn=%d", - badsn(bt), bt->bt_cyl, bt->bt_trksec>>8, + "sn=%lld, cn=%d, tn=%d, sn=%d", + (long long)badsn(bt), bt->bt_cyl, bt->bt_trksec>>8, bt->bt_trksec & 0xff); errors++; } @@ -388,7 +389,8 @@ checkold(void) warned++; } if (i > 0 && sn == lsn) { - warnx("bad sector file contains duplicates (sn %d)", sn); + warnx("bad sector file contains duplicates (sn %lld)", + (long long)sn); errors++; } lsn = sn; @@ -426,8 +428,8 @@ shift(int f, int new, int old) blkzero(f, repl - new); } else { if (blkcopy(f, repl - old, repl - new) == 0) - warnx("Can't copy replacement sector %d to %d", - repl-old, repl-new); + warnx("Can't copy replacement sector %lld to %lld", + (long long)repl-old, (long long)repl-new); old--; } new--; @@ -457,17 +459,17 @@ blkcopy(int f, daddr_t s1, daddr_t s2) } if (n != dp->d_secsize) { if (n < 0) - err(4, "can't read sector, %d", s1); + err(4, "can't read sector, %lld", (long long)s1); else - errx(4, "can't read sector, %d", s1); + errx(4, "can't read sector, %lld", (long long)s1); return(0); } if (lseek(f, (off_t)(dp->d_secsize * s2), SEEK_SET) < 0) err(4, "lseek"); if (verbose) - printf("copying %d to %d\n", s1, s2); + printf("copying %lld to %lld\n", (long long)s1, (long long)s2); if (nflag == 0 && write(f, buf, dp->d_secsize) != dp->d_secsize) { - warn("can't write replacement sector, %d", s2); + warn("can't write replacement sector, %lld", (long long)s2); return(0); } return(1); @@ -484,9 +486,10 @@ blkzero(int f, daddr_t sn) if (lseek(f, (off_t)(dp->d_secsize * sn), SEEK_SET) < 0) err(4, "lseek"); if (verbose) - printf("zeroing %d\n", sn); + printf("zeroing %lld\n", (long long)sn); if (nflag == 0 && write(f, zbuf, dp->d_secsize) != dp->d_secsize) - warn("can't write replacement sector, %d", sn); + warn("can't write replacement sector, %lld", + (long long)sn); } int diff --git a/usr.sbin/dumplfs/dumplfs.c b/usr.sbin/dumplfs/dumplfs.c index 39b8f0635667..020553da8478 100644 --- a/usr.sbin/dumplfs/dumplfs.c +++ b/usr.sbin/dumplfs/dumplfs.c @@ -1,4 +1,4 @@ -/* $NetBSD: dumplfs.c,v 1.19 2001/07/13 20:30:21 perseant Exp $ */ +/* $NetBSD: dumplfs.c,v 1.20 2003/01/24 21:55:31 fvdl Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -45,7 +45,7 @@ __COPYRIGHT( #if 0 static char sccsid[] = "@(#)dumplfs.c 8.5 (Berkeley) 5/24/95"; #else -__RCSID("$NetBSD: dumplfs.c,v 1.19 2001/07/13 20:30:21 perseant Exp $"); +__RCSID("$NetBSD: dumplfs.c,v 1.20 2003/01/24 21:55:31 fvdl Exp $"); #endif #endif /* not lint */ @@ -70,7 +70,7 @@ __RCSID("$NetBSD: dumplfs.c,v 1.19 2001/07/13 20:30:21 perseant Exp $"); static void addseg(char *); static void dump_cleaner_info(struct lfs *, void *); static void dump_dinode(struct dinode *); -static void dump_ifile(int, struct lfs *, int, int, int); +static void dump_ifile(int, struct lfs *, int, int, daddr_t); static int dump_ipage_ifile(struct lfs *, int, char *, int); static int dump_ipage_segusage(struct lfs *, int, char *, int); static void dump_segment(int, int, daddr_t, struct lfs *, int); @@ -207,7 +207,7 @@ main(int argc, char **argv) lfs_master->lfs_fsbtodb = 0; } - (void)printf("Master Superblock at 0x%x:\n", sbdaddr); + (void)printf("Master Superblock at 0x%llx:\n", (long long)sbdaddr); dump_super(lfs_master); dump_ifile(fd, lfs_master, do_ientries, do_segentries, idaddr); @@ -239,7 +239,8 @@ dump_ifile(int fd, struct lfs *lfsp, int do_ientries, int do_segentries, daddr_t { char *ipage; struct dinode *dip, *dpage; - daddr_t *addrp, *dindir, *iaddrp, *indir; + /* XXX ondisk32 */ + int32_t *addrp, *dindir, *iaddrp, *indir; int block_limit, i, inum, j, nblocks, psize; psize = lfsp->lfs_bsize; @@ -255,8 +256,8 @@ dump_ifile(int fd, struct lfs *lfsp, int do_ientries, int do_segentries, daddr_t break; if (dip < dpage) - errx(1, "unable to locate ifile inode at disk address 0x%x", - addr); + errx(1, "unable to locate ifile inode at disk address 0x%llx", + (long long)addr); (void)printf("\nIFILE inode\n"); dump_dinode(dip); @@ -455,7 +456,7 @@ static int dump_sum(int fd, struct lfs *lfsp, SEGSUM *sp, int segnum, daddr_t addr) { FINFO *fp; - daddr_t *dp; + int32_t *dp; int i, j; int ck; int numbytes; @@ -467,19 +468,19 @@ dump_sum(int fd, struct lfs *lfsp, SEGSUM *sp, int segnum, daddr_t addr) /* Don't print "corrupt" if we're just too close to the edge */ if (dtosn(lfsp, addr + fsbtodb(lfsp, 1)) == dtosn(lfsp, addr)) - (void)printf("dumplfs: %s %d address 0x%x\n", + (void)printf("dumplfs: %s %d address 0x%llx\n", "corrupt summary block; segment", segnum, - addr); + (long long)addr); return (0); } if (lfsp->lfs_version > 1 && sp->ss_ident != lfsp->lfs_ident) { - (void)printf("dumplfs: %s %d address 0x%x\n", + (void)printf("dumplfs: %s %d address 0x%llx\n", "summary from a former life; segment", segnum, addr); return (0); } - (void)printf("Segment Summary Info at 0x%x\n", addr); + (void)printf("Segment Summary Info at 0x%llx\n", (long long)addr); (void)printf(" %s0x%x\t%s%d\t%s%d\t%s%c%c\n %s0x%x\t%s0x%x", "next ", sp->ss_next, "nfinfo ", sp->ss_nfinfo, @@ -497,8 +498,8 @@ dump_sum(int fd, struct lfs *lfsp, SEGSUM *sp, int segnum, daddr_t addr) } /* Dump out inode disk addresses */ - dp = (daddr_t *)sp; - dp += lfsp->lfs_sumsize / sizeof(daddr_t); + dp = (int32_t *)sp; + dp += lfsp->lfs_sumsize / sizeof(int32_t); inop = malloc(lfsp->lfs_bsize); printf(" Inode addresses:"); numbytes = 0; @@ -553,8 +554,8 @@ dump_segment(int fd, int segnum, daddr_t addr, struct lfs *lfsp, int dump_sb) off_t sum_offset; daddr_t new_addr; - (void)printf("\nSEGMENT %d (Disk Address 0x%x)\n", dtosn(lfsp, addr), - addr); + (void)printf("\nSEGMENT %lld (Disk Address 0x%llx)\n", + (long long)dtosn(lfsp, addr), (long long)addr); sum_offset = fsbtobyte(lfsp, addr); sumblock = malloc(lfsp->lfs_sumsize); @@ -590,8 +591,8 @@ dump_segment(int fd, int segnum, daddr_t addr, struct lfs *lfsp, int dump_sb) } else if (did_one) break; else { - printf("Segment at 0x%x empty or corrupt\n", - addr); + printf("Segment at 0x%llx empty or corrupt\n", + (long long)addr); break; } } else { diff --git a/usr.sbin/installboot/ffs.c b/usr.sbin/installboot/ffs.c index 3bac9085d67f..10dff9bbc618 100644 --- a/usr.sbin/installboot/ffs.c +++ b/usr.sbin/installboot/ffs.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs.c,v 1.6 2002/05/15 09:44:55 lukem Exp $ */ +/* $NetBSD: ffs.c,v 1.7 2003/01/24 21:55:31 fvdl Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) && !defined(__lint) -__RCSID("$NetBSD: ffs.c,v 1.6 2002/05/15 09:44:55 lukem Exp $"); +__RCSID("$NetBSD: ffs.c,v 1.7 2003/01/24 21:55:31 fvdl Exp $"); #endif /* !__lint */ #include @@ -113,11 +113,12 @@ ffs_find_disk_blocks(ib_params *params, uint32_t ino, char inodebuf[MAXBSIZE]; struct dinode *inode; int level_i; - ufs_daddr_t blk, lblk, nblk; + daddr_t blk, lblk, nblk; int rv; #define LEVELS 4 struct { - ufs_daddr_t *blknums; + /* XXX ondisk32 */ + int32_t *blknums; unsigned long blkcount; char diskbuf[MAXBSIZE]; } level[LEVELS]; @@ -205,8 +206,9 @@ ffs_find_disk_blocks(ib_params *params, uint32_t ino, fsbtodb(fs, blk), fs->fs_bsize, level[level_i].diskbuf)) return (0); + /* XXX ondisk32 */ level[level_i].blknums = - (ufs_daddr_t *)level[level_i].diskbuf; + (int32_t *)level[level_i].diskbuf; level[level_i].blkcount = NINDIR(fs); continue; } diff --git a/usr.sbin/makefs/ffs.c b/usr.sbin/makefs/ffs.c index dd5bb7dffeea..93010f3ef573 100644 --- a/usr.sbin/makefs/ffs.c +++ b/usr.sbin/makefs/ffs.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs.c,v 1.15 2002/05/30 18:16:41 thorpej Exp $ */ +/* $NetBSD: ffs.c,v 1.16 2003/01/24 21:55:32 fvdl Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -71,7 +71,7 @@ #include #if defined(__RCSID) && !defined(__lint) -__RCSID("$NetBSD: ffs.c,v 1.15 2002/05/30 18:16:41 thorpej Exp $"); +__RCSID("$NetBSD: ffs.c,v 1.16 2003/01/24 21:55:32 fvdl Exp $"); #endif /* !__lint */ #include @@ -308,8 +308,9 @@ ffs_validate(const char *dir, fsnode *root, fsinfo_t *fsopts) MAX(1, MIN(MAXPHYS, MAXBSIZE) / fsopts->bsize); if (fsopts->rotdelay == -1) fsopts->rotdelay = DFL_ROTDELAY; + /* XXX ondisk32 */ if (fsopts->maxbpg == -1) - fsopts->maxbpg = fsopts->bsize / sizeof(ufs_daddr_t); + fsopts->maxbpg = fsopts->bsize / sizeof(int32_t); if (fsopts->nrpos == -1) fsopts->nrpos = DFL_NRPOS; if (fsopts->avgfilesize == -1) diff --git a/usr.sbin/makefs/ffs/buf.c b/usr.sbin/makefs/ffs/buf.c index 6e777527ca24..0a85da8d6114 100644 --- a/usr.sbin/makefs/ffs/buf.c +++ b/usr.sbin/makefs/ffs/buf.c @@ -1,4 +1,4 @@ -/* $NetBSD: buf.c,v 1.9 2002/01/31 22:44:03 tv Exp $ */ +/* $NetBSD: buf.c,v 1.10 2003/01/24 21:55:32 fvdl Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(__lint) -__RCSID("$NetBSD: buf.c,v 1.9 2002/01/31 22:44:03 tv Exp $"); +__RCSID("$NetBSD: buf.c,v 1.10 2003/01/24 21:55:32 fvdl Exp $"); #endif /* !__lint */ #include @@ -71,13 +71,13 @@ bread(int fd, struct fs *fs, daddr_t blkno, int size, struct buf **bpp) assert (bpp != NULL); if (debug & DEBUG_BUF_BREAD) - printf("bread: fs %p blkno %d size %d\n", - fs, blkno, size); + printf("bread: fs %p blkno %lld size %d\n", + fs, (long long)blkno, size); *bpp = getblk(fd, fs, blkno, size); offset = (*bpp)->b_blkno * sectorsize; /* XXX */ if (debug & DEBUG_BUF_BREAD) - printf("bread: bp %p blkno %d offset %lld bcount %ld\n", - (*bpp), (*bpp)->b_blkno, (long long) offset, + printf("bread: bp %p blkno %lld offset %lld bcount %ld\n", + (*bpp), (long long)(*bpp)->b_blkno, (long long) offset, (*bpp)->b_bcount); if (lseek((*bpp)->b_fd, offset, SEEK_SET) == -1) err(1, "bread: lseek %lld (%lld)", @@ -135,8 +135,9 @@ bwrite(struct buf *bp) assert (bp != NULL); offset = bp->b_blkno * sectorsize; /* XXX */ if (debug & DEBUG_BUF_BWRITE) - printf("bwrite: bp %p blkno %d offset %lld bcount %ld\n", - bp, bp->b_blkno, (long long) offset, bp->b_bcount); + printf("bwrite: bp %p blkno %lld offset %lld bcount %ld\n", + bp, (long long)bp->b_blkno, (long long) offset, + bp->b_bcount); if (lseek(bp->b_fd, offset, SEEK_SET) == -1) return (errno); rv = write(bp->b_fd, bp->b_data, bp->b_bcount); @@ -167,8 +168,9 @@ bcleanup(void) printf("bcleanup: unflushed buffers:\n"); TAILQ_FOREACH(bp, &buftail, b_tailq) { - printf("\tlblkno %10d blkno %10d count %6ld bufsize %6ld\n", - bp->b_lblkno, bp->b_blkno, bp->b_bcount, bp->b_bufsize); + printf("\tlblkno %10lld blkno %10lld count %6ld bufsize %6ld\n", + (long long)bp->b_lblkno, (long long)bp->b_blkno, + bp->b_bcount, bp->b_bufsize); } printf("bcleanup: done\n"); } @@ -181,7 +183,8 @@ getblk(int fd, struct fs *fs, daddr_t blkno, int size) assert (fs != NULL); if (debug & DEBUG_BUF_GETBLK) - printf("getblk: fs %p blkno %d size %d\n", fs, blkno, size); + printf("getblk: fs %p blkno %lld size %d\n", fs, + (long long)blkno, size); bp = NULL; if (!buftailinitted) { diff --git a/usr.sbin/makefs/ffs/ffs_alloc.c b/usr.sbin/makefs/ffs/ffs_alloc.c index 56332ea5906b..662731984e35 100644 --- a/usr.sbin/makefs/ffs/ffs_alloc.c +++ b/usr.sbin/makefs/ffs/ffs_alloc.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_alloc.c,v 1.10 2002/07/20 08:40:18 grant Exp $ */ +/* $NetBSD: ffs_alloc.c,v 1.11 2003/01/24 21:55:32 fvdl Exp $ */ /* From: NetBSD: ffs_alloc.c,v 1.50 2001/09/06 02:16:01 lukem Exp */ /* @@ -38,7 +38,7 @@ #include #if defined(__RCSID) && !defined(__lint) -__RCSID("$NetBSD: ffs_alloc.c,v 1.10 2002/07/20 08:40:18 grant Exp $"); +__RCSID("$NetBSD: ffs_alloc.c,v 1.11 2003/01/24 21:55:32 fvdl Exp $"); #endif /* !__lint */ #include @@ -59,11 +59,11 @@ __RCSID("$NetBSD: ffs_alloc.c,v 1.10 2002/07/20 08:40:18 grant Exp $"); static int scanc(u_int, const u_char *, const u_char *, int); -static ufs_daddr_t ffs_alloccg(struct inode *, int, ufs_daddr_t, int); -static ufs_daddr_t ffs_alloccgblk(struct inode *, struct buf *, ufs_daddr_t); -static u_long ffs_hashalloc(struct inode *, int, long, int, - ufs_daddr_t (*)(struct inode *, int, ufs_daddr_t, int)); -static ufs_daddr_t ffs_mapsearch(struct fs *, struct cg *, ufs_daddr_t, int); +static daddr_t ffs_alloccg(struct inode *, int, daddr_t, int); +static daddr_t ffs_alloccgblk(struct inode *, struct buf *, daddr_t); +static daddr_t ffs_hashalloc(struct inode *, int, daddr_t, int, + daddr_t (*)(struct inode *, int, daddr_t, int)); +static daddr_t ffs_mapsearch(struct fs *, struct cg *, daddr_t, int); /* in ffs_tables.c */ extern const int inside[], around[]; @@ -89,11 +89,11 @@ extern const u_char * const fragtbl[]; * available block is located. */ int -ffs_alloc(struct inode *ip, ufs_daddr_t lbn, ufs_daddr_t bpref, int size, - ufs_daddr_t *bnp) +ffs_alloc(struct inode *ip, daddr_t lbn, daddr_t bpref, int size, + daddr_t *bnp) { struct fs *fs = ip->i_fs; - ufs_daddr_t bno; + daddr_t bno; int cg; *bnp = 0; @@ -109,8 +109,7 @@ ffs_alloc(struct inode *ip, ufs_daddr_t lbn, ufs_daddr_t bpref, int size, cg = ino_to_cg(fs, ip->i_number); else cg = dtog(fs, bpref); - bno = (ufs_daddr_t)ffs_hashalloc(ip, cg, (long)bpref, size, - ffs_alloccg); + bno = ffs_hashalloc(ip, cg, bpref, size, ffs_alloccg); if (bno > 0) { ip->i_ffs_blocks += size / DEV_BSIZE; *bnp = bno; @@ -146,13 +145,14 @@ nospace: * fs_rotdelay milliseconds. This is to allow time for the processor to * schedule another I/O transfer. */ -ufs_daddr_t -ffs_blkpref(struct inode *ip, ufs_daddr_t lbn, int indx, ufs_daddr_t *bap) +/* XXX ondisk32 */ +daddr_t +ffs_blkpref(struct inode *ip, daddr_t lbn, int indx, int32_t *bap) { struct fs *fs; int cg; int avgbfree, startcg; - ufs_daddr_t nextblk; + daddr_t nextblk; fs = ip->i_fs; if (indx % fs->fs_maxbpg == 0 || bap[indx - 1] == 0) { @@ -190,6 +190,7 @@ ffs_blkpref(struct inode *ip, ufs_daddr_t lbn, int indx, ufs_daddr_t *bap) * next block is requested contiguously, otherwise it is * requested rotationally delayed by fs_rotdelay milliseconds. */ + /* XXX ondisk32 */ nextblk = ufs_rw32(bap[indx - 1], UFS_FSNEEDSWAP(fs)) + fs->fs_frag; if (indx < fs->fs_maxcontig || ufs_rw32(bap[indx - fs->fs_maxcontig], UFS_FSNEEDSWAP(fs)) + @@ -218,12 +219,12 @@ ffs_blkpref(struct inode *ip, ufs_daddr_t lbn, int indx, ufs_daddr_t *bap) * `size': size for data blocks, mode for inodes */ /*VARARGS5*/ -static u_long -ffs_hashalloc(struct inode *ip, int cg, long pref, int size, - ufs_daddr_t (*allocator)(struct inode *, int, ufs_daddr_t, int)) +static daddr_t +ffs_hashalloc(struct inode *ip, int cg, daddr_t pref, int size, + daddr_t (*allocator)(struct inode *, int, daddr_t, int)) { struct fs *fs; - long result; + daddr_t result; int i, icg = cg; fs = ip->i_fs; @@ -267,12 +268,12 @@ ffs_hashalloc(struct inode *ip, int cg, long pref, int size, * Check to see if a block of the appropriate size is available, * and if it is, allocate it. */ -static ufs_daddr_t -ffs_alloccg(struct inode *ip, int cg, ufs_daddr_t bpref, int size) +static daddr_t +ffs_alloccg(struct inode *ip, int cg, daddr_t bpref, int size) { struct cg *cgp; struct buf *bp; - ufs_daddr_t bno, blkno; + daddr_t bno, blkno; int error, frags, allocsiz, i; struct fs *fs = ip->i_fs; const int needswap = UFS_FSNEEDSWAP(fs); @@ -353,11 +354,11 @@ ffs_alloccg(struct inode *ip, int cg, ufs_daddr_t bpref, int size) * Note that this routine only allocates fs_bsize blocks; these * blocks may be fragmented by the routine that allocates them. */ -static ufs_daddr_t -ffs_alloccgblk(struct inode *ip, struct buf *bp, ufs_daddr_t bpref) +static daddr_t +ffs_alloccgblk(struct inode *ip, struct buf *bp, daddr_t bpref) { struct cg *cgp; - ufs_daddr_t bno, blkno; + daddr_t bno, blkno; int cylno, pos, delta; short *cylbp; int i; @@ -365,6 +366,7 @@ ffs_alloccgblk(struct inode *ip, struct buf *bp, ufs_daddr_t bpref) const int needswap = UFS_FSNEEDSWAP(fs); cgp = (struct cg *)bp->b_data; + /* XXX ondisk32 */ if (bpref == 0 || dtog(fs, bpref) != ufs_rw32(cgp->cg_cgx, needswap)) { bpref = ufs_rw32(cgp->cg_rotor, needswap); goto norot; @@ -444,7 +446,8 @@ norot: bno = ffs_mapsearch(fs, cgp, bpref, (int)fs->fs_frag); if (bno < 0) return (0); - cgp->cg_rotor = ufs_rw32(bno, needswap); + /* XXX ondisk32 */ + cgp->cg_rotor = ufs_rw64(bno, needswap); gotit: blkno = fragstoblks(fs, bno); ffs_clrblock(fs, cg_blksfree(cgp, needswap), (long)blkno); @@ -457,6 +460,7 @@ gotit: needswap); ufs_add32(cg_blktot(cgp, needswap)[cylno], -1, needswap); fs->fs_fmod = 1; + /* XXX ondisk32 */ blkno = ufs_rw32(cgp->cg_cgx, needswap) * fs->fs_fpg + bno; return (blkno); } @@ -469,23 +473,23 @@ gotit: * block reassembly is checked. */ void -ffs_blkfree(struct inode *ip, ufs_daddr_t bno, long size) +ffs_blkfree(struct inode *ip, daddr_t bno, long size) { struct cg *cgp; struct buf *bp; - ufs_daddr_t blkno; + daddr_t blkno; int i, error, cg, blk, frags, bbase; struct fs *fs = ip->i_fs; const int needswap = UFS_FSNEEDSWAP(fs); if ((u_int)size > fs->fs_bsize || fragoff(fs, size) != 0 || fragnum(fs, bno) + numfrags(fs, size) > fs->fs_frag) { - errx(1, "blkfree: bad size: bno %u bsize %d size %ld", - bno, fs->fs_bsize, size); + errx(1, "blkfree: bad size: bno %lld bsize %d size %ld", + (long long)bno, fs->fs_bsize, size); } cg = dtog(fs, bno); if ((u_int)bno >= fs->fs_size) { - warnx("bad block %d, ino %d", bno, ip->i_number); + warnx("bad block %lld, ino %d", (long long)bno, ip->i_number); return; } error = bread(ip->i_fd, ip->i_fs, fsbtodb(fs, cgtod(fs, cg)), @@ -503,7 +507,8 @@ ffs_blkfree(struct inode *ip, ufs_daddr_t bno, long size) if (size == fs->fs_bsize) { blkno = fragstoblks(fs, bno); if (!ffs_isfreeblock(fs, cg_blksfree(cgp, needswap), blkno)) { - errx(1, "blkfree: freeing free block %d", bno); + errx(1, "blkfree: freeing free block %lld", + (long long)bno); } ffs_setblock(fs, cg_blksfree(cgp, needswap), blkno); ffs_clusteracct(fs, cgp, blkno, 1); @@ -527,8 +532,8 @@ ffs_blkfree(struct inode *ip, ufs_daddr_t bno, long size) frags = numfrags(fs, size); for (i = 0; i < frags; i++) { if (isset(cg_blksfree(cgp, needswap), bno + i)) { - errx(1, "blkfree: freeing free frag: block %d", - bno + i); + errx(1, "blkfree: freeing free frag: block %lld", + (long long)(bno + i)); } setbit(cg_blksfree(cgp, needswap), bno + i); } @@ -580,10 +585,10 @@ scanc(u_int size, const u_char *cp, const u_char table[], int mask) * It is a panic if a request is made to find a block if none are * available. */ -static ufs_daddr_t -ffs_mapsearch(struct fs *fs, struct cg *cgp, ufs_daddr_t bpref, int allocsiz) +static daddr_t +ffs_mapsearch(struct fs *fs, struct cg *cgp, daddr_t bpref, int allocsiz) { - ufs_daddr_t bno; + daddr_t bno; int start, len, loc, i; int blk, field, subfield, pos; int ostart, olen; @@ -638,7 +643,7 @@ ffs_mapsearch(struct fs *fs, struct cg *cgp, ufs_daddr_t bpref, int allocsiz) subfield <<= 1; } } - errx(1, "ffs_alloccg: block not in map: bno %d", bno); + errx(1, "ffs_alloccg: block not in map: bno %lld", (long long)bno); return (-1); } @@ -648,7 +653,7 @@ ffs_mapsearch(struct fs *fs, struct cg *cgp, ufs_daddr_t bpref, int allocsiz) * Cnt == 1 means free; cnt == -1 means allocating. */ void -ffs_clusteracct(struct fs *fs, struct cg *cgp, ufs_daddr_t blkno, int cnt) +ffs_clusteracct(struct fs *fs, struct cg *cgp, daddr_t blkno, int cnt) { int32_t *sump; int32_t *lp; diff --git a/usr.sbin/makefs/ffs/ffs_balloc.c b/usr.sbin/makefs/ffs/ffs_balloc.c index 1839a03be158..b32b048be8c3 100644 --- a/usr.sbin/makefs/ffs/ffs_balloc.c +++ b/usr.sbin/makefs/ffs/ffs_balloc.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_balloc.c,v 1.9 2002/01/31 22:44:04 tv Exp $ */ +/* $NetBSD: ffs_balloc.c,v 1.10 2003/01/24 21:55:32 fvdl Exp $ */ /* From NetBSD: ffs_balloc.c,v 1.25 2001/08/08 08:36:36 lukem Exp */ /* @@ -38,7 +38,7 @@ #include #if defined(__RCSID) && !defined(__lint) -__RCSID("$NetBSD: ffs_balloc.c,v 1.9 2002/01/31 22:44:04 tv Exp $"); +__RCSID("$NetBSD: ffs_balloc.c,v 1.10 2003/01/24 21:55:32 fvdl Exp $"); #endif /* !__lint */ #include @@ -70,15 +70,17 @@ __RCSID("$NetBSD: ffs_balloc.c,v 1.9 2002/01/31 22:44:04 tv Exp $"); int ffs_balloc(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) { - ufs_daddr_t lbn; + daddr_t lbn; int size; - ufs_daddr_t nb; + daddr_t nb; struct buf *bp, *nbp; struct fs *fs = ip->i_fs; struct indir indirs[NIADDR + 2]; - ufs_daddr_t newb, *bap, pref; + daddr_t newb, pref; + int32_t *bap; /* XXX ondisk32 */ int osize, nsize, num, i, error; - ufs_daddr_t *allocib, *allocblk, allociblk[NIADDR + 1]; + daddr_t *allocblk, allociblk[NIADDR + 1]; + int32_t *allocib; /* XXX ondisk32 */ const int needswap = UFS_FSNEEDSWAP(fs); lbn = lblkno(fs, offset); @@ -111,6 +113,7 @@ ffs_balloc(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) */ if (lbn < NDADDR) { + /* XXX ondisk32 */ nb = ufs_rw32(ip->i_ffs_db[lbn], needswap); if (nb != 0 && ip->i_ffs_size >= lblktosize(fs, lbn + 1)) { @@ -183,7 +186,8 @@ ffs_balloc(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) *bpp = bp; } } - ip->i_ffs_db[lbn] = ufs_rw32(newb, needswap); + /* XXX ondisk32 */ + ip->i_ffs_db[lbn] = ufs_rw32((int32_t)newb, needswap); return (0); } /* @@ -205,7 +209,7 @@ ffs_balloc(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) allocib = NULL; allocblk = allociblk; if (nb == 0) { - pref = ffs_blkpref(ip, lbn, 0, (ufs_daddr_t *)0); + pref = ffs_blkpref(ip, lbn, 0, (int32_t *)0); error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, &newb); if (error) return (error); @@ -221,7 +225,8 @@ ffs_balloc(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) if ((error = bwrite(bp)) != 0) goto fail; allocib = &ip->i_ffs_ib[indirs[0].in_off]; - *allocib = ufs_rw32(nb, needswap); + /* XXX ondisk32 */ + *allocib = ufs_rw32((int32_t)nb, needswap); } /* * Fetch through the indirect blocks, allocating as necessary. @@ -233,7 +238,8 @@ ffs_balloc(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) brelse(bp); goto fail; } - bap = (ufs_daddr_t *)bp->b_data; + /* XXX ondisk32 */ + bap = (int32_t *)bp->b_data; nb = ufs_rw32(bap[indirs[i].in_off], needswap); if (i == num) break; @@ -243,7 +249,7 @@ ffs_balloc(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) continue; } if (pref == 0) - pref = ffs_blkpref(ip, lbn, 0, (ufs_daddr_t *)0); + pref = ffs_blkpref(ip, lbn, 0, (int32_t *)0); error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, &newb); if (error) { brelse(bp); @@ -288,7 +294,8 @@ ffs_balloc(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) clrbuf(nbp); *bpp = nbp; } - bap[indirs[num].in_off] = ufs_rw32(nb, needswap); + /* XXX ondisk32 */ + bap[indirs[num].in_off] = ufs_rw32((int32_t)nb, needswap); /* * If required, write synchronously, otherwise use * delayed write. diff --git a/usr.sbin/makefs/ffs/ffs_extern.h b/usr.sbin/makefs/ffs/ffs_extern.h index 3b95b1cbab7c..990483a4961f 100644 --- a/usr.sbin/makefs/ffs/ffs_extern.h +++ b/usr.sbin/makefs/ffs/ffs_extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_extern.h,v 1.2 2002/01/07 16:56:27 lukem Exp $ */ +/* $NetBSD: ffs_extern.h,v 1.3 2003/01/24 21:55:32 fvdl Exp $ */ /* From: NetBSD: ffs_extern.h,v 1.19 2001/08/17 02:18:48 lukem Exp */ /*- @@ -43,7 +43,7 @@ * ufs_getlbns and used by truncate and bmap code. */ struct indir { - ufs_daddr_t in_lbn; /* Logical block number. */ + daddr_t in_lbn; /* Logical block number. */ int in_off; /* Offset in buffer. */ int in_exists; /* Flag if the block exists. */ }; @@ -53,10 +53,11 @@ void panic(const char *, ...) __attribute__((__noreturn__,__format__(__printf__,1,2))); /* ffs_alloc.c */ -int ffs_alloc(struct inode *, ufs_daddr_t, ufs_daddr_t, int, ufs_daddr_t *); -ufs_daddr_t ffs_blkpref(struct inode *, ufs_daddr_t, int, ufs_daddr_t *); -void ffs_blkfree(struct inode *, ufs_daddr_t, long); -void ffs_clusteracct(struct fs *, struct cg *, ufs_daddr_t, int); +int ffs_alloc(struct inode *, daddr_t, daddr_t, int, daddr_t *); +/* XXX ondisk32 */ +daddr_t ffs_blkpref(struct inode *, daddr_t, int, int32_t *); +void ffs_blkfree(struct inode *, daddr_t, long); +void ffs_clusteracct(struct fs *, struct cg *, daddr_t, int); /* ffs_balloc.c */ int ffs_balloc(struct inode *, off_t, int, struct buf **); @@ -68,10 +69,10 @@ void ffs_csum_swap(struct csum *, struct csum *, int); /* ffs_subr.c */ void ffs_fragacct(struct fs *, int, int32_t[], int, int); -int ffs_isblock(struct fs *, u_char *, ufs_daddr_t); -int ffs_isfreeblock(struct fs *, u_char *, ufs_daddr_t); -void ffs_clrblock(struct fs *, u_char *, ufs_daddr_t); -void ffs_setblock(struct fs *, u_char *, ufs_daddr_t); +int ffs_isblock(struct fs *, u_char *, daddr_t); +int ffs_isfreeblock(struct fs *, u_char *, daddr_t); +void ffs_clrblock(struct fs *, u_char *, daddr_t); +void ffs_setblock(struct fs *, u_char *, daddr_t); /* ufs_bmap.c */ -int ufs_getlbns(struct inode *, ufs_daddr_t, struct indir *, int *); +int ufs_getlbns(struct inode *, daddr_t, struct indir *, int *); diff --git a/usr.sbin/makefs/ffs/mkfs.c b/usr.sbin/makefs/ffs/mkfs.c index ef76a123220d..27b650e2a979 100644 --- a/usr.sbin/makefs/ffs/mkfs.c +++ b/usr.sbin/makefs/ffs/mkfs.c @@ -1,4 +1,4 @@ -/* $NetBSD: mkfs.c,v 1.11 2002/08/08 13:24:15 soren Exp $ */ +/* $NetBSD: mkfs.c,v 1.12 2003/01/24 21:55:33 fvdl Exp $ */ /* From NetBSD: mkfs.c,v 1.59 2001/12/31 07:07:58 lukem Exp $ */ /* @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95"; #else -__RCSID("$NetBSD: mkfs.c,v 1.11 2002/08/08 13:24:15 soren Exp $"); +__RCSID("$NetBSD: mkfs.c,v 1.12 2003/01/24 21:55:33 fvdl Exp $"); #endif #endif /* not lint */ @@ -256,13 +256,15 @@ ffs_mkfs(const char *fsys, const fsinfo_t *fsopts) exit(21); } sblock.fs_nrpos = nrpos; - sblock.fs_nindir = sblock.fs_bsize / sizeof(daddr_t); + /* XXX ondisk32 */ + sblock.fs_nindir = sblock.fs_bsize / sizeof(int32_t); sblock.fs_inopb = sblock.fs_bsize / DINODE_SIZE; sblock.fs_nspf = sblock.fs_fsize / sectorsize; for (sblock.fs_fsbtodb = 0, i = NSPF(&sblock); i > 1; i >>= 1) sblock.fs_fsbtodb++; sblock.fs_sblkno = roundup(howmany(bbsize + sbsize, sblock.fs_fsize), sblock.fs_frag); + /* XXX ondisk32 */ sblock.fs_cblkno = (daddr_t)(sblock.fs_sblkno + roundup(howmany(sbsize, sblock.fs_fsize), sblock.fs_frag)); sblock.fs_iblkno = sblock.fs_cblkno + sblock.fs_frag; @@ -522,8 +524,9 @@ next: sblock.fs_dblkno = sblock.fs_iblkno + sblock.fs_ipg / INOPF(&sblock); i = MIN(~sblock.fs_cgmask, sblock.fs_ncg - 1); if (cgdmin(&sblock, i) - cgbase(&sblock, i) >= sblock.fs_fpg) { - printf("inode blocks/cyl group (%d) >= data blocks (%d)\n", - cgdmin(&sblock, i) - cgbase(&sblock, i) / sblock.fs_frag, + printf("inode blocks/cyl group (%lld) >= data blocks (%d)\n", + (long long)cgdmin(&sblock, i) - + cgbase(&sblock, i) / sblock.fs_frag, sblock.fs_fpg / sblock.fs_frag); printf("number of cylinders per cylinder group (%d) %s.\n", sblock.fs_cpg, "must be increased"); @@ -533,14 +536,15 @@ next: if ((i = fssize - j * sblock.fs_fpg) < sblock.fs_fpg && cgdmin(&sblock, j) - cgbase(&sblock, j) > i) { if (j == 0) { - printf("File system must have at least %d sectors\n", - NSPF(&sblock) * + printf("File system must have at least %lld sectors\n", + (long long)NSPF(&sblock) * (cgdmin(&sblock, 0) + 3 * sblock.fs_frag)); exit(30); } - printf("Warning: inode blocks/cyl group (%d) >= " + printf("Warning: inode blocks/cyl group (%lld) >= " "data blocks (%d) in last\n", - (cgdmin(&sblock, j) - cgbase(&sblock, j)) / sblock.fs_frag, + (long long)(cgdmin(&sblock, j) - cgbase(&sblock, j)) + / sblock.fs_frag, i / sblock.fs_frag); printf(" cylinder group. This implies %d sector(s) " "cannot be allocated.\n", @@ -639,8 +643,8 @@ next: initcg(cylno, start_time.tv_sec, fsopts); if (cylno % nprintcols == 0) printf("\n"); - printf(" %*d,", printcolwidth, - fsbtodb(&sblock, cgsblock(&sblock, cylno))); + printf(" %*lld,", printcolwidth, + (long long)fsbtodb(&sblock, cgsblock(&sblock, cylno))); fflush(stdout); } printf("\n"); @@ -908,14 +912,15 @@ ffs_rdfs(daddr_t bno, int size, void *bf, const fsinfo_t *fsopts) offset = bno; offset *= fsopts->sectorsize; if (lseek(fsopts->fd, offset, SEEK_SET) < 0) - err(1, "ffs_rdfs: seek error: %d", bno); + err(1, "ffs_rdfs: seek error: %lld", (long long)bno); n = read(fsopts->fd, bf, size); if (n == -1) - err(1, "ffs_rdfs: read error bno %d size %d", bno, size); + err(1, "ffs_rdfs: read error bno %lld size %d", (long long)bno, + size); else if (n != size) errx(1, - "ffs_rdfs: read error bno %d size %d: short read of %d", - bno, size, n); + "ffs_rdfs: read error bno %lld size %d: short read of %d", + (long long)bno, size, n); } /* @@ -930,14 +935,14 @@ ffs_wtfs(daddr_t bno, int size, void *bf, const fsinfo_t *fsopts) offset = bno; offset *= fsopts->sectorsize; if (lseek(fsopts->fd, offset, SEEK_SET) < 0) - err(1, "ffs_wtfs: seek error: %d", bno); + err(1, "ffs_wtfs: seek error: %lld", (long long)bno); n = write(fsopts->fd, bf, size); if (n == -1) - err(1, "ffs_wtfs: write error bno %d size %d", bno, size); + err(1, "ffs_wtfs: write error bno %lld size %d", (long long)bno, size); else if (n != size) errx(1, - "ffs_wtfs: write error bno %d size %d: short write of %d", - bno, size, n); + "ffs_wtfs: write error bno %lld size %d: short write of %d", + (long long)bno, size, n); } /* swap byte order of cylinder group */ diff --git a/usr.sbin/makefs/ffs/ufs_bmap.c b/usr.sbin/makefs/ffs/ufs_bmap.c index a8bf59f7afcb..e3dffe41e0a2 100644 --- a/usr.sbin/makefs/ffs/ufs_bmap.c +++ b/usr.sbin/makefs/ffs/ufs_bmap.c @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_bmap.c,v 1.11 2002/01/31 19:37:15 tv Exp $ */ +/* $NetBSD: ufs_bmap.c,v 1.12 2003/01/24 21:55:33 fvdl Exp $ */ /* From: NetBSD: ufs_bmap.c,v 1.14 2001/11/08 05:00:51 chs Exp */ /* @@ -43,7 +43,7 @@ #include #if defined(__RCSID) && !defined(__lint) -__RCSID("$NetBSD: ufs_bmap.c,v 1.11 2002/01/31 19:37:15 tv Exp $"); +__RCSID("$NetBSD: ufs_bmap.c,v 1.12 2003/01/24 21:55:33 fvdl Exp $"); #endif /* !__lint */ #include @@ -72,9 +72,9 @@ __RCSID("$NetBSD: ufs_bmap.c,v 1.11 2002/01/31 19:37:15 tv Exp $"); * once with the offset into the page itself. */ int -ufs_getlbns(struct inode *ip, ufs_daddr_t bn, struct indir *ap, int *nump) +ufs_getlbns(struct inode *ip, daddr_t bn, struct indir *ap, int *nump) { - long metalbn, realbn; + daddr_t metalbn, realbn; int64_t blockcnt; int lbc; int i, numlevels, off; diff --git a/usr.sbin/quotacheck/quotacheck.c b/usr.sbin/quotacheck/quotacheck.c index 091df174e5d7..317c2f09b7a9 100644 --- a/usr.sbin/quotacheck/quotacheck.c +++ b/usr.sbin/quotacheck/quotacheck.c @@ -1,4 +1,4 @@ -/* $NetBSD: quotacheck.c,v 1.23 2002/12/10 22:42:00 bouyer Exp $ */ +/* $NetBSD: quotacheck.c,v 1.24 2003/01/24 21:55:33 fvdl Exp $ */ /* * Copyright (c) 1980, 1990, 1993 @@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1990, 1993\n\ #if 0 static char sccsid[] = "@(#)quotacheck.c 8.6 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: quotacheck.c,v 1.23 2002/12/10 22:42:00 bouyer Exp $"); +__RCSID("$NetBSD: quotacheck.c,v 1.24 2003/01/24 21:55:33 fvdl Exp $"); #endif #endif /* not lint */ @@ -671,7 +671,7 @@ bread(bno, buf, cnt) if (lseek(fi, (off_t)bno * dev_bsize, SEEK_SET) < 0 || read(fi, buf, cnt) != cnt) - err(1, "block %d", bno); + err(1, "block %lld", (long long)bno); } void