[gvfs] daemon: New logic to the backend to block requests
- From: Christian Kellner <gicmo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] daemon: New logic to the backend to block requests
- Date: Tue, 7 Jun 2011 12:36:02 +0000 (UTC)
commit 66bbe38a1329616e6313b6bd41b98e1b77d1306d
Author: Christian Kellner <gicmo gnome org>
Date: Wed May 25 15:27:33 2011 +0200
daemon: New logic to the backend to block requests
When the backend is set to block requests it will answer all
incoming requets with G_IO_ERROR_NOT_MOUNTED. This will later
be used by the unmount code to bridge the time while we are
unregistering the mount but have not finished doing so.
daemon/gvfsbackend.c | 22 ++++++++++++++++++++++
daemon/gvfsbackend.h | 2 ++
2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/daemon/gvfsbackend.c b/daemon/gvfsbackend.c
index ee32108..1c2fb8a 100644
--- a/daemon/gvfsbackend.c
+++ b/daemon/gvfsbackend.c
@@ -80,6 +80,7 @@ struct _GVfsBackendPrivate
gboolean user_visible;
char *default_location;
GMountSpec *mount_spec;
+ gboolean block_requests;
};
@@ -509,6 +510,12 @@ g_vfs_backend_add_auto_info (GVfsBackend *backend,
}
+void
+g_vfs_backend_set_block_requests (GVfsBackend *backend)
+{
+ backend->priv->block_requests = TRUE;
+}
+
static DBusHandlerResult
backend_dbus_handler (DBusConnection *connection,
DBusMessage *message,
@@ -522,6 +529,21 @@ backend_dbus_handler (DBusConnection *connection,
g_debug ("backend_dbus_handler %s:%s\n",
dbus_message_get_interface (message),
dbus_message_get_member (message));
+
+ if (backend->priv->block_requests)
+ {
+ DBusMessage *reply;
+
+ reply = _dbus_message_new_gerror (message,
+ G_IO_ERROR,
+ G_IO_ERROR_NOT_MOUNTED,
+ "%s", "Backend currently unmounting");
+
+ g_assert (reply != NULL);
+
+ dbus_connection_send (connection, reply, NULL);
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
if (dbus_message_is_method_call (message,
G_VFS_DBUS_MOUNT_INTERFACE,
diff --git a/daemon/gvfsbackend.h b/daemon/gvfsbackend.h
index 4734f36..6c152ac 100644
--- a/daemon/gvfsbackend.h
+++ b/daemon/gvfsbackend.h
@@ -498,6 +498,8 @@ void g_vfs_backend_add_auto_info (GVfsBackend
GFileInfo *info,
const char *uri);
+void g_vfs_backend_set_block_requests (GVfsBackend *backend);
+
gboolean g_vfs_backend_has_blocking_processes (GVfsBackend *backend);
gboolean g_vfs_backend_unmount_with_operation_finish (GVfsBackend *backend,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]