e_fm: Correct mount options used for udisks mounting

udisks has a restricted set of mount options which can be
  used for most filesystems.  I have adjusted our mount
  options based on the current udisks code.



SVN revision: 73549
This commit is contained in:
Nicholas Hughart 2012-07-11 05:52:56 +00:00
parent 8de859c901
commit ff1224d07d
1 changed files with 20 additions and 16 deletions

View File

@ -895,9 +895,12 @@ _e_fm_main_udisks_volume_mount(E_Volume *v)
INF("mount %s %s [fs type = %s]", v->udi, v->mount_point, v->fstype); INF("mount %s %s [fs type = %s]", v->udi, v->mount_point, v->fstype);
// for vfat and ntfs we want the uid mapped to the user mounting, if we can // Map uid to current user if possible
// Possible filesystems found in udisks source (src/udiskslinuxfilesystem.c) as of 2012-07-11
if ((!strcmp(v->fstype, "vfat")) || if ((!strcmp(v->fstype, "vfat")) ||
(!strcmp(v->fstype, "ntfs")) (!strcmp(v->fstype, "ntfs")) ||
(!strcmp(v->fstype, "iso9660")) ||
(!strcmp(v->fstype, "udf"))
) )
{ {
snprintf(buf, sizeof(buf), "uid=%i", (int)getuid()); snprintf(buf, sizeof(buf), "uid=%i", (int)getuid());
@ -906,17 +909,17 @@ _e_fm_main_udisks_volume_mount(E_Volume *v)
// force utf8 as the encoding - e only likes/handles utf8. its the // force utf8 as the encoding - e only likes/handles utf8. its the
// pseudo-standard these days anyway for "linux" for intl text to work // pseudo-standard these days anyway for "linux" for intl text to work
// everywhere. problem is some fs's use differing options // everywhere. problem is some fs's use differing options and udisks
if ((!strcmp(v->fstype, "vfat")) || // doesn't allow some options with certain filesystems.
(!strcmp(v->fstype, "ntfs")) || // Valid options found in udisks (src/udiskslinuxfilesystem.c) as of 2012-07-11
(!strcmp(v->fstype, "iso9660")) // Note that these options are default with the latest udisks, kept here to
) // avoid breakage in the future (hopefully).
if (!strcmp(v->fstype, "vfat"))
{ {
snprintf(buf2, sizeof(buf2), "utf8"); snprintf(buf2, sizeof(buf2), "utf8=1");
opt = eina_list_append(opt, buf2); opt = eina_list_append(opt, buf2);
} }
else if ((!strcmp(v->fstype, "fat")) || else if ((!strcmp(v->fstype, "iso9660")) ||
(!strcmp(v->fstype, "jfs")) ||
(!strcmp(v->fstype, "udf")) (!strcmp(v->fstype, "udf"))
) )
{ {
@ -925,13 +928,14 @@ _e_fm_main_udisks_volume_mount(E_Volume *v)
} }
v->guard = ecore_timer_add(E_FM_MOUNT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_udisks_vol_mount_timeout, v); v->guard = ecore_timer_add(E_FM_MOUNT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_udisks_vol_mount_timeout, v);
// on ubuntu 10.04 if we request mount with opt - it fails. unknown why right
// now, but lets try without and maybe we need to try 2 mounts - one with // It was previously noted here that ubuntu 10.04 failed to mount if opt was passed to
// opts and one without? // e_udisks_volume_mount. The reason at the time was unknown and apparently never found.
// v->op = e_udisks_volume_mount(_e_fm_main_udisks_conn, v->udi, // I theorize that this was due to improper mount options being passed (namely the utf8 options).
// v->fstype, opt); // If this still fails on Ubuntu 10.04 then an actual fix should be found.
v->op = e_udisks_volume_mount(_e_fm_main_udisks_conn, v->udi, v->op = e_udisks_volume_mount(_e_fm_main_udisks_conn, v->udi,
v->fstype, NULL); v->fstype, opt);
eina_list_free(opt); eina_list_free(opt);
v->optype = E_VOLUME_OP_TYPE_MOUNT; v->optype = E_VOLUME_OP_TYPE_MOUNT;
} }