CVS commit: src/usr.sbin/makefs/ffs
Module Name:src Committed By: kre Date: Thu Mar 26 04:25:28 UTC 2020 Modified Files: src/usr.sbin/makefs/ffs: mkfs.c Log Message: Fix the build, use %jd and (intmax_t) cast for big numbers, off_t and ptrdiff_t aren't always the same size. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/makefs/ffs/mkfs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/makefs/ffs/mkfs.c diff -u src/usr.sbin/makefs/ffs/mkfs.c:1.38 src/usr.sbin/makefs/ffs/mkfs.c:1.39 --- src/usr.sbin/makefs/ffs/mkfs.c:1.38 Wed Mar 25 20:17:48 2020 +++ src/usr.sbin/makefs/ffs/mkfs.c Thu Mar 26 04:25:28 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: mkfs.c,v 1.38 2020/03/25 20:17:48 christos Exp $ */ +/* $NetBSD: mkfs.c,v 1.39 2020/03/26 04:25:28 kre Exp $ */ /* * Copyright (c) 2002 Networks Associates Technology, Inc. @@ -48,7 +48,7 @@ static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95"; #else #ifdef __RCSID -__RCSID("$NetBSD: mkfs.c,v 1.38 2020/03/25 20:17:48 christos Exp $"); +__RCSID("$NetBSD: mkfs.c,v 1.39 2020/03/26 04:25:28 kre Exp $"); #endif #endif #endif /* not lint */ @@ -821,8 +821,8 @@ ffs_wtfs(daddr_t bno, int size, void *bf offset = bno * fsopts->sectorsize + fsopts->offset; if (lseek(fsopts->fd, offset, SEEK_SET) == -1) - err(EXIT_FAILURE, "%s: seek error @%td for sector %jd", - __func__, offset, (intmax_t)bno); + err(EXIT_FAILURE, "%s: seek error @%jd for sector %jd", + __func__, (intmax_t)offset, (intmax_t)bno); n = write(fsopts->fd, bf, size); if (n == -1) err(EXIT_FAILURE, "%s: write error for sector %jd", __func__,
CVS commit: src/usr.sbin/makefs/ffs
Module Name:src Committed By: christos Date: Wed Mar 25 20:17:48 UTC 2020 Modified Files: src/usr.sbin/makefs/ffs: mkfs.c Log Message: improve error messages. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/usr.sbin/makefs/ffs/mkfs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/makefs/ffs/mkfs.c diff -u src/usr.sbin/makefs/ffs/mkfs.c:1.37 src/usr.sbin/makefs/ffs/mkfs.c:1.38 --- src/usr.sbin/makefs/ffs/mkfs.c:1.37 Wed Feb 8 23:42:53 2017 +++ src/usr.sbin/makefs/ffs/mkfs.c Wed Mar 25 16:17:48 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: mkfs.c,v 1.37 2017/02/09 04:42:53 kre Exp $ */ +/* $NetBSD: mkfs.c,v 1.38 2020/03/25 20:17:48 christos Exp $ */ /* * Copyright (c) 2002 Networks Associates Technology, Inc. @@ -48,7 +48,7 @@ static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95"; #else #ifdef __RCSID -__RCSID("$NetBSD: mkfs.c,v 1.37 2017/02/09 04:42:53 kre Exp $"); +__RCSID("$NetBSD: mkfs.c,v 1.38 2020/03/25 20:17:48 christos Exp $"); #endif #endif #endif /* not lint */ @@ -821,15 +821,15 @@ ffs_wtfs(daddr_t bno, int size, void *bf offset = bno * fsopts->sectorsize + fsopts->offset; if (lseek(fsopts->fd, offset, SEEK_SET) == -1) - err(EXIT_FAILURE, "%s: seek error for sector %lld", __func__, - (long long)bno); + err(EXIT_FAILURE, "%s: seek error @%td for sector %jd", + __func__, offset, (intmax_t)bno); n = write(fsopts->fd, bf, size); if (n == -1) - err(EXIT_FAILURE, "%s: write error for sector %lld", __func__, - (long long)bno); + err(EXIT_FAILURE, "%s: write error for sector %jd", __func__, + (intmax_t)bno); else if (n != size) - errx(EXIT_FAILURE, "%s: short write error for sector %lld", - __func__, (long long)bno); + errx(EXIT_FAILURE, "%s: short write error for sector %jd", + __func__, (intmax_t)bno); }
CVS commit: src/usr.sbin/makefs/ffs
Module Name:src Committed By: christos Date: Thu Feb 16 22:10:50 UTC 2017 Modified Files: src/usr.sbin/makefs/ffs: buf.h Log Message: need To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/makefs/ffs/buf.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/makefs/ffs/buf.h diff -u src/usr.sbin/makefs/ffs/buf.h:1.11 src/usr.sbin/makefs/ffs/buf.h:1.12 --- src/usr.sbin/makefs/ffs/buf.h:1.11 Thu Feb 16 14:11:13 2017 +++ src/usr.sbin/makefs/ffs/buf.h Thu Feb 16 17:10:50 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: buf.h,v 1.11 2017/02/16 19:11:13 christos Exp $ */ +/* $NetBSD: buf.h,v 1.12 2017/02/16 22:10:50 christos Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -40,6 +40,7 @@ #include #include +#include #include #include
CVS commit: src/usr.sbin/makefs/ffs
Module Name:src Committed By: christos Date: Thu Feb 16 19:11:13 UTC 2017 Modified Files: src/usr.sbin/makefs/ffs: buf.h Log Message: fix msdos reproducible builds! To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/makefs/ffs/buf.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/makefs/ffs/buf.h diff -u src/usr.sbin/makefs/ffs/buf.h:1.10 src/usr.sbin/makefs/ffs/buf.h:1.11 --- src/usr.sbin/makefs/ffs/buf.h:1.10 Sun Mar 29 01:52:59 2015 +++ src/usr.sbin/makefs/ffs/buf.h Thu Feb 16 14:11:13 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: buf.h,v 1.10 2015/03/29 05:52:59 agc Exp $ */ +/* $NetBSD: buf.h,v 1.11 2017/02/16 19:11:13 christos Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -87,7 +87,20 @@ struct buf * getblk(struct vnode *, dadd #define BC_AGE 0 #define min(a, b) MIN((a), (b)) -#define microtime(tv) gettimeofday((tv), NULL) + +static inline void +microtime(struct timeval *tv) +{ + extern struct stat stampst; + + if (stampst.st_ino) { + tv->tv_sec = stampst.st_mtime; + tv->tv_usec = 0; + } else { + gettimeofday((tv), NULL); + } +} + #define KASSERT(a) #define IO_SYNC 1
CVS commit: src/usr.sbin/makefs/ffs
Module Name:src Committed By: kre Date: Thu Feb 9 04:42:53 UTC 2017 Modified Files: src/usr.sbin/makefs/ffs: ffs_extern.h mkfs.c Log Message: Revert the part of mkfs.c 1.36 that "gutted the const" (while retaining the part that added a different one). That is, re-constipate makefs (well, just a bit, no real pain here.) To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/makefs/ffs/ffs_extern.h cvs rdiff -u -r1.36 -r1.37 src/usr.sbin/makefs/ffs/mkfs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/makefs/ffs/ffs_extern.h diff -u src/usr.sbin/makefs/ffs/ffs_extern.h:1.6 src/usr.sbin/makefs/ffs/ffs_extern.h:1.7 --- src/usr.sbin/makefs/ffs/ffs_extern.h:1.6 Thu Aug 7 11:25:33 2003 +++ src/usr.sbin/makefs/ffs/ffs_extern.h Thu Feb 9 04:42:53 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_extern.h,v 1.6 2003/08/07 11:25:33 agc Exp $ */ +/* $NetBSD: ffs_extern.h,v 1.7 2017/02/09 04:42:53 kre Exp $ */ /* From: NetBSD: ffs_extern.h,v 1.19 2001/08/17 02:18:48 lukem Exp */ /*- @@ -59,7 +59,7 @@ void ffs_clusteracct(struct fs *, struct int ffs_balloc(struct inode *, off_t, int, struct buf **); /* ffs_bswap.c */ -void ffs_sb_swap(struct fs*, struct fs *); +void ffs_sb_swap(const struct fs*, struct fs *); void ffs_dinode1_swap(struct ufs1_dinode *, struct ufs1_dinode *); void ffs_dinode2_swap(struct ufs2_dinode *, struct ufs2_dinode *); void ffs_csum_swap(struct csum *, struct csum *, int); Index: src/usr.sbin/makefs/ffs/mkfs.c diff -u src/usr.sbin/makefs/ffs/mkfs.c:1.36 src/usr.sbin/makefs/ffs/mkfs.c:1.37 --- src/usr.sbin/makefs/ffs/mkfs.c:1.36 Wed Feb 8 16:00:30 2017 +++ src/usr.sbin/makefs/ffs/mkfs.c Thu Feb 9 04:42:53 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: mkfs.c,v 1.36 2017/02/08 16:00:30 christos Exp $ */ +/* $NetBSD: mkfs.c,v 1.37 2017/02/09 04:42:53 kre Exp $ */ /* * Copyright (c) 2002 Networks Associates Technology, Inc. @@ -48,7 +48,7 @@ static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95"; #else #ifdef __RCSID -__RCSID("$NetBSD: mkfs.c,v 1.36 2017/02/08 16:00:30 christos Exp $"); +__RCSID("$NetBSD: mkfs.c,v 1.37 2017/02/09 04:42:53 kre Exp $"); #endif #endif #endif /* not lint */ @@ -126,7 +126,7 @@ static int avgfilesize; /* expect static int avgfpdir; /* expected number of files per directory */ static void -ffs_sb_copy(struct fs *o, struct fs *i, size_t l, const fsinfo_t *fsopts) +ffs_sb_copy(struct fs *o, const struct fs *i, size_t l, const fsinfo_t *fsopts) { memcpy(o, i, l); /* Zero out pointers */
CVS commit: src/usr.sbin/makefs/ffs
Module Name:src Committed By: christos Date: Wed Feb 8 16:00:30 UTC 2017 Modified Files: src/usr.sbin/makefs/ffs: mkfs.c Log Message: gut const for now. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/usr.sbin/makefs/ffs/mkfs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/makefs/ffs/mkfs.c diff -u src/usr.sbin/makefs/ffs/mkfs.c:1.35 src/usr.sbin/makefs/ffs/mkfs.c:1.36 --- src/usr.sbin/makefs/ffs/mkfs.c:1.35 Tue Feb 7 23:08:53 2017 +++ src/usr.sbin/makefs/ffs/mkfs.c Wed Feb 8 11:00:30 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: mkfs.c,v 1.35 2017/02/08 04:08:53 christos Exp $ */ +/* $NetBSD: mkfs.c,v 1.36 2017/02/08 16:00:30 christos Exp $ */ /* * Copyright (c) 2002 Networks Associates Technology, Inc. @@ -48,7 +48,7 @@ static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95"; #else #ifdef __RCSID -__RCSID("$NetBSD: mkfs.c,v 1.35 2017/02/08 04:08:53 christos Exp $"); +__RCSID("$NetBSD: mkfs.c,v 1.36 2017/02/08 16:00:30 christos Exp $"); #endif #endif #endif /* not lint */ @@ -126,7 +126,7 @@ static int avgfilesize; /* expect static int avgfpdir; /* expected number of files per directory */ static void -ffs_sb_copy(struct fs *o, const struct fs *i, size_t l, fsinfo_t *fsopts) +ffs_sb_copy(struct fs *o, struct fs *i, size_t l, const fsinfo_t *fsopts) { memcpy(o, i, l); /* Zero out pointers */
CVS commit: src/usr.sbin/makefs/ffs
Module Name:src Committed By: christos Date: Wed Feb 8 04:08:53 UTC 2017 Modified Files: src/usr.sbin/makefs/ffs: mkfs.c Log Message: Don't store random (from ASLR) pointers into the superblock. Should be the last (famous last words) problem with reproducible builds! To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/usr.sbin/makefs/ffs/mkfs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/makefs/ffs/mkfs.c diff -u src/usr.sbin/makefs/ffs/mkfs.c:1.34 src/usr.sbin/makefs/ffs/mkfs.c:1.35 --- src/usr.sbin/makefs/ffs/mkfs.c:1.34 Fri Jun 24 15:24:11 2016 +++ src/usr.sbin/makefs/ffs/mkfs.c Tue Feb 7 23:08:53 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: mkfs.c,v 1.34 2016/06/24 19:24:11 christos Exp $ */ +/* $NetBSD: mkfs.c,v 1.35 2017/02/08 04:08:53 christos Exp $ */ /* * Copyright (c) 2002 Networks Associates Technology, Inc. @@ -48,7 +48,7 @@ static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95"; #else #ifdef __RCSID -__RCSID("$NetBSD: mkfs.c,v 1.34 2016/06/24 19:24:11 christos Exp $"); +__RCSID("$NetBSD: mkfs.c,v 1.35 2017/02/08 04:08:53 christos Exp $"); #endif #endif #endif /* not lint */ @@ -102,7 +102,11 @@ union { char *iobuf; int iobufsize; -char writebuf[FFS_MAXBSIZE]; +union { + struct fs fs; + char pad[FFS_MAXBSIZE]; +} wb; +#define writebuf wb.pad static int Oflag; /* format as an 4.3BSD file system */ static int64_t fssize; /* file system size */ @@ -121,6 +125,17 @@ static int sbsize; /* superblock static int avgfilesize; /* expected average file size */ static int avgfpdir; /* expected number of files per directory */ +static void +ffs_sb_copy(struct fs *o, const struct fs *i, size_t l, fsinfo_t *fsopts) +{ + memcpy(o, i, l); + /* Zero out pointers */ + o->fs_csp = NULL; + o->fs_maxcluster = NULL; + if (fsopts->needswap) + ffs_sb_swap(i, o); +} + struct fs * ffs_mkfs(const char *fsys, const fsinfo_t *fsopts, time_t tstamp) { @@ -508,9 +523,7 @@ ffs_mkfs(const char *fsys, const fsinfo_ * Make a copy of the superblock into the buffer that we will be * writing out in each cylinder group. */ - memcpy(writebuf, , sbsize); - if (fsopts->needswap) - ffs_sb_swap(, (struct fs*)writebuf); + ffs_sb_copy(, , sbsize, fsopts); memcpy(iobuf, writebuf, SBLOCKSIZE); printf("super-block backups (for fsck -b #) at:"); @@ -555,9 +568,7 @@ ffs_write_superblock(struct fs *fs, cons saveflag = fs->fs_flags & FS_INTERNAL; fs->fs_flags &= ~FS_INTERNAL; -memcpy(writebuf, , sbsize); - if (fsopts->needswap) - ffs_sb_swap(fs, (struct fs*)writebuf); + ffs_sb_copy(, , sbsize, fsopts); ffs_wtfs(fs->fs_sblockloc / sectorsize, sbsize, writebuf, fsopts); /* Write out the duplicate super blocks */
CVS commit: src/usr.sbin/makefs/ffs
Module Name:src Committed By: christos Date: Fri Jun 24 19:24:11 UTC 2016 Modified Files: src/usr.sbin/makefs/ffs: buf.c ffs_alloc.c mkfs.c Log Message: tidy up error messages To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/makefs/ffs/buf.c cvs rdiff -u -r1.28 -r1.29 src/usr.sbin/makefs/ffs/ffs_alloc.c cvs rdiff -u -r1.33 -r1.34 src/usr.sbin/makefs/ffs/mkfs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/makefs/ffs/buf.c diff -u src/usr.sbin/makefs/ffs/buf.c:1.23 src/usr.sbin/makefs/ffs/buf.c:1.24 --- src/usr.sbin/makefs/ffs/buf.c:1.23 Thu Dec 24 10:52:37 2015 +++ src/usr.sbin/makefs/ffs/buf.c Fri Jun 24 15:24:11 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: buf.c,v 1.23 2015/12/24 15:52:37 christos Exp $ */ +/* $NetBSD: buf.c,v 1.24 2016/06/24 19:24:11 christos Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -41,7 +41,7 @@ #include #if defined(__RCSID) && !defined(__lint) -__RCSID("$NetBSD: buf.c,v 1.23 2015/12/24 15:52:37 christos Exp $"); +__RCSID("$NetBSD: buf.c,v 1.24 2016/06/24 19:24:11 christos Exp $"); #endif /* !__lint */ #include @@ -78,17 +78,17 @@ bread(struct vnode *vp, daddr_t blkno, i (long long)(*bpp)->b_blkno, (long long) offset, (*bpp)->b_bcount); if (lseek((*bpp)->b_fs->fd, offset, SEEK_SET) == -1) - err(1, "%s: lseek %lld (%lld)", __func__, + err(EXIT_FAILURE, "%s: lseek %lld (%lld)", __func__, (long long)(*bpp)->b_blkno, (long long)offset); rv = read((*bpp)->b_fs->fd, (*bpp)->b_data, (size_t)(*bpp)->b_bcount); if (debug & DEBUG_BUF_BREAD) printf("bread: read %ld (%lld) returned %zd\n", (*bpp)->b_bcount, (long long)offset, rv); if (rv == -1)/* read error */ - err(1, "%s: read %ld (%lld) returned %zd", __func__, + err(EXIT_FAILURE, "%s: read %ld (%lld) returned %zd", __func__, (*bpp)->b_bcount, (long long)offset, rv); else if (rv != (*bpp)->b_bcount) /* short read */ - err(1, "%s: read %ld (%lld) returned %zd", __func__, + errx(EXIT_FAILURE, "%s: read %ld (%lld) returned %zd", __func__, (*bpp)->b_bcount, (long long)offset, rv); else return (0); Index: src/usr.sbin/makefs/ffs/ffs_alloc.c diff -u src/usr.sbin/makefs/ffs/ffs_alloc.c:1.28 src/usr.sbin/makefs/ffs/ffs_alloc.c:1.29 --- src/usr.sbin/makefs/ffs/ffs_alloc.c:1.28 Sun Mar 29 01:52:59 2015 +++ src/usr.sbin/makefs/ffs/ffs_alloc.c Fri Jun 24 15:24:11 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_alloc.c,v 1.28 2015/03/29 05:52:59 agc Exp $ */ +/* $NetBSD: ffs_alloc.c,v 1.29 2016/06/24 19:24:11 christos Exp $ */ /* From: NetBSD: ffs_alloc.c,v 1.50 2001/09/06 02:16:01 lukem Exp */ /* @@ -47,7 +47,7 @@ #include #if defined(__RCSID) && !defined(__lint) -__RCSID("$NetBSD: ffs_alloc.c,v 1.28 2015/03/29 05:52:59 agc Exp $"); +__RCSID("$NetBSD: ffs_alloc.c,v 1.29 2016/06/24 19:24:11 christos Exp $"); #endif /* !__lint */ #include @@ -107,7 +107,7 @@ ffs_alloc(struct inode *ip, daddr_t lbn *bnp = 0; if (size > fs->fs_bsize || ffs_fragoff(fs, size) != 0) { - errx(1, "ffs_alloc: bad size: bsize %d size %d", + errx(EXIT_FAILURE, "%s: bad size: bsize %d size %d", __func__, fs->fs_bsize, size); } if (size == fs->fs_bsize && fs->fs_cstotal.cs_nbfree == 0) @@ -441,8 +441,8 @@ ffs_blkfree(struct inode *ip, daddr_t bn if (size > fs->fs_bsize || ffs_fragoff(fs, size) != 0 || ffs_fragnum(fs, bno) + ffs_numfrags(fs, size) > fs->fs_frag) { - errx(1, "blkfree: bad size: bno %lld bsize %d size %ld", - (long long)bno, fs->fs_bsize, size); + errx(EXIT_FAILURE, "%s: bad size: bno %lld bsize %d " + "size %ld", __func__, (long long)bno, fs->fs_bsize, size); } cg = dtog(fs, bno); if (bno >= fs->fs_size) { @@ -465,8 +465,8 @@ ffs_blkfree(struct inode *ip, daddr_t bn if (size == fs->fs_bsize) { fragno = ffs_fragstoblks(fs, cgbno); if (!ffs_isfreeblock(fs, cg_blksfree(cgp, needswap), fragno)) { - errx(1, "blkfree: freeing free block %lld", - (long long)bno); + errx(EXIT_FAILURE, "%s: freeing free block %lld", + __func__, (long long)bno); } ffs_setblock(fs, cg_blksfree(cgp, needswap), fragno); ffs_clusteracct(fs, cgp, fragno, 1); @@ -486,7 +486,8 @@ ffs_blkfree(struct inode *ip, daddr_t bn frags = ffs_numfrags(fs, size); for (i = 0; i < frags; i++) { if (isset(cg_blksfree(cgp, needswap), cgbno + i)) { -errx(1, "blkfree: freeing free frag: block %lld", +errx(EXIT_FAILURE, "%s: freeing free frag: " +"block %lld", __func__, (long long)(cgbno + i)); } setbit(cg_blksfree(cgp, needswap), cgbno + i); @@ -566,11 +567,10 @@ ffs_mapsearch(struct fs *fs, struct cg * (const u_char *)fragtbl[fs->fs_frag], (1 << (allocsiz - 1 + (fs->fs_frag % NBBY; if (loc == 0) { - errx(1, -"ffs_alloccg: map corrupted: start %d len %d offset %d %ld", -ostart, olen, -ufs_rw32(cgp->cg_freeoff, needswap),
CVS commit: src/usr.sbin/makefs/ffs
Module Name:src Committed By: christos Date: Wed Jan 30 17:29:05 UTC 2013 Modified Files: src/usr.sbin/makefs/ffs: buf.c buf.h Log Message: buf is generic; it has nothing to do with ffs and will eventually be moved. gc sectorize. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/makefs/ffs/buf.c cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/makefs/ffs/buf.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/makefs/ffs/buf.c diff -u src/usr.sbin/makefs/ffs/buf.c:1.17 src/usr.sbin/makefs/ffs/buf.c:1.18 --- src/usr.sbin/makefs/ffs/buf.c:1.17 Mon Jan 28 16:03:29 2013 +++ src/usr.sbin/makefs/ffs/buf.c Wed Jan 30 12:29:05 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: buf.c,v 1.17 2013/01/28 21:03:29 christos Exp $ */ +/* $NetBSD: buf.c,v 1.18 2013/01/30 17:29:05 christos Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -41,7 +41,7 @@ #include sys/cdefs.h #if defined(__RCSID) !defined(__lint) -__RCSID($NetBSD: buf.c,v 1.17 2013/01/28 21:03:29 christos Exp $); +__RCSID($NetBSD: buf.c,v 1.18 2013/01/30 17:29:05 christos Exp $); #endif /* !__lint */ #include sys/param.h @@ -55,14 +55,7 @@ __RCSID($NetBSD: buf.c,v 1.17 2013/01/2 #include util.h #include makefs.h - -#include ufs/ufs/dinode.h -#include ufs/ffs/fs.h - -#include ffs/buf.h -#include ffs/ufs_inode.h - -extern int sectorsize; /* XXX: from ffs.c mkfs.c */ +#include buf.h TAILQ_HEAD(buftailhead,buf) buftail; @@ -72,15 +65,14 @@ bread(struct vnode *vp, daddr_t blkno, i { off_t offset; ssize_t rv; - struct fs *fs = vp-fs; + fsinfo_t *fs = vp-fs; - assert (fs != NULL); assert (bpp != NULL); if (debug DEBUG_BUF_BREAD) printf(bread: blkno %lld size %d\n, (long long)blkno, size); *bpp = getblk(vp, blkno, size, 0, 0); - offset = (*bpp)-b_blkno * sectorsize; /* XXX */ + offset = (*bpp)-b_blkno * fs-sectorsize; if (debug DEBUG_BUF_BREAD) printf(bread: blkno %lld offset %lld bcount %ld\n, (long long)(*bpp)-b_blkno, (long long) offset, @@ -138,9 +130,10 @@ bwrite(struct buf *bp) off_t offset; ssize_t rv; int bytes; + fsinfo_t *fs = bp-b_fs; assert (bp != NULL); - offset = bp-b_blkno * sectorsize; /* XXX */ + offset = bp-b_blkno * fs-sectorsize; bytes = bp-b_bcount; if (debug DEBUG_BUF_BWRITE) printf(bwrite: blkno %lld offset %lld bcount %d\n, @@ -190,10 +183,7 @@ getblk(struct vnode *vp, daddr_t blkno, static int buftailinitted; struct buf *bp; void *n; - int fd = vp-fd; - struct fs *fs = vp-fs; - assert (fs != NULL); if (debug DEBUG_BUF_GETBLK) printf(getblk: blkno %lld size %d\n, (long long)blkno, size); @@ -214,8 +204,8 @@ getblk(struct vnode *vp, daddr_t blkno, bp = ecalloc(1, sizeof(*bp)); bp-b_bufsize = 0; bp-b_blkno = bp-b_lblkno = blkno; - bp-b_fd = fd; - bp-b_fs = fs; + bp-b_fd = vp-fd; + bp-b_fs = vp-fs; bp-b_data = NULL; TAILQ_INSERT_HEAD(buftail, bp, b_tailq); } Index: src/usr.sbin/makefs/ffs/buf.h diff -u src/usr.sbin/makefs/ffs/buf.h:1.7 src/usr.sbin/makefs/ffs/buf.h:1.8 --- src/usr.sbin/makefs/ffs/buf.h:1.7 Mon Jan 28 16:03:29 2013 +++ src/usr.sbin/makefs/ffs/buf.h Wed Jan 30 12:29:05 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: buf.h,v 1.7 2013/01/28 21:03:29 christos Exp $ */ +/* $NetBSD: buf.h,v 1.8 2013/01/30 17:29:05 christos Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -69,7 +69,7 @@ struct buf { daddr_t b_blkno; daddr_t b_lblkno; int b_fd; - struct fs * b_fs; + void * b_fs; TAILQ_ENTRY(buf) b_tailq; };
CVS commit: src/usr.sbin/makefs/ffs
Module Name:src Committed By: mlelstv Date: Mon Jan 28 10:16:35 UTC 2013 Modified Files: src/usr.sbin/makefs/ffs: buf.c Log Message: Do not use *bp after freeing it in brelse. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/makefs/ffs/buf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/makefs/ffs/buf.c diff -u src/usr.sbin/makefs/ffs/buf.c:1.15 src/usr.sbin/makefs/ffs/buf.c:1.16 --- src/usr.sbin/makefs/ffs/buf.c:1.15 Sun Jan 27 20:05:46 2013 +++ src/usr.sbin/makefs/ffs/buf.c Mon Jan 28 10:16:35 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: buf.c,v 1.15 2013/01/27 20:05:46 christos Exp $ */ +/* $NetBSD: buf.c,v 1.16 2013/01/28 10:16:35 mlelstv Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -41,7 +41,7 @@ #include sys/cdefs.h #if defined(__RCSID) !defined(__lint) -__RCSID($NetBSD: buf.c,v 1.15 2013/01/27 20:05:46 christos Exp $); +__RCSID($NetBSD: buf.c,v 1.16 2013/01/28 10:16:35 mlelstv Exp $); #endif /* !__lint */ #include sys/param.h @@ -136,20 +136,22 @@ bwrite(struct buf *bp) { off_t offset; ssize_t rv; + int bytes; assert (bp != NULL); offset = bp-b_blkno * sectorsize; /* XXX */ + bytes = bp-b_bcount; if (debug DEBUG_BUF_BWRITE) - printf(bwrite: blkno %lld offset %lld bcount %ld\n, - (long long)bp-b_blkno, (long long) offset, bp-b_bcount); + printf(bwrite: blkno %lld offset %lld bcount %d\n, + (long long)bp-b_blkno, (long long) offset, bytes); if (lseek(bp-b_fd, offset, SEEK_SET) == -1) return (errno); - rv = write(bp-b_fd, bp-b_data, bp-b_bcount); + rv = write(bp-b_fd, bp-b_data, bytes); if (debug DEBUG_BUF_BWRITE) printf(bwrite: write %ld (offset %lld) returned %lld\n, bp-b_bcount, (long long)offset, (long long)rv); brelse(bp, 0); - if (rv == bp-b_bcount) + if (rv == bytes) return (0); else if (rv == -1) /* write error */ return (errno);
CVS commit: src/usr.sbin/makefs/ffs
Module Name:src Committed By: christos Date: Sun Jan 27 14:10:04 UTC 2013 Modified Files: src/usr.sbin/makefs/ffs: buf.c Log Message: Don't print the pointers in debugging, it is not useful. zero all memory To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/makefs/ffs/buf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/makefs/ffs/buf.c diff -u src/usr.sbin/makefs/ffs/buf.c:1.13 src/usr.sbin/makefs/ffs/buf.c:1.14 --- src/usr.sbin/makefs/ffs/buf.c:1.13 Fri Jan 25 19:19:39 2013 +++ src/usr.sbin/makefs/ffs/buf.c Sun Jan 27 09:10:03 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: buf.c,v 1.13 2013/01/26 00:19:39 christos Exp $ */ +/* $NetBSD: buf.c,v 1.14 2013/01/27 14:10:03 christos Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -41,7 +41,7 @@ #include sys/cdefs.h #if defined(__RCSID) !defined(__lint) -__RCSID($NetBSD: buf.c,v 1.13 2013/01/26 00:19:39 christos Exp $); +__RCSID($NetBSD: buf.c,v 1.14 2013/01/27 14:10:03 christos Exp $); #endif /* !__lint */ #include sys/param.h @@ -77,13 +77,12 @@ bread(struct vnode *vp, daddr_t blkno, i assert (bpp != NULL); if (debug DEBUG_BUF_BREAD) - printf(bread: fs %p blkno %lld size %d\n, - fs, (long long)blkno, size); + printf(bread: blkno %lld size %d\n, (long long)blkno, size); *bpp = getblk(vp, blkno, size, 0, 0); offset = (*bpp)-b_blkno * sectorsize; /* XXX */ if (debug DEBUG_BUF_BREAD) - printf(bread: bp %p blkno %lld offset %lld bcount %ld\n, - (*bpp), (long long)(*bpp)-b_blkno, (long long) offset, + printf(bread: blkno %lld offset %lld bcount %ld\n, + (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), @@ -141,9 +140,8 @@ bwrite(struct buf *bp) assert (bp != NULL); offset = bp-b_blkno * sectorsize; /* XXX */ if (debug DEBUG_BUF_BWRITE) - printf(bwrite: bp %p blkno %lld offset %lld bcount %ld\n, - bp, (long long)bp-b_blkno, (long long) offset, - bp-b_bcount); + printf(bwrite: blkno %lld offset %lld bcount %ld\n, + (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); @@ -191,11 +189,10 @@ getblk(struct vnode *vp, daddr_t blkno, int fd = vp-fd; struct fs *fs = vp-fs; - blkno += vp-offset; + // blkno += vp-offset; assert (fs != NULL); if (debug DEBUG_BUF_GETBLK) - printf(getblk: fs %p blkno %lld size %d\n, fs, - (long long)blkno, size); + printf(getblk: blkno %lld size %d\n, (long long)blkno, size); bp = NULL; if (!buftailinitted) { @@ -226,6 +223,7 @@ getblk(struct vnode *vp, daddr_t blkno, n = realloc(bp-b_data, size); if (n == NULL) err(1, getblk: realloc b_data %ld, bp-b_bcount); + memset(n, 0, size); bp-b_data = n; bp-b_bufsize = size; }
CVS commit: src/usr.sbin/makefs/ffs
Module Name:src Committed By: christos Date: Sun Jan 27 14:10:22 UTC 2013 Modified Files: src/usr.sbin/makefs/ffs: buf.h Log Message: zero memory To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/makefs/ffs/buf.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/makefs/ffs/buf.h diff -u src/usr.sbin/makefs/ffs/buf.h:1.4 src/usr.sbin/makefs/ffs/buf.h:1.5 --- src/usr.sbin/makefs/ffs/buf.h:1.4 Sat Jan 26 11:50:46 2013 +++ src/usr.sbin/makefs/ffs/buf.h Sun Jan 27 09:10:22 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: buf.h,v 1.4 2013/01/26 16:50:46 christos Exp $ */ +/* $NetBSD: buf.h,v 1.5 2013/01/27 14:10:22 christos Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -99,7 +99,7 @@ struct pool { }; #define pool_init(p, s, a1, a2, a3, a4, a5, a6) (p)-size = (s) -#define pool_get(p, f) malloc((p)-size) +#define pool_get(p, f) calloc(1, (p)-size) #define pool_put(p, a) free(a) #define pool_destroy(p)
CVS commit: src/usr.sbin/makefs/ffs
Module Name:src Committed By: dholland Date: Thu Apr 19 19:48:15 UTC 2012 Modified Files: src/usr.sbin/makefs/ffs: mkfs.c Log Message: Fix build failure reported by bracket. (shouldn't this size_t be ino_t?) To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/makefs/ffs/mkfs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/makefs/ffs/mkfs.c diff -u src/usr.sbin/makefs/ffs/mkfs.c:1.23 src/usr.sbin/makefs/ffs/mkfs.c:1.24 --- src/usr.sbin/makefs/ffs/mkfs.c:1.23 Thu Apr 19 17:28:26 2012 +++ src/usr.sbin/makefs/ffs/mkfs.c Thu Apr 19 19:48:14 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: mkfs.c,v 1.23 2012/04/19 17:28:26 christos Exp $ */ +/* $NetBSD: mkfs.c,v 1.24 2012/04/19 19:48:14 dholland Exp $ */ /* * Copyright (c) 2002 Networks Associates Technology, Inc. @@ -48,7 +48,7 @@ static char sccsid[] = @(#)mkfs.c 8.11 (Berkeley) 5/3/95; #else #ifdef __RCSID -__RCSID($NetBSD: mkfs.c,v 1.23 2012/04/19 17:28:26 christos Exp $); +__RCSID($NetBSD: mkfs.c,v 1.24 2012/04/19 19:48:14 dholland Exp $); #endif #endif #endif /* not lint */ @@ -666,11 +666,14 @@ initcg(int cylno, time_t utime, const fs exit(37); } acg.cg_cs.cs_nifree += sblock.fs_ipg; - if (cylno == 0) - for (size_t r = 0; r ROOTINO; r++) { + if (cylno == 0) { + size_t r; + + for (r = 0; r ROOTINO; r++) { setbit(cg_inosused(acg, 0), r); acg.cg_cs.cs_nifree--; } + } if (cylno 0) { /* * In cylno 0, beginning space is reserved