Re: Patch to support devfs and mountpoints outside /mnt



On 19 Feb 2003, Mattias Eriksson wrote:

> Hi,
> 
> I have made a minor patch to add some kind of fallback for mounting
> cdroms and floppies outside /mnt. I also made it find floppies and
> cdroms using devfs devices.
> 
> I know there is a bug there somewhere (earlier today I filed it usign
> bug-buddy, but I cant find it now... wonder how that works)

I did this slightly different in order to avoid duplicating the checks:

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.5702
diff -u -p -r1.5702 ChangeLog
--- ChangeLog	21 Feb 2003 12:47:04 -0000	1.5702
+++ ChangeLog	28 Feb 2003 09:31:41 -0000
@@ -1,3 +1,9 @@
+2003-02-28  Alexander Larsson  <alexl redhat com>
+
+	* libnautilus-private/nautilus-volume-monitor.c (finish_creating_volume):
+	Correctly handle floppies and cdroms mounted outside /mnt too.
+	Based on patch from Mattias Eriksson <snaggen acc umu se>.
+
 2003-02-21  Roozbeh Pournader  <rozobeh sharif edu>
 
 	* configure.in: Added "fa" to ALL_LINGUAS.
Index: libnautilus-private/nautilus-volume-monitor.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-volume-monitor.c,v
retrieving revision 1.135
diff -u -p -r1.135 nautilus-volume-monitor.c
--- libnautilus-private/nautilus-volume-monitor.c	29 Aug 2002 10:56:02 -0000	1.135
+++ libnautilus-private/nautilus-volume-monitor.c	28 Feb 2003 09:31:42 -0000
@@ -1826,7 +1826,16 @@ finish_creating_volume (NautilusVolumeMo
 	}
 
 	/* Identify device type */
-	if (eel_str_has_prefix (volume->mount_path, "/mnt/")) {		
+	if (eel_str_has_prefix (volume->device_path, floppy_device_path_prefix)) {
+                volume->device_type = NAUTILUS_DEVICE_FLOPPY_DRIVE;
+                volume->is_removable = TRUE;
+	} else if (eel_str_has_prefix (volume->device_path, "/dev/floppy")) { 
+                volume->device_type = NAUTILUS_DEVICE_FLOPPY_DRIVE;
+                volume->is_removable = TRUE;
+	} else if (eel_str_has_prefix (volume->device_path, "/dev/cdrom")) {
+                volume->device_type = NAUTILUS_DEVICE_CDROM_DRIVE;
+                volume->is_removable = TRUE;
+	} else if (eel_str_has_prefix (volume->mount_path, "/mnt/")) {		
 		name = volume->mount_path + strlen ("/mnt/");
 		
 		if (eel_str_has_prefix (name, "cdrom")
@@ -1836,9 +1845,6 @@ finish_creating_volume (NautilusVolumeMo
 		} else if (eel_str_has_prefix (name, "floppy")) {
 			volume->device_type = NAUTILUS_DEVICE_FLOPPY_DRIVE;
 				volume->is_removable = TRUE;
-		} else if (eel_str_has_prefix (volume->device_path, floppy_device_path_prefix)) {		
-			volume->device_type = NAUTILUS_DEVICE_FLOPPY_DRIVE;
-			volume->is_removable = TRUE;
 		} else if (eel_str_has_prefix (name, "zip")) {
 			volume->device_type = NAUTILUS_DEVICE_ZIP_DRIVE;
 			volume->is_removable = TRUE;
@@ -1873,7 +1879,7 @@ finish_creating_volume (NautilusVolumeMo
 			} else if (eel_str_has_prefix (name, "rmdisk")) {
 				volume->device_type = NAUTILUS_DEVICE_ZIP_DRIVE;
 				volume->is_removable = TRUE;
-				if( eel_str_has_suffix (volume->device_path, ":c")) {
+				if (eel_str_has_suffix (volume->device_path, ":c")) {
 					volume->device_path = eel_str_strip_trailing_str
 								(volume->device_path, ":c");
 				}

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a jaded zombie firefighter plagued by the memory of his family's brutal 
murder. She's a high-kicking streetsmart doctor who believes she is the 
reincarnation of an ancient Egyptian queen. They fight crime! 




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