devd based AUTOMOUNTER

Ian Smith smithi at nimnet.asn.au
Wed Feb 29 06:16:25 UTC 2012


On Tue, 28 Feb 2012, vermaden wrote:
 > "Andriy Gapon" <avg at FreeBSD.org> pisze:
 > > on 29/02/2012 00:04 vermaden said the following:
 > > > "Andriy Gapon"  said:
 > > >> on 28/02/2012 17:26 Alexander Leidinger said the following:
 > > >>> The kernel does not poll for CD changes, and the people guarding the relevant CD
 > > >>> code where against something like this in the kernel everytime this came up in
 > > >>> the past. So no devd event for this.
 > > >>
 > > >> My impression was that lately people were asking for it (and nobody actually
 > > >> "guarded" the code), but there is no good design on how to do it.
 > > > 
 > > > The mentioned earlier sysctl OID changes whenever CD is in the
 > > > drive or not, something changes that ... so adding appreciate
 > > > events like "MEDIA INSERTED" and "MEDIA REMOVED" to cd* class
 > > > should be enought to handle them and mount/umount the
 > > > medium with script like mine with appreciate devd(8) config.
 > > 
 > > I don't think that there is any kernel component that pro-actively changes that
 > > value.  Most likely you have something like hald running or otherwise tried to
 > > access the device before the change was noted.
 > 
 > I do not even have working CD drive in my laptop, so I cant tell ;)
 > 
 > Ivan Klymenko sent this earlier in that thread:
 > 
 > NO CD:
 > > kern.geom.conftxt: 0 DISK cd0 0 2048 hd 0 sc 0
 > 
 > CD IN:
 > > kern.geom.conftxt: 0 DISK cd0 4700372992 2048 hd 0 sc 0

That looks like a DVD, I only have a CDRW in this .. but inserting 
either a music or a data CD has no effect whatsoever on that sysctl 
here, on 8.2-RELEASE anyway, which still has /dev/acd0 as well.

Further, it's not so easy to parse:

t23# sysctl kern.geom.conftxt
t23#

ie nothing, but no 'unknown oid' either, huh?

t23# sysctl -d kern.geom.conftxt
kern.geom.conftxt: Dump the GEOM config in txt

Hmm, checking sysctl(8), only the -b switch seems to dump it:

t23# sysctl -b kern.geom.conftxt
0 DISK cd0 534181888 2048 hd 0 sc 0
0 DISK ad0 120034123776 512 hd 16 sc 63
1 PART ad0s4 34143137280 512 i 4 o 85888373760 ty freebsd xs MBR xt 165
[.. partitions on slices s4, s3, s2 and DOS slice s1 shown, omitted ..]

but:

t23# sysctl -b kern.geom.conftxt | grep cd0
Binary file (standard input) matches

Note also that the above entry for cd0 does NOT change after inserting 
various different data CDs, all different sizes, nor after mounting one, 
so that 534181888 entry is from some time before, perhaps the first CD 
inserted after boot, not sure?  Also the sizes are bytes, regardless of 
sector size (DVD above, while ad0s4 is a 32GiB slice on a 120GB disk).

Doesn't look like this one is going to fly.

cheers, Ian

(meanwhile other progress is looking good, maybe I'll get some time next 
month to play with it, still behind due to aforesaid near-disaster :) 


More information about the freebsd-stable mailing list