Re: Patch: supermount support
- From: Alexander Larsson <alexl redhat com>
- To: Frederic Crozat <fcrozat mandrakesoft com>
- Cc: nautilus-list gnome org
- Subject: Re: Patch: supermount support
- Date: Thu, 4 Jul 2002 09:38:34 -0400 (EDT)
On 1 Jul 2002, Frederic Crozat wrote:
> Ok, here is patch for supermount support (bug 48090)
>
> It is a bit ugly, due to supermount nature => when "umounting"
> supermount devices, only eject command is started..
>
> Comments (or OK to commit) are welcome..
--- libnautilus-private/nautilus-volume-monitor.c 28 Jun 2002 10:59:06 -0000 1.131
+++ libnautilus-private/nautilus-volume-monitor.c 1 Jul 2002 12:30:26 -0000
@@ -493,7 +493,8 @@
/* Use "owner" or "user" or "users" as our way of determining a removable volume */
if (hasmntopt (ent, "user") != NULL
|| hasmntopt (ent, "users") != NULL
- || hasmntopt (ent, "owner") != NULL) {
+ || hasmntopt (ent, "owner") != NULL
+ || eel_strcmp ("supermount", ent->mnt_type) == 0) {
return TRUE;
}
#endif
@@ -563,7 +564,16 @@
#elif defined (HAVE_MNTENT_H)
while ((ent = getmntent (file)) != NULL) {
if (has_removable_mntent_options (ent)) {
+#if defined (HAVE_HASMNTOPT)
+ if (eel_strcmp ("supermount", ent->mnt_type) == 0) {
+ volume = create_volume (eel_str_strip_substring_and_after (hasmntopt(ent, "dev"), ",") + strlen("dev="),
+ ent->mnt_dir);
+ } else {
+#endif
This leaks the return value of eel_str_strip_substring_and_after. It also
assumes that any substring "dev" will be on the form dev=something, while
not actually looing for the "=".
volume = create_volume (ent->mnt_fsname, ent->mnt_dir);
this line is wrongly indented.
+#if defined (HAVE_HASMNTOPT)
+ }
+#endif
volumes = finish_creating_volume_and_prepend
(monitor, volume, ent->mnt_type, volumes);
}
@@ -617,7 +627,10 @@
}
#elif defined (HAVE_MNTENT_H)
while ((ent = getmntent (file)) != NULL) {
- if (strcmp (volume->device_path, ent->mnt_fsname) == 0
+ if (((strcmp (volume->device_path, ent->mnt_fsname) == 0)
+ || (strcmp (ent->mnt_type, "supermount") == 0 &&
+ strcmp (volume->device_path, eel_str_strip_substring_and_after (hasmntopt (ent, "dev"), ",") + strlen ("dev=")) == 0))
+ && (strcmp (volume->mount_path, ent->mnt_dir) == 0)
&& has_removable_mntent_options (ent)) {
removable = TRUE;
break;
Same here as above. This code should probably be broken out into a
function. Also, why did you add the strcmp (volume->mount_path,
ent->mnt_dir) == 0 check?
@@ -1027,6 +1040,20 @@
device_path = eel_string_list_nth (list, 0);
mount_path = eel_string_list_nth (list, 1);
file_system_type_name = eel_string_list_nth (list, 2);
+ /* For supermount, search info in removable list */
+ if (eel_strcmp ("supermount", file_system_type_name) == 0) {
+ GList * list;
Variable declaration go at the start of the function.
+ g_free (device_path);
Free this when you find a match instead, to avoid a segfault if we didn't
find the path ib removable_volumes.
+ list = monitor->details->removable_volumes;
+ while (list) {
+ volume = (NautilusVolume *) list->data;
+ if (eel_strcmp (mount_path, volume->mount_path) == 0) {
+ device_path = g_strdup (volume->device_path);
+ break;
+ }
+ list = list->next;
+ }
+ }
volume = create_volume (device_path, mount_path);
if (eel_string_list_get_length (list) >= 4 &&
option_list_has_option (eel_string_list_peek_nth (list, 3), MNTOPT_RO))
@@ -1566,6 +1593,15 @@
#else
name = mount_point;
#endif
+
+ /* Don't run mount/umount on supermount mount point, it is useless */
+ if ((volume->file_system_type != NULL)
+ && (strcmp (volume->file_system_type->name, "supermount") == 0)) {
+ if (volume->device_type == NAUTILUS_DEVICE_CDROM_DRIVE) {
+ eject_device (volume->device_path);
+ }
+ return;
+ }
Why are you only ejecting cdroms? floppys on some hardware (e.g. macs)
support eject.
if (should_mount) {
command = find_command (MOUNT_COMMAND);
--- src/file-manager/fm-desktop-icon-view.c 28 Jun 2002 10:59:09 -0000 1.183
+++ src/file-manager/fm-desktop-icon-view.c 1 Jul 2002 12:30:26 -0000
@@ -377,7 +377,12 @@
*/
index = 1;
- volume_name = nautilus_volume_get_name (volume);
+ volume_name = nautilus_volume_get_name (volume);
+ if ((strcmp(volume_name,_("Unknown")) == 0)
+ && ((nautilus_volume_get_device_type (volume) == NAUTILUS_DEVICE_CDROM_DRIVE)
+ || (nautilus_volume_get_device_type (volume) == NAUTILUS_DEVICE_AUDIO_CD))) {
+ volume_name = g_strdup(_("CD-ROM"));
+ }
This hack should be in nautilus_volume_get_name(), or even better
volume->volume_name could be set to the right thing when the volume is
constructed.
uri_path = g_strdup_printf ("%s/%s", desktop_directory, volume_name);
uri = gnome_vfs_uri_new (uri_path);
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Alexander Larsson Red Hat, Inc
alexl redhat com alla lysator liu se
He's a maverick Amish dwarf on a mission from God. She's a time-travelling
thirtysomething safe cracker who inherited a spooky stately manor from her
late maiden aunt. They fight crime!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]