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,24 +427,28 @@ _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);
v->fstype = e_ukit_property_string_get(ret, "IdType", &err);
v->fstype = eina_stringshare_add(v->fstype);
if (!v->encrypted)
{
const Eina_List *l;
v->size = e_ukit_property_uint64_get(ret, "DeviceSize", &err);
l = e_ukit_property_strlist_get(ret, "DeviceMountPaths", &err);
if (err) goto error;
if (l) v->mount_point = eina_stringshare_add(l->data);
v->mounted = e_ukit_property_bool_get(ret, "DeviceIsMounted", &err);
if (err) goto error;
v->fstype = e_ukit_property_string_get(ret, "IdType", &err);
v->fstype = eina_stringshare_add(v->fstype);
v->size = e_ukit_property_uint64_get(ret, "DeviceSize", &err);
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,24 +456,39 @@ _e_fm_main_udisks_cb_vol_prop(E_Volume *v,
v->partition_label = eina_stringshare_add(v->partition_label);
}
v->parent = e_ukit_property_string_get(ret, "PartitionSlave", &err);
if (!err)
if (v->unlocked)
{
if (v->parent)
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)
{
s = e_storage_find(v->parent);
if (s)
if (v->parent)
{
v->storage = s;
if (!eina_list_data_find_list(s->volumes, v))
s->volumes = eina_list_append(s->volumes, v);
s = e_storage_find(v->parent);
if (s)
{
v->storage = s;
if (!eina_list_data_find_list(s->volumes, v))
s->volumes = eina_list_append(s->volumes, v);
}
}
else
{
v->storage = _e_fm_main_udisks_storage_add(v->udi); /* disk is both storage and volume */
if (v->storage) v->storage->volumes = eina_list_append(v->storage->volumes, v);
v->parent = v->udi;
}
}
else
{
v->storage = _e_fm_main_udisks_storage_add(v->udi); /* disk is both storage and volume */
if (v->storage) v->storage->volumes = eina_list_append(v->storage->volumes, v);
v->parent = v->udi;
}
}
v->parent = eina_stringshare_add(v->parent);

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

@ -89,6 +89,9 @@ struct _E_Volume
Ecore_Timer *guard; // operation guard timer
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