On Wed,  5 Jan 2011 17:35:41 -0800
"Enlightenment SVN" <no-re...@enlightenment.org> wrote:

> Log:
> with this commit, udisks mounting is now fully functional (wfm!) and has a
> number of benefits over the HAL backend, such as being able to automount
> media that's in your fstab dev notes: changes to efm were required for this
> to work since udisks doesn't report back a mount point upon executing a mount
> command, so the actual dir listing/display must be delayed by another
> callback until we actually know where the disk is to avoid opening a random
> directory 
> 
> Author:       discomfitor
> Date:         2011-01-05 17:35:41 -0800 (Wed, 05 Jan 2011)
> New Revision: 55916
> Trac:         http://trac.enlightenment.org/e/changeset/55916
> 
> Modified:
>   trunk/e/src/bin/e_fm.c trunk/e/src/bin/e_fm/e_fm_main_udisks.c
> trunk/e/src/bin/e_fm_device.c 
> 
> Modified: trunk/e/src/bin/e_fm/e_fm_main_udisks.c
> ===================================================================
> --- trunk/e/src/bin/e_fm/e_fm_main_udisks.c   2011-01-06 01:31:52 UTC
> (rev 55915) +++ trunk/e/src/bin/e_fm/e_fm_main_udisks.c       2011-01-06
> 01:35:41 UTC (rev 55916) @@ -127,7 +127,7 @@
>                                DBUS_TYPE_INVALID))
>       dbus_error_free(&err);
>  
> -   printf("name: %s\nfrom: %s\nto: %s\n", name, from, to);
> +   //printf("name: %s\nfrom: %s\nto: %s\n", name, from, to);
>     if ((name) && !strcmp(name, E_UDISKS_BUS))
>       _e_fm_main_udisks_test(NULL, NULL, NULL);
>  }
> @@ -731,7 +731,7 @@
>     v = calloc(1, sizeof(E_Volume));
>     if (!v) return NULL;
>  //   printf("VOL+ %s\n", udi);
> -   v->efm_mode = USING_UDISKS_MOUNT;
> +   v->efm_mode = EFM_MODE_USING_UDISKS_MOUNT;
>     v->udi = eina_stringshare_add(udi);
>     v->icon = NULL;
>     v->first_time = first_time;
> @@ -825,7 +825,7 @@
>     char buf2[256];
>     Eina_List *opt = NULL;
>  
> -   if ((!v) || (v->guard) || (!v->storage) || (!v->storage->removable))
> +   if ((!v) || (v->guard))
>       return;
>  
>  //   printf("mount %s %s [fs type = %s]\n", v->udi, v->mount_point,
> v->fstype);
> 
> Modified: trunk/e/src/bin/e_fm.c
> ===================================================================
> --- trunk/e/src/bin/e_fm.c    2011-01-06 01:31:52 UTC (rev 55915)
> +++ trunk/e/src/bin/e_fm.c    2011-01-06 01:35:41 UTC (rev 55916)
> @@ -823,6 +823,16 @@
>     sd = evas_object_smart_data_get(data);
>     if (!sd) return;  // safety
>  
> +   if (sd->mount->volume->efm_mode != EFM_MODE_USING_HAL_MOUNT)
> +     {
> +        /* Clean up typebuf. */
> +        _e_fm2_typebuf_hide(data);
> +        /* we only just now have the mount point so we should do stuff we
> couldn't do before */
> +        eina_stringshare_replace(&sd->realpath,
> sd->mount->volume->mount_point);
> +        eina_stringshare_replace(&sd->mount->mount_point,
> sd->mount->volume->mount_point);
> +        _e_fm2_dir_load_props(sd);
> +     }
> +
>     if (strcmp(sd->mount->mount_point, sd->realpath))
>       {
>          e_fm2_path_set(sd->obj, "/", sd->mount->mount_point);
> @@ -994,11 +1004,14 @@
>       {
>          E_Volume *v = NULL;
>  
> -        v = e_fm2_device_volume_find(sd->dev + strlen("removable:"));
> +        v = e_fm2_device_volume_find(sd->dev + sizeof("removable:") - 1);
>          if (v)
> -          sd->mount = e_fm2_device_mount(v,
> -                                         _e_fm2_cb_mount_ok,
> _e_fm2_cb_mount_fail,
> -                                         _e_fm2_cb_unmount_ok, NULL, obj);
> +          {
> +             sd->mount = e_fm2_device_mount(v,
> +                                            _e_fm2_cb_mount_ok,
> _e_fm2_cb_mount_fail,
> +                                            _e_fm2_cb_unmount_ok, NULL, obj);
> +             if (v->efm_mode != EFM_MODE_USING_HAL_MOUNT) return;
> +          }
>       }
>     else if (sd->config->view.open_dirs_in_place == 0)
>       {
> @@ -1151,6 +1164,8 @@
>  {
>     E_Fm2_Custom_File *cf;
>  
> +
> +   if (!sd->realpath) return; /* come back later */
>     if (!(sd->view_flags & E_FM2_VIEW_LOAD_DIR_CUSTOM)) return;
>  
>     cf = e_fm2_custom_file_get(sd->realpath);
> @@ -2574,17 +2589,23 @@
>  _e_fm2_client_mount(const char *udi, const char *mountpoint)
>  {
>     char *d;
> -   int l, l1, l2;
> +   int l, l1, l2 = 0;
>  
> -   if (!udi || !mountpoint)
> +   if (!udi)
>       return 0;
>  
>     l1 = strlen(udi);
> -   l2 = strlen(mountpoint);
> -   l = l1 + 1 + l2 + 1;
> +   if (mountpoint)
> +     {
> +        l2 = strlen(mountpoint);
> +        l = l1 + 1 + l2 + 1;
> +     }
> +   else
> +     l = l1 + 1;
>     d = alloca(l);
>     strcpy(d, udi);
> -   strcpy(d + l1 + 1, mountpoint);
> +   if (mountpoint)
> +     strcpy(d + l1 + 1, mountpoint);
>  
>     return _e_fm_client_send_new(E_FM_OP_MOUNT, (void *)d, l);
>  }
> @@ -3241,8 +3262,9 @@
>               v = e_fm2_device_volume_find(dev + strlen("removable:"));
>               if (v)
>                 {
> -                  if (!v->mount_point)
> +                  if ((!v->mount_point) && (v->efm_mode ==
> EFM_MODE_USING_HAL_MOUNT)) v->mount_point =
> e_fm2_device_volume_mountpoint_get(v);
> +                  else return NULL;
>  
>                    if (PRT("%s/%s", v->mount_point, path) >= sizeof(buf))
>                      return NULL;
> 
> Modified: trunk/e/src/bin/e_fm_device.c
> ===================================================================
> --- trunk/e/src/bin/e_fm_device.c     2011-01-06 01:31:52 UTC (rev 55915)
> +++ trunk/e/src/bin/e_fm_device.c     2011-01-06 01:35:41 UTC (rev 55916)
> @@ -130,12 +130,13 @@
>            v->parent);
>   */
>  /* Check mount point */
> -   if ((!v->mount_point) || (v->mount_point[0] == 0))
> +   if ((v->efm_mode == EFM_MODE_USING_HAL_MOUNT) &&
> +       ((!v->mount_point) || (!v->mount_point[0])))
>       {
>          if (v->mount_point) eina_stringshare_del(v->mount_point);
>          v->mount_point = NULL;
>          v->mount_point = e_fm2_device_volume_mountpoint_get(v);
> -        if ((!v->mount_point) || (v->mount_point[0] == 0))
> +        if ((!v->mount_point) || (!v->mount_point[0]))
>            {
>               char buf[PATH_MAX];
>               const char *id;
> @@ -377,6 +378,8 @@
>          //   printf("GET MOUNTPOINT = %s\n", v->mount_point);
>            return eina_stringshare_add(v->mount_point);
>       }
> +   else if (v->efm_mode != EFM_MODE_USING_HAL_MOUNT)
> +     return NULL;
>  
>     if (v->label && v->label[0] != '\0')
>       snprintf(buf, sizeof(buf) - 1, "/media/%s", v->label);
> 
> 
udisks (using eukit from e_dbus) mounting is automatically enabled at compile
time if eukit is detected and --disable-mount-udisks is not specified.  At
runtime, HAL is checked for.  If found, HAL is used.
If not found, udisks is checked for.  If found, udisks is used and necessary
changes are applied to efm to make mounting work.
After this I will be adding a much more generic eeze mount backend, which will
be the fallback if neither HAL/udisks are present.  It will use
enlightenment_sys to execute a mount command, and thus will be able to handle
such things as nfs, sshfs, isos, etc with eeze (tm).

I plan on waiting a while for that, however, since I want to be able to catch
any udisks bugs which crop up first.

-- 
Mike Blumenkrantz
Zentific: We run the three-legged race individually.

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to