From owner-cvs-src-old@FreeBSD.ORG Wed Dec 3 18:37:16 2008 Return-Path: Delivered-To: cvs-src-old@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A0D121065782 for ; Wed, 3 Dec 2008 18:37:16 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 8F07B8FC08 for ; Wed, 3 Dec 2008 18:37:16 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id mB3IbG9Z002426 for ; Wed, 3 Dec 2008 18:37:16 GMT (envelope-from luigi@repoman.freebsd.org) Received: (from svn2cvs@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id mB3IbG21002423 for cvs-src-old@freebsd.org; Wed, 3 Dec 2008 18:37:16 GMT (envelope-from luigi@repoman.freebsd.org) Message-Id: <200812031837.mB3IbG21002423@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: svn2cvs set sender to luigi@repoman.freebsd.org using -f From: Luigi Rizzo Date: Wed, 3 Dec 2008 18:36:59 +0000 (UTC) To: cvs-src-old@freebsd.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/sbin/newfs Makefile mkfs.c newfs.8 newfs.c newfs.h X-BeenThere: cvs-src-old@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: **OBSOLETE** CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Dec 2008 18:37:16 -0000 luigi 2008-12-03 18:36:59 UTC FreeBSD src repository Modified files: sbin/newfs Makefile mkfs.c newfs.8 newfs.c newfs.h Log: SVN rev 185588 on 2008-12-03 18:36:59Z by luigi Enable operation of newfs on plain files, which is useful when you want to prepare disk images for emulators (though 'makefs' in port can do something similar). This relies on: + minor changes to pass the consistency checks even when working on a file; + an additional option, '-p partition' , to specify the disk partition to initialize; + some changes on the I/O routines to deal with partition offsets. The latter was a bit tricky to implement, see the details in newfs.h: in newfs, I/O is done through libufs which assumes that the file descriptor refers to the whole partition. Introducing support for the offset in libufs would require a non-backward compatible change in the library, to be dealt with a version bump or with symbol versioning. I felt both approaches to be overkill for this specific application, especially because there might be other changes to libufs that might become necessary in the near future. So I used the following trick: - read access is always done by calling bread() directly, so we just add the offset in the (few) places that call bread(); - write access is done through bwrite() and sbwrite(), which in turn calls bwrite(). To avoid rewriting sbwrite(), we supply our own version of bwrite() here, which takes precedence over the version in libufs. MFC after: 4 weeks Revision Changes Path 1.23 +4 -1 src/sbin/newfs/Makefile 1.96 +4 -4 src/sbin/newfs/mkfs.c 1.74 +12 -0 src/sbin/newfs/newfs.8 1.86 +76 -11 src/sbin/newfs/newfs.c 1.21 +16 -0 src/sbin/newfs/newfs.h