diff --git a/exo-mount/exo-mount-hal.c b/exo-mount/exo-mount-hal.c index ea38e76..b1287ee 100644 --- a/exo-mount/exo-mount-hal.c +++ b/exo-mount/exo-mount-hal.c @@ -61,6 +61,7 @@ struct _ExoMountHalDevice /* file system options */ gchar **fsoptions; const gchar *fstype; + gchar *altfstype; LibHalVolumeUsage fsusage; }; @@ -243,6 +244,7 @@ err1: g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("Given device \"% /* setup the file system internals */ device->fstype = libhal_volume_get_fstype (device->volume); + device->altfstype = libhal_device_get_property_string (hal_context, udi, "volume.fstype.alternative.preferred", NULL); device->fsusage = libhal_volume_get_fsusage (device->volume); } } @@ -263,7 +265,16 @@ err1: g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("Given device \"% } /* determine the valid mount options from the UDI */ - device->fsoptions = libhal_device_get_property_strlist (hal_context, udi, "volume.mount.valid_options", &derror); + if (device->altfstype) + { + char key[128]; + sprintf(key, "volume.mount.%s.valid_options", device->altfstype); + device->fsoptions = libhal_device_get_property_strlist (hal_context, udi, key, &derror); + } + else + { + device->fsoptions = libhal_device_get_property_strlist (hal_context, udi, "volume.mount.valid_options", &derror); + } /* sanity checking */ if (G_UNLIKELY (device->file == NULL || device->name == NULL)) @@ -663,6 +674,7 @@ exo_mount_hal_device_mount (ExoMountHalDevice *device, /* this is currently mostly Linux specific noise */ if (strcmp (device->fsoptions[m], "uid=") == 0 && (strcmp (device->fstype, "vfat") == 0 + || strcmp (device->altfstype, "ntfs-3g") == 0 || strcmp (device->fstype, "iso9660") == 0 || strcmp (device->fstype, "udf") == 0 || device->volume == NULL)) @@ -686,6 +698,12 @@ exo_mount_hal_device_mount (ExoMountHalDevice *device, /* however this one is FreeBSD specific */ options[n++] = g_strdup ("longnames"); } + /* We need to pass umask=0077 to ntfs-3g or else it gets 0777 perms */ + else if (strcmp (device->fsoptions[m], "umask=") == 0 + && strcmp (device->altfstype, "ntfs-3g") == 0) + { + options[n++] = g_strdup_printf ("umask=0077"); + } } } @@ -706,8 +724,15 @@ exo_mount_hal_device_mount (ExoMountHalDevice *device, ? exo_str_replace (mount_point, G_DIR_SEPARATOR_S, "_") : g_strdup (""); - /* let HAL guess the fstype */ - fstype = g_strdup (""); + if (G_UNLIKELY (device->altfstype != NULL)) + { + fstype = g_strdup (device->altfstype); + } + else + { + /* let HAL guess the fstype */ + fstype = g_strdup (""); + } /* setup the D-Bus error */ dbus_error_init (&derror);