The attached patch contains the changes from the above (-v3) patch,
but replaces 15_uuid_mount.patch rather than following it.

Thanks to Josselin Mouette for the crash course on quilt :)


Index: gnome-vfs-2.22.0/libgnomevfs/gnome-vfs-unix-mounts.c
===================================================================
--- gnome-vfs-2.22.0.orig/libgnomevfs/gnome-vfs-unix-mounts.c	2009-01-15 18:33:00.490079534 -0500
+++ gnome-vfs-2.22.0/libgnomevfs/gnome-vfs-unix-mounts.c	2009-01-15 18:33:12.322080488 -0500
@@ -41,6 +41,7 @@
 #include <poll.h>
 #endif
 #include <stdio.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include <sys/time.h>
 #include <errno.h>
@@ -290,6 +291,15 @@
 
 		mount_entry->mount_path = g_strdup (mntent->mnt_dir);
 		mount_entry->device_path = g_strdup (mntent->mnt_fsname);
+
+		if (g_file_test (mntent->mnt_fsname, G_FILE_TEST_IS_SYMLINK)) {
+			char rpath[PATH_MAX];
+			if (realpath (mntent->mnt_fsname, rpath)) {
+				g_free (mount_entry->device_path);
+				mount_entry->device_path = g_strdup (rpath);
+			}
+		}
+
 		mount_entry->filesystem_type = g_strdup (mntent->mnt_type);
 		
 		g_hash_table_insert (mounts_hash,
@@ -528,9 +538,48 @@
 #endif
 }
 
+static void
+resolve_mount_device (GnomeVFSUnixMountPoint *mount_entry) {
+	/* handle UUID= and LABEL= by trying equivalent /dev/disk/ links */
+	if(strlen(mount_entry->device_path) >= 5 && !strncmp (mount_entry->device_path, "UUID=", 5)) {
+		gchar *device_path;
+
+		device_path = g_strdup_printf ("/dev/disk/by-uuid/%s", mount_entry->device_path+5);
+		/* if the device does not exist, keep using the old name */
+		if (g_file_test (device_path, G_FILE_TEST_EXISTS)) {
+			g_free (mount_entry->device_path);
+			mount_entry->device_path = device_path;
+		} else {
+			g_free (device_path);
+		}
+	}
+	if(strlen(mount_entry->device_path) >= 6 && !strncmp (mount_entry->device_path, "LABEL=", 6)) {
+		gchar *device_path;
+
+		device_path = g_strdup_printf ("/dev/disk/by-label/%s", mount_entry->device_path+6);
+		/* if the device does not exist, keep using the old name */
+		if (g_file_test (device_path, G_FILE_TEST_EXISTS)) {
+			g_free (mount_entry->device_path);
+			mount_entry->device_path = device_path;
+		} else {
+			g_free (device_path);
+		}
+	}
+
+	/* resolve symlinks in the device */
+	if (g_file_test (mount_entry->device_path, G_FILE_TEST_IS_SYMLINK)) {
+		char rpath[PATH_MAX];
+		if (realpath (mount_entry->device_path, rpath)) {
+			g_free (mount_entry->device_path);
+			mount_entry->device_path = g_strdup(rpath);
+		}
+	}
+}
+
 #ifdef HAVE_MNTENT_H
+
 gboolean
-_gnome_vfs_get_unix_mount_table (GList **return_list)
+_gnome_vfs_get_unix_mount_table (GList **return_list, gboolean force_rescan)
 {
 	static time_t last_mtime = 0;
 	static off_t last_size = 0;
@@ -553,7 +602,7 @@
 		return TRUE;
 	}
 
