1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
--- a/src/vfs/vfs-volume-hal.c 2008-06-11 15:38:25.000000000 -0300
+++ b/src/vfs/vfs-volume-hal.c 2008-12-16 10:20:18.000000000 -0200
@@ -944,7 +944,7 @@
if (G_LIKELY (desired_mount_point != NULL && *desired_mount_point != '\0'))
{
filename = g_build_filename (mount_root, desired_mount_point, NULL);
- volume->mount_point = filename;
+ volume->mount_point = g_strdup( desired_mount_point );
}
libhal_free_string (desired_mount_point);
}
@@ -954,8 +954,7 @@
{
/* <mount-root>/<device> looks like a good idea */
basename = g_path_get_basename (volume->device_file);
- filename = g_build_filename (mount_root, basename, NULL);
- volume->mount_point = filename;
+ volume->mount_point = g_strdup( basename );
g_free (basename);
}
@@ -2310,7 +2309,7 @@
}
gboolean
-vfs_volume_hal_mount (ExoMountHalDevice *device,
+vfs_volume_hal_mount (VFSVolume *vol,
GError **error)
{
DBusMessage *message;
@@ -2323,8 +2322,13 @@
const gchar *uuid = NULL, *label = NULL;
gint m, n = 0;
VFSVolumeOptions opts;
+ ExoMountHalDevice* device = NULL;
+
+ g_return_val_if_fail (vol != NULL, FALSE);
+
+ if (!(device = vfs_volume_hal_from_udi( vol->udi, error )))
+ return FALSE;
- g_return_val_if_fail (device != NULL, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
if( device->volume != NULL) {
@@ -2472,16 +2476,23 @@
}
}
- /* try to determine a usable mount point */
- if (G_LIKELY (device->volume != NULL))
+ if (G_LIKELY (vol->mount_point == NULL))
{
- /* maybe we can use the volume's label... */
- mount_point = g_strdup( libhal_volume_get_label (device->volume) );
+ /* try to determine a usable mount point */
+ if (G_LIKELY (device->volume != NULL))
+ {
+ /* maybe we can use the volume's label... */
+ mount_point = g_strdup( libhal_volume_get_label (device->volume) );
+ }
+ else
+ {
+ /* maybe we can use the the textual type... */
+ mount_point = g_strdup( libhal_drive_get_type_textual (device->drive) );
+ }
}
else
{
- /* maybe we can use the the textual type... */
- mount_point = g_strdup( libhal_drive_get_type_textual (device->drive) );
+ mount_point = g_strdup( vol->mount_point );
}
/* However, the label may contain G_DIR_SEPARATOR so just replace these
@@ -2825,13 +2836,10 @@
gboolean vfs_volume_mount( VFSVolume* vol, GError** err )
{
- ExoMountHalDevice* device;
gboolean ret = FALSE;
- device = vfs_volume_hal_from_udi( vol->udi, err );
- if( device )
+ if( vol )
{
- ret = vfs_volume_hal_mount( device, err );
- vfs_volume_hal_free( device );
+ ret = vfs_volume_hal_mount( vol, err );
}
return ret;
}
|