All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Rosbrook <rosbrookn@gmail.com>
To: xen-devel@lists.xenproject.org
Cc: george.dunlap@citrix.com, Nick Rosbrook <rosbrookn@ainfosec.com>,
	Ian Jackson <iwj@xenproject.org>, Wei Liu <wl@xen.org>,
	Anthony PERARD <anthony.perard@citrix.com>
Subject: [RFC v2 7/7] libxl: replace LIBXL_DEFINE_DEVICE* macro usage with generated code
Date: Tue,  2 Mar 2021 20:46:19 -0500	[thread overview]
Message-ID: <25b500b54881b8ff3e86c7da5b8a977884471b01.1614734296.git.rosbrookn@ainfosec.com> (raw)
In-Reply-To: <cover.1614734296.git.rosbrookn@ainfosec.com>
In-Reply-To: <cover.1614734296.git.rosbrookn@ainfosec.com>

Allow the gentypes.py script to write generated function output to
_libxl_types.c, and remove the LIBXL_DEFINE_DEVICE* macro calls in the
appropriate locations.

Signed-off-by: Nick Rosbrook <rosbrookn@ainfosec.com>
---

Note: This commit does not build; there is more work to be done,
particularly around accessing libxl__device_from* functions, as well as
libxl__device_<type>_add functions.
---
 tools/libs/light/gentypes.py     | 8 +++++---
 tools/libs/light/libxl_9pfs.c    | 2 --
 tools/libs/light/libxl_console.c | 2 --
 tools/libs/light/libxl_disk.c    | 2 --
 tools/libs/light/libxl_nic.c     | 2 --
 tools/libs/light/libxl_pvcalls.c | 2 --
 tools/libs/light/libxl_usb.c     | 3 ---
 tools/libs/light/libxl_vdispl.c  | 2 --
 tools/libs/light/libxl_vkb.c     | 1 -
 tools/libs/light/libxl_vsnd.c    | 2 --
 tools/libs/light/libxl_vtpm.c    | 2 --
 11 files changed, 5 insertions(+), 23 deletions(-)

diff --git a/tools/libs/light/gentypes.py b/tools/libs/light/gentypes.py
index 9f1856399a..5b72b4613e 100644
--- a/tools/libs/light/gentypes.py
+++ b/tools/libs/light/gentypes.py
@@ -874,12 +874,14 @@ if __name__ == '__main__':
         f.write("\n")
 
     for func in funcs:
+        f.write("\n")
+
         if type(func) is idl.DeviceAddFunction:
-            _ = libxl_func_define_device_add(func)
+            f.write(libxl_func_define_device_add(func))
         elif type(func) is idl.DeviceRemoveFunction:
-            _ = libxl_func_define_device_remove(func)
+            f.write(libxl_func_define_device_remove(func))
         elif type(func) is idl.DeviceDestroyFunction:
-            _ = libxl_func_define_device_destroy(func)
+            f.write(libxl_func_define_device_destroy(func))
         else:
             raise Exception("Unexpected Function class %s" % type(func))
 
diff --git a/tools/libs/light/libxl_9pfs.c b/tools/libs/light/libxl_9pfs.c
index 5ab0d3aa21..f4875ea996 100644
--- a/tools/libs/light/libxl_9pfs.c
+++ b/tools/libs/light/libxl_9pfs.c
@@ -43,8 +43,6 @@ static int libxl__set_xenstore_p9(libxl__gc *gc, uint32_t domid,
 static LIBXL_DEFINE_UPDATE_DEVID(p9)
 static LIBXL_DEFINE_DEVICE_FROM_TYPE(p9)
 
-LIBXL_DEFINE_DEVICE_REMOVE(p9)
-
 DEFINE_DEVICE_TYPE_STRUCT(p9, 9PFS, p9s,
     .skip_attach = 1,
     .set_xenstore_config = (device_set_xenstore_config_fn_t)
diff --git a/tools/libs/light/libxl_console.c b/tools/libs/light/libxl_console.c
index d8b2bc5465..726bee3b16 100644
--- a/tools/libs/light/libxl_console.c
+++ b/tools/libs/light/libxl_console.c
@@ -723,8 +723,6 @@ static LIBXL_DEFINE_UPDATE_DEVID(vfb)
 static LIBXL_DEFINE_DEVICE_FROM_TYPE(vfb)
 
 /* vfb */
-LIBXL_DEFINE_DEVICE_REMOVE(vfb)
-
 DEFINE_DEVICE_TYPE_STRUCT(vfb, VFB, vfbs,
     .skip_attach = 1,
     .set_xenstore_config = (device_set_xenstore_config_fn_t)
diff --git a/tools/libs/light/libxl_disk.c b/tools/libs/light/libxl_disk.c
index 411ffeaca6..16d2667d3a 100644
--- a/tools/libs/light/libxl_disk.c
+++ b/tools/libs/light/libxl_disk.c
@@ -1320,9 +1320,7 @@ out:
  * libxl_device_disk_destroy
  * libxl_device_disk_safe_remove
  */
-LIBXL_DEFINE_DEVICE_ADD(disk)
 LIBXL_DEFINE_DEVICES_ADD(disk)
-LIBXL_DEFINE_DEVICE_REMOVE(disk)
 LIBXL_DEFINE_DEVICE_SAFE_REMOVE(disk)
 
 static int libxl_device_disk_compare(const libxl_device_disk *d1,
diff --git a/tools/libs/light/libxl_nic.c b/tools/libs/light/libxl_nic.c
index 0b45469dca..f77e1a07a5 100644
--- a/tools/libs/light/libxl_nic.c
+++ b/tools/libs/light/libxl_nic.c
@@ -525,9 +525,7 @@ static LIBXL_DEFINE_UPDATE_DEVID(nic)
 static LIBXL_DEFINE_DEVICE_FROM_TYPE(nic)
 
 LIBXL_DEFINE_DEVID_TO_DEVICE(nic)
-LIBXL_DEFINE_DEVICE_ADD(nic)
 LIBXL_DEFINE_DEVICES_ADD(nic)
-LIBXL_DEFINE_DEVICE_REMOVE(nic)
 
 DEFINE_DEVICE_TYPE_STRUCT(nic, VIF, nics,
     .update_config = libxl_device_nic_update_config,
diff --git a/tools/libs/light/libxl_pvcalls.c b/tools/libs/light/libxl_pvcalls.c
index 1fbedf651c..6816cc3d4d 100644
--- a/tools/libs/light/libxl_pvcalls.c
+++ b/tools/libs/light/libxl_pvcalls.c
@@ -32,6 +32,4 @@ static LIBXL_DEFINE_DEVICE_FROM_TYPE(pvcallsif)
 #define libxl_device_pvcallsif_list NULL
 #define libxl_device_pvcallsif_compare NULL
 
-LIBXL_DEFINE_DEVICE_REMOVE(pvcallsif)
-
 DEFINE_DEVICE_TYPE_STRUCT(pvcallsif, PVCALLS, pvcallsifs);
diff --git a/tools/libs/light/libxl_usb.c b/tools/libs/light/libxl_usb.c
index c5ae59681c..af5230b261 100644
--- a/tools/libs/light/libxl_usb.c
+++ b/tools/libs/light/libxl_usb.c
@@ -547,9 +547,7 @@ static void device_usbctrl_add_done(libxl__egc *egc,
     aodev->callback(egc, aodev);
 }
 
-LIBXL_DEFINE_DEVICE_ADD(usbctrl)
 static LIBXL_DEFINE_DEVICES_ADD(usbctrl)
-LIBXL_DEFINE_DEVICE_REMOVE_CUSTOM(usbctrl)
 
 static int libxl__device_usbdev_list_for_usbctrl(libxl__gc *gc, uint32_t domid,
                                                  libxl_devid usbctrl,
@@ -1865,7 +1863,6 @@ static void device_usbdev_add_done(libxl__egc *egc,
     aodev->callback(egc, aodev);
 }
 
-LIBXL_DEFINE_DEVICE_ADD(usbdev)
 static LIBXL_DEFINE_DEVICES_ADD(usbdev)
 
 static void device_usbdev_remove_timeout(libxl__egc *egc,
diff --git a/tools/libs/light/libxl_vdispl.c b/tools/libs/light/libxl_vdispl.c
index 60427c76c2..13b6c2be99 100644
--- a/tools/libs/light/libxl_vdispl.c
+++ b/tools/libs/light/libxl_vdispl.c
@@ -202,8 +202,6 @@ static LIBXL_DEFINE_UPDATE_DEVID(vdispl)
 static LIBXL_DEFINE_DEVICES_ADD(vdispl)
 
 LIBXL_DEFINE_DEVID_TO_DEVICE(vdispl)
-LIBXL_DEFINE_DEVICE_ADD(vdispl)
-LIBXL_DEFINE_DEVICE_REMOVE(vdispl)
 LIBXL_DEFINE_DEVICE_LIST(vdispl)
 
 DEFINE_DEVICE_TYPE_STRUCT(vdispl, VDISPL, vdispls,
diff --git a/tools/libs/light/libxl_vkb.c b/tools/libs/light/libxl_vkb.c
index bb88059f93..5b552c262f 100644
--- a/tools/libs/light/libxl_vkb.c
+++ b/tools/libs/light/libxl_vkb.c
@@ -334,7 +334,6 @@ static LIBXL_DEFINE_UPDATE_DEVID(vkb)
 #define libxl_device_vkb_compare NULL
 
 LIBXL_DEFINE_DEVICE_LIST(vkb)
-LIBXL_DEFINE_DEVICE_REMOVE(vkb)
 
 DEFINE_DEVICE_TYPE_STRUCT(vkb, VKBD, vkbs,
     .skip_attach = 1,
diff --git a/tools/libs/light/libxl_vsnd.c b/tools/libs/light/libxl_vsnd.c
index bb7942bbc9..16f448c74e 100644
--- a/tools/libs/light/libxl_vsnd.c
+++ b/tools/libs/light/libxl_vsnd.c
@@ -666,8 +666,6 @@ out:
 static LIBXL_DEFINE_UPDATE_DEVID(vsnd)
 static LIBXL_DEFINE_DEVICES_ADD(vsnd)
 
-LIBXL_DEFINE_DEVICE_ADD(vsnd)
-LIBXL_DEFINE_DEVICE_REMOVE(vsnd)
 LIBXL_DEFINE_DEVICE_LIST(vsnd)
 
 DEFINE_DEVICE_TYPE_STRUCT(vsnd, VSND, vsnds,
diff --git a/tools/libs/light/libxl_vtpm.c b/tools/libs/light/libxl_vtpm.c
index 0148c572d4..8dcc965860 100644
--- a/tools/libs/light/libxl_vtpm.c
+++ b/tools/libs/light/libxl_vtpm.c
@@ -227,8 +227,6 @@ static LIBXL_DEFINE_UPDATE_DEVID(vtpm)
 static LIBXL_DEFINE_DEVICE_FROM_TYPE(vtpm)
 static LIBXL_DEFINE_DEVICES_ADD(vtpm)
 
-LIBXL_DEFINE_DEVICE_ADD(vtpm)
-LIBXL_DEFINE_DEVICE_REMOVE(vtpm)
 LIBXL_DEFINE_DEVICE_LIST(vtpm)
 
 DEFINE_DEVICE_TYPE_STRUCT(vtpm, VTPM, vtpms,
-- 
2.17.1



  parent reply	other threads:[~2021-03-03  1:47 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-03  1:46 [RFC v2 0/7] add function support to IDL Nick Rosbrook
2021-03-03  1:46 ` [RFC v2 1/7] libxl: remove extra whitespace from gentypes.py Nick Rosbrook
2021-05-04 14:39   ` Anthony PERARD
2021-03-03  1:46 ` [RFC v2 2/7] libxl: add Function class to IDL Nick Rosbrook
2021-03-03  1:46 ` [RFC v2 3/7] libxl: add PASS_BY_CONST_REFERENCE to idl Nick Rosbrook
2021-03-03  1:46 ` [RFC v2 4/7] libxl: add DeviceFunction classes to IDL Nick Rosbrook
2021-03-03  1:46 ` [RFC v2 5/7] libxl: add device function definitions to libxl_types.idl Nick Rosbrook
2021-05-04 15:43   ` Anthony PERARD
2021-05-04 17:26     ` Nick Rosbrook
2021-03-03  1:46 ` [RFC v2 6/7] libxl: implement device add/remove/destroy functions generation Nick Rosbrook
2021-05-04 15:02   ` Anthony PERARD
2021-05-04 17:29     ` Nick Rosbrook
2021-03-03  1:46 ` Nick Rosbrook [this message]
2021-03-03  9:48 ` [RFC v2 0/7] add function support to IDL Ian Jackson
2021-03-03 13:41   ` Nick Rosbrook
2021-04-21 21:28     ` Nick Rosbrook
2021-05-04 15:46 ` Anthony PERARD
2021-05-04 17:31   ` Nick Rosbrook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=25b500b54881b8ff3e86c7da5b8a977884471b01.1614734296.git.rosbrookn@ainfosec.com \
    --to=rosbrookn@gmail.com \
    --cc=anthony.perard@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=iwj@xenproject.org \
    --cc=rosbrookn@ainfosec.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.