*BSD News Article 66237


Return to BSD News archive

Newsgroups: comp.unix.bsd.freebsd.misc
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.rmit.EDU.AU!news.unimelb.EDU.AU!munnari.OZ.AU!spool.mu.edu!news.sol.net!uniserve!van-bc!news.rmii.com!newsjunkie.ans.net!newsfeeds.ans.net!howland.reston.ans.net!gatech!newsfeed.internetmci.com!in2.uu.net!news.nkn.net!news.panther.net!nemesis!uhclem
From: uhclem@nemesis.lonestar.org (Frank Durda IV)
Subject: Re: Automatic mounting of CD and disk???
X-Newsreader: Tin 1.1 PL5
Organization: The Big Blue Box
Message-ID: <DpzF9u.J63@nemesis.lonestar.org>
References: <31739A36.41C67EA6@ima.mdh.se>
Date: Wed, 17 Apr 1996 01:10:41 GMT
Lines: 34

[0]Martin Christiansson (cel94mcn@ima.mdh.se) wrote:
[0]Is there anybody out there who could give me a hint on
[0]how to automaticly mount the CD-ROM drive when a disk is
[0]inserted, and unmount it when pressing the "eject"-button?

Sure, do what Windows '95 does - write a daemon that tests the
driver every few seconds to see if it is ready.  If it is, read
the TOC to determine if it is a data CD.  If it is, determine
if it is a file-system the system supports.  If it is, issue an
appropriate mount and mount the filesystem where previously specified.

If there is media and any of the other above tests fail, keep checking
until the drive goes not-ready, then go back to step 1.

If you did mount the media, continue to test the drive every few seconds.
If you get a not-ready error, assume that is a cue to unmount
the media and attempt to do so.  NOTE: The unmount may fail if someone
is cd'ed to the drive or if files are open.  How you deal with these
situations is up to you and won't be trivial.  No nice solutions to this.


[0]Could this also be done whith the floppy disk?

Same issues/problems as above except now you can leave yourself with a
completely corrupted filesystem on the floppy, and permanently unreadable
sectors if the drive happened to be writing when you elected to eject the
media.  This is a bad idea.


Frank Durda IV <uhclem@nemesis.lonestar.org>|"The Knights who say "LETNi"
or uhclem%nemesis@rwsystr.nkn.net           | demand...  A SEGMENT REGISTER!!!"
					    |"A what?"
or ...letni!rwsys!nemesis!uhclem	    |"LETNi! LETNi! LETNi!"  - 1983