Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Oct 2010 11:03:26 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-current@freebsd.org
Cc:        Alexander Motin <mav@freebsd.org>, Pawel Jakub Dawidek <pjd@freebsd.org>, Andriy Gapon <avg@icyb.net.ua>, sos@freebsd.org
Subject:   Re: letting glabel recognise a media change
Message-ID:  <201010111103.26780.jhb@freebsd.org>
In-Reply-To: <4CB22833.70304@FreeBSD.org>
References:  <4CA3BD7C.9080306@feral.com> <20101010155340.GQ1733@garage.freebsd.pl> <4CB22833.70304@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sunday, October 10, 2010 4:55:15 pm Alexander Motin wrote:
> Pawel Jakub Dawidek wrote:
> > On Thu, Sep 30, 2010 at 08:46:11PM +0300, Alexander Motin wrote:
> >> Andriy Gapon wrote:
> >>> on 30/09/2010 01:28 Matthew Jacob said the following:
> >>>> If something like that was in place, I assure you that things would start to use
> >>>> it very quickly.
> >>> I am not sure about this.
> >>> Because, e.g. I don't see an easy way to know that media is changed in scsi_cd
> >>> driver.  That is, without polling.  I don't consider polling to be an easy way for
> >>> a number of reasons.
> >> SATA specification defines concept of Asynchronous Notification. It is
> >> already used by port multipliers to report about PHY events. It is also
> >> supposed to be used by CD drives to report media change. I haven't seen
> >> such devices yet, but hope they may appear sometimes.
> >>
> >> And even without AN support it would be nice to implement proper
> >> handling for SCSI "UA - media changed" errors within CAM. It still won't
> >> be perfect without using polling, but probably still something.
> > 
> > I'd like to know the original reason why CD device is represented by
> > GEOM provider and not CD media. For my naive thinking CD media should be
> > GEOM provider that we taste once the media is inserted and orphan once
> > the media is removed. I don't see any reasons for CD device to be useful
> > GEOM provider, but maybe I'm overlooking something.
> > 
> > Poul-Henning or Soren, do you remember who made and why this design choice?
> 
> SCSI drivers receive no notification on media insertion. Somebody should
> poll device. At this moment it is handled by consumers. Indeed not sure
> it is the best idea. If we want driver to bother with this polling - we
> may do as you propose. Actually in sdhci(4) driver I am doing this way -
> mmcsdX device appears when card inserted and disappears on removal.
> 
> I think first thing that may brake if there will be no cdX device -
> loading the media with some commands. Also it may be non-intuitive that
> drive is present, but disk is not registered in GEOM.

With CD drives you are also rather stuck in that the existing ABI for
controlling CD drives (e.g. ioctls in 3rd party software to eject a CD) are
done on the /dev/cdX device.  Ideally enclosures for removable media would
be separate devices from the removable media itself, but a lot of existing
software for CD's would break if this changes now.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010111103.26780.jhb>