[gnome-disk-utility] add gdu_device_get_dev() to get the dev_t for a device
- From: David Zeuthen <davidz src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-disk-utility] add gdu_device_get_dev() to get the dev_t for a device
- Date: Thu, 2 Apr 2009 14:40:56 -0400 (EDT)
commit 440b112c9952c213e26cc4273a806ec6a3a8a8c5
Author: David Zeuthen <davidz redhat com>
Date: Thu Apr 2 14:38:36 2009 -0400
add gdu_device_get_dev() to get the dev_t for a device
---
src/gdu/gdu-device.c | 12 ++++++++++++
src/gdu/gdu-device.h | 1 +
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/src/gdu/gdu-device.c b/src/gdu/gdu-device.c
index e6767db..f49a91e 100644
--- a/src/gdu/gdu-device.c
+++ b/src/gdu/gdu-device.c
@@ -46,6 +46,8 @@ typedef struct
{
char *native_path;
+ gint64 device_major;
+ gint64 device_minor;
char *device_file;
char **device_file_by_id;
char **device_file_by_path;
@@ -177,6 +179,10 @@ collect_props (const char *key, const GValue *value, DeviceProperties *props)
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)
@@ -747,6 +753,12 @@ gdu_device_find_parent (GduDevice *device)
return parent;
}
+dev_t
+gdu_device_get_dev (GduDevice *device)
+{
+ return makedev (device->priv->props->device_major, device->priv->props->device_minor);
+}
+
const char *
gdu_device_get_device_file (GduDevice *device)
{
diff --git a/src/gdu/gdu-device.h b/src/gdu/gdu-device.h
index 776f939..0cc9f54 100644
--- a/src/gdu/gdu-device.h
+++ b/src/gdu/gdu-device.h
@@ -67,6 +67,7 @@ const char *gdu_device_get_object_path (GduDevice *device);
GduDevice *gdu_device_find_parent (GduDevice *device);
GduPool *gdu_device_get_pool (GduDevice *device);
+dev_t gdu_device_get_dev (GduDevice *device);
const char *gdu_device_get_device_file (GduDevice *device);
guint64 gdu_device_get_size (GduDevice *device);
guint64 gdu_device_get_block_size (GduDevice *device);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]