diff options
author | David Zeuthen <davidz@redhat.com> | 2009-06-30 23:19:01 -0400 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2009-07-08 13:53:04 +0200 |
commit | 8af5a5581e11d9c07e8ba3a17eb2cc93b5c70631 (patch) | |
tree | 47206e3fdc7532a97deacb836ec5c79042661421 /daemon/gvfsdaemon.c | |
parent | c33e26d3914e0659d4a317fda7fe9acbb6269dc9 (diff) | |
download | gvfs-8af5a5581e11d9c07e8ba3a17eb2cc93b5c70631.tar.gz |
Bug 587484 – Interaction when unmounting mounts and misc fixes
- Port everything to use _with_operation() variants of unmount/eject
methods
- Add support for g_file_poll_mountable()
- new job class: GVfsJobPollMountable
- Pass mount operation for unmount/eject ops on GDaemonFile and
GDaemonMount
- receive in the appropriate GVfsJob classes
- also pass unmount flags where it was missing
- port all backends to use this
- Teach GMountSource and GMountOperationDBus about the new
GMountOperation::show-processes signal
- also provide new API
- g_mount_source_is_dummy() - e.g. when the client didn't
passed NULL for the GMountOperation
- g_mount_source_abort() - to send the ::abort signal to the
client-side GMountOperation
- make the client-side of GMountSource return ::reply with
NOT_HANDLED when we do an abort
- Refactor the mount operation handling in GProxyVolumeMonitor
- Pass mount operation for unmount/ejects in GProxyVolumeMonitor
- Pass the process id of the actual reader/writer in OpenForRead
and OpenForWrite daemon methods
- add some private API for making the FUSE client set the
pid of the POSIX client (otherwise it looks like the FUSE
client is blocking) and pass the right pid.
This is because the FUSE client is basically impersonating the
POSIX processes.
- Make the process id mentioned above available in appropriate
GVfsJob classes
- GVfsJobOpenForRead
- GVfsJobOpenForWrite
- GVfsChannel
- Provide API to get a list of all blocking clients, e.g. an array
of GPid
- g_vfs_daemon_get_blocking_processes()
- Provide convenience API to easily doing the right thing on unmount;
e.g. interact with the user about blocking processes - see the gphoto2
backend for example usage
- g_vfs_backend_has_blocking_processes()
- g_vfs_backend_unmount_with_operation() and
g_vfs_backend_unmount_with_operation_finish()
- Only the gphoto2 backend supports ::show-processes right now. Support
for other backends will be added shortly.
- Implement support for ::show-processes in the GDU volume monitor
- right now we don't support "Unmount Anyway" since it requires
ABI changes in libgdu.so - this will be changed as soon as there's
a new gnome-disk-utility release
Diffstat (limited to 'daemon/gvfsdaemon.c')
-rw-r--r-- | daemon/gvfsdaemon.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/daemon/gvfsdaemon.c b/daemon/gvfsdaemon.c index cf4264eb..8b7d521b 100644 --- a/daemon/gvfsdaemon.c +++ b/daemon/gvfsdaemon.c @@ -40,6 +40,8 @@ #include <gvfsdaemonprotocol.h> #include <gvfsdaemonutils.h> #include <gvfsjobmount.h> +#include <gvfsjobopenforread.h> +#include <gvfsjobopenforwrite.h> #include <gdbusutils.h> enum { @@ -1065,3 +1067,33 @@ g_vfs_daemon_initiate_mount (GVfsDaemon *daemon, job = g_vfs_job_mount_new (mount_spec, mount_source, is_automount, request, backend); g_vfs_daemon_queue_job (daemon, job); } + +/** + * g_vfs_daemon_get_blocking_processes: + * @daemon: A #GVfsDaemon. + * + * Gets all processes that blocks unmounting, e.g. processes with open + * file handles. + * + * Returns: An array of #GPid. Free with g_array_unref(). + */ +GArray * +g_vfs_daemon_get_blocking_processes (GVfsDaemon *daemon) +{ + GArray *processes; + GList *l; + + processes = g_array_new (FALSE, FALSE, sizeof (GPid)); + for (l = daemon->job_sources; l != NULL; l = l->next) + { + if (G_VFS_IS_CHANNEL (l->data)) + { + GPid pid; + pid = g_vfs_channel_get_actual_consumer (G_VFS_CHANNEL (l->data)); + g_array_append_val (processes, pid); + } + } + + return processes; +} + |