Subject: Re: special-casing access to image files
To: Greywolf <greywolf@starwolf.com>
From: Luke Mewburn <lukem@wasabisystems.com>
List: tech-userlevel
Date: 08/20/2001 09:20:51
On Sun, Aug 19, 2001 at 08:58:04AM -0700, Greywolf wrote:
> On Sun, 19 Aug 2001, Hubert Feyrer wrote:
> 
> # On Sun, 19 Aug 2001, Luke Mewburn wrote:
> # > Modified Files:
> # > 	basesrc/sbin/fsirand: fsirand.8 fsirand.c
> # >
> # > Log Message:
> # > - add -F - manipulate a file system image in a regular file (instead of
> # >   a special device).
> #
> # I see this -F added to ~all filesystem utilities. Is that really
> # necessary? IIRC there's the Unix philosophy of "everything is a file", so
> # why is there a difference when giving a filename over /dev/somedisk?
> # Can't the fools be at least made auto-detect if th eunderlying thing is a
> # disk image over a real disk?
> 
> Not to mention, don't you usually run things like fsck etc. on things
> that have been vnconfig'd?  Why not just run the fsirand there?

This work is part of a larger project to make it far easier to build
NetBSD distributions without requiring root privileges (which vnconfig
does), nor requiring NetBSD (other systems don't necessarily have a
vnd or equivalent device). Todd's work on USE_NEW_TOOLCHAIN also helps
achieve the latter goal.


> WRT auto-detect:  I seem to recall having been able to run newfs/mkfs
> on a regular file in the past on other operating systems, with a warning
> printed at create time:
> 
> WARNING: "image.fs" is not a character special file; continue (y/n)?

fsck_ffs had this warning. It's annoying for automated scripting of
this process.

With -F, file system images in regular files can be manipulated by
various scripts and tools without user intervention, and the -F flag
checks that the provided argument is a regular file, so it shouldn't
trash a real device.


For what it's worth, it's this -F functionality in various file
system tools that made it much easier for me to test and debug the
recent FFS_EI bugfix I made without either nuking an existing
partition on my machines, and without requiring root privs to
continually vnconfig image files for testing.


Luke.