Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Dec 2008 18:36:59 +0000 (UTC)
From:      Luigi Rizzo <luigi@FreeBSD.org>
To:        cvs-src-old@freebsd.org
Subject:   cvs commit: src/sbin/newfs Makefile mkfs.c newfs.8 newfs.c newfs.h
Message-ID:  <200812031837.mB3IbG21002423@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812031837.mB3IbG21002423>