Skip to contentSkip to conversation

libxl: add back libxl_device_v{k,f}b_add

PATCH In review Wei Liu 3 participants 4 messages Sep 13, 2017 – Sep 14, 2017

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH 1/1 libxl: add back libxl_device_v{k,f}b_add

The two functions, unlike a lot others, were hand-coded. They were deleted by accident while the device framework was reworked. Add them back.

---
Cc: Ian Jackson <[email protected]>
Cc: Oleksandr Grytsov <[email protected]>
Cc: Andrew Cooper <[email protected]>

---
 tools/libxl/libxl_console.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
tools/libxl/libxl_console.c +34 -0
index 6dcad8a88a..68511d7dc5 100644
@@ -603,6 +603,23 @@ static int libxl__device_from_vkb(libxl__gc *gc, uint32_t domid,
     return 0;
 }
 
+int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb,
+                         const libxl_asyncop_how *ao_how)
+{
+    AO_CREATE(ctx, domid, ao_how);
+    int rc;
+
+    rc = libxl__device_add(gc, domid, &libxl__vkb_devtype, vkb);
+    if (rc) {
+        LOGD(ERROR, domid, "Unable to add vkb device");
+        goto out;
+    }
+
+out:
+    libxl__ao_complete(egc, ao, rc);
+    return AO_INPROGRESS;
+}
+
 static LIBXL_DEFINE_UPDATE_DEVID(vkb, "vkb")
 
 static int libxl__device_vfb_setdefault(libxl__gc *gc, uint32_t domid,
@@ -642,6 +659,23 @@ static int libxl__device_from_vfb(libxl__gc *gc, uint32_t domid,
     return 0;
 }
 
+int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb,
+                         const libxl_asyncop_how *ao_how)
+{
+    AO_CREATE(ctx, domid, ao_how);
+    int rc;
+
+    rc = libxl__device_add(gc, domid, &libxl__vfb_devtype, vfb);
+    if (rc) {
+        LOGD(ERROR, domid, "Unable to add vfb device");
+        goto out;
+    }
+
+out:
+    libxl__ao_complete(egc, ao, rc);
+    return AO_INPROGRESS;
+}
+
 static LIBXL_DEFINE_UPDATE_DEVID(vfb, "vfb")
 
 static int libxl__set_xenstore_vfb(libxl__gc *gc, uint32_t domid,
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw
Quoted 70 lines · Wei Liu

The two functions, unlike a lot others, were hand-coded. They were deleted by accident while the device framework was reworked. Add them back.

---
Cc: Ian Jackson <[email protected]>
Cc: Oleksandr Grytsov <[email protected]>
Cc: Andrew Cooper <[email protected]>

---
 tools/libxl/libxl_console.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
tools/libxl/libxl_console.c +34 -1
index 6dcad8a88a..68511d7dc5 100644
@@ -603,6 +603,23 @@ static int libxl__device_from_vkb(libxl__gc *gc, uint32_t domid,
     return 0;
 }
 
+int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb,
+                         const libxl_asyncop_how *ao_how)
+{
+    AO_CREATE(ctx, domid, ao_how);
+    int rc;
+
+    rc = libxl__device_add(gc, domid, &libxl__vkb_devtype, vkb);
+    if (rc) {
+        LOGD(ERROR, domid, "Unable to add vkb device");
+        goto out;
+    }
+
+out:
+    libxl__ao_complete(egc, ao, rc);
+    return AO_INPROGRESS;
+}
+
 static LIBXL_DEFINE_UPDATE_DEVID(vkb, "vkb")
 
 static int libxl__device_vfb_setdefault(libxl__gc *gc, uint32_t domid,
@@ -642,6 +659,23 @@ static int libxl__device_from_vfb(libxl__gc *gc, uint32_t domid,
     return 0;
 }
 
+int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb,
+                         const libxl_asyncop_how *ao_how)
+{
+    AO_CREATE(ctx, domid, ao_how);
+    int rc;
+
+    rc = libxl__device_add(gc, domid, &libxl__vfb_devtype, vfb);
+    if (rc) {
+        LOGD(ERROR, domid, "Unable to add vfb device");
+        goto out;
+    }
+
+out:
+    libxl__ao_complete(egc, ao, rc);
+    return AO_INPROGRESS;
+}
+
 static LIBXL_DEFINE_UPDATE_DEVID(vfb, "vfb")
 
 static int libxl__set_xenstore_vfb(libxl__gc *gc, uint32_t domid,
--

2.11.0

Quoted 4 lines

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

I've removed these functions as they weren't used. For proper removing they should be removed from header as well.
If they are required by some extern application could they use generic async function to add vkb and vfb as other devices use:

static void libxl__device_vkb_add(libxl__egc *egc, uint32_t domid,
libxl_device_vkb *vkb, libxl__ao_device *aodev)

{
    libxl__device_add_async(egc, domid, &libxl__vkb_devtype, vkb, aodev);
}

LIBXL_DEFINE_DEVICE_ADD(vkb)

?

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#2 lore raw
Quoted 6 lines · Oleksandr Grytsov

I've removed these functions as they weren't used. For proper removing they should be removed from header as well.
If they are required by some extern application could they use generic async function to add vkb and vfb as other devices use:

They were public functions. That means they can be used by any libxl users, not just xl.

Quoted 8 lines

static void libxl__device_vkb_add(libxl__egc *egc, uint32_t domid,
libxl_device_vkb *vkb, libxl__ao_device *aodev)

{
    libxl__device_add_async(egc, domid, &libxl__vkb_devtype, vkb, aodev);
}

LIBXL_DEFINE_DEVICE_ADD(vkb)

Then that change them from sync to async. I didn't have the time to work out if that would be okay so I played safe here.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Acked-by
#3 lore raw

Wei Liu writes ("Re: [Xen-devel] [PATCH] libxl: add back libxl_device_v{k,f}b_add"):

Quoted 10 lines · Oleksandr Grytsov
Quoted 6 lines

I've removed these functions as they weren't used. For proper removing they should be removed from header as well.
If they are required by some extern application could they use generic async function to add vkb and vfb as other devices use:

They were public functions. That means they can be used by any libxl users, not just xl.

Surely only
libxl_device_vkb_add
is public and the other is the implementation.

Anyway,

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel