- Update AFC patch

This commit is contained in:
Bastien Nocera 2009-08-14 14:50:11 +00:00
parent 391fb17122
commit 4059e79184
3 changed files with 76 additions and 98 deletions

View File

@ -1,4 +1,4 @@
From 1ba08909cdc395c14116d7cdf0f8f3442ba5e4c0 Mon Sep 17 00:00:00 2001
From 8675a60e030fc91292d19cfd2cd9a6d74dd1776f Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Thu, 6 Aug 2009 22:55:47 +0100
Subject: [PATCH] Add AFC backend
@ -15,18 +15,18 @@ Bastien Nocera <hadess@hadess.net>
configure.ac | 26 +-
daemon/Makefile.am | 23 +
daemon/afc.mount.in | 7 +
daemon/gvfsbackendafc.c | 1226 ++++++++++++++++++++
daemon/gvfsbackendafc.c | 1228 ++++++++++++++++++++
daemon/gvfsbackendafc.h | 37 +
monitor/Makefile.am | 6 +-
monitor/afc/Makefile.am | 49 +
monitor/afc/afc.monitor | 5 +
monitor/afc/afcvolume.c | 336 ++++++
monitor/afc/afcvolume.c | 353 ++++++
monitor/afc/afcvolume.h | 44 +
monitor/afc/afcvolumemonitor.c | 215 ++++
monitor/afc/afcvolumemonitor.c | 224 ++++
monitor/afc/afcvolumemonitor.h | 39 +
monitor/afc/afcvolumemonitordaemon.c | 31 +
.../org.gtk.Private.AfcVolumeMonitor.service.in | 4 +
14 files changed, 2046 insertions(+), 2 deletions(-)
14 files changed, 2074 insertions(+), 2 deletions(-)
create mode 100644 daemon/afc.mount.in
create mode 100644 daemon/gvfsbackendafc.c
create mode 100644 daemon/gvfsbackendafc.h
@ -40,7 +40,7 @@ Bastien Nocera <hadess@hadess.net>
create mode 100644 monitor/afc/org.gtk.Private.AfcVolumeMonitor.service.in
diff --git a/configure.ac b/configure.ac
index 7f1ec16..4675ae9 100644
index 9bfb8ad..6b3838c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -324,6 +324,28 @@ AC_SUBST(CDDA_CFLAGS)
@ -91,7 +91,7 @@ index 7f1ec16..4675ae9 100644
DNS-SD support: $msg_avahi
Build HAL volume monitor: $msg_hal (with fast init path: $have_hal_fast_init)
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 733fa41..4c9e4af 100644
index a03eba1..cf68391 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -101,6 +101,12 @@ mount_DATA += archive.mount
@ -107,7 +107,7 @@ index 733fa41..4c9e4af 100644
EXTRA_DIST = gvfs-daemon.service.in $(mount_in_files) obexftp-marshal.list
DISTCLEANFILES = gvfs-daemon.service $(mount_DATA)
@@ -433,3 +439,20 @@ gvfsd_dav_LDADD = $(libraries) $(HTTP_LIBS)
@@ -442,3 +448,20 @@ gvfsd_dav_LDADD = $(libraries) $(HTTP_LIBS)
if HAVE_AVAHI
gvfsd_dav_LDADD += $(top_builddir)/common/libgvfscommon-dnssd.la
endif
@ -143,10 +143,10 @@ index 0000000..727d833
+
diff --git a/daemon/gvfsbackendafc.c b/daemon/gvfsbackendafc.c
new file mode 100644
index 0000000..97d0a22
index 0000000..d30ede8
--- /dev/null
+++ b/daemon/gvfsbackendafc.c
@@ -0,0 +1,1226 @@
@@ -0,0 +1,1228 @@
+/*
+ * gvfs/daemon/gvfsbackendafc.c
+ *
@ -165,7 +165,6 @@ index 0000000..97d0a22
+#include <glib/gi18n.h>
+#include <errno.h>
+
+#define G_UDEV_API_IS_SUBJECT_TO_CHANGE
+#include <gudev/gudev.h>
+
+#include <libiphone/libiphone.h>
@ -239,7 +238,7 @@ index 0000000..97d0a22
+ { -1 }
+};
+
+/**
+/**
+ * Tries to convert the AFC error value into a GIOError.
+ *
+ * @param client AFC client to retrieve status value from.
@ -414,7 +413,7 @@ index 0000000..97d0a22
+ int retries;
+ iphone_error_t err;
+ lockdownd_client_t lockdown_cli = NULL;
+ const gchar * const subsystems[] = { "usb_endpoint", NULL };
+ const gchar * const subsystems[] = { "usb", NULL };
+
+ self = G_VFS_BACKEND_AFC(backend);
+ self->connected = FALSE;
@ -505,7 +504,7 @@ index 0000000..97d0a22
+ /* translators:
+ * This is the device name, with the service being browsed in brackets, eg.:
+ * Alan Smithee's iPhone (Service 2 on Apple Mobile Device */
+ g_vfs_backend_set_display_name (G_VFS_BACKEND(self),
+ g_vfs_backend_set_display_name (G_VFS_BACKEND(self),
+ g_strdup_printf (_("%s (%s)"), display_name, self->service));
+ }
+ else
@ -566,10 +565,13 @@ index 0000000..97d0a22
+
+static void
+g_vfs_backend_afc_unmount (GVfsBackend *backend,
+ GVfsJobUnmount * job)
+ GVfsJobUnmount *job,
+ GMountUnmountFlags flags,
+ GMountSource *mount_source)
+{
+ GVfsBackendAfc *self;
+
+ /* FIXME: check on G_MOUNT_UNMOUNT_FORCE flag */
+ self = G_VFS_BACKEND_AFC (backend);
+ g_vfs_backend_afc_close_connection (self);
+ g_vfs_job_succeeded (G_VFS_JOB(job));
@ -768,7 +770,7 @@ index 0000000..97d0a22
+ if (req > 0 &&
+ G_UNLIKELY(g_vfs_backend_afc_check (afc_file_read (self->afc_cli,
+ fd, buffer, req, &nread),
+ G_VFS_JOB(job))))
+ G_VFS_JOB(job))))
+ {
+ return;
+ }
@ -797,7 +799,7 @@ index 0000000..97d0a22
+ if (sz > 0 &&
+ G_UNLIKELY(g_vfs_backend_afc_check(afc_file_write (self->afc_cli,
+ fd, buffer, sz, &nwritten),
+ G_VFS_JOB(job))))
+ G_VFS_JOB(job))))
+ {
+ return;
+ }
@ -1179,19 +1181,19 @@ index 0000000..97d0a22
+ g_strfreev (kvps);
+
+ g_file_info_set_attribute_uint32 (info,
+ G_FILE_ATTRIBUTE_UNIX_BLOCK_SIZE,
+ G_FILE_ATTRIBUTE_UNIX_BLOCK_SIZE,
+ (guint32) blocksize);
+ g_file_info_set_attribute_uint64 (info,
+ G_FILE_ATTRIBUTE_FILESYSTEM_SIZE,
+ g_file_info_set_attribute_uint64 (info,
+ G_FILE_ATTRIBUTE_FILESYSTEM_SIZE,
+ (guint64) totalspace);
+ g_file_info_set_attribute_uint64 (info,
+ G_FILE_ATTRIBUTE_FILESYSTEM_FREE,
+ g_file_info_set_attribute_uint64 (info,
+ G_FILE_ATTRIBUTE_FILESYSTEM_FREE,
+ (guint64) freespace);
+ g_file_info_set_attribute_boolean (info,
+ G_FILE_ATTRIBUTE_FILESYSTEM_READONLY,
+ g_file_info_set_attribute_boolean (info,
+ G_FILE_ATTRIBUTE_FILESYSTEM_READONLY,
+ FALSE);
+ g_file_info_set_attribute_uint32 (info,
+ G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW,
+ G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW,
+ G_FILESYSTEM_PREVIEW_TYPE_IF_LOCAL);
+ }
+
@ -1502,10 +1504,10 @@ index 0000000..1663573
+
diff --git a/monitor/afc/afcvolume.c b/monitor/afc/afcvolume.c
new file mode 100644
index 0000000..fe290a1
index 0000000..688f75b
--- /dev/null
+++ b/monitor/afc/afcvolume.c
@@ -0,0 +1,336 @@
@@ -0,0 +1,353 @@
+/*
+ * gvfs/monitor/afc/afc-volume.c
+ *
@ -1592,7 +1594,7 @@ index 0000000..fe290a1
+ err = iphone_get_device_by_uuid (&dev, self->uuid);
+ if (err == IPHONE_E_SUCCESS)
+ break;
+ g_usleep (G_USEC_PER_SEC);
+ g_usleep (G_USEC_PER_SEC);
+ } while (retries++ < 10);
+
+ if (err != IPHONE_E_SUCCESS)
@ -1624,7 +1626,7 @@ index 0000000..fe290a1
+ model = afc_get_device_info_field (afc_cli, "Model");
+ if (model != NULL)
+ {
+ if(strstr(model, "iPod") != NULL)
+ if(g_str_has_prefix(model, "iPod") != FALSE)
+ {
+ g_free (self->icon);
+ self->icon = g_strdup ("multimedia-player-apple-ipod-touch");
@ -1699,6 +1701,17 @@ index 0000000..fe290a1
+ return TRUE;
+}
+
+static GDrive *
+g_vfs_afc_volume_get_drive (GVolume *volume)
+{
+ return NULL;
+}
+
+static GMount *
+g_vfs_afc_volume_get_mount (GVolume *volume)
+{
+ return NULL;
+}
+
+typedef struct
+{
@ -1778,7 +1791,7 @@ index 0000000..fe290a1
+ char *id;
+
+ id = NULL;
+ if (strcmp (kind, G_VOLUME_IDENTIFIER_KIND_UUID) == 0)
+ if (g_str_equal (kind, G_VOLUME_IDENTIFIER_KIND_UUID) != FALSE)
+ id = g_strdup (afc_volume->uuid);
+
+ return id;
@ -1810,7 +1823,11 @@ index 0000000..fe290a1
+static GFile *
+g_vfs_afc_volume_get_activation_root (GVolume *volume)
+{
+ GFile *root = g_object_get_data (G_OBJECT (volume), "root");
+ GFile *root;
+
+ root = g_object_get_data (G_OBJECT (volume), "root");
+ if (root == NULL)
+ return NULL;
+
+ return g_object_ref (root);
+}
@ -1821,6 +1838,8 @@ index 0000000..fe290a1
+ iface->get_name = g_vfs_afc_volume_get_name;
+ iface->get_icon = g_vfs_afc_volume_get_icon;
+ iface->get_uuid = g_vfs_afc_volume_get_uuid;
+ iface->get_drive = g_vfs_afc_volume_get_drive;
+ iface->get_mount = g_vfs_afc_volume_get_mount;
+ iface->can_mount = g_vfs_afc_volume_can_mount;
+ iface->should_automount = g_vfs_afc_volume_should_automount;
+ iface->mount_fn = g_vfs_afc_volume_mount;
@ -1894,10 +1913,10 @@ index 0000000..de24cd5
+ */
diff --git a/monitor/afc/afcvolumemonitor.c b/monitor/afc/afcvolumemonitor.c
new file mode 100644
index 0000000..c98b603
index 0000000..93926eb
--- /dev/null
+++ b/monitor/afc/afcvolumemonitor.c
@@ -0,0 +1,215 @@
@@ -0,0 +1,224 @@
+/*
+ * gvfs/monitor/afc/afc-volume-monitor.c
+ *
@ -1977,33 +1996,28 @@ index 0000000..c98b603
+ gpointer user_data)
+{
+ GVfsAfcVolumeMonitor *self;
+ const char *vendor, *devname, *uuid;
+ const char *vendor, *uuid;
+
+ self = G_VFS_AFC_VOLUME_MONITOR(user_data);
+
+ /* Vendor is Apple? */
+ vendor = g_udev_device_get_property (device, "ID_VENDOR");
+ if (vendor == NULL ||
+ g_str_equal (vendor, "Apple_Inc.") == FALSE)
+ return;
+
+ /* Device is for end point 85? */
+ devname = g_udev_device_get_device_file (device);
+ if (devname == NULL ||
+ g_str_has_suffix (devname, "_ep85") == FALSE)
+ g_str_equal (vendor, "Apple_Inc.") == FALSE) {
+ return;
+ }
+
+ /* Get us a UUID */
+ uuid = g_udev_device_get_property (device, "ID_SERIAL_SHORT");
+ if (uuid == NULL)
+ {
+ g_warning ("Could not get UUID for device '%s'", devname);
+ g_message ("No serial for device");
+ return;
+ }
+
+ if (g_str_equal (action, "add") != FALSE)
+ g_vfs_afc_monitor_create_volume (self, uuid);
+ else
+ else if (g_str_equal (action, "remove") != FALSE)
+ g_vfs_afc_monitor_remove_volume (self, uuid);
+}
+
@ -2013,7 +2027,7 @@ index 0000000..c98b603
+{
+ GVfsAfcVolumeMonitor *self;
+ GList *devices, *l;
+ const gchar * const subsystems[] = { "usb_endpoint", NULL };
+ const gchar * const subsystems[] = { "usb", NULL };
+
+ /* Boilerplate code to chain from parent. */
+ self = G_VFS_AFC_VOLUME_MONITOR((*G_OBJECT_CLASS(g_vfs_afc_volume_monitor_parent_class)->constructor)(type, ncps, cps));
@ -2066,6 +2080,12 @@ index 0000000..c98b603
+}
+
+static GList *
+g_vfs_afc_volume_monitor_get_mounts (GVolumeMonitor *_self)
+{
+ return NULL;
+}
+
+static GList *
+g_vfs_afc_volume_monitor_get_volumes (GVolumeMonitor *_self)
+{
+ GVfsAfcVolumeMonitor *self;
@ -2079,6 +2099,12 @@ index 0000000..c98b603
+ return l;
+}
+
+static GList *
+g_vfs_afc_volume_monitor_get_connected_drives (GVolumeMonitor *_self)
+{
+ return NULL;
+}
+
+static gboolean
+g_vfs_afc_volume_monitor_is_supported (void)
+{
@ -2094,7 +2120,9 @@ index 0000000..c98b603
+ gobject_class->constructor = g_vfs_afc_volume_monitor_constructor;
+ gobject_class->finalize = g_vfs_afc_volume_monitor_finalize;
+
+ monitor_class->get_mounts = g_vfs_afc_volume_monitor_get_mounts;
+ monitor_class->get_volumes = g_vfs_afc_volume_monitor_get_volumes;
+ monitor_class->get_connected_drives = g_vfs_afc_volume_monitor_get_connected_drives;
+ monitor_class->is_supported = g_vfs_afc_volume_monitor_is_supported;
+}
+

View File

@ -1,52 +0,0 @@
From 8b926f38fe60569de6ddcddf3e19ef0ee3fbad8a Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Tue, 11 Aug 2009 17:19:31 +0100
Subject: [PATCH] Revert part of the excessive function culling
---
monitor/afc/afc-volume-monitor.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/monitor/afc/afcvolumemonitor.c b/monitor/afc/afcvolumemonitor.c
index ee491d5..faa384d 100644
--- a/monitor/afc/afcvolumemonitor.c
+++ b/monitor/afc/afcvolumemonitor.c
@@ -166,6 +166,12 @@ g_vfs_afc_volume_monitor_finalize (GObject *_self)
}
static GList *
+g_vfs_afc_volume_monitor_get_mounts (GVolumeMonitor *_self)
+{
+ return NULL;
+}
+
+static GList *
g_vfs_afc_volume_monitor_get_volumes (GVolumeMonitor *_self)
{
GVfsAfcVolumeMonitor *self;
@@ -179,6 +185,12 @@ g_vfs_afc_volume_monitor_get_volumes (GVolumeMonitor *_self)
return l;
}
+static GList *
+g_vfs_afc_volume_monitor_get_connected_drives (GVolumeMonitor *_self)
+{
+ return NULL;
+}
+
static gboolean
g_vfs_afc_volume_monitor_is_supported (void)
{
@@ -194,7 +206,9 @@ g_vfs_afc_volume_monitor_class_init (GVfsAfcVolumeMonitorClass * klass)
gobject_class->constructor = g_vfs_afc_volume_monitor_constructor;
gobject_class->finalize = g_vfs_afc_volume_monitor_finalize;
+ monitor_class->get_mounts = g_vfs_afc_volume_monitor_get_mounts;
monitor_class->get_volumes = g_vfs_afc_volume_monitor_get_volumes;
+ monitor_class->get_connected_drives = g_vfs_afc_volume_monitor_get_connected_drives;
monitor_class->is_supported = g_vfs_afc_volume_monitor_is_supported;
}
--
1.6.2.5

View File

@ -1,7 +1,7 @@
Summary: Backends for the gio framework in GLib
Name: gvfs
Version: 1.3.4
Release: 5%{?dist}
Release: 6%{?dist}
License: LGPLv2+
Group: System Environment/Libraries
URL: http://www.gtk.org
@ -48,7 +48,6 @@ Patch8: gvfs-1.2.2-dnssd-deadlock.patch
Patch9: gvfs-1.2.3-sftp-40sec-timeout.patch
# http://bugzilla.gnome.org/show_bug.cgi?id=591005
Patch10: 0001-Add-AFC-backend.patch
Patch11: 0001-Revert-part-of-the-excessive-function-culling.patch
%description
The gvfs package provides backend implementations for the gio
@ -301,6 +300,9 @@ update-desktop-database &> /dev/null ||:
%{_datadir}/gvfs/remote-volume-monitors/afc.monitor
%changelog
* Fri Aug 14 2009 Bastien Nocera <bnocera@redhat.com> 1.3.4-6
- Update AFC patch
* Thu Aug 13 2009 Tomas Bzatek <tbzatek@redhat.com> - 1.3.4-5
- More complete fix for DAV mount path prefix issues