File gnome-vfs-submount.patch of Package gnome-vfs2
--- gnome-vfs-2.11.3/libgnomevfs/gnome-vfs-filesystem-type.c
+++ gnome-vfs-2.11.3/libgnomevfs/gnome-vfs-filesystem-type.c
@@ -64,6 +64,7 @@
{ "reiserfs" , N_("ReiserFS Linux Volume"), 1 },
{ "smbfs" , N_("Windows Shared Volume"), 1 },
{ "supermount",N_("SuperMount Volume"), 0 },
+ { "subfs", N_("SubMount Volume"), 0 },
{ "udf" , N_("DVD Volume"), 0 },
{ "ufs" , N_("Solaris/BSD Volume"), 1 },
{ "udfs" , N_("Udfs Solaris Volume"), 1 },
--- gnome-vfs-2.11.3/libgnomevfs/gnome-vfs-unix-mounts.c
+++ gnome-vfs-2.11.3/libgnomevfs/gnome-vfs-unix-mounts.c
@@ -594,7 +594,8 @@
}
#endif
- if ((mntent->mnt_type != NULL && strcmp ("supermount", mntent->mnt_type) == 0)
+ if ((mntent->mnt_type != NULL && strcmp ("supermount", mntent->mnt_type) == 0)
+ || (mntent->mnt_type != NULL && strcmp ("subfs", mntent->mnt_type) == 0)
#ifdef HAVE_HASMNTOPT
|| (hasmntopt (mntent, "user") != NULL
&& hasmntopt (mntent, "user") != hasmntopt (mntent, "user_xattr"))
--- gnome-vfs-2.11.3/libgnomevfs/gnome-vfs-volume-monitor-daemon.c
+++ gnome-vfs-2.11.3/libgnomevfs/gnome-vfs-volume-monitor-daemon.c
@@ -262,10 +262,13 @@
return GNOME_VFS_DEVICE_TYPE_CDROM;
} else if (g_str_has_prefix (device_path, "/dev/cd")) {
return GNOME_VFS_DEVICE_TYPE_CDROM;
+ } else if (g_str_has_prefix (device_path, "/dev/dvd")) {
+ return GNOME_VFS_DEVICE_TYPE_CDROM;
} else if (g_str_has_prefix (device_path, "/vol/")) {
name = mount_path + strlen ("/");
- if (g_str_has_prefix (name, "cdrom")) {
+ if (g_str_has_prefix (name, "cdrom") ||
+ g_str_has_prefix (name, "dvd")) {
return GNOME_VFS_DEVICE_TYPE_CDROM;
} else if (g_str_has_prefix (name, "floppy")) {
return GNOME_VFS_DEVICE_TYPE_FLOPPY;
@@ -872,7 +875,7 @@
vol->priv->is_mounted = 1;
vol->priv->device_type = get_device_type_from_device_and_mount (mount->device_path, mount->mount_path);
-
+
if ((strcmp (mount->filesystem_type, "iso9660") == 0) ||
(strcmp (mount->filesystem_type, "cd9660") == 0)) {
if (vol->priv->device_type == GNOME_VFS_DEVICE_TYPE_UNKNOWN) {
@@ -908,7 +911,8 @@
vol->priv->device_type = GNOME_VFS_DEVICE_TYPE_HARDDRIVE;
}
- if (vol->priv->device_type == GNOME_VFS_DEVICE_TYPE_CDROM) {
+ if (vol->priv->device_type == GNOME_VFS_DEVICE_TYPE_CDROM &&
+ strcmp (mount->filesystem_type, "subfs")) {
fd = 0;
disctype = _gnome_vfs_get_cdrom_type (mount->device_path, &fd);
@@ -991,6 +995,45 @@
return vol;
}
+static GList *
+remove_submounts (GList *volumes)
+{
+ GList *l;
+ GList *new_volumes;
+ GHashTable *submounts;
+
+ submounts = g_hash_table_new (g_str_hash, g_str_equal);
+
+ for (l = volumes; l != NULL; l = l->next) {
+ GnomeVFSUnixMount *mount = l->data;
+
+ if (!strcmp (mount->filesystem_type, "subfs")) {
+ g_hash_table_insert (submounts,
+ mount->device_path,
+ mount);
+ }
+ }
+
+ new_volumes = NULL;
+
+ for (l = volumes; l != NULL; l = l->next) {
+ GnomeVFSUnixMount *mount = l->data;
+
+ if (strcmp (mount->filesystem_type, "subfs") != 0 &&
+ g_hash_table_lookup (submounts, mount->device_path)) {
+ _gnome_vfs_unix_mount_free (mount);
+ } else {
+ new_volumes = g_list_prepend (new_volumes, mount);
+ }
+ }
+
+ g_list_free (volumes);
+
+ g_hash_table_destroy (submounts);
+
+ return g_list_reverse (new_volumes);
+}
+
static void
update_mtab_volumes (GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon)
{
@@ -1006,6 +1049,8 @@
if (_gnome_vfs_get_current_unix_mounts (&new_mtab)) {
new_mtab = g_list_sort (new_mtab, (GCompareFunc) _gnome_vfs_unix_mount_compare);
+ new_mtab = remove_submounts (new_mtab);
+
diff_sorted_lists (volume_monitor_daemon->last_mtab,
new_mtab, (GCompareFunc) _gnome_vfs_unix_mount_compare,
&added, &removed);
--- gnome-vfs-2.11.3/libgnomevfs/gnome-vfs-volume-ops.c
+++ gnome-vfs-2.11.3/libgnomevfs/gnome-vfs-volume-ops.c
@@ -374,6 +374,7 @@
mount_unmount_operation (const char *mount_point,
const char *device_path,
const char *hal_udi,
+ const char *filesystem_type,
GnomeVFSDeviceType device_type,
gboolean should_mount,
gboolean should_unmount,
@@ -432,6 +433,10 @@
command = find_command (UMOUNT_COMMAND);
#else
command = find_command (UMOUNT_COMMAND);
+ /* Don't unmount subfs volumes */
+ if (!filesystem_type || strcmp (filesystem_type, "subfs") != 0) {
+ command = find_command (UMOUNT_COMMAND);
+ }
#endif
#ifdef UNMOUNT_ARGUMENT
argument = UNMOUNT_ARGUMENT;
@@ -590,7 +595,7 @@
GnomeVFSVolumeOpCallback callback,
gpointer user_data)
{
- char *mount_path, *device_path;
+ char *mount_path, *device_path, *filesystem_type;
char *uri;
GnomeVFSVolumeType type;
@@ -609,14 +614,17 @@
mount_path = gnome_vfs_get_local_path_from_uri (uri);
g_free (uri);
device_path = gnome_vfs_volume_get_device_path (volume);
+ filesystem_type = gnome_vfs_volume_get_filesystem_type (volume);
mount_unmount_operation (mount_path,
device_path,
gnome_vfs_volume_get_hal_udi (volume),
+ filesystem_type,
gnome_vfs_volume_get_device_type (volume),
FALSE, TRUE, FALSE,
callback, user_data);
g_free (mount_path);
g_free (device_path);
+ g_free (filesystem_type);
} else {
unmount_connected_server (volume, callback, user_data);
}
@@ -637,7 +645,7 @@
GnomeVFSVolumeOpCallback callback,
gpointer user_data)
{
- char *mount_path, *device_path;
+ char *mount_path, *device_path, *filesystem_type;
char *uri;
GnomeVFSVolumeType type;
@@ -652,11 +660,13 @@
mount_unmount_operation (mount_path,
device_path,
gnome_vfs_volume_get_hal_udi (volume),
+ NULL,
gnome_vfs_volume_get_device_type (volume),
FALSE, TRUE, TRUE,
callback, user_data);
g_free (mount_path);
g_free (device_path);
+ g_free (filesystem_type);
} else {
unmount_connected_server (volume, callback, user_data);
}
@@ -686,6 +696,7 @@
mount_unmount_operation (mount_path,
device_path,
gnome_vfs_drive_get_hal_udi (drive),
+ NULL,
GNOME_VFS_DEVICE_TYPE_UNKNOWN,
TRUE, FALSE, FALSE,
callback, user_data);
@@ -779,6 +790,7 @@
mount_unmount_operation (mount_path,
device_path,
gnome_vfs_drive_get_hal_udi (drive),
+ NULL,
GNOME_VFS_DEVICE_TYPE_UNKNOWN,
FALSE, FALSE, TRUE,
callback, user_data);
--- gnome-vfs-2.11.3/modules/computer-method.c
+++ gnome-vfs-2.11.3/modules/computer-method.c
@@ -494,19 +494,26 @@
volume_list = gnome_vfs_drive_get_mounted_volumes (drive);
if (volume_list != NULL) {
+ char *filesystem_type;
+
GnomeVFSVolume *volume;
volume = GNOME_VFS_VOLUME (volume_list->data);
uri = gnome_vfs_volume_get_activation_uri (volume);
tmp1 = gnome_vfs_drive_get_display_name (drive);
tmp2 = gnome_vfs_volume_get_display_name (volume);
- if (strcmp (tmp1, tmp2) != 0) {
+
+ /* Don't bother to figure out subfs volumes */
+ filesystem_type = gnome_vfs_volume_get_filesystem_type (volume);
+ if ((filesystem_type == NULL || strcmp (filesystem_type, "subfs") != 0)
+ && strcmp (tmp1, tmp2) != 0) {
name = g_strconcat (tmp1, ": ", tmp2, NULL);
} else {
name = g_strdup (tmp1);
}
g_free (tmp1);
g_free (tmp2);
+ g_free (filesystem_type);
icon = gnome_vfs_volume_get_icon (volume);
gnome_vfs_volume_unref (volume);
} else {
--- gnome-vfs-2.11.3/modules/file-method.c
+++ gnome-vfs-2.11.3/modules/file-method.c
@@ -2425,6 +2425,16 @@
return GNOME_VFS_ERROR_INVALID_URI;
}
+ /* Horrible hack, I hate myself. There are problems
+ * monitoring subfs volumes, and just about everything in /media
+ * on suse is going to be a subfs volume */
+ if (g_str_has_prefix (filename, "/media")) {
+ g_free (filename);
+
+ return GNOME_VFS_ERROR_NOT_SUPPORTED;
+ }
+
+
handle = g_new0 (FileMonitorHandle, 1);
handle->uri = uri;
handle->cancelled = FALSE;