gvfs r1607 - in trunk: . hal
- From: alexl svn gnome org
- To: svn-commits-list gnome org
- Subject: gvfs r1607 - in trunk: . hal
- Date: Fri, 7 Mar 2008 15:22:37 +0000 (GMT)
Author: alexl
Date: Fri Mar 7 15:22:37 2008
New Revision: 1607
URL: http://svn.gnome.org/viewvc/gvfs?rev=1607&view=rev
Log:
2008-03-07 Alexander Larsson <alexl redhat com>
* hal/ghalvolumemonitor.c:
(get_mount_point_for_device):
(should_volume_be_ignored):
Really make sure we ignore stuff outside /media (#520615)
Modified:
trunk/ChangeLog
trunk/hal/ghalvolumemonitor.c
Modified: trunk/hal/ghalvolumemonitor.c
==============================================================================
--- trunk/hal/ghalvolumemonitor.c (original)
+++ trunk/hal/ghalvolumemonitor.c Fri Mar 7 15:22:37 2008
@@ -797,52 +797,52 @@
}
-static gboolean
-should_be_hidden_according_to_etc_fstab (HalDevice *d, GList *fstab_mount_points)
+static GUnixMountPoint *
+get_mount_point_for_device (HalDevice *d, GList *fstab_mount_points)
{
GList *l;
gboolean ret;
const char *device_file;
+ const char *device_mount_point;
- ret = TRUE;
+ device_mount_point = hal_device_get_property_string (d, "volume.mount_point");
device_file = hal_device_get_property_string (d, "block.device");
- for (l = fstab_mount_points; l != NULL; l = l->next) {
- GUnixMountPoint *mount_point = l->data;
- const char *device_path;
- gboolean device_file_matches;
-
- device_file_matches = FALSE;
- device_path = g_unix_mount_point_get_device_path (mount_point);
-
- if (g_str_has_prefix (device_path, "LABEL="))
- {
- if (strcmp (device_path + 6, hal_device_get_property_string (d, "volume.label")) == 0)
- device_file_matches = TRUE;
- }
- else if (g_str_has_prefix (device_path, "UUID="))
- {
- if (g_ascii_strcasecmp (device_path + 5, hal_device_get_property_string (d, "volume.uuid")) == 0)
- device_file_matches = TRUE;
- }
- else
- {
- char resolved_device_path[PATH_MAX];
- /* handle symlinks such as /dev/disk/by-uuid/47C2-1994 */
- if (realpath (device_path, resolved_device_path) != NULL &&
- strcmp (resolved_device_path, device_file) == 0)
- device_file_matches = TRUE;
- }
-
- if (device_file_matches && !_g_unix_mount_point_guess_should_display (mount_point))
- goto out;
- }
-
- ret = FALSE;
+ for (l = fstab_mount_points; l != NULL; l = l->next)
+ {
+ GUnixMountPoint *mount_point = l->data;
+ const char *device_path;
+ const char *mount_path;
+
+ mount_path = g_unix_mount_point_get_mount_path (mount_point);
+ if (device_mount_point != NULL &&
+ mount_path != NULL &&
+ strcmp (device_mount_point, mount_path) == 0)
+ return mount_point;
+
+ device_path = g_unix_mount_point_get_device_path (mount_point);
+ if (g_str_has_prefix (device_path, "LABEL="))
+ {
+ if (strcmp (device_path + 6, hal_device_get_property_string (d, "volume.label")) == 0)
+ return mount_point;
+ }
+ else if (g_str_has_prefix (device_path, "UUID="))
+ {
+ if (g_ascii_strcasecmp (device_path + 5, hal_device_get_property_string (d, "volume.uuid")) == 0)
+ return mount_point;
+ }
+ else
+ {
+ char resolved_device_path[PATH_MAX];
+ /* handle symlinks such as /dev/disk/by-uuid/47C2-1994 */
+ if (realpath (device_path, resolved_device_path) != NULL &&
+ strcmp (resolved_device_path, device_file) == 0)
+ return mount_point;
+ }
+ }
- out:
- return ret;
+ return NULL;
}
static gboolean
@@ -850,6 +850,7 @@
{
gboolean volume_ignore;
const char *volume_fsusage;
+ GUnixMountPoint *mount_point;
volume_fsusage = hal_device_get_property_string (d, "volume.fsusage");
volume_ignore = hal_device_get_property_bool (d, "volume.ignore");
@@ -889,17 +890,9 @@
return TRUE;
}
- if (hal_device_get_property_bool (d, "volume.is_mounted"))
- {
- if (g_unix_is_mount_path_system_internal (hal_device_get_property_string (d, "volume.mount_point")))
- return TRUE;
- }
- else
- {
- /* not mounted, may be referenced in /etc/fstab though */
- if (should_be_hidden_according_to_etc_fstab (d, fstab_mount_points))
- return TRUE;
- }
+ mount_point = get_mount_point_for_device (d, fstab_mount_points);
+ if (mount_point != NULL && !_g_unix_mount_point_guess_should_display (mount_point))
+ return TRUE;
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]