-	if (sb.st_mtime == last_mtime && sb.st_size == last_size) {
+	if (!force_rescan && sb.st_mtime == last_mtime && sb.st_size == last_size) {
 		return FALSE;
 	}
 
@@ -573,13 +622,15 @@
 		
 		mount_entry = g_new0 (GnomeVFSUnixMountPoint, 1);
 
-                /* resolve symlinks */
+                /* resolve symlinks in the mount point */
                 if (realpath (mntent->mnt_dir, rpath))
                     mount_entry->mount_path = g_strdup (rpath);
                 else
                     mount_entry->mount_path = g_strdup (mntent->mnt_dir);
 
 		mount_entry->device_path = g_strdup (mntent->mnt_fsname);
+		resolve_mount_device(mount_entry);
+
 		mount_entry->filesystem_type = g_strdup (mntent->mnt_type);
 
 #ifdef HAVE_HASMNTOPT
@@ -626,7 +677,7 @@
 #elif defined (HAVE_SYS_MNTTAB_H)
 
 gboolean
-_gnome_vfs_get_unix_mount_table (GList **return_list)
+_gnome_vfs_get_unix_mount_table (GList **return_list, gboolean force_rescan)
 {
 	static time_t last_mtime = 0;
 	static off_t last_size = 0;
@@ -647,7 +698,7 @@
 		return TRUE;
 	}
 
-	if (sb.st_mtime == last_mtime && sb.st_size == last_size) {
+	if (!force_rescan && sb.st_mtime == last_mtime && sb.st_size == last_size) {
 		return FALSE;
 	}
 
@@ -809,7 +860,7 @@
 }
 
 gboolean
-_gnome_vfs_get_unix_mount_table (GList **return_list)
+_gnome_vfs_get_unix_mount_table (GList **return_list, gboolean force_rescan)
 {
 	static time_t last_mtime = 0;
 	static off_t last_size = 0;
@@ -831,7 +882,7 @@
 		return TRUE;
 	}
 		
-	if (last_mtime != 0 && fsb.st_mtime == last_mtime && fsb.st_size == last_size) {
+	if (!force_rescan && last_mtime != 0 && fsb.st_mtime == last_mtime && fsb.st_size == last_size) {
 		return FALSE;
 	}
 	last_mtime = fsb.st_mtime;
@@ -867,7 +918,7 @@
 #elif defined(HAVE_GETMNTINFO) && defined(HAVE_FSTAB_H) && defined(HAVE_SYS_MOUNT_H)
 
 gboolean
-_gnome_vfs_get_unix_mount_table (GList **return_list)
+_gnome_vfs_get_unix_mount_table (GList **return_list, gboolean force_rescan)
 {
     	static time_t last_mtime = 0;
 	static off_t last_size = 0;
@@ -891,7 +942,7 @@
 		return TRUE;
 	}
 
-	if (last_mtime != 0 && fsb.st_mtime == last_mtime && fsb.st_size == last_size) {
+	if (!force_rescan && last_mtime != 0 && fsb.st_mtime == last_mtime && fsb.st_size == last_size) {
 	    	return FALSE;
 	}
 	last_mtime = fsb.st_mtime;
Index: gnome-vfs-2.22.0/libgnomevfs/gnome-vfs-unix-mounts.h
===================================================================
--- gnome-vfs-2.22.0.orig/libgnomevfs/gnome-vfs-unix-mounts.h	2009-01-15 18:33:00.554080476 -0500
+++ gnome-vfs-2.22.0/libgnomevfs/gnome-vfs-unix-mounts.h	2009-01-15 18:33:12.326078015 -0500
@@ -59,7 +59,8 @@
 						 GnomeVFSUnixMount          *mount_entry2);
 gint     _gnome_vfs_unix_mount_point_compare    (GnomeVFSUnixMountPoint     *mount_point1,
 						 GnomeVFSUnixMountPoint     *mount_point2);
-gboolean _gnome_vfs_get_unix_mount_table        (GList                     **return_list);
+gboolean _gnome_vfs_get_unix_mount_table        (GList                     **return_list,
+						 gboolean                    force_rescan);
 gboolean _gnome_vfs_get_current_unix_mounts     (GList                     **return_list);
 GList *  _gnome_vfs_unix_mount_get_unix_device  (GList                      *mounts);
 void     _gnome_vfs_monitor_unix_mounts         (GnomeVFSUnixMountCallback   mount_table_changed,
Index: gnome-vfs-2.22.0/libgnomevfs/gnome-vfs-volume-monitor-daemon.c
===================================================================
--- gnome-vfs-2.22.0.orig/libgnomevfs/gnome-vfs-volume-monitor-daemon.c	2009-01-15 18:33:00.622081180 -0500
+++ gnome-vfs-2.22.0/libgnomevfs/gnome-vfs-volume-monitor-daemon.c	2009-01-15 18:33:12.326078015 -0500
@@ -42,7 +42,7 @@
 static void gnome_vfs_volume_monitor_daemon_init       (GnomeVFSVolumeMonitorDaemon      *volume_monitor_daemon);
 static void gnome_vfs_volume_monitor_daemon_finalize   (GObject                          *object);
 
-static void update_fstab_drives (GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon);
+static void update_fstab_drives (GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon, gboolean force_rescan);
 static void update_mtab_volumes (GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon);
 
 static void update_connected_servers (GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon);
@@ -128,7 +128,7 @@
 	GnomeVFSVolumeMonitorDaemon *volume_monitor;
 
 	volume_monitor = data;
-	update_fstab_drives (volume_monitor);
+	update_fstab_drives (volume_monitor, FALSE);
 }
 
 static void
@@ -137,6 +137,7 @@
 	GnomeVFSVolumeMonitorDaemon *volume_monitor;
 
 	volume_monitor = data;
+	update_fstab_drives (volume_monitor, TRUE);
 	update_mtab_volumes (volume_monitor);
 }
 
@@ -187,7 +188,7 @@
 					 NULL);
 								       
 	
-	update_fstab_drives (volume_monitor_daemon);
+	update_fstab_drives (volume_monitor_daemon, FALSE);
 	update_mtab_volumes (volume_monitor_daemon);
 	update_connected_servers (volume_monitor_daemon);
 }
@@ -203,7 +204,7 @@
 	if (!dont_use_hald)
 		_gnome_vfs_hal_mounts_force_reprobe (volume_monitor_daemon);
 #endif
-	update_fstab_drives (volume_monitor_daemon);
+	update_fstab_drives (volume_monitor_daemon, TRUE);
 	update_mtab_volumes (volume_monitor_daemon);
 	update_connected_servers (volume_monitor_daemon);
 }
@@ -717,7 +718,7 @@
 }
 
 static void
-update_fstab_drives (GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon)
+update_fstab_drives (GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon, gboolean force_rescan)
 {
 	GList *new_fstab;
 	GList *removed, *added;
@@ -729,7 +730,7 @@
 
 	volume_monitor = GNOME_VFS_VOLUME_MONITOR (volume_monitor_daemon);
 
-	if (_gnome_vfs_get_unix_mount_table (&new_fstab)) {
+	if (_gnome_vfs_get_unix_mount_table (&new_fstab, force_rescan)) {
 		new_fstab = g_list_sort (new_fstab, (GCompareFunc) _gnome_vfs_unix_mount_point_compare);
 		
 		diff_sorted_lists (volume_monitor_daemon->last_fstab,

-- 
Neil Moore, n...@s-z.org, http://s-z.org/neil/

Reply via email to