linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Zeuthen <david@fubar.dk>
To: linux-hotplug@vger.kernel.org
Subject: Re: How to detect whether media is present in a reader?
Date: Sat, 12 Jun 2004 12:21:27 +0000	[thread overview]
Message-ID: <1087042887.6345.12.camel@ixus.fubar.dk> (raw)
In-Reply-To: <200406101053.33097.michael@gentoo.co.nz>

On Sat, 2004-06-12 at 23:39 +1200, Michael Hamilton wrote:
> Thanks for the pointers.  However it has just occurred to me -
> and please correct me if I'm wrong - that frequently polling flash 
> media might prematurely wear it out. 

It is my understanding that flash media (NOR and NAND flash) only wears
out when doing erase/write operations, think of a lot of embedded
devices using flash. But I'm not sure. 

Second, all that the polling for media entails is a readonly nonblocking
open(2) on the top level block device, e.g. /dev/sda. Whether this means
that the device actually accesses the flash memory or it's handled in
some logic another place, I'm not sure either. 

I think Greg's point was that the cheap devices doesn't give the kernel
a signal when media is inserted/removed, not that it was impossible to
poll for it - and I guess polling is frowned upon in the kernel. But now
I'm just speculating; I don't know really.

>  I guess the media should 
> only be polled when the user tries to access it - something like 
> the approach taken by submount - so I'm probably going to look 
> at virtual file systems (maybe using the fuse library).
> 

There's something called volumagic that goes a step further and mounts/
unmounts devices based on whether the device is accessed - btw, it is
all implemented in user space through a NFS server. This solves the
problems of user yanking out a USB device and locking of optical drives.

IMHO, It would be good, for desktop Linux at least, if functionality
like this was implemented in the kernel without changing the interface
that userspace has today, but it doesn't seem like it's going to happy
anytime soon. Oh well.

Cheers,
David




-------------------------------------------------------
This SF.Net email is sponsored by the new InstallShield X.
From Windows to Linux, servers to mobile, InstallShield X is the
one installation-authoring solution that does it all. Learn more and
evaluate today! http://www.installshield.com/Dev2Dev/0504
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

  parent reply	other threads:[~2004-06-12 12:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-09 22:53 How to detect whether media is present in a reader? Michael Hamilton
2004-06-09 22:57 ` Michael Hamilton
2004-06-09 23:34 ` Greg KH
2004-06-11 21:01 ` David Zeuthen
2004-06-12 11:39 ` Michael Hamilton
2004-06-12 12:21 ` David Zeuthen [this message]
2004-06-14 20:33 ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1087042887.6345.12.camel@ixus.fubar.dk \
    --to=david@fubar.dk \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).