[openbeosstorage] To Unmount Or Not To Unmount

Howdy,

it's been kind of peaceful here, lately. :-)

OK, here goes the story: What do you think about our BPartition::Unmount() 
method; shall it have immediate effect, i.e. without a 
CommitModifications()? The same questions needs to be answered for Mount() 
as well, but it is more interesting for Unmount(), since some operations 
(e.g. Resize(), Move()) may only work on unmounted partitions (as reported 
by the respective Can*() methods).

In favor of unmounting on commit speaks, that the behavior would be 
consistent with the other modifying methods. On the other hand, 
mounting/unmounting can be done by a third party at any time, even if one 
is preparing modifications at that time. Moreover it would be less 
convenient, if one just wants to unmount a partition and has to 
PrepareModifications(), Unmount(), CommitModifications(); which BTW won't 
work, if someone else is already preparing modifications.

It's even more complicated for Mount(). It can't be done immediately, when 
you invoke it on a modified or even new partition.

So, perhaps a hybrid approach is the best solution: When one has already 
called PrepareModifications() on the device, the Mount() and Unmount() 
invocations will take effect after the modifications are committed, 
otherwise the mounting/unmounting is done immediately.

Mmh, maybe that's confusing? It would make the mount/unmount handling in 
the disk device manager a bit more complicated, but as far as I can judge 
it at the moment, it should be feasible.

Oh, there's still the general question whether the user has to Unmount() 
the concerned partition explicitely, when e.g. CanResize() reported, that 
it works only when the partition is unmounted, or whether Resize() would 
automagically do the unmounting (or at least mark the partition to be 
unmounted).

Thoughts?

CU, Ingo

Other related posts: