Signed-off-by: Xu Wang <gesaint(a)linux.vnet.ibm.com>
---
libxkutil/device_parsing.c | 52 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 52 insertions(+), 0 deletions(-)
diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c
index 15f9d99..37582da 100644
--- a/libxkutil/device_parsing.c
+++ b/libxkutil/device_parsing.c
@@ -1361,6 +1361,58 @@ static int parse_input_device(xmlNode *node, struct virt_device
**vdevs)
return 0;
}
+static int parse_unknown_device(xmlNode *node, struct virt_device **vdevs)
+{
+ struct virt_device *vdev = NULL;
+ struct unknown_device *udev = NULL;
+ xmlNode *child = NULL;
+
+ CU_DEBUG("Enter parse_unknown_device().");
+
+ vdev = calloc(1, sizeof(*vdev));
+ if (vdev == NULL) {
+ CU_DEBUG("calloc failed.");
+ goto err;
+ }
+
+ udev = &(vdev->dev.unknown);
+
+ for (child = node->children; child != NULL; child = child->next) {
+ /* Skip all items parsed in other parse_*() functions.
+ * Everything here is just to be compatible with old versions.
+ * Here may need some improvement in the future.
+ */
+ if (XSTREQ(child->name, "disk") ||
+ XSTREQ(child->name, "filesystem") ||
+ XSTREQ(child->name, "interface") ||
+ XSTREQ(child->name, "emulator") ||
+ XSTREQ(child->name, "graphics") ||
+ XSTREQ(child->name, "console") ||
+ XSTREQ(child->name, "serial") ||
+ XSTREQ(child->name, "input")) {
+ /* Just skip them and do nothing */
+ } else {
+ udev->others = parse_data_to_others(child, BAD_CAST
"devices");
+ }
+ }
+
+ if (udev->others == NULL) {
+ CU_DEBUG("no others.");
+ goto err;
+ }
+
+ udev->name = strdup("unknown");
+
+ *vdevs = vdev;
+
+ return 1;
+err:
+ cleanup_unknown_device(udev);
+ free(vdev);
+
+ return 0;
+}
+
static bool resize_devlist(struct virt_device **list, int newsize)
{
struct virt_device *_list;
--
1.7.1