xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libxl: add back libxl_device_v{k,f}b_add
@ 2017-09-13 13:44 Wei Liu
  2017-09-14 14:27 ` Oleksandr Grytsov
  0 siblings, 1 reply; 4+ messages in thread
From: Wei Liu @ 2017-09-13 13:44 UTC (permalink / raw)
  To: Xen-devel; +Cc: Ian Jackson, Wei Liu, Oleksandr Grytsov, Andrew Cooper

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

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libxl/libxl_console.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/tools/libxl/libxl_console.c b/tools/libxl/libxl_console.c
index 6dcad8a88a..68511d7dc5 100644
--- a/tools/libxl/libxl_console.c
+++ b/tools/libxl/libxl_console.c
@@ -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


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] libxl: add back libxl_device_v{k,f}b_add
  2017-09-13 13:44 [PATCH] libxl: add back libxl_device_v{k,f}b_add Wei Liu
@ 2017-09-14 14:27 ` Oleksandr Grytsov
  2017-09-14 14:29   ` Wei Liu
  0 siblings, 1 reply; 4+ messages in thread
From: Oleksandr Grytsov @ 2017-09-14 14:27 UTC (permalink / raw)
  To: Wei Liu; +Cc: Xen-devel, Ian Jackson, Oleksandr Grytsov, Andrew Cooper

On Wed, Sep 13, 2017 at 4:44 PM, Wei Liu <wei.liu2@citrix.com> wrote:
> The two functions, unlike a lot others, were hand-coded. They were
> deleted by accident while the device framework was reworked. Add them
> back.
>
> Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> ---
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
>  tools/libxl/libxl_console.c | 34 ++++++++++++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
>
> diff --git a/tools/libxl/libxl_console.c b/tools/libxl/libxl_console.c
> index 6dcad8a88a..68511d7dc5 100644
> --- a/tools/libxl/libxl_console.c
> +++ b/tools/libxl/libxl_console.c
> @@ -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
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> 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
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] libxl: add back libxl_device_v{k,f}b_add
  2017-09-14 14:27 ` Oleksandr Grytsov
@ 2017-09-14 14:29   ` Wei Liu
  2017-09-14 15:42     ` Ian Jackson
  0 siblings, 1 reply; 4+ messages in thread
From: Wei Liu @ 2017-09-14 14:29 UTC (permalink / raw)
  To: Oleksandr Grytsov
  Cc: Xen-devel, Wei Liu, Ian Jackson, Oleksandr Grytsov, Andrew Cooper

On Thu, Sep 14, 2017 at 05:27:07PM +0300, Oleksandr Grytsov wrote:
> 
> 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.

>  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
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] libxl: add back libxl_device_v{k,f}b_add
  2017-09-14 14:29   ` Wei Liu
@ 2017-09-14 15:42     ` Ian Jackson
  0 siblings, 0 replies; 4+ messages in thread
From: Ian Jackson @ 2017-09-14 15:42 UTC (permalink / raw)
  To: Wei Liu; +Cc: Xen-devel, Oleksandr Grytsov, Oleksandr Grytsov, Andrew Cooper

Wei Liu writes ("Re: [Xen-devel] [PATCH] libxl: add back libxl_device_v{k,f}b_add"):
> On Thu, Sep 14, 2017 at 05:27:07PM +0300, Oleksandr Grytsov wrote:
> > 
> > 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,

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-09-14 15:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-13 13:44 [PATCH] libxl: add back libxl_device_v{k,f}b_add Wei Liu
2017-09-14 14:27 ` Oleksandr Grytsov
2017-09-14 14:29   ` Wei Liu
2017-09-14 15:42     ` Ian Jackson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).