Date: Thu, 9 May 1996 23:14:48 +0200 (SAT) From: Robert Nordier <rnordier@iafrica.com> To: hackers@freebsd.org Subject: [Q] Raw interface to block devices Message-ID: <199605092114.XAA02591@eac.iafrica.com>
next in thread | raw e-mail | index | archive | help
I have a function int process(const char *fs); which expects 'fs' to refer to a device which may hold a filesystem. The function actually works with the raw device, but allows the user some flexibility. Eg: process("/dev/rfd0"); or process("/dev/fd0"); An obvious, though clumsy, approach is: stat() if {S_IFCHR, S_IFBLK} derive the other name by deleting/inserting an 'r' somewhere stat() check for (reversed) {S_IFCHR, S_IFBLK} This tries to ensure we are not dealing with (say) '/dev/tty'; and to come up with the device name needed. However, something like ln -s /dev/fd0 floppy causes problems. There must be a better way to do this. The stuff I've looked at either trustingly waits forever on '/dev/tty', or refuses to even consider 'floppy'. Surely a library function is needed (or already exists). -- Robert Nordier
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199605092114.XAA02591>