[gvfs/gdbus-core] gdbus: Use G_VARIANT_TYPE_HANDLE for fd_id arguments
- From: Tomas Bzatek <tbzatek src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs/gdbus-core] gdbus: Use G_VARIANT_TYPE_HANDLE for fd_id arguments
- Date: Fri, 20 Jul 2012 15:06:59 +0000 (UTC)
commit 21ab5e2b3a997ca86635c4270274bdcdf1cd4a2b
Author: Tomas Bzatek <tbzatek redhat com>
Date: Fri Jul 20 17:06:12 2012 +0200
gdbus: Use G_VARIANT_TYPE_HANDLE for fd_id arguments
client/gdaemonfile.c | 24 ++++++++++++++++++++----
client/gvfsiconloadable.c | 12 ++++++++++--
common/dbus-interfaces.xml | 6 +++---
daemon/gvfsjobopenforread.c | 8 ++++++--
daemon/gvfsjobopenforwrite.c | 5 ++++-
5 files changed, 43 insertions(+), 12 deletions(-)
---
diff --git a/client/gdaemonfile.c b/client/gdaemonfile.c
index e80710b..5cfe15f 100644
--- a/client/gdaemonfile.c
+++ b/client/gdaemonfile.c
@@ -1040,18 +1040,22 @@ read_async_cb (GVfsDBusMount *proxy,
gboolean can_seek;
GUnixFDList *fd_list;
int fd;
+ GVariant *fd_id_val;
guint fd_id;
GFileInputStream *stream;
g_print ("read_async_cb\n");
orig_result = data->result;
- if (! gvfs_dbus_mount_call_open_for_read_finish (proxy, &fd_id, &can_seek, &fd_list, res, &error))
+ if (! gvfs_dbus_mount_call_open_for_read_finish (proxy, &fd_id_val, &can_seek, &fd_list, res, &error))
{
g_simple_async_result_take_error (orig_result, error);
goto out;
}
+ fd_id = g_variant_get_handle (fd_id_val);
+ g_variant_unref (fd_id_val);
+
if (fd_list == NULL || g_unix_fd_list_get_length (fd_list) != 1 ||
(fd = g_unix_fd_list_get (fd_list, fd_id, NULL)) == -1)
{
@@ -1152,6 +1156,7 @@ g_daemon_file_read (GFile *file,
gboolean can_seek;
GUnixFDList *fd_list;
int fd;
+ GVariant *fd_id_val;
guint fd_id;
guint32 pid;
GError *local_error = NULL;
@@ -1168,7 +1173,7 @@ g_daemon_file_read (GFile *file,
path,
pid,
NULL,
- &fd_id,
+ &fd_id_val,
&can_seek,
&fd_list,
cancellable,
@@ -1176,6 +1181,9 @@ g_daemon_file_read (GFile *file,
g_print ("g_daemon_file_read: done, res = %d\n", res);
+ fd_id = g_variant_get_handle (fd_id_val);
+ g_variant_unref (fd_id_val);
+
if (! res)
{
if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
@@ -1217,6 +1225,7 @@ file_open_write (GFile *file,
gboolean can_seek;
GUnixFDList *fd_list;
int fd;
+ GVariant *fd_id_val;
guint32 fd_id;
guint32 pid;
guint64 initial_offset;
@@ -1239,7 +1248,7 @@ file_open_write (GFile *file,
flags,
pid,
NULL,
- &fd_id,
+ &fd_id_val,
&can_seek,
&initial_offset,
&fd_list,
@@ -1248,6 +1257,9 @@ file_open_write (GFile *file,
g_print ("file_open_write: done, res = %d\n", res);
+ fd_id = g_variant_get_handle (fd_id_val);
+ g_variant_unref (fd_id_val);
+
if (! res)
{
if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
@@ -3201,6 +3213,7 @@ file_open_write_async_cb (GVfsDBusMount *proxy,
gboolean can_seek;
GUnixFDList *fd_list;
int fd;
+ GVariant *fd_id_val;
guint fd_id;
guint64 initial_offset;
GFileOutputStream *output_stream;
@@ -3208,12 +3221,15 @@ file_open_write_async_cb (GVfsDBusMount *proxy,
g_print ("file_open_write_async_cb\n");
orig_result = data->result;
- if (! gvfs_dbus_mount_call_open_for_write_finish (proxy, &fd_id, &can_seek, &initial_offset, &fd_list, res, &error))
+ if (! gvfs_dbus_mount_call_open_for_write_finish (proxy, &fd_id_val, &can_seek, &initial_offset, &fd_list, res, &error))
{
g_simple_async_result_take_error (orig_result, error);
goto out;
}
+ fd_id = g_variant_get_handle (fd_id_val);
+ g_variant_unref (fd_id_val);
+
if (fd_list == NULL || g_unix_fd_list_get_length (fd_list) != 1 ||
(fd = g_unix_fd_list_get (fd_list, fd_id, NULL)) == -1)
{
diff --git a/client/gvfsiconloadable.c b/client/gvfsiconloadable.c
index 4c43510..f698a49 100644
--- a/client/gvfsiconloadable.c
+++ b/client/gvfsiconloadable.c
@@ -91,6 +91,7 @@ g_vfs_icon_load (GLoadableIcon *icon,
gboolean can_seek;
GUnixFDList *fd_list;
int fd;
+ GVariant *fd_id_val;
guint32 fd_id;
GError *local_error = NULL;
@@ -103,7 +104,7 @@ g_vfs_icon_load (GLoadableIcon *icon,
res = gvfs_dbus_mount_call_open_icon_for_read_sync (proxy,
vfs_icon->icon_id,
NULL,
- &fd_id,
+ &fd_id_val,
&can_seek,
&fd_list,
cancellable,
@@ -111,6 +112,9 @@ g_vfs_icon_load (GLoadableIcon *icon,
g_print ("gvfsiconloadable.c: g_vfs_icon_load: done, res = %d\n", res);
+ fd_id = g_variant_get_handle (fd_id_val);
+ g_variant_unref (fd_id_val);
+
if (! res)
{
if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
@@ -290,17 +294,21 @@ open_icon_read_cb (GVfsDBusMount *proxy,
gboolean can_seek;
GUnixFDList *fd_list;
int fd;
+ GVariant *fd_id_val;
guint fd_id;
GFileInputStream *stream;
g_print ("gvfsiconloadable.c: open_icon_read_cb\n");
- if (! gvfs_dbus_mount_call_open_icon_for_read_finish (proxy, &fd_id, &can_seek, &fd_list, res, &error))
+ if (! gvfs_dbus_mount_call_open_icon_for_read_finish (proxy, &fd_id_val, &can_seek, &fd_list, res, &error))
{
g_simple_async_result_take_error (data->result, error);
goto out;
}
+ fd_id = g_variant_get_handle (fd_id_val);
+ g_variant_unref (fd_id_val);
+
if (fd_list == NULL || g_unix_fd_list_get_length (fd_list) != 1 ||
(fd = g_unix_fd_list_get (fd_list, fd_id, NULL)) == -1)
{
diff --git a/common/dbus-interfaces.xml b/common/dbus-interfaces.xml
index aa8e829..3931c12 100644
--- a/common/dbus-interfaces.xml
+++ b/common/dbus-interfaces.xml
@@ -181,7 +181,7 @@
<method name="OpenForRead">
<arg type='ay' name='path_data' direction='in'/>
<arg type='u' name='pid' direction='in'/>
- <arg type='u' name='fd_id' direction='out'/>
+ <arg type='h' name='fd_id' direction='out'/>
<arg type='b' name='can_seek' direction='out'/>
<annotation name="org.gtk.GDBus.C.UnixFD" value="true"/>
</method>
@@ -192,7 +192,7 @@
<arg type='b' name='make_backup' direction='in'/>
<arg type='u' name='flags' direction='in'/>
<arg type='u' name='pid' direction='in'/>
- <arg type='u' name='fd_id' direction='out'/>
+ <arg type='h' name='fd_id' direction='out'/>
<arg type='b' name='can_seek' direction='out'/>
<arg type='t' name='initial_offset' direction='out'/>
<annotation name="org.gtk.GDBus.C.UnixFD" value="true"/>
@@ -322,7 +322,7 @@
</method>
<method name="OpenIconForRead">
<arg type='ay' name='path_data' direction='in'/>
- <arg type='u' name='fd_id' direction='out'/>
+ <arg type='h' name='fd_id' direction='out'/>
<arg type='b' name='can_seek' direction='out'/>
<annotation name="org.gtk.GDBus.C.UnixFD" value="true"/>
</method>
diff --git a/daemon/gvfsjobopenforread.c b/daemon/gvfsjobopenforread.c
index fcc9123..13b8d2a 100644
--- a/daemon/gvfsjobopenforread.c
+++ b/daemon/gvfsjobopenforread.c
@@ -187,9 +187,13 @@ create_reply (GVfsJob *job,
}
if (open_job->read_icon)
- gvfs_dbus_mount_complete_open_icon_for_read (object, invocation, fd_list, fd_id, open_job->can_seek);
+ gvfs_dbus_mount_complete_open_icon_for_read (object, invocation,
+ fd_list, g_variant_new_handle (fd_id),
+ open_job->can_seek);
else
- gvfs_dbus_mount_complete_open_for_read (object, invocation, fd_list, fd_id, open_job->can_seek);
+ gvfs_dbus_mount_complete_open_for_read (object, invocation,
+ fd_list, g_variant_new_handle (fd_id),
+ open_job->can_seek);
/* FIXME: this could cause issues as long as fd_list closes all its fd's when it's finalized */
close (remote_fd);
diff --git a/daemon/gvfsjobopenforwrite.c b/daemon/gvfsjobopenforwrite.c
index 76f3a3d..f70cfef 100644
--- a/daemon/gvfsjobopenforwrite.c
+++ b/daemon/gvfsjobopenforwrite.c
@@ -270,7 +270,10 @@ create_reply (GVfsJob *job,
g_error_free (error);
}
- gvfs_dbus_mount_complete_open_for_write (object, invocation, fd_list, fd_id, open_job->can_seek, open_job->initial_offset);
+ gvfs_dbus_mount_complete_open_for_write (object, invocation,
+ fd_list, g_variant_new_handle (fd_id),
+ open_job->can_seek,
+ open_job->initial_offset);
close (remote_fd);
g_object_unref (fd_list);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]