2011/5/21 Rémi Denis-Courmont <[email protected]>: > Le samedi 21 mai 2011 21:03:58 Stef Bon, vous avez écrit : >> Well, this issue does not only happen with a construction like mine. >> >> For example, when working on a document on a USB stick (or a partition >> on a harddisk) with LibreOffice for example, and you want to create another >> filesystem on it. > > This does not strike me as a common occurence. And it would be far simpler to > "fix" LibreOffice to only keep file descriptors open while loading/saving > documents - if it is not already doing so.
According to me keeping a file open is not strange and should not be fixed. You need a filedescriptor to set a lock. So while working a fd should be set. The way you suggest is not so good in multi user environments. > > USB mass storage gadget is the only real-life scenario that I've ever: to > expose a block device via USB MSC, the device must be unmounted. So > applications running on the USB gadget cannot it. This mostly affects handheld > devices. > > Even then, that's more of a design bug. If you want to share the handheld > filesystem over USB, you should use a higher level protocol that does not > require raw block access, e.g. OBEX-FTP or PTP/MTP. That is also the only way > to not be stuck with the crappy old VFAT filesystem format. > My target is not only a filesystem on a USB stick, but also a partition on a harddisk, and you want to create a new filesystem on it, or has a file open on a network share and about to close the networkconnection. >> It's a very good and gentle service to the average user to have a >> mechanism which informs the app to do something, like for example a >> dialog informing the user and asking what to do. > > And what do you suggest? I'm not suggesting anything, just asking this is already possible. I do not know everything, and maybe this is already possible. So just a question. You're right that it's not possible to pass the fd. Instead of that the inode is sufficient, or the path. The path is likely a candidate. Well I do not know how app developers have to implement this. I think it's a big plus to have this, instead of just closing the file bluntly, losing data. You can also think of the end of a session. When a app like swriter has a file open with unsaved changes, it's a good thing to send a message first (and wait for it to complete in reasonable period) and then terminate the app. Stef _______________________________________________ xdg mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/xdg
