- 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> From: Bastien Nocera <hadess@hadess.net>
Date: Thu, 6 Aug 2009 22:55:47 +0100 Date: Thu, 6 Aug 2009 22:55:47 +0100
Subject: [PATCH] Add AFC backend Subject: [PATCH] Add AFC backend
@ -15,18 +15,18 @@ Bastien Nocera <hadess@hadess.net>
configure.ac | 26 +- configure.ac | 26 +-
daemon/Makefile.am | 23 + daemon/Makefile.am | 23 +
daemon/afc.mount.in | 7 + daemon/afc.mount.in | 7 +
daemon/gvfsbackendafc.c | 1226 ++++++++++++++++++++ daemon/gvfsbackendafc.c | 1228 ++++++++++++++++++++
daemon/gvfsbackendafc.h | 37 + daemon/gvfsbackendafc.h | 37 +
monitor/Makefile.am | 6 +- monitor/Makefile.am | 6 +-
monitor/afc/Makefile.am | 49 + monitor/afc/Makefile.am | 49 +
monitor/afc/afc.monitor | 5 + monitor/afc/afc.monitor | 5 +
monitor/afc/afcvolume.c | 336 ++++++ monitor/afc/afcvolume.c | 353 ++++++
monitor/afc/afcvolume.h | 44 + monitor/afc/afcvolume.h | 44 +
monitor/afc/afcvolumemonitor.c | 215 ++++ monitor/afc/afcvolumemonitor.c | 224 ++++
monitor/afc/afcvolumemonitor.h | 39 + monitor/afc/afcvolumemonitor.h | 39 +
monitor/afc/afcvolumemonitordaemon.c | 31 + monitor/afc/afcvolumemonitordaemon.c | 31 +
.../org.gtk.Private.AfcVolumeMonitor.service.in | 4 + .../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/afc.mount.in
create mode 100644 daemon/gvfsbackendafc.c create mode 100644 daemon/gvfsbackendafc.c
create mode 100644 daemon/gvfsbackendafc.h 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 create mode 100644 monitor/afc/org.gtk.Private.AfcVolumeMonitor.service.in
diff --git a/configure.ac b/configure.ac diff --git a/configure.ac b/configure.ac
index 7f1ec16..4675ae9 100644 index 9bfb8ad..6b3838c 100644
--- a/configure.ac --- a/configure.ac
+++ b/configure.ac +++ b/configure.ac
@@ -324,6 +324,28 @@ AC_SUBST(CDDA_CFLAGS) @@ -324,6 +324,28 @@ AC_SUBST(CDDA_CFLAGS)
@ -91,7 +91,7 @@ index 7f1ec16..4675ae9 100644
DNS-SD support: $msg_avahi DNS-SD support: $msg_avahi
Build HAL volume monitor: $msg_hal (with fast init path: $have_hal_fast_init) Build HAL volume monitor: $msg_hal (with fast init path: $have_hal_fast_init)
diff --git a/daemon/Makefile.am b/daemon/Makefile.am diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 733fa41..4c9e4af 100644 index a03eba1..cf68391 100644
--- a/daemon/Makefile.am --- a/daemon/Makefile.am
+++ b/daemon/Makefile.am +++ b/daemon/Makefile.am
@@ -101,6 +101,12 @@ mount_DATA += archive.mount @@ -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 EXTRA_DIST = gvfs-daemon.service.in $(mount_in_files) obexftp-marshal.list
DISTCLEANFILES = gvfs-daemon.service $(mount_DATA) 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 if HAVE_AVAHI
gvfsd_dav_LDADD += $(top_builddir)/common/libgvfscommon-dnssd.la gvfsd_dav_LDADD += $(top_builddir)/common/libgvfscommon-dnssd.la
endif endif
@ -143,10 +143,10 @@ index 0000000..727d833
+ +
diff --git a/daemon/gvfsbackendafc.c b/daemon/gvfsbackendafc.c diff --git a/daemon/gvfsbackendafc.c b/daemon/gvfsbackendafc.c
new file mode 100644 new file mode 100644
index 0000000..97d0a22 index 0000000..d30ede8
--- /dev/null --- /dev/null
+++ b/daemon/gvfsbackendafc.c +++ b/daemon/gvfsbackendafc.c
@@ -0,0 +1,1226 @@ @@ -0,0 +1,1228 @@
+/* +/*
+ * gvfs/daemon/gvfsbackendafc.c + * gvfs/daemon/gvfsbackendafc.c
+ * + *
@ -165,7 +165,6 @@ index 0000000..97d0a22
+#include <glib/gi18n.h> +#include <glib/gi18n.h>
+#include <errno.h> +#include <errno.h>
+ +
+#define G_UDEV_API_IS_SUBJECT_TO_CHANGE
+#include <gudev/gudev.h> +#include <gudev/gudev.h>
+ +
+#include <libiphone/libiphone.h> +#include <libiphone/libiphone.h>
@ -414,7 +413,7 @@ index 0000000..97d0a22
+ int retries; + int retries;
+ iphone_error_t err; + iphone_error_t err;
+ lockdownd_client_t lockdown_cli = NULL; + 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 = G_VFS_BACKEND_AFC(backend);
+ self->connected = FALSE; + self->connected = FALSE;
@ -566,10 +565,13 @@ index 0000000..97d0a22
+ +
+static void +static void
+g_vfs_backend_afc_unmount (GVfsBackend *backend, +g_vfs_backend_afc_unmount (GVfsBackend *backend,
+ GVfsJobUnmount * job) + GVfsJobUnmount *job,
+ GMountUnmountFlags flags,
+ GMountSource *mount_source)
+{ +{
+ GVfsBackendAfc *self; + GVfsBackendAfc *self;
+ +
+ /* FIXME: check on G_MOUNT_UNMOUNT_FORCE flag */
+ self = G_VFS_BACKEND_AFC (backend); + self = G_VFS_BACKEND_AFC (backend);
+ g_vfs_backend_afc_close_connection (self); + g_vfs_backend_afc_close_connection (self);
+ g_vfs_job_succeeded (G_VFS_JOB(job)); + g_vfs_job_succeeded (G_VFS_JOB(job));
@ -1502,10 +1504,10 @@ index 0000000..1663573
+ +
diff --git a/monitor/afc/afcvolume.c b/monitor/afc/afcvolume.c diff --git a/monitor/afc/afcvolume.c b/monitor/afc/afcvolume.c
new file mode 100644 new file mode 100644
index 0000000..fe290a1 index 0000000..688f75b
--- /dev/null --- /dev/null
+++ b/monitor/afc/afcvolume.c +++ b/monitor/afc/afcvolume.c
@@ -0,0 +1,336 @@ @@ -0,0 +1,353 @@
+/* +/*
+ * gvfs/monitor/afc/afc-volume.c + * gvfs/monitor/afc/afc-volume.c
+ * + *
@ -1624,7 +1626,7 @@ index 0000000..fe290a1
+ model = afc_get_device_info_field (afc_cli, "Model"); + model = afc_get_device_info_field (afc_cli, "Model");
+ if (model != NULL) + if (model != NULL)
+ { + {
+ if(strstr(model, "iPod") != NULL) + if(g_str_has_prefix(model, "iPod") != FALSE)
+ { + {
+ g_free (self->icon); + g_free (self->icon);
+ self->icon = g_strdup ("multimedia-player-apple-ipod-touch"); + self->icon = g_strdup ("multimedia-player-apple-ipod-touch");
@ -1699,6 +1701,17 @@ index 0000000..fe290a1
+ return TRUE; + 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 +typedef struct
+{ +{
@ -1778,7 +1791,7 @@ index 0000000..fe290a1
+ char *id; + char *id;
+ +
+ id = NULL; + 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); + id = g_strdup (afc_volume->uuid);
+ +
+ return id; + return id;
@ -1810,7 +1823,11 @@ index 0000000..fe290a1
+static GFile * +static GFile *
+g_vfs_afc_volume_get_activation_root (GVolume *volume) +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); + return g_object_ref (root);
+} +}
@ -1821,6 +1838,8 @@ index 0000000..fe290a1
+ iface->get_name = g_vfs_afc_volume_get_name; + iface->get_name = g_vfs_afc_volume_get_name;
+ iface->get_icon = g_vfs_afc_volume_get_icon; + iface->get_icon = g_vfs_afc_volume_get_icon;
+ iface->get_uuid = g_vfs_afc_volume_get_uuid; + 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->can_mount = g_vfs_afc_volume_can_mount;
+ iface->should_automount = g_vfs_afc_volume_should_automount; + iface->should_automount = g_vfs_afc_volume_should_automount;
+ iface->mount_fn = g_vfs_afc_volume_mount; + 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 diff --git a/monitor/afc/afcvolumemonitor.c b/monitor/afc/afcvolumemonitor.c
new file mode 100644 new file mode 100644
index 0000000..c98b603 index 0000000..93926eb
--- /dev/null --- /dev/null
+++ b/monitor/afc/afcvolumemonitor.c +++ b/monitor/afc/afcvolumemonitor.c
@@ -0,0 +1,215 @@ @@ -0,0 +1,224 @@
+/* +/*
+ * gvfs/monitor/afc/afc-volume-monitor.c + * gvfs/monitor/afc/afc-volume-monitor.c
+ * + *
@ -1977,33 +1996,28 @@ index 0000000..c98b603
+ gpointer user_data) + gpointer user_data)
+{ +{
+ GVfsAfcVolumeMonitor *self; + GVfsAfcVolumeMonitor *self;
+ const char *vendor, *devname, *uuid; + const char *vendor, *uuid;
+ +
+ self = G_VFS_AFC_VOLUME_MONITOR(user_data); + self = G_VFS_AFC_VOLUME_MONITOR(user_data);
+ +
+ /* Vendor is Apple? */ + /* Vendor is Apple? */
+ vendor = g_udev_device_get_property (device, "ID_VENDOR"); + vendor = g_udev_device_get_property (device, "ID_VENDOR");
+ if (vendor == NULL || + if (vendor == NULL ||
+ g_str_equal (vendor, "Apple_Inc.") == FALSE) + 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)
+ return; + return;
+ }
+ +
+ /* Get us a UUID */ + /* Get us a UUID */
+ uuid = g_udev_device_get_property (device, "ID_SERIAL_SHORT"); + uuid = g_udev_device_get_property (device, "ID_SERIAL_SHORT");
+ if (uuid == NULL) + if (uuid == NULL)
+ { + {
+ g_warning ("Could not get UUID for device '%s'", devname); + g_message ("No serial for device");
+ return; + return;
+ } + }
+ +
+ if (g_str_equal (action, "add") != FALSE) + if (g_str_equal (action, "add") != FALSE)
+ g_vfs_afc_monitor_create_volume (self, uuid); + 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); + g_vfs_afc_monitor_remove_volume (self, uuid);
+} +}
+ +
@ -2013,7 +2027,7 @@ index 0000000..c98b603
+{ +{
+ GVfsAfcVolumeMonitor *self; + GVfsAfcVolumeMonitor *self;
+ GList *devices, *l; + GList *devices, *l;
+ const gchar * const subsystems[] = { "usb_endpoint", NULL }; + const gchar * const subsystems[] = { "usb", NULL };
+ +
+ /* Boilerplate code to chain from parent. */ + /* 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)); + 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 * +static GList *
+g_vfs_afc_volume_monitor_get_mounts (GVolumeMonitor *_self)
+{
+ return NULL;
+}
+
+static GList *
+g_vfs_afc_volume_monitor_get_volumes (GVolumeMonitor *_self) +g_vfs_afc_volume_monitor_get_volumes (GVolumeMonitor *_self)
+{ +{
+ GVfsAfcVolumeMonitor *self; + GVfsAfcVolumeMonitor *self;
@ -2079,6 +2099,12 @@ index 0000000..c98b603
+ return l; + return l;
+} +}
+ +
+static GList *
+g_vfs_afc_volume_monitor_get_connected_drives (GVolumeMonitor *_self)
+{
+ return NULL;
+}
+
+static gboolean +static gboolean
+g_vfs_afc_volume_monitor_is_supported (void) +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->constructor = g_vfs_afc_volume_monitor_constructor;
+ gobject_class->finalize = g_vfs_afc_volume_monitor_finalize; + 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_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; + 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 Summary: Backends for the gio framework in GLib
Name: gvfs Name: gvfs
Version: 1.3.4 Version: 1.3.4
Release: 5%{?dist} Release: 6%{?dist}
License: LGPLv2+ License: LGPLv2+
Group: System Environment/Libraries Group: System Environment/Libraries
URL: http://www.gtk.org 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 Patch9: gvfs-1.2.3-sftp-40sec-timeout.patch
# http://bugzilla.gnome.org/show_bug.cgi?id=591005 # http://bugzilla.gnome.org/show_bug.cgi?id=591005
Patch10: 0001-Add-AFC-backend.patch Patch10: 0001-Add-AFC-backend.patch
Patch11: 0001-Revert-part-of-the-excessive-function-culling.patch
%description %description
The gvfs package provides backend implementations for the gio 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 %{_datadir}/gvfs/remote-volume-monitors/afc.monitor
%changelog %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 * Thu Aug 13 2009 Tomas Bzatek <tbzatek@redhat.com> - 1.3.4-5
- More complete fix for DAV mount path prefix issues - More complete fix for DAV mount path prefix issues