On Sat, Jun 11, 2011 at 4:08 AM, T <[email protected]> wrote:
> So is there some reliable way of detecting whether the underlying
> storage device has gone away when a library/system call fails,
> even if the OS still regards the filesystem as being mounted? Can
> I, upon detecting errno==ENOENT after fopen(), use some other
> calls (for example ioctl(), getfsstat(), or statfs()) to
> determine whether the cause is a mis-spelled filename or removed
> USB stick? What is the recommended/preferred way? Can/should I
> perhaps do something before attempting the fopen(), to find out
> whether the USB stick is still attached?

There are no filesystems without storage, they are force unmounted
when the device is removed.  You should look into hotplugd if you want
notification of device removal.

Reply via email to