From owner-svn-src-head@freebsd.org Wed May 3 14:21:19 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9FD2CD5CF4D; Wed, 3 May 2017 14:21:19 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7B49935F; Wed, 3 May 2017 14:21:19 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43ELITt093371; Wed, 3 May 2017 14:21:18 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43ELIP9093367; Wed, 3 May 2017 14:21:18 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201705031421.v43ELIP9093367@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 3 May 2017 14:21:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317744 - in head/usr.sbin/makefs: . ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 14:21:19 -0000 Author: emaste Date: Wed May 3 14:21:18 2017 New Revision: 317744 URL: https://svnweb.freebsd.org/changeset/base/317744 Log: makefs: make buf generic it has nothing to do with ffs and will eventually be moved. gc sectorsize. NetBSD versions: ffs.c 1.58 ffs/buf.c 1.14 1.18 ffs/buf.h 1.8 Obtained from: NetBSD Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/makefs/ffs.c head/usr.sbin/makefs/ffs/buf.c head/usr.sbin/makefs/ffs/buf.h Modified: head/usr.sbin/makefs/ffs.c ============================================================================== --- head/usr.sbin/makefs/ffs.c Wed May 3 14:03:46 2017 (r317743) +++ head/usr.sbin/makefs/ffs.c Wed May 3 14:21:18 2017 (r317744) @@ -144,7 +144,6 @@ static void *ffs_build_dinode2(struct u -int sectorsize; /* XXX: for buf.c::getblk() */ /* publicly visible functions */ void @@ -427,8 +426,6 @@ ffs_validate(const char *dir, fsnode *ro printf("ffs_validate: dir %s; %lld bytes, %lld inodes\n", dir, (long long)fsopts->size, (long long)fsopts->inodes); } - sectorsize = fsopts->sectorsize; /* XXX - see earlier */ - /* now check calculated sizes vs requested sizes */ if (fsopts->maxsize > 0 && fsopts->size > fsopts->maxsize) { errx(1, "`%s' size of %lld is larger than the maxsize of %lld.", Modified: head/usr.sbin/makefs/ffs/buf.c ============================================================================== --- head/usr.sbin/makefs/ffs/buf.c Wed May 3 14:03:46 2017 (r317743) +++ head/usr.sbin/makefs/ffs/buf.c Wed May 3 14:21:18 2017 (r317744) @@ -50,14 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include "makefs.h" - -#include -#include - -#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; @@ -67,16 +60,15 @@ 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("%s: blkno %lld size %d\n", __func__, (long long)blkno, size); *bpp = getblk(vp, blkno, size, 0, 0, 0); - offset = (*bpp)->b_blkno * sectorsize; /* XXX */ + offset = (*bpp)->b_blkno * fs->sectorsize; if (debug & DEBUG_BUF_BREAD) printf("%s: blkno %lld offset %lld bcount %ld\n", __func__, (long long)(*bpp)->b_blkno, (long long) offset, @@ -133,9 +125,10 @@ bwrite(struct buf *bp) { off_t offset; ssize_t rv; + fsinfo_t *fs = bp->b_fs; assert (bp != NULL); - offset = bp->b_blkno * sectorsize; /* XXX */ + offset = bp->b_blkno * fs->sectorsize; if (debug & DEBUG_BUF_BWRITE) printf("bwrite: blkno %lld offset %lld bcount %ld\n", (long long)bp->b_blkno, (long long) offset, @@ -184,11 +177,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; - blkno += vp->offset; - assert (fs != NULL); if (debug & DEBUG_BUF_GETBLK) printf("getblk: blkno %lld size %d\n", (long long)blkno, size); @@ -209,8 +198,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); } Modified: head/usr.sbin/makefs/ffs/buf.h ============================================================================== --- head/usr.sbin/makefs/ffs/buf.h Wed May 3 14:03:46 2017 (r317743) +++ head/usr.sbin/makefs/ffs/buf.h Wed May 3 14:21:18 2017 (r317744) @@ -59,7 +59,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; };