/* if non-zero, the id of the idle for emitting a 'change' signal */
guint emit_changed_idle_id;
- dev_t dev; /* not exported */
-
/**************/
/* properties */
/*************/
char *device_file;
+ dev_t dev;
GPtrArray *device_file_by_id;
GPtrArray *device_file_by_path;
gboolean device_is_system_internal;
PROP_0,
PROP_NATIVE_PATH,
+ PROP_DEVICE_MAJOR,
+ PROP_DEVICE_MINOR,
PROP_DEVICE_FILE,
PROP_DEVICE_FILE_BY_ID,
PROP_DEVICE_FILE_BY_PATH,
g_value_set_string (value, device->priv->native_path);
break;
+ case PROP_DEVICE_MAJOR:
+ g_value_set_int64 (value, major (device->priv->dev));
+ break;
+ case PROP_DEVICE_MINOR:
+ g_value_set_int64 (value, minor (device->priv->dev));
+ break;
case PROP_DEVICE_FILE:
g_value_set_string (value, device->priv->device_file);
break;
g_param_spec_string ("native-path", NULL, NULL, NULL, G_PARAM_READABLE));
g_object_class_install_property (
object_class,
+ PROP_DEVICE_MAJOR,
+ g_param_spec_int64 ("device-major", NULL, NULL, -G_MAXINT64, G_MAXINT64, 0, G_PARAM_READABLE));
+ g_object_class_install_property (
+ object_class,
+ PROP_DEVICE_MINOR,
+ g_param_spec_int64 ("device-minor", NULL, NULL, -G_MAXINT64, G_MAXINT64, 0, G_PARAM_READABLE));
+ g_object_class_install_property (
+ object_class,
PROP_DEVICE_FILE,
g_param_spec_string ("device-file", NULL, NULL, NULL, G_PARAM_READABLE));
g_object_class_install_property (
OS specific native path of the device. On Linux this is the sysfs path, for example <doc:tt>/sys/devices/pci0000:00/0000:00:1f.2/host2/target2:0:1/2:0:1:0/block/sda</doc:tt>.
</doc:para></doc:description></doc:doc>
</property>
+ <property name="device-major" type="x" access="read">
+ <doc:doc><doc:description><doc:para>
+ Major for the device or -1 if not set.
+ </doc:para></doc:description></doc:doc>
+ </property>
+ <property name="device-minor" type="x" access="read">
+ <doc:doc><doc:description><doc:para>
+ Major for the device or -1 if not set.
+ </doc:para></doc:description></doc:doc>
+ </property>
<property name="device-file" type="s" access="read">
<doc:doc><doc:description><doc:para>
UNIX special device file for device. Example: <doc:tt>/dev/sda</doc:tt>.
{
char *native_path;
+ gint64 device_major;
+ gint64 device_minor;
char *device_file;
char **device_file_by_id;
char **device_file_by_path;
if (strcmp (key, "native-path") == 0)
props->native_path = g_strdup (g_value_get_string (value));
+ else if (strcmp (key, "device-major") == 0)
+ props->device_major = g_value_get_int64 (value);
+ else if (strcmp (key, "device-minor") == 0)
+ props->device_minor = g_value_get_int64 (value);
else if (strcmp (key, "device-file") == 0)
props->device_file = g_strdup (g_value_get_string (value));
else if (strcmp (key, "device-file-by-id") == 0)
g_print ("Showing information for %s\n", object_path);
g_print (" native-path: %s\n", props->native_path);
+ g_print (" device: %" G_GINT64_MODIFIER "d:%" G_GINT64_MODIFIER "d\n",
+ props->device_major,
+ props->device_minor);
g_print (" device-file: %s\n", props->device_file);
for (n = 0; props->device_file_by_id[n] != NULL; n++)
g_print (" by-id: %s\n", (char *) props->device_file_by_id[n]);