add some initial detection for luks encrypted fs types

SVN revision: 55962
This commit is contained in:
Mike Blumenkrantz 2011-01-07 00:47:49 +00:00
parent 5cfb046aa9
commit 7396fa5d00
3 changed files with 58 additions and 27 deletions

View File

@ -409,7 +409,14 @@ _e_fm_main_udisks_cb_vol_prop(E_Volume *v,
/* skip volumes that aren't filesystems */
str = e_ukit_property_string_get(ret, "IdUsage", &err);
if (err || !str) goto error;
if (strcmp(str, "filesystem")) goto error;
if (strcmp(str, "filesystem"))
{
if (strcmp(str, "crypto"))
v->encrypted = e_ukit_property_bool_get(ret, "DeviceIsLuks", &err);
if (!v->encrypted)
goto error;
}
str = NULL;
v->uuid = e_ukit_property_string_get(ret, "IdUuid", &err);
@ -420,6 +427,14 @@ _e_fm_main_udisks_cb_vol_prop(E_Volume *v,
if (!v->label) v->label = e_ukit_property_string_get(ret, "DeviceFile", &err); /* avoid having blank labels */
v->label = eina_stringshare_add(v->label);
if (!v->encrypted)
{
const Eina_List *l;
l = e_ukit_property_strlist_get(ret, "DeviceMountPaths", &err);
if (err) goto error;
if (l) v->mount_point = eina_stringshare_add(l->data);
v->fstype = e_ukit_property_string_get(ret, "IdType", &err);
v->fstype = eina_stringshare_add(v->fstype);
@ -427,17 +442,13 @@ _e_fm_main_udisks_cb_vol_prop(E_Volume *v,
v->mounted = e_ukit_property_bool_get(ret, "DeviceIsMounted", &err);
if (err) goto error;
}
else
v->unlocked = e_ukit_property_bool_get(ret, "DeviceIsLuksCleartext", &err);
v->partition = e_ukit_property_bool_get(ret, "DeviceIsPartition", &err);
if (err) goto error;
{
const Eina_List *l;
l = e_ukit_property_strlist_get(ret, "DeviceMountPaths", &err);
if (err) goto error;
if (l) v->mount_point = eina_stringshare_add(l->data);
}
if (v->partition)
{
v->partition_number = e_ukit_property_int_get(ret, "PartitionNumber", NULL);
@ -445,7 +456,21 @@ _e_fm_main_udisks_cb_vol_prop(E_Volume *v,
v->partition_label = eina_stringshare_add(v->partition_label);
}
if (v->unlocked)
{
const char *enc;
E_Volume *venc;
enc = e_ukit_property_string_get(ret, "LuksCleartextSlave", &err);
venc = _e_fm_main_udisks_volume_find(enc);
v->parent = venc->parent;
v->storage = venc->storage;
v->storage->volumes = eina_list_append(v->storage->volumes, v);
}
else
{
v->parent = e_ukit_property_string_get(ret, "PartitionSlave", &err);
if (!err)
{
if (v->parent)
@ -465,6 +490,7 @@ _e_fm_main_udisks_cb_vol_prop(E_Volume *v,
v->parent = v->udi;
}
}
}
v->parent = eina_stringshare_add(v->parent);
switch (v->optype)

View File

@ -31,6 +31,8 @@ _e_volume_edd_new(void)
DAT(mount_point, STRING);
DAT(parent, STRING);
DAT(first_time, CHAR);
DAT(encrypted, CHAR);
DAT(unlocked, CHAR);
DAT(efm_mode, UINT);
#undef DAT
return edd;

View File

@ -90,6 +90,9 @@ struct _E_Volume
E_Volume_Op_Type optype;
Efm_Mode efm_mode;
Eina_Bool encrypted;
Eina_Bool unlocked;
#if @DBUS_MOUNT_CONFIG@
DBusPendingCall *op; // d-bus call handle
void *prop_handler;