Date: Fri, 10 May 1996 12:49:54 +0200 (SAT) From: Robert Nordier <rnordier@iafrica.com> To: bde@zeta.org.au (Bruce Evans) Cc: hackers@freebsd.org Subject: Re: [Q] Raw interface to block devices Message-ID: <199605101049.MAA00520@eac.iafrica.com> In-Reply-To: <199605100747.RAA02365@godzilla.zeta.org.au> from "Bruce Evans" at May 10, 96 05:47:24 pm
next in thread | previous in thread | raw e-mail | index | archive | help
Bruce Evans wrote: > > >> devname(3) seems to be almost what you want. You can stat the first name > >> to get the dev number and then call devname() to get the other name. It > >> searches quickly through all the names in /var/run/dev.db. > > >I've just tried that, and it seems to be _exactly_ what I want. :-) > > Actually, it is no help. It just does a fast search through /dev. It > doesn't support going from the bdev to the cdev or vice versa. It can't > support this because even the kernel barely knows the correspondence > between bdevs and cdevs. In -current, the bdevsw and cdevsw entries > contain pointers to each other. In -stable there is only the poorly > maintained chrtoblk() routine. Yes, it's a shame about to bdev <-> cdev mapping. Anyway, devname(3) does hand off some of the task to a library routine, and may allow the rest to be handled in a simple lookup table. Though, for portability, I suppose there is still something to be said for fiddling with the names themselves: /dev/[r]sd0a /dev/[r]dsk/0s0 -- Robert Nordier
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199605101049.MAA00520>