Enlightenment CVS committal
Author : raster
Project : e17
Module : apps/e
Dir : e17/apps/e/src/bin
Modified Files:
e_fm.c e_fm_main.c
Log Message:
revert lok's patch - gettign segv's and mount success/failure is not working.
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_fm.c,v
retrieving revision 1.209
retrieving revision 1.210
diff -u -3 -r1.209 -r1.210
--- e_fm.c 3 Oct 2007 16:46:29 -0000 1.209
+++ e_fm.c 3 Oct 2007 17:19:17 -0000 1.210
@@ -189,7 +189,6 @@
{
const char *udi;
const char *mount_point;
- int instances;
Ecore_Timer *timeout;
void (*mount_ok) (void *data);
@@ -214,7 +213,6 @@
static E_Storage *e_storage_find(const char *udi);
static const char *_e_fm2_dev_path_map(const char *dev, const char *path);
-static char *_e_fm2_vol_mountpoint_resolve(E_Volume *v);
static void _e_fm2_file_add(Evas_Object *obj, const char *file, int unique,
const char *file_rel, int after, E_Fm2_Finfo *finf);
static void _e_fm2_file_del(Evas_Object *obj, const char *file);
static void _e_fm2_queue_process(Evas_Object *obj);
@@ -470,10 +468,9 @@
e_fm2_path_set(Evas_Object *obj, const char *dev, const char *path)
{
E_Fm2_Smart_Data *sd;
- Evas_List *l;
sd = evas_object_smart_data_get(obj);
- if (!sd || !path) return; // safety
+ if (!sd) return; // safety
if (!evas_object_type_get(obj)) return; // safety
if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety
@@ -513,6 +510,12 @@
if (sd->dev) evas_stringshare_del(sd->dev);
if (sd->path) evas_stringshare_del(sd->path);
+ if (sd->mount)
+ {
+ printf("UM2\n");
+ _e_fm2_unmount(sd->mount);
+ sd->mount = NULL;
+ }
if (sd->realpath)
{
evas_stringshare_del(sd->realpath);
@@ -528,30 +531,8 @@
_e_fm2_regions_free(obj);
_e_fm2_icons_free(obj);
edje_object_part_text_set(sd->overlay, "e.text.busy_label", "");
-
- if (!sd->mount && !sd->dev)
- {
- for (l = _e_fm2_mounts; l; l = l->next)
- {
- E_Fm2_Mount *m;
- m = l->data;
- if (!strncmp(m->mount_point, sd->realpath, strlen(m->mount_point)))
- {
- sd->mount = m;
- m->instances++;
- break;
- }
- }
- }
- if (!l && sd->mount && strncmp(sd->mount->mount_point, sd->realpath,
- strlen(sd->mount->mount_point)))
- {
- printf("UM2\n");
- _e_fm2_unmount(sd->mount);
- sd->mount = NULL;
- }
- if ((!sd->mount) && (sd->dev) && (!strncmp(sd->dev, "removable:", 10)))
+ if ((sd->dev) && (!strncmp(sd->dev, "removable:", 10)))
{
E_Volume *v;
@@ -1390,21 +1371,21 @@
E_Fm2_Mount *m;
Evas_List *l, *dels = NULL;
+ if (_e_fm2_mount_stack > 1) return;
for (l = _e_fm2_mounts; l; l = l->next)
{
m = l->data;
- if (m->instances == 0)
- {
- _e_fm2_mounts = evas_list_remove(_e_fm2_mounts, m);
- evas_stringshare_del(m->udi);
- evas_stringshare_del(m->mount_point);
- if (m->timeout)
- {
- ecore_timer_del(m->timeout);
- m->timeout = NULL;
- }
- free(m);
- }
+ if (m->delete_me) dels = evas_list_append(dels, m);
+ }
+ while (dels)
+ {
+ m = dels->data;
+ _e_fm2_mounts = evas_list_remove(_e_fm2_mounts, m);
+ dels = evas_list_remove_list(dels, dels);
+ evas_stringshare_del(m->udi);
+ evas_stringshare_del(m->mount_point);
+ if (m->timeout) ecore_timer_del(m->timeout);
+ free(m);
}
}
@@ -1424,7 +1405,7 @@
for (l = _e_fm2_mounts; l; l = l->next)
{
m = l->data;
- if ((!strcmp(m->udi, udi)) && (m->mount_ok))
+ if ((!m->delete_me) && (!strcmp(m->udi, udi)) && (m->mount_ok))
{
m->mounted = 1;
m->mount_ok(m->data);
@@ -1435,7 +1416,7 @@
}
}
}
- //_e_fm2_mount_flush();
+ _e_fm2_mount_flush();
_e_fm2_mount_stack--;
}
@@ -1531,19 +1512,18 @@
int exists = 0;
int mounted = 0;
+ m = calloc(1, sizeof(E_Fm2_Mount));
+ if (!m) return NULL;
for (l = _e_fm2_mounts; l; l = l->next)
{
m2 = l->data;
if (!strcmp(v->udi, m2->udi))
{
- m = m2;
- m->instances++;
+ exists = 1;
+ mounted = m2->mounted;
break;
}
}
-
- m = calloc(1, sizeof(E_Fm2_Mount));
- if (!m) return NULL;
m->udi = evas_stringshare_add(v->udi);
m->mount_point = evas_stringshare_add(v->mount_point);
m->mount_ok = mount_ok;
@@ -1551,14 +1531,13 @@
m->unmount_ok = unmount_ok;
m->unmount_fail = unmount_fail;
m->data = data;
- m->mounted = v->mounted;
- m->instances++;
- if (!v->mounted)
+ m->mounted = mounted;
+ if (!exists)
{
m->timeout = ecore_timer_add(10.0, _e_fm2_cb_mount_timeout, m);
_e_fm2_client_mount(m->udi, m->mount_point);
- _e_fm2_mounts = evas_list_prepend(_e_fm2_mounts, m);
}
+ _e_fm2_mounts = evas_list_prepend(_e_fm2_mounts, m);
return m;
}
@@ -1570,13 +1549,12 @@
int exists = 0;
_e_fm2_mount_stack++;
- m->instances--;
for (l = _e_fm2_mounts; l; l = l->next)
{
m2 = l->data;
- if (!strcmp(m->udi, m2->udi)) break;
+ if (!strcmp(m->udi, m2->udi)) exists++;
}
- if (l && !m->instances)
+ if (exists == 1)
{
printf("_e_fm2_unmount UM\n");
_e_fm2_client_unmount(m->udi);
@@ -1966,20 +1944,15 @@
{
E_Fm2_Client *cl;
char *d;
- const char *mp;
int l, l1, l2;
- if (!strncmp(mountpoint, "/media/", 7))
- mp = mountpoint + 7;
- else
- mp = mountpoint;
l1 = strlen(udi);
- l2 = strlen(mp);
+ l2 = strlen(mountpoint);
l = l1 + 1 + l2 + 1;
d = alloca(l);
strcpy(d, udi);
- strcpy(d + l1 + 1, mp);
- printf("SEND %s %s\n", udi, mp);
+ strcpy(d + l1 + 1, mountpoint);
+ printf("SEND %s %s\n", udi, mountpoint);
cl = _e_fm2_client_get();
if (!cl)
{
@@ -2552,21 +2525,21 @@
s = e_storage_find(v->parent);
if (!v->mount_point)
{
- char buf[512];
if (v->uuid)
- snprintf(buf, sizeof(buf), "/media/%s",
strdup(v->uuid));
+ v->mount_point = strdup(v->uuid);
else if (v->label)
- snprintf(buf, sizeof(buf), "/media/%s",
strdup(v->label));
+ v->mount_point = strdup(v->label);
else if ((v->storage) && (v->storage->serial))
- snprintf(buf, sizeof(buf), "/media/%s",
strdup(v->storage->serial));
+ v->mount_point = strdup(v->storage->serial);
else
{
+ char buf[256];
static int mount_count = 0;
snprintf(buf, sizeof(buf), "unknown-%i\n",
mount_count);
mount_count++;
+ v->mount_point = strdup(buf);
}
- v->mount_point = strdup(buf);
}
if (s)
{
@@ -2614,11 +2587,8 @@
{
v->mounted = 1;
if (v->mount_point) free(v->mount_point);
- if (mountpoint[0] == 0)
- v->mount_point = _e_fm2_vol_mountpoint_resolve(v);
- else
- v->mount_point = strdup(mountpoint);
- printf("MOUNT %s %s\n", v->udi, v->mount_point);
+ v->mount_point = strdup(mountpoint);
+ printf("MOUNT %s %s\n", udi, mountpoint);
}
_e_fm2_mount_ok(udi);
}
@@ -2635,12 +2605,7 @@
if (v)
{
v->mounted = 0;
- if (v->mount_point) free(v->mount_point);
- if (mountpoint[0] == 0)
- v->mount_point = _e_fm2_vol_mountpoint_resolve(v);
- else
- v->mount_point = strdup(mountpoint);
- printf("UNMOUNT %s %s\n", v->udi, v->mount_point);
+ printf("UNMOUNT %s %s\n", udi, mountpoint);
}
_e_fm2_unmount_ok(udi);
}
@@ -2728,9 +2693,9 @@
E_Volume *v;
v = e_volume_find(dev + strlen("removable:"));
- if (v && v->mount_point)
+ if (v)
{
- snprintf(buf, sizeof(buf), "%s%s", v->mount_point, path);
+ snprintf(buf, sizeof(buf), "/media/%s", v->mount_point);
}
}
else if (CMP("dvd") || CMP("dvd-*")) {
@@ -2774,27 +2739,6 @@
}
return evas_stringshare_add(buf);
}
-
-static char *
-_e_fm2_vol_mountpoint_resolve(E_Volume *v)
-{
- if (!v) return;
- char buf[512];
- if (v->uuid)
- snprintf(buf, sizeof(buf), "/media/%s", strdup(v->uuid));
- else if (v->label)
- snprintf(buf, sizeof(buf), "/media/%s", strdup(v->label));
- else if ((v->storage) && (v->storage->serial))
- snprintf(buf, sizeof(buf), "/media/%s", strdup(v->storage->serial));
- else
- {
- static int mount_count = 0;
-
- snprintf(buf, sizeof(buf), "/media/unknown-%i", mount_count);
- mount_count++;
- }
- return strdup(buf);
-}
static void
_e_fm2_file_add(Evas_Object *obj, const char *file, int unique, const char
*file_rel, int after, E_Fm2_Finfo *finf)
@@ -5459,7 +5403,7 @@
snprintf(buf, sizeof(buf), "%s/%s", ic->sd->path, ic->info.file);
e_fm2_path_set(ic->sd->obj, dev, buf);
E_FREE(dev);
- }
+ }
else
evas_object_smart_callback_call(ic->sd->obj, "selected", NULL);
/* if its in file selector mode then signal that a selection has
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_fm_main.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -3 -r1.29 -r1.30
--- e_fm_main.c 3 Oct 2007 16:46:29 -0000 1.29
+++ e_fm_main.c 3 Oct 2007 17:19:17 -0000 1.30
@@ -142,10 +142,8 @@
static void _e_dbus_cb_dev_add(void *data, DBusMessage *msg);
static void _e_dbus_cb_dev_del(void *data, DBusMessage *msg);
static void _e_dbus_cb_cap_add(void *data, DBusMessage *msg);
-static void _e_dbus_cb_prop_modified(void *data, DBusMessage *msg);
static void _e_dbus_cb_store_prop(void *data, void *reply_data, DBusError
*error);
static void _e_dbus_cb_vol_prop(void *data, void *reply_data, DBusError
*error);
-static void _e_dbus_cb_vol_prop_mount_modified(void *data, void *reply_data,
DBusError *error);
static void _e_dbus_cb_vol_mounted(void *user_data, void *method_return,
DBusError *error);
static void _e_dbus_cb_vol_unmounted(void *user_data, void *method_return,
DBusError *error);
@@ -431,54 +429,6 @@
}
static void
-_e_dbus_cb_prop_modified(void *data, DBusMessage *msg)
-{
- E_Volume *v;
- DBusMessageIter iter, sub, subsub;
- struct {
- const char *name;
- int added;
- int removed;
- } prop;
- int num_changes = 0, i;
-
- if (!(v = data)) return;
-
- if (dbus_message_get_error_name(msg))
- {
- printf("DBUS ERROR: %s\n", dbus_message_get_error_name(msg));
- return;
- }
- if (!dbus_message_iter_init(msg, &iter)) return;
-
- if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_INT32) return;
- dbus_message_iter_get_basic(&iter, &num_changes);
- if (num_changes == 0) return;
-
- dbus_message_iter_next(&iter);
- if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY) return;
- dbus_message_iter_recurse(&iter, &sub);
-
- for (i = 0; i < num_changes; i++, dbus_message_iter_next(&sub))
- {
- dbus_message_iter_recurse(&sub, &subsub);
-
- if (dbus_message_iter_get_arg_type(&subsub) != DBUS_TYPE_STRING) break;
- dbus_message_iter_get_basic(&subsub, &(prop.name));
- if (!strcmp(prop.name, "volume.mount_point"))
- {
- e_hal_device_get_all_properties(_e_dbus_conn, v->udi,
- _e_dbus_cb_vol_prop_mount_modified,
- v);
- return;
- }
-
- dbus_message_iter_next(&subsub);
- dbus_message_iter_next(&subsub);
- }
-}
-
-static void
_e_dbus_cb_store_prop(void *data, void *reply_data, DBusError *error)
{
E_Storage *s = data;
@@ -537,7 +487,7 @@
return;
error:
- printf("ERR on %s \n name : %s\n msg : %s\n", s->udi, error->name,
error->message);
+ printf("ERR %s\n", s->udi);
e_storage_del(s->udi);
}
@@ -680,52 +630,6 @@
return;
}
-static void
-_e_dbus_cb_vol_prop_mount_modified(void *data, void *reply_data, DBusError
*error)
-{
- E_Volume *v = data;
- E_Storage *s = NULL;
- E_Hal_Device_Get_All_Properties_Return *ret = reply_data;
- int err = 0;
- char *str = NULL;
-
- if (!ret) return;
- if (dbus_error_is_set(error))
- {
- dbus_error_free(error);
- return;
- }
-
- v->mounted = e_hal_property_bool_get(ret, "volume.is_mounted", &err);
- if (err) printf("HAL Error : can't get volume.is_mounted property");
-
- if (v->mount_point) free(v->mount_point);
- v->mount_point = e_hal_property_string_get(ret, "volume.mount_point", &err);
- if (err) printf("HAL Error : can't get volume.is_mount_point property");
-
- printf("**VOL udi: %s mount_point: %s mounted: %d\n", v->udi,
v->mount_point, v->mounted);
- {
- char *buf;
- int size;
-
- size = strlen(v->udi) + 1 + strlen(v->mount_point) + 1;
- buf = alloca(size);
- strcpy(buf, v->udi);
- strcpy(buf + strlen(buf) + 1, v->mount_point);
- if (v->mounted)
- ecore_ipc_server_send(_e_ipc_server,
- 6/*E_IPC_DOMAIN_FM*/,
- 12/*mount done*/,
- 0, 0, 0, buf, size);
- else
- ecore_ipc_server_send(_e_ipc_server,
- 6/*E_IPC_DOMAIN_FM*/,
- 13/*unmount done*/,
- 0, 0, 0, buf, size);
- }
- return;
-}
-
static Evas_List *_e_vols = NULL;
EAPI E_Volume *
@@ -742,10 +646,6 @@
_e_vols = evas_list_append(_e_vols, v);
e_hal_device_get_all_properties(_e_dbus_conn, v->udi,
_e_dbus_cb_vol_prop, v);
- e_dbus_signal_handler_add(_e_dbus_conn, "org.freedesktop.Hal",
- udi,
- "org.freedesktop.Hal.Device",
- "PropertyModified", _e_dbus_cb_prop_modified, v);
return v;
}
@@ -793,7 +693,6 @@
v->mounted = 1;
printf("MOUNT: %s from %s\n", v->udi, v->mount_point);
- printf("DBus Error name: %s \nmsg : %s\n", error->name, error->message);
size = strlen(v->udi) + 1 + strlen(v->mount_point) + 1;
buf = alloca(size);
strcpy(buf, v->udi);
@@ -843,7 +742,7 @@
// ecore_list_append(opt, "user");
// ecore_list_append(opt, "utf8");
e_hal_device_volume_mount(_e_dbus_conn, v->udi, v->mount_point,
- v->fstype, opt, NULL, v);
+ v->fstype, opt, _e_dbus_cb_vol_mounted, v);
// ecore_list_destroy(opt);
}
@@ -1001,11 +900,7 @@
{
if ((!strcmp(dp->d_name, ".")) || (!strcmp(dp->d_name,
"..")))
continue;
- if (!strcmp(dp->d_name, ".order"))
- {
- dot_order = 1;
- continue;
- }
+ if (!strcmp(dp->d_name, ".order")) dot_order = 1;
files = evas_list_append(files, strdup(dp->d_name));
}
closedir(dir);
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs