[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[virt-tools-list] [libosinfo] Add API to fetch paths to kernel and initrd images



From: "Zeeshan Ali (Khattak)" <zeeshanak gnome org>

---
 docs/reference/Libosinfo-sections.txt |    2 ++
 osinfo/libosinfo.syms                 |    2 ++
 osinfo/osinfo_loader.c                |    2 ++
 osinfo/osinfo_media.c                 |   32 ++++++++++++++++++++++++++++++++
 osinfo/osinfo_media.h                 |    4 ++++
 5 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/docs/reference/Libosinfo-sections.txt b/docs/reference/Libosinfo-sections.txt
index 70423c9..ad08dd2 100644
--- a/docs/reference/Libosinfo-sections.txt
+++ b/docs/reference/Libosinfo-sections.txt
@@ -415,6 +415,8 @@ osinfo_media_get_url
 osinfo_media_get_volume_id
 osinfo_media_get_system_id
 osinfo_media_get_publisher_id
+osinfo_media_get_kernel_path
+osinfo_media_get_initrd_path
 <SUBSECTION Standard>
 OSINFO_MEDIA
 OSINFO_IS_MEDIA
diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms
index dfed3ff..5b4113e 100644
--- a/osinfo/libosinfo.syms
+++ b/osinfo/libosinfo.syms
@@ -155,6 +155,8 @@ LIBOSINFO_0.0.1 {
 	osinfo_media_get_volume_id;
 	osinfo_media_get_system_id;
 	osinfo_media_get_publisher_id;
+        osinfo_media_get_kernel_path;
+        osinfo_media_get_initrd_path;
 	osinfo_medialist_get_type;
 	osinfo_medialist_new;
 	osinfo_medialist_new_copy;
diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index 4c32a90..8a3de6a 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -491,6 +491,8 @@ static OsinfoMedia *osinfo_loader_media (OsinfoLoader *loader,
     gchar *arch = (gchar *)xmlGetProp(root, BAD_CAST "arch");
     const gchar *const keys[] = {
         OSINFO_MEDIA_PROP_URL,
+        OSINFO_MEDIA_PROP_KERNEL,
+        OSINFO_MEDIA_PROP_INITRD,
         NULL
     };
 
diff --git a/osinfo/osinfo_media.c b/osinfo/osinfo_media.c
index a509a7b..6c98ba7 100644
--- a/osinfo/osinfo_media.c
+++ b/osinfo/osinfo_media.c
@@ -545,6 +545,38 @@ const gchar *osinfo_media_get_publisher_id(OsinfoMedia *media)
                                          OSINFO_MEDIA_PROP_PUBLISHER_ID);
 }
 
+/**
+ * osinfo_media_get_kernel_path:
+ * @media: a #OsinfoMedia instance
+ *
+ * Retrieves the path to the kernel image in the install tree.
+ *
+ * Note: This only applies to installer medias of 'Linux' OS family.
+ *
+ * Returns: (transfer none): the path to kernel image, or NULL
+ */
+const gchar *osinfo_media_get_kernel_path(OsinfoMedia *media)
+{
+    return osinfo_entity_get_param_value(OSINFO_ENTITY(media),
+                                         OSINFO_MEDIA_PROP_KERNEL);
+}
+
+/**
+ * osinfo_media_get_initrd_path:
+ * @media: a #OsinfoMedia instance
+ *
+ * Retrieves the path to the initrd image in the install tree.
+ *
+ * Note: This only applies to installer medias of 'Linux' OS family.
+ *
+ * Returns: (transfer none): the path to initrd image, or NULL
+ */
+const gchar *osinfo_media_get_initrd_path(OsinfoMedia *media)
+{
+    return osinfo_entity_get_param_value(OSINFO_ENTITY(media),
+                                         OSINFO_MEDIA_PROP_INITRD);
+}
+
 /*
  * Local variables:
  *  indent-tabs-mode: nil
diff --git a/osinfo/osinfo_media.h b/osinfo/osinfo_media.h
index 9ecf0b1..4a82025 100644
--- a/osinfo/osinfo_media.h
+++ b/osinfo/osinfo_media.h
@@ -75,6 +75,8 @@ typedef struct _OsinfoMediaPrivate OsinfoMediaPrivate;
 #define OSINFO_MEDIA_PROP_VOLUME_ID    "volume-id"
 #define OSINFO_MEDIA_PROP_SYSTEM_ID    "system-id"
 #define OSINFO_MEDIA_PROP_PUBLISHER_ID "publisher-id"
+#define OSINFO_MEDIA_PROP_KERNEL       "kernel"
+#define OSINFO_MEDIA_PROP_INITRD       "initrd"
 
 /* object */
 struct _OsinfoMedia
@@ -114,6 +116,8 @@ const gchar *osinfo_media_get_url(OsinfoMedia *media);
 const gchar *osinfo_media_get_volume_id(OsinfoMedia *media);
 const gchar *osinfo_media_get_system_id(OsinfoMedia *media);
 const gchar *osinfo_media_get_publisher_id(OsinfoMedia *media);
+const gchar *osinfo_media_get_kernel_path(OsinfoMedia *media);
+const gchar *osinfo_media_get_initrd_path(OsinfoMedia *media);
 
 #endif /* __OSINFO_MEDIA_H__ */
 /*
-- 
1.7.6.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]