[patch] use gnome-mount for unmounting, ejecting floppy, IDE zip drive etc
- From: David Zeuthen <david fubar dk>
- To: alexl redhat com
- Cc: gnome-vfs-list gnome org
- Subject: [patch] use gnome-mount for unmounting, ejecting floppy, IDE zip drive etc
- Date: Tue, 21 Feb 2006 13:02:06 -0500
Hi,
Attached patch should fix the bug described here
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=182046
ChangeLog | 14 ++++++++++++
libgnomevfs/gnome-vfs-hal-mounts.c | 1
libgnomevfs/gnome-vfs-volume-ops.c | 41 +++++++++++++++++++++++++++++++++++--
3 files changed, 53 insertions(+), 3 deletions(-)
I've tested this with both floppy and IDE zip drives. There are no
string or UI changes. OK to commit?
Thanks,
David
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-vfs/ChangeLog,v
retrieving revision 1.2368
diff -u -p -r1.2368 ChangeLog
--- ChangeLog 19 Feb 2006 16:29:57 -0000 1.2368
+++ ChangeLog 21 Feb 2006 17:56:14 -0000
@@ -1,3 +1,17 @@
+2006-02-21 David Zeuthen <davidz redhat com>
+
+ * libgnomevfs/gnome-vfs-volume-ops.c (gnome_vfs_volume_eject)
+ (gnome_vfs_volume_unmount): Get the hal_udi for from the drive if
+ a volume doesn't have a hal_udi and we're using gnome-mount. This
+ is the case for PC style floppy disks, IDE zip drives and other
+ drives that hal cannot poll. This means we can use gnome-eject
+ resp. gnome-eject for these which is necessary as we used
+ gnome-mount to actually mount them (needs privs and needs to clean
+ up mount point). Also fixes leaking the hal udi. This is also Red
+ Hat bug #182046.
+
+ * libgnomevfs/gnome-vfs-hal-mounts.c: Uncomment debug
+
2006-02-19 Christian Neumair <chris gnome-de org>
* libgnomevfs/xdgmimemagic.c: (_xdg_mime_magic_lookup_data): When two
Index: libgnomevfs/gnome-vfs-hal-mounts.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-hal-mounts.c,v
retrieving revision 1.26
diff -u -p -r1.26 gnome-vfs-hal-mounts.c
--- libgnomevfs/gnome-vfs-hal-mounts.c 19 Feb 2006 00:59:30 -0000 1.26
+++ libgnomevfs/gnome-vfs-hal-mounts.c 21 Feb 2006 17:56:14 -0000
@@ -27,7 +27,6 @@
/* uncomment to get helpful debug messages */
/* #define HAL_SHOW_DEBUG */
-#define HAL_SHOW_DEBUG
#include <stdio.h>
#include <stdlib.h>
Index: libgnomevfs/gnome-vfs-volume-ops.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-volume-ops.c,v
retrieving revision 1.28
diff -u -p -r1.28 gnome-vfs-volume-ops.c
--- libgnomevfs/gnome-vfs-volume-ops.c 19 Feb 2006 00:59:30 -0000 1.28
+++ libgnomevfs/gnome-vfs-volume-ops.c 21 Feb 2006 17:56:14 -0000
@@ -1027,18 +1027,37 @@ gnome_vfs_volume_unmount (GnomeVFSVolume
type = gnome_vfs_volume_get_volume_type (volume);
if (type == GNOME_VFS_VOLUME_TYPE_MOUNTPOINT) {
+ char *hal_udi;
+
uri = gnome_vfs_volume_get_activation_uri (volume);
mount_path = gnome_vfs_get_local_path_from_uri (uri);
g_free (uri);
device_path = gnome_vfs_volume_get_device_path (volume);
+ hal_udi = gnome_vfs_volume_get_hal_udi (volume);
+
+#if defined(USE_GNOME_MOUNT)
+ /* Volumes from drives that are not polled may not
+ * have a hal_udi.. take the one from HAL to get
+ * gnome-mount working */
+ if (hal_udi == NULL) {
+ GnomeVFSDrive *drive;
+ drive = gnome_vfs_volume_get_drive (volume);
+ if (drive != NULL) {
+ hal_udi = gnome_vfs_drive_get_hal_udi (drive);
+ gnome_vfs_drive_unref (drive);
+ }
+ }
+#endif /* USE_GNOME_MOUNT */
+
mount_unmount_operation (mount_path,
device_path,
- gnome_vfs_volume_get_hal_udi (volume),
+ hal_udi,
gnome_vfs_volume_get_device_type (volume),
FALSE, TRUE, FALSE,
callback, user_data);
g_free (mount_path);
g_free (device_path);
+ g_free (hal_udi);
} else if (type == GNOME_VFS_VOLUME_TYPE_VFS_MOUNT) {
/* left intentionally blank as these cannot be mounted and thus not unmounted */
} else if (type == GNOME_VFS_VOLUME_TYPE_CONNECTED_SERVER) {
@@ -1074,14 +1093,31 @@ gnome_vfs_volume_eject (GnomeVFSVolume *
mount_path = gnome_vfs_get_local_path_from_uri (uri);
g_free (uri);
device_path = gnome_vfs_volume_get_device_path (volume);
+ hal_udi = gnome_vfs_volume_get_hal_udi (volume);
+
+#if defined(USE_GNOME_MOUNT)
+ /* Volumes from drives that are not polled may not
+ * have a hal_udi.. take the one from HAL to get
+ * gnome-mount working */
+ if (hal_udi == NULL) {
+ GnomeVFSDrive *drive;
+ drive = gnome_vfs_volume_get_drive (volume);
+ if (drive != NULL) {
+ hal_udi = gnome_vfs_drive_get_hal_udi (drive);
+ gnome_vfs_drive_unref (drive);
+ }
+ }
+#endif /* USE_GNOME_MOUNT */
+
mount_unmount_operation (mount_path,
device_path,
- gnome_vfs_volume_get_hal_udi (volume),
+ hal_udi,
gnome_vfs_volume_get_device_type (volume),
FALSE, TRUE, TRUE,
callback, user_data);
g_free (mount_path);
g_free (device_path);
+ g_free (hal_udi);
} else if (type == GNOME_VFS_VOLUME_TYPE_VFS_MOUNT) {
hal_udi = gnome_vfs_volume_get_hal_udi (volume);
uri = gnome_vfs_volume_get_activation_uri (volume);
@@ -1100,6 +1136,7 @@ gnome_vfs_volume_eject (GnomeVFSVolume *
g_free (device_path);
}
g_free (uri);
+ g_free (hal_udi);
} else if (type == GNOME_VFS_VOLUME_TYPE_CONNECTED_SERVER) {
unmount_connected_server (volume, callback, user_data);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]