Subject: Re: Filesystems that don't support devices
To: Ben Harris <bjh21@netbsd.org>
From: Gavan Fantom <gavan@coolfactor.org>
List: tech-kern
Date: 12/19/2001 19:54:51
On Wed, 19 Dec 2001, Ben Harris wrote:

> How about just checking if /dev/console exists and is a device, or if there
> are any devices at all in /dev?


The code currently looks like this:

        if (statfs("/", &sfs) == -1)
                return;

        if (strcmp(sfs.f_fstypename, MOUNT_MSDOS) != 0)
                return;

        /* If we have devices, we cannot be on msdosfs */
        if (access(_PATH_CONSOLE, F_OK) != -1)
                return;

So /dev/console already has to exist, but actually on an msdos filesystem.

Maybe removing the check for an msdos filesystem and just checking for
existence of a console device would be enough?

> If you really need to have the code not run on a filesystem that
> supports devices, you could tentatively mknod one and see if it works.

Wouldn't that also fail on an ffs mounted read-only, such as is usually
the case on a normally configured system?


I guess my question is now whether just removing the test for msdos and
relying on testing for the presence of /dev/console is safe and sensible.

-- 
Gillette - the best a man can forget