PROP_DEVICE_IS_READ_ONLY,
PROP_DEVICE_IS_DRIVE,
PROP_DEVICE_IS_CRYPTO_CLEARTEXT,
+ PROP_DEVICE_IS_LINUX_MD_COMPONENT,
PROP_DEVICE_SIZE,
PROP_DEVICE_BLOCK_SIZE,
PROP_DEVICE_IS_MOUNTED,
PROP_DRIVE_CONNECTION_SPEED,
PROP_DRIVE_MEDIA_COMPATIBILITY,
PROP_DRIVE_MEDIA,
+
+ PROP_LINUX_MD_COMPONENT_LEVEL,
+ PROP_LINUX_MD_COMPONENT_NUM_RAID_DEVICES,
+ PROP_LINUX_MD_COMPONENT_UUID,
+ PROP_LINUX_MD_COMPONENT_NAME,
+ PROP_LINUX_MD_COMPONENT_VERSION,
};
enum
case PROP_DEVICE_IS_CRYPTO_CLEARTEXT:
g_value_set_boolean (value, device->priv->info.device_is_crypto_cleartext);
break;
+ case PROP_DEVICE_IS_LINUX_MD_COMPONENT:
+ g_value_set_boolean (value, device->priv->info.device_is_linux_md_component);
+ break;
case PROP_DEVICE_SIZE:
g_value_set_uint64 (value, device->priv->info.device_size);
break;
g_value_set_string (value, device->priv->info.drive_media);
break;
+ case PROP_LINUX_MD_COMPONENT_LEVEL:
+ g_value_set_int (value, device->priv->info.linux_md_component_level);
+ break;
+ case PROP_LINUX_MD_COMPONENT_NUM_RAID_DEVICES:
+ g_value_set_int (value, device->priv->info.linux_md_component_num_raid_devices);
+ break;
+ case PROP_LINUX_MD_COMPONENT_UUID:
+ g_value_set_string (value, device->priv->info.linux_md_component_uuid);
+ break;
+ case PROP_LINUX_MD_COMPONENT_NAME:
+ g_value_set_string (value, device->priv->info.linux_md_component_name);
+ break;
+ case PROP_LINUX_MD_COMPONENT_VERSION:
+ g_value_set_string (value, device->priv->info.linux_md_component_version);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
g_param_spec_boolean ("device-is-crypto-cleartext", NULL, NULL, FALSE, G_PARAM_READABLE));
g_object_class_install_property (
object_class,
+ PROP_DEVICE_IS_LINUX_MD_COMPONENT,
+ g_param_spec_boolean ("device-is-linux-md-component", NULL, NULL, FALSE, G_PARAM_READABLE));
+ g_object_class_install_property (
+ object_class,
PROP_DEVICE_SIZE,
g_param_spec_uint64 ("device-size", NULL, NULL, 0, G_MAXUINT64, 0, G_PARAM_READABLE));
g_object_class_install_property (
object_class,
PROP_DRIVE_MEDIA,
g_param_spec_string ("drive-media", NULL, NULL, NULL, G_PARAM_READABLE));
+
+
+ g_object_class_install_property (
+ object_class,
+ PROP_LINUX_MD_COMPONENT_LEVEL,
+ g_param_spec_int ("linux-md-component-level", NULL, NULL, 0, G_MAXINT, 0, G_PARAM_READABLE));
+ g_object_class_install_property (
+ object_class,
+ PROP_LINUX_MD_COMPONENT_NUM_RAID_DEVICES,
+ g_param_spec_int ("linux-md-component-num-raid-devices", NULL, NULL, 0, G_MAXINT, 0, G_PARAM_READABLE));
+ g_object_class_install_property (
+ object_class,
+ PROP_LINUX_MD_COMPONENT_UUID,
+ g_param_spec_string ("linux-md-component-uuid", NULL, NULL, NULL, G_PARAM_READABLE));
+ g_object_class_install_property (
+ object_class,
+ PROP_LINUX_MD_COMPONENT_NAME,
+ g_param_spec_string ("linux-md-component-name", NULL, NULL, NULL, G_PARAM_READABLE));
+ g_object_class_install_property (
+ object_class,
+ PROP_LINUX_MD_COMPONENT_VERSION,
+ g_param_spec_string ("linux-md-component-version", NULL, NULL, NULL, G_PARAM_READABLE));
}
static void
device->priv->info.id_type = _dupv8 (devkit_info_property_get_string (info, key));
} else if (strcmp (key, "ID_FS_VERSION") == 0) {
device->priv->info.id_version = _dupv8 (devkit_info_property_get_string (info, key));
+ if (device->priv->info.device_is_linux_md_component) {
+ device->priv->info.linux_md_component_version =
+ _dupv8 (devkit_info_property_get_string (info, key));
+ }
} else if (strcmp (key, "ID_FS_UUID") == 0) {
device->priv->info.id_uuid = _dupv8 (devkit_info_property_get_string (info, key));
+ if (device->priv->info.device_is_linux_md_component) {
+ device->priv->info.linux_md_component_uuid =
+ _dupv8 (devkit_info_property_get_string (info, key));
+ }
} else if (strcmp (key, "ID_FS_LABEL") == 0) {
device->priv->info.id_label = _dupv8 (devkit_info_property_get_string (info, key));
+ if (device->priv->info.device_is_linux_md_component) {
+ device->priv->info.linux_md_component_name =
+ _dupv8 (devkit_info_property_get_string (info, key));
+ }
} else if (strcmp (key, "ID_VENDOR") == 0) {
if (device->priv->info.device_is_drive && device->priv->info.drive_vendor == NULL)
}
}
+ } else if (strcmp (key, "ID_FS_MD_RAID_DISKS") == 0) {
+ device->priv->info.linux_md_component_num_raid_devices = devkit_info_property_get_int (info, key);
+
+ } else if (strcmp (key, "ID_FS_MD_RAID_LEVEL") == 0) {
+ device->priv->info.linux_md_component_level = devkit_info_property_get_int (info, key);
+
} else if (strcmp (key, "DM_NAME") == 0) {
const char *dm_name;
dm_name = devkit_info_property_get_string (info, key);
GDir *dir;
const char *name;
GList *l;
+ const char *fstype;
ret = FALSE;
info = NULL;
}
g_free (path);
+ /* ------------------------------------- */
+ /* Now set all properties from udev data */
+ /* ------------------------------------- */
+
+ /* set this first since e.g. ID_FS_LABEL et. al. needs to be redirected/copied */
+ fstype = devkit_info_property_get_string (info, "ID_FS_TYPE");
+ if (fstype != NULL && strcmp (fstype, "linux_raid_member") == 0) {
+ device->priv->info.device_is_linux_md_component = TRUE;
+ }
+
if (devkit_info_property_foreach (info, update_info_properties_cb, device)) {
goto out;
}
update_slaves (device);
- /* update whether device is mounted */
+ /* Update whether device is mounted */
l = g_list_prepend (NULL, device);
devkit_disks_daemon_local_update_mount_state (device->priv->daemon, l, FALSE);
g_list_free (l);
gboolean device_is_crypto_cleartext;
gboolean device_is_mounted;
gboolean device_is_busy;
+ gboolean device_is_linux_md_component;
char *device_mount_path;
guint64 device_size;
guint64 device_block_size;
guint64 drive_connection_speed;
char **drive_media_compatibility;
char *drive_media;
+
+ int linux_md_component_level;
+ int linux_md_component_num_raid_devices;
+ char *linux_md_component_uuid;
+ char *linux_md_component_name;
+ char *linux_md_component_version;
} DeviceProperties;
static void
props->device_is_drive = g_value_get_boolean (value);
else if (strcmp (key, "device-is-crypto-cleartext") == 0)
props->device_is_crypto_cleartext = g_value_get_boolean (value);
+ else if (strcmp (key, "device-is-linux-md-component") == 0)
+ props->device_is_linux_md_component = g_value_get_boolean (value);
else if (strcmp (key, "device-is-mounted") == 0)
props->device_is_mounted = g_value_get_boolean (value);
else if (strcmp (key, "device-is-busy") == 0)
else if (strcmp (key, "drive-media") == 0)
props->drive_media = g_strdup (g_value_get_string (value));
+ else if (strcmp (key, "linux-md-component-level") == 0)
+ props->linux_md_component_level = g_value_get_int (value);
+ else if (strcmp (key, "linux-md-component-num-raid-devices") == 0)
+ props->linux_md_component_num_raid_devices = g_value_get_int (value);
+ else if (strcmp (key, "linux-md-component-uuid") == 0)
+ props->linux_md_component_uuid = g_strdup (g_value_get_string (value));
+ else if (strcmp (key, "linux-md-component-name") == 0)
+ props->linux_md_component_name = g_strdup (g_value_get_string (value));
+ else if (strcmp (key, "linux-md-component-version") == 0)
+ props->linux_md_component_version = g_strdup (g_value_get_string (value));
+
else
handled = FALSE;
g_free (props->drive_connection_interface);
g_strfreev (props->drive_media_compatibility);
g_free (props->drive_media);
+ g_free (props->linux_md_component_uuid);
+ g_free (props->linux_md_component_name);
+ g_free (props->linux_md_component_version);
g_free (props);
}
g_print (" version: %s\n", props->id_version);
g_print (" uuid: %s\n", props->id_uuid);
g_print (" label: %s\n", props->id_label);
+ if (props->device_is_linux_md_component) {
+ g_print (" linux md component:\n");
+ g_print (" RAID level: %d\n", props->linux_md_component_level);
+ g_print (" num comp: %d\n", props->linux_md_component_num_raid_devices);
+ g_print (" uuid: %s\n", props->linux_md_component_uuid);
+ g_print (" name: %s\n", props->linux_md_component_name);
+ g_print (" version: %s\n", props->linux_md_component_version);
+ }
if (props->device_is_crypto_cleartext) {
g_print (" cleartext crypto device:\n");
g_print (" backed by: %s\n", props->crypto_cleartext_slave);