Unmounting vs. ejecting



Hey,

a while ago I ported the Xfce file manager Thunar to GIO. Today I took
a quick look back at how I implemented unmounting/ejecting and I
started wondering...

We have GVolume, GMount and GDrive. A GDrive may contain multiple
GVolumes, each of them may have a GMount (if they are mounted). GDrives
can be ejected, GVolumes can be ejected and GMounts can be unmounted as
well as ejected.

I realize that ejecting means the media (be it a USB stick with
multiple volumes or a CD) will be unavailable after the operation has
finished. Ejecting a volume seems to have the same effect as
ejecting the drive (at least that's what I experienced with my
DVD drive). Unmounting a mount means all volumes on the media can still
be used afterwards.

Now, in a modern file manager no one wants do think about all these
options, right? You want to mount and you want to eject, where ejecting
doesn't necessarily mean the media becomes unavailable. E.g. ejecting a
volume on a USB stick with multiple volumes should technically only
unmount that volume, not eject the entire USB stick.

So, I wonder: what is the preferred order in which one should attempt
to eject a volume? 

Is it

  1. try to unmount the mount
  2. if that fails, try to eject the volume 
 (3. if that fails as well, try to eject the drive)?

Or would it be better to do it like this:

  1. check if the volume is the only one mounted on the drive
    a) if so, eject the volume
    b) if not, unmout the mount
  2. if that fails, try to to eject the volume
 (3. if that fails as well, try to eject the drive)?

Ejecting is especially weird with USB sticks, as they become
unavailable with that operation. So, in addition, I wonder how to
decide when to eject and when not to eject.

Someone clearly had a reason to add these different alternatives to
eject and unmount. I'd be interested in knowing how to use them in a
sane way. Anyone interested in explaining his take on this matter?

Cheers and thanks in advance,
Jannis

Attachment: signature.asc
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]