[PATCH] use pmount instead of mount for hotpluggable device



Without this patch I'm unable to mount previously unmounted hotpluggable
devices again using gnome-vfs/nautilus. The successful first time pmount
is probably done by the gnome-volume-manager.
Index: libgnomevfs/gnome-vfs-volume-ops.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-volume-ops.c,v
retrieving revision 1.26
diff -u -p -r1.26 gnome-vfs-volume-ops.c
--- libgnomevfs/gnome-vfs-volume-ops.c	24 Jan 2006 12:43:57 -0000	1.26
+++ libgnomevfs/gnome-vfs-volume-ops.c	12 Feb 2006 21:29:05 -0000
@@ -88,6 +91,13 @@ static const char *mount_known_locations
 	NULL
 };
 
+static const char *pmount_known_locations [] = {
+	"/usr/sbin/pmount", "/usr/bin/pmount",
+	"/sbin/mount", "/bin/mount",
+	"/usr/sbin/mount", "/usr/bin/mount",
+	NULL
+};
+
 static const char *umount_known_locations [] = {
 	"/sbin/umount", "/bin/umount",
 	"/usr/sbin/umount", "/usr/bin/umount",
@@ -103,6 +113,8 @@ static const char *pumount_known_locatio
 
 #define MOUNT_COMMAND mount_known_locations
 #define MOUNT_SEPARATOR " "
+#define PMOUNT_COMMAND pmount_known_locations
+#define PMOUNT_SEPARATOR " "
 #define UMOUNT_COMMAND umount_known_locations
 #define UMOUNT_SEPARATOR " "
 #define PUMOUNT_COMMAND pumount_known_locations
@@ -777,8 +820,8 @@ mount_unmount_operation (const char *mou
 	pthread_t mount_thread;
 	const char *name;
 	int i;
+	gboolean is_in_media;
 
-	
 #ifdef USE_VOLRMMOUNT
 	if (mount_point != NULL) {
 		name = strrchr (mount_point, '/');
@@ -799,7 +842,9 @@ mount_unmount_operation (const char *mou
 # endif
 
 #endif
-       
+
+	is_in_media = mount_point != NULL ? g_str_has_prefix (mount_point, "/media") : FALSE;
+
        if (should_mount) {
 #if defined(USE_GNOME_MOUNT)
 	       if (hal_udi != NULL && g_file_test (GNOME_VFS_BINDIR "/gnome-mount", G_FILE_TEST_IS_EXECUTABLE)) {
@@ -807,15 +852,15 @@ mount_unmount_operation (const char *mou
 		       argument = "--hal-udi";
 		       name = hal_udi;
 	       } else {
-		       command = find_command (MOUNT_COMMAND);
+		       command = find_command (is_in_media ? PMOUNT_COMMAND : MOUNT_COMMAND);
 	       }
 #elif defined(USE_HAL) && defined(HAL_MOUNT)
 	       if (hal_udi != NULL && g_file_test (HAL_MOUNT, G_FILE_TEST_IS_EXECUTABLE))
 		       command = HAL_MOUNT;
 	       else
-		       command = find_command (MOUNT_COMMAND);
+		       command = find_command (is_in_media ? PMOUNT_COMMAND : MOUNT_COMMAND);
 #else
-	       command = find_command (MOUNT_COMMAND);
+	       command = find_command (is_in_media ? PMOUNT_COMMAND : MOUNT_COMMAND);
 #endif
 #ifdef  MOUNT_ARGUMENT
 	       argument = MOUNT_ARGUMENT;
@@ -823,7 +868,6 @@ mount_unmount_operation (const char *mou
        }
 
        if (should_unmount) {
-	       gboolean is_in_media = mount_point != NULL ? g_str_has_prefix (mount_point, "/media") : FALSE;
 #if defined(USE_GNOME_MOUNT)
 	       if (hal_udi != NULL && g_file_test (GNOME_VFS_BINDIR "/gnome-umount", G_FILE_TEST_IS_EXECUTABLE)) {
 		       command = GNOME_VFS_BINDIR "/gnome-umount";


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]