Skip to contentSkip to conversation

tools: remove include/xen-external directory

PATCH Superseded Juergen Gross 2 participants 9 messages Feb 7, 2022 – Feb 8, 2022

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover tools: remove include/xen-external directory

The tools/include/xen-external directory contains a header file from FreeBSD used to generate Xen header files. This series is replacing the complete directory by a single header with the same semantics.

Changes in V2:
- remove stale comment in patch 1

Juergen Gross (5):
tools/include: generate a _xen_list.h file tools/libs/light: replace _libxl_list.h with _xen_list.h tools/libs/toolcore: replace _xentoolcore_list.h with _xen_list.h tools/libs/evtchn: use _xen_list.h
tools/include: remove xen-external directory

 .gitignore                                    |    1 -
 tools/include/Makefile                        |    2 +
 tools/include/_xen_list.h                     |  509 ++++++++
 tools/include/libxl.h                         |    4 +-
 tools/include/xen-external/README             |   24 -
 tools/include/xen-external/bsd-COPYRIGHT      |  126 --
 tools/include/xen-external/bsd-queue.3        | 1044 -----------------
 .../xen-external/bsd-sys-queue-h-seddery      |   74 --
 tools/include/xen-external/bsd-sys-queue.h    |  637 ----------
 tools/include/xentoolcore_internal.h          |    4 +-
 tools/libs/evtchn/minios.c                    |   20 +-
 tools/libs/light/Makefile                     |   10 +-
 tools/libs/light/libxl.c                      |   40 +-
 tools/libs/light/libxl_aoutils.c              |   20 +-
 tools/libs/light/libxl_device.c               |   27 +-
 tools/libs/light/libxl_disk.c                 |    4 +-
 tools/libs/light/libxl_domain.c               |   18 +-
 tools/libs/light/libxl_event.c                |  128 +-
 tools/libs/light/libxl_fork.c                 |   44 +-
 tools/libs/light/libxl_internal.h             |   86 +-
 tools/libs/light/libxl_qmp.c                  |   19 +-
 tools/libs/light/libxl_stream_read.c          |   20 +-
 tools/libs/toolcore/Makefile                  |    8 -
 23 files changed, 729 insertions(+), 2140 deletions(-)
 create mode 100644 tools/include/_xen_list.h
 delete mode 100644 tools/include/xen-external/README
 delete mode 100644 tools/include/xen-external/bsd-COPYRIGHT
 delete mode 100644 tools/include/xen-external/bsd-queue.3
 delete mode 100755 tools/include/xen-external/bsd-sys-queue-h-seddery
 delete mode 100644 tools/include/xen-external/bsd-sys-queue.h
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/5 tools/include: generate a _xen_list.h file

Today tools/include contains two basically identical header files generated from the same source. They just differ by the used name space and they are being generated from different Makefiles via a perl script.

Prepare to have only one such header by using a more generic namespace "XEN" for _xen_list.h.

As the original header hasn't been updated in the Xen tree since its introduction about 10 years ago, and the updates of FreeBSD side have mostly covered BSD internal debugging aids, just don't generate the new header during build, especially as using the current FreeBSD version of the file would require some updates of the perl script, which are potentially more work than just doing the needed editing by hand. Additionally this enables to remove the not needed debugging extensions of FreeBSD.

---
 tools/include/Makefile    |   2 +
 tools/include/_xen_list.h | 509 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 511 insertions(+)
 create mode 100644 tools/include/_xen_list.h
tools/include/Makefile +2 -0
index d7b51006e0..d965987f55 100644
@@ -70,11 +70,13 @@ install: all
 	$(INSTALL_DATA) xen/io/*.h $(DESTDIR)$(includedir)/xen/io
 	$(INSTALL_DATA) xen/sys/*.h $(DESTDIR)$(includedir)/xen/sys
 	$(INSTALL_DATA) xen/xsm/*.h $(DESTDIR)$(includedir)/xen/xsm
+	$(INSTALL_DATA) _xen_list.h $(DESTDIR)$(includedir)
 
 .PHONY: uninstall
 uninstall:
 	echo "[FIXME] uninstall headers"
 	rm -rf $(DESTDIR)$(includedir)/xen
+	rm -f $(DESTDIR)$(includedir)/_xen_list.h
 
 .PHONY: clean
 clean:
tools/include/_xen_list.h new file +509 -0

509 lines not on this page · raw message

Signature · 1 line
2.34.1
#2 lore raw

PATCH v2 2/5 tools/libs/light: replace _libxl_list.h with _xen_list.h

In reply to Juergen Gross

Remove generating _libxl_list.h and use the common _xen_list.h instead.

---
 tools/include/libxl.h                |   4 +-
 tools/libs/light/Makefile            |  10 +--
 tools/libs/light/libxl.c             |  40 ++++-----
 tools/libs/light/libxl_aoutils.c     |  20 ++---
 tools/libs/light/libxl_device.c      |  27 +++---
 tools/libs/light/libxl_disk.c        |   4 +-
 tools/libs/light/libxl_domain.c      |  18 ++--
 tools/libs/light/libxl_event.c       | 128 +++++++++++++--------------
 tools/libs/light/libxl_fork.c        |  44 ++++-----
 tools/libs/light/libxl_internal.h    |  86 +++++++++---------
 tools/libs/light/libxl_qmp.c         |  19 ++--
 tools/libs/light/libxl_stream_read.c |  20 ++---
 12 files changed, 206 insertions(+), 214 deletions(-)
tools/include/libxl.h +2 -2
index 2bbbd21f0b..51a9b6cfac 100644
@@ -747,7 +747,7 @@
 typedef struct libxl__ctx libxl_ctx;
 
 #include <libxl_uuid.h>
-#include <_libxl_list.h>
+#include <_xen_list.h>
 
 /* API compatibility. */
 #ifdef LIBXL_API_VERSION
@@ -1448,7 +1448,7 @@ typedef struct {
 } libxl_enum_string_table;
 
 struct libxl_event;
-typedef LIBXL_TAILQ_ENTRY(struct libxl_event) libxl_ev_link;
+typedef XEN_TAILQ_ENTRY(struct libxl_event) libxl_ev_link;
 
 /*
  * A boolean variable with an explicit default state.
tools/libs/light/Makefile +3 -7
index be32d95d39..5642955672 100644
@@ -153,14 +153,14 @@ LIBXL_TEST_OBJS += $(foreach t, $(LIBXL_TESTS_INSIDE),libxl_test_$t.opic)
 TEST_PROG_OBJS += $(foreach t, $(LIBXL_TESTS_PROGS),test_$t.o) test_common.o
 TEST_PROGS += $(foreach t, $(LIBXL_TESTS_PROGS),test_$t)
 
-AUTOINCS = $(XEN_INCLUDE)/_libxl_list.h _libxl_save_msgs_callout.h _libxl_save_msgs_helper.h
+AUTOINCS = _libxl_save_msgs_callout.h _libxl_save_msgs_helper.h
 AUTOSRCS = _libxl_save_msgs_callout.c _libxl_save_msgs_helper.c
 
 CLIENTS = testidl libxl-save-helper
 
 SAVE_HELPER_OBJS = libxl_save_helper.o _libxl_save_msgs_helper.o
 
-LIBHEADER := libxl.h libxl_event.h libxl_json.h _libxl_types.h _libxl_types_json.h _libxl_list.h libxl_utils.h libxl_uuid.h
+LIBHEADER := libxl.h libxl_event.h libxl_json.h _libxl_types.h _libxl_types_json.h libxl_utils.h libxl_uuid.h
 
 NO_HEADERS_CHK := y
 
@@ -201,17 +201,13 @@ _libxl.api-for-check: $(XEN_INCLUDE)/libxl.h $(AUTOINCS)
 		>[email protected]
 	mv -f [email protected] $@
 
-$(XEN_INCLUDE)/_libxl_list.h: $(XEN_INCLUDE)/xen-external/bsd-sys-queue-h-seddery $(XEN_INCLUDE)/xen-external/bsd-sys-queue.h
-	$(PERL) $^ --prefix=libxl >$(notdir $@).new
-	$(call move-if-changed,$(notdir $@).new,$@)
-
 _libxl_save_msgs_helper.c _libxl_save_msgs_callout.c \
 _libxl_save_msgs_helper.h _libxl_save_msgs_callout.h: \
 		libxl_save_msgs_gen.pl
 	$(PERL) -w $< $@ >[email protected]
 	$(call move-if-changed,[email protected],$@)
 
-$(XEN_INCLUDE)/libxl.h: $(XEN_INCLUDE)/_libxl_types.h $(XEN_INCLUDE)/_libxl_list.h
+$(XEN_INCLUDE)/libxl.h: $(XEN_INCLUDE)/_libxl_types.h
 $(XEN_INCLUDE)/libxl_json.h: $(XEN_INCLUDE)/_libxl_types_json.h
 libxl_internal.h: _libxl_types_internal.h _libxl_types_private.h _libxl_types_internal_private.h
 libxl_internal_json.h: _libxl_types_internal_json.h
tools/libs/light/libxl.c +20 -20
index 667ae6409b..a0bf7d186f 100644
@@ -41,29 +41,29 @@ int libxl_ctx_alloc(libxl_ctx **pctx, int version,
     ctx->nogc_gc.alloc_maxsize = -1;
     ctx->nogc_gc.owner = ctx;
 
-    LIBXL_TAILQ_INIT(&ctx->occurred);
+    XEN_TAILQ_INIT(&ctx->occurred);
 
     ctx->osevent_hooks = 0;
 
     ctx->poller_app = 0;
-    LIBXL_LIST_INIT(&ctx->pollers_event);
-    LIBXL_LIST_INIT(&ctx->pollers_idle);
-    LIBXL_LIST_INIT(&ctx->pollers_active);
+    XEN_LIST_INIT(&ctx->pollers_event);
+    XEN_LIST_INIT(&ctx->pollers_idle);
+    XEN_LIST_INIT(&ctx->pollers_active);
 
-    LIBXL_LIST_INIT(&ctx->efds);
-    LIBXL_TAILQ_INIT(&ctx->etimes);
+    XEN_LIST_INIT(&ctx->efds);
+    XEN_TAILQ_INIT(&ctx->etimes);
 
     ctx->watch_slots = 0;
-    LIBXL_SLIST_INIT(&ctx->watch_freeslots);
+    XEN_SLIST_INIT(&ctx->watch_freeslots);
     libxl__ev_fd_init(&ctx->watch_efd);
 
     ctx->xce = 0;
-    LIBXL_LIST_INIT(&ctx->evtchns_waiting);
+    XEN_LIST_INIT(&ctx->evtchns_waiting);
     libxl__ev_fd_init(&ctx->evtchn_efd);
 
-    LIBXL_LIST_INIT(&ctx->aos_inprogress);
+    XEN_LIST_INIT(&ctx->aos_inprogress);
 
-    LIBXL_TAILQ_INIT(&ctx->death_list);
+    XEN_TAILQ_INIT(&ctx->death_list);
     libxl__ev_xswatch_init(&ctx->death_watch);
 
     ctx->childproc_hooks = &libxl__childproc_default_hooks;
@@ -122,14 +122,14 @@ int libxl_ctx_alloc(libxl_ctx **pctx, int version,
 static void free_disable_deaths(libxl__gc *gc,
                                 struct libxl__evgen_domain_death_list *l) {
     libxl_evgen_domain_death *death;
-    while ((death = LIBXL_TAILQ_FIRST(l)))
+    while ((death = XEN_TAILQ_FIRST(l)))
         libxl__evdisable_domain_death(gc, death);
 }
 
 static void discard_events(struct libxl__event_list *l) {
     /* doesn't bother unlinking from the list, so l is corrupt on return */
     libxl_event *ev, *next;
-    LIBXL_TAILQ_FOREACH_SAFE(ev, l, link, next)
+    XEN_TAILQ_FOREACH_SAFE(ev, l, link, next)
         libxl_event_free(0, ev);
 }
 
@@ -150,7 +150,7 @@ int libxl_ctx_free(libxl_ctx *ctx)
     free_disable_deaths(gc, &CTX->death_reported);
 
     libxl_evgen_disk_eject *eject;
-    while ((eject = LIBXL_LIST_FIRST(&CTX->disk_eject_evgens)))
+    while ((eject = XEN_LIST_FIRST(&CTX->disk_eject_evgens)))
         libxl__evdisable_disk_eject(gc, eject);
 
     libxl_childproc_setmode(CTX,0,0);
@@ -162,10 +162,10 @@ int libxl_ctx_free(libxl_ctx *ctx)
 
     /* Now there should be no more events requested from the application: */
 
-    assert(LIBXL_LIST_EMPTY(&ctx->efds));
-    assert(LIBXL_TAILQ_EMPTY(&ctx->etimes));
-    assert(LIBXL_LIST_EMPTY(&ctx->evtchns_waiting));
-    assert(LIBXL_LIST_EMPTY(&ctx->aos_inprogress));
+    assert(XEN_LIST_EMPTY(&ctx->efds));
+    assert(XEN_TAILQ_EMPTY(&ctx->etimes));
+    assert(XEN_LIST_EMPTY(&ctx->evtchns_waiting));
+    assert(XEN_LIST_EMPTY(&ctx->aos_inprogress));
 
     if (ctx->xch) xc_interface_close(ctx->xch);
     libxl_version_info_dispose(&ctx->version_info);
@@ -174,10 +174,10 @@ int libxl_ctx_free(libxl_ctx *ctx)
 
     libxl__poller_put(ctx, ctx->poller_app);
     ctx->poller_app = NULL;
-    assert(LIBXL_LIST_EMPTY(&ctx->pollers_event));
-    assert(LIBXL_LIST_EMPTY(&ctx->pollers_active));
+    assert(XEN_LIST_EMPTY(&ctx->pollers_event));
+    assert(XEN_LIST_EMPTY(&ctx->pollers_active));
     libxl__poller *poller, *poller_tmp;
-    LIBXL_LIST_FOREACH_SAFE(poller, &ctx->pollers_idle, entry, poller_tmp) {
+    XEN_LIST_FOREACH_SAFE(poller, &ctx->pollers_idle, entry, poller_tmp) {
         libxl__poller_dispose(poller);
         free(poller);
     }
tools/libs/light/libxl_aoutils.c +10 -10
index c4c095a5ba..c2d42e7cac 100644
@@ -106,7 +106,7 @@ void libxl__datacopier_init(libxl__datacopier_state *dc)
     libxl__ao_abortable_init(&dc->abrt);
     libxl__ev_fd_init(&dc->toread);
     libxl__ev_fd_init(&dc->towrite);
-    LIBXL_TAILQ_INIT(&dc->bufs);
+    XEN_TAILQ_INIT(&dc->bufs);
 }
 
 void libxl__datacopier_kill(libxl__datacopier_state *dc)
@@ -117,9 +117,9 @@ void libxl__datacopier_kill(libxl__datacopier_state *dc)
     libxl__ao_abortable_deregister(&dc->abrt);
     libxl__ev_fd_deregister(gc, &dc->toread);
     libxl__ev_fd_deregister(gc, &dc->towrite);
-    LIBXL_TAILQ_FOREACH_SAFE(buf, &dc->bufs, entry, tbuf)
+    XEN_TAILQ_FOREACH_SAFE(buf, &dc->bufs, entry, tbuf)
         free(buf);
-    LIBXL_TAILQ_INIT(&dc->bufs);
+    XEN_TAILQ_INIT(&dc->bufs);
 }
 
 static void datacopier_callback(libxl__egc *egc, libxl__datacopier_state *dc,
@@ -182,7 +182,7 @@ void libxl__datacopier_prefixdata(libxl__egc *egc, libxl__datacopier_state *dc,
         memcpy(buf->buf, ptr, buf->used);
 
         dc->used += buf->used;
-        LIBXL_TAILQ_INSERT_TAIL(&dc->bufs, buf, entry);
+        XEN_TAILQ_INSERT_TAIL(&dc->bufs, buf, entry);
     }
 }
 
@@ -235,18 +235,18 @@ static void datacopier_readable(libxl__egc *egc, libxl__ev_fd *ev,
             r = read(ev->fd, dc->readbuf + dc->used, dc->bytes_to_read);
         } else {
             while (dc->used >= dc->maxsz) {
-                libxl__datacopier_buf *rm = LIBXL_TAILQ_FIRST(&dc->bufs);
+                libxl__datacopier_buf *rm = XEN_TAILQ_FIRST(&dc->bufs);
                 dc->used -= rm->used;
                 assert(dc->used >= 0);
-                LIBXL_TAILQ_REMOVE(&dc->bufs, rm, entry);
+                XEN_TAILQ_REMOVE(&dc->bufs, rm, entry);
                 free(rm);
             }
 
-            buf = LIBXL_TAILQ_LAST(&dc->bufs, libxl__datacopier_bufs);
+            buf = XEN_TAILQ_LAST(&dc->bufs, libxl__datacopier_bufs);
             if (!buf || buf->used >= sizeof(buf->buf)) {
                 buf = libxl__malloc(NOGC, sizeof(*buf));
                 buf->used = 0;
-                LIBXL_TAILQ_INSERT_TAIL(&dc->bufs, buf, entry);
+                XEN_TAILQ_INSERT_TAIL(&dc->bufs, buf, entry);
             }
             r = read(ev->fd, buf->buf + buf->used,
                      min_t(size_t, sizeof(buf->buf) - buf->used,
@@ -331,11 +331,11 @@ static void datacopier_writable(libxl__egc *egc, libxl__ev_fd *ev,
     }
     assert(revents & POLLOUT);
     for (;;) {
-        libxl__datacopier_buf *buf = LIBXL_TAILQ_FIRST(&dc->bufs);
+        libxl__datacopier_buf *buf = XEN_TAILQ_FIRST(&dc->bufs);
         if (!buf)
             break;
         if (!buf->used) {
-            LIBXL_TAILQ_REMOVE(&dc->bufs, buf, entry);
+            XEN_TAILQ_REMOVE(&dc->bufs, buf, entry);
             free(buf);
             continue;
         }
tools/libs/light/libxl_device.c +13 -14
index 36c4e41e4d..e6025d135e 100644
@@ -1476,7 +1476,7 @@ static void qdisk_spawn_outcome(libxl__egc *egc, libxl__dm_spawn_state *dmss,
  */
 typedef struct libxl__ddomain_device {
     libxl__device *dev;
-    LIBXL_SLIST_ENTRY(struct libxl__ddomain_device) next;
+    XEN_SLIST_ENTRY(struct libxl__ddomain_device) next;
 } libxl__ddomain_device;
 
 /*
@@ -1485,8 +1485,8 @@ typedef struct libxl__ddomain_device {
 typedef struct libxl__ddomain_guest {
     uint32_t domid;
     int num_qdisks;
-    LIBXL_SLIST_HEAD(, struct libxl__ddomain_device) devices;
-    LIBXL_SLIST_ENTRY(struct libxl__ddomain_guest) next;
+    XEN_SLIST_HEAD(, struct libxl__ddomain_device) devices;
+    XEN_SLIST_ENTRY(struct libxl__ddomain_guest) next;
 } libxl__ddomain_guest;
 
 /*
@@ -1496,7 +1496,7 @@ typedef struct libxl__ddomain_guest {
 typedef struct {
     libxl__ao *ao;
     libxl__ev_xswatch watch;
-    LIBXL_SLIST_HEAD(, struct libxl__ddomain_guest) guests;
+    XEN_SLIST_HEAD(, struct libxl__ddomain_guest) guests;
 } libxl__ddomain;
 
 static libxl__ddomain_guest *search_for_guest(libxl__ddomain *ddomain,
@@ -1504,7 +1504,7 @@ static libxl__ddomain_guest *search_for_guest(libxl__ddomain *ddomain,
 {
     libxl__ddomain_guest *dguest;
 
-    LIBXL_SLIST_FOREACH(dguest, &ddomain->guests, next) {
+    XEN_SLIST_FOREACH(dguest, &ddomain->guests, next) {
         if (dguest->domid == domid)
             return dguest;
     }
@@ -1516,7 +1516,7 @@ static libxl__ddomain_device *search_for_device(libxl__ddomain_guest *dguest,
 {
     libxl__ddomain_device *ddev;
 
-    LIBXL_SLIST_FOREACH(ddev, &dguest->devices, next) {
+    XEN_SLIST_FOREACH(ddev, &dguest->devices, next) {
 #define LIBXL_DEVICE_CMP(dev1, dev2, entry) (dev1->entry == dev2->entry)
         if (LIBXL_DEVICE_CMP(ddev->dev, dev, backend_devid) &&
             LIBXL_DEVICE_CMP(ddev->dev, dev, backend_domid) &&
@@ -1537,8 +1537,8 @@ static void check_and_maybe_remove_guest(libxl__gc *gc,
 {
     assert(ddomain);
 
-    if (dguest != NULL && LIBXL_SLIST_FIRST(&dguest->devices) == NULL) {
-        LIBXL_SLIST_REMOVE(&ddomain->guests, dguest, libxl__ddomain_guest,
+    if (dguest != NULL && XEN_SLIST_FIRST(&dguest->devices) == NULL) {
+        XEN_SLIST_REMOVE(&ddomain->guests, dguest, libxl__ddomain_guest,
                            next);
         LOGD(DEBUG, dguest->domid, "Removed domain from the list of active guests");
         /* Clear any leftovers in libxl/<domid> */
@@ -1572,7 +1572,7 @@ static int add_device(libxl__egc *egc, libxl__ao *ao,
     ddev = libxl__zalloc(NOGC, sizeof(*ddev));
     ddev->dev = libxl__zalloc(NOGC, sizeof(*ddev->dev));
     *ddev->dev = *dev;
-    LIBXL_SLIST_INSERT_HEAD(&dguest->devices, ddev, next);
+    XEN_SLIST_INSERT_HEAD(&dguest->devices, ddev, next);
     LOGD(DEBUG, dev->domid, "Added device %s to the list of active devices",
          libxl__device_backend_path(gc, dev));
 
@@ -1649,8 +1649,7 @@ static int remove_device(libxl__egc *egc, libxl__ao *ao,
      * above or from add_device make a copy of the data they use, so
      * there's no risk of dereferencing.
      */
-    LIBXL_SLIST_REMOVE(&dguest->devices, ddev, libxl__ddomain_device,
-                       next);
+    XEN_SLIST_REMOVE(&dguest->devices, ddev, libxl__ddomain_device, next);
     LOGD(DEBUG, dev->domid, "Removed device %s from the list of active devices",
          libxl__device_backend_path(gc, dev));
 
@@ -1716,8 +1715,8 @@ static void backend_watch_callback(libxl__egc *egc, libxl__ev_xswatch *watch,
         /* Create a new guest struct and initialize it */
         dguest = libxl__zalloc(NOGC, sizeof(*dguest));
         dguest->domid = dev->domid;
-        LIBXL_SLIST_INIT(&dguest->devices);
-        LIBXL_SLIST_INSERT_HEAD(&ddomain->guests, dguest, next);
+        XEN_SLIST_INIT(&dguest->devices);
+        XEN_SLIST_INSERT_HEAD(&ddomain->guests, dguest, next);
         LOGD(DEBUG, dguest->domid, "Added domain to the list of active guests");
     }
     ddev = search_for_device(dguest, dev);
@@ -1766,7 +1765,7 @@ int libxl_device_events_handler(libxl_ctx *ctx,
     int i, j, k;
 
     ddomain.ao = ao;
-    LIBXL_SLIST_INIT(&ddomain.guests);
+    XEN_SLIST_INIT(&ddomain.guests);
 
     rc = libxl__get_domid(gc, &domid);
     if (rc) {
tools/libs/light/libxl_disk.c +2 -2
index 93936d0dd0..a5ca77850f 100644
@@ -88,7 +88,7 @@ int libxl_evenable_disk_eject(libxl_ctx *ctx, uint32_t guest_domid,
     memset(evg, 0, sizeof(*evg));
     evg->user = user;
     evg->domid = guest_domid;
-    LIBXL_LIST_INSERT_HEAD(&CTX->disk_eject_evgens, evg, entry);
+    XEN_LIST_INSERT_HEAD(&CTX->disk_eject_evgens, evg, entry);
 
     uint32_t domid = libxl_get_stubdom_id(ctx, guest_domid);
 
@@ -133,7 +133,7 @@ int libxl_evenable_disk_eject(libxl_ctx *ctx, uint32_t guest_domid,
 void libxl__evdisable_disk_eject(libxl__gc *gc, libxl_evgen_disk_eject *evg) {
     CTX_LOCK;
 
-    LIBXL_LIST_REMOVE(evg, entry);
+    XEN_LIST_REMOVE(evg, entry);
 
     if (libxl__ev_xswatch_isregistered(&evg->watch))
         libxl__ev_xswatch_deregister(gc, &evg->watch);
tools/libs/light/libxl_domain.c +9 -9
index 544a9bf59d..d544a60777 100644
@@ -867,7 +867,7 @@ static void domain_death_occurred(libxl__egc *egc,
 
     LOGD(DEBUG, evg->domid, "%s", why);
 
-    libxl_evgen_domain_death *evg_next = LIBXL_TAILQ_NEXT(evg, entry);
+    libxl_evgen_domain_death *evg_next = XEN_TAILQ_NEXT(evg, entry);
     *evg_upd = evg_next;
 
     libxl_event *ev = NEW_EVENT(egc, DOMAIN_DEATH, evg->domid, evg->user);
@@ -875,8 +875,8 @@ static void domain_death_occurred(libxl__egc *egc,
     libxl__event_occurred(egc, ev);
 
     evg->death_reported = 1;
-    LIBXL_TAILQ_REMOVE(&CTX->death_list, evg, entry);
-    LIBXL_TAILQ_INSERT_HEAD(&CTX->death_reported, evg, entry);
+    XEN_TAILQ_REMOVE(&CTX->death_list, evg, entry);
+    XEN_TAILQ_INSERT_HEAD(&CTX->death_reported, evg, entry);
 }
 
 static void domain_death_xswatch_callback(libxl__egc *egc, libxl__ev_xswatch *w,
@@ -887,12 +887,12 @@ static void domain_death_xswatch_callback(libxl__egc *egc, libxl__ev_xswatch *w,
 
     CTX_LOCK;
 
-    evg = LIBXL_TAILQ_FIRST(&CTX->death_list);
+    evg = XEN_TAILQ_FIRST(&CTX->death_list);
 
     for (;;) {
         if (!evg) goto out;
 
-        int nentries = LIBXL_TAILQ_NEXT(evg, entry) ? 200 : 1;
+        int nentries = XEN_TAILQ_NEXT(evg, entry) ? 200 : 1;
         xc_domaininfo_t domaininfos[nentries];
         const xc_domaininfo_t *got = domaininfos, *gotend;
 
@@ -966,7 +966,7 @@ static void domain_death_xswatch_callback(libxl__egc *egc, libxl__ev_xswatch *w,
 
                 evg->shutdown_reported = 1;
             }
-            evg = LIBXL_TAILQ_NEXT(evg, entry);
+            evg = XEN_TAILQ_NEXT(evg, entry);
         }
 
         assert(rc); /* rc==0 results in us eating all evgs and quitting */
@@ -1015,13 +1015,13 @@ void libxl__evdisable_domain_death(libxl__gc *gc,
     CTX_LOCK;
 
     if (!evg->death_reported)
-        LIBXL_TAILQ_REMOVE(&CTX->death_list, evg, entry);
+        XEN_TAILQ_REMOVE(&CTX->death_list, evg, entry);
     else
-        LIBXL_TAILQ_REMOVE(&CTX->death_reported, evg, entry);
+        XEN_TAILQ_REMOVE(&CTX->death_reported, evg, entry);
 
     free(evg);
 
-    if (!LIBXL_TAILQ_FIRST(&CTX->death_list) &&
+    if (!XEN_TAILQ_FIRST(&CTX->death_list) &&
         libxl__ev_xswatch_isregistered(&CTX->death_watch))
         libxl__ev_xswatch_deregister(gc, &CTX->death_watch);
 
tools/libs/light/libxl_event.c +63 -65

418 lines not on this page · raw message

tools/libs/light/libxl_fork.c +22 -22

156 lines not on this page · raw message

tools/libs/light/libxl_internal.h +43 -43

252 lines not on this page · raw message

tools/libs/light/libxl_qmp.c +9 -10
index fb146a54cb..8faa102e4d 100644
@@ -63,7 +63,7 @@
 
 #include <yajl/yajl_gen.h>
 
-#include "_libxl_list.h"
+#include "_xen_list.h"
 #include "libxl_internal.h"
 
 /* #define DEBUG_RECEIVED */
@@ -107,7 +107,7 @@ typedef struct callback_id_pair {
     qmp_callback_t callback;
     void *opaque;
     qmp_request_context *context;
-    LIBXL_STAILQ_ENTRY(struct callback_id_pair) next;
+    XEN_STAILQ_ENTRY(struct callback_id_pair) next;
 } callback_id_pair;
 
 struct libxl__qmp_handler {
@@ -123,7 +123,7 @@ struct libxl__qmp_handler {
     uint32_t domid;
 
     int last_id_used;
-    LIBXL_STAILQ_HEAD(callback_list, callback_id_pair) callback_list;
+    XEN_STAILQ_HEAD(callback_list, callback_id_pair) callback_list;
     struct {
         int major;
         int minor;
@@ -189,7 +189,7 @@ static callback_id_pair *qmp_get_callback_from_id(libxl__qmp_handler *qmp,
     if (id_object) {
         id = libxl__json_object_get_integer(id_object);
 
-        LIBXL_STAILQ_FOREACH(pp, &qmp->callback_list, next) {
+        XEN_STAILQ_FOREACH(pp, &qmp->callback_list, next) {
             if (pp->id == id) {
                 return pp;
             }
@@ -217,7 +217,7 @@ static void qmp_handle_error_response(libxl__gc *gc, libxl__qmp_handler *qmp,
             /* tell that the id have been processed */
             qmp->wait_for_id = 0;
         }
-        LIBXL_STAILQ_REMOVE(&qmp->callback_list, pp, callback_id_pair, next);
+        XEN_STAILQ_REMOVE(&qmp->callback_list, pp, callback_id_pair, next);
         free(pp);
     }
 
@@ -266,8 +266,7 @@ static int qmp_handle_response(libxl__gc *gc, libxl__qmp_handler *qmp,
                 /* tell that the id have been processed */
                 qmp->wait_for_id = 0;
             }
-            LIBXL_STAILQ_REMOVE(&qmp->callback_list, pp, callback_id_pair,
-                                next);
+            XEN_STAILQ_REMOVE(&qmp->callback_list, pp, callback_id_pair, next);
             free(pp);
         }
         return 0;
@@ -325,7 +324,7 @@ static libxl__qmp_handler *qmp_init_handler(libxl__gc *gc, uint32_t domid)
     qmp->domid = domid;
     qmp->timeout = 5;
 
-    LIBXL_STAILQ_INIT(&qmp->callback_list);
+    XEN_STAILQ_INIT(&qmp->callback_list);
 
     return qmp;
 }
@@ -383,7 +382,7 @@ static void qmp_close(libxl__qmp_handler *qmp)
     callback_id_pair *tmp = NULL;
 
     close(qmp->qmp_fd);
-    LIBXL_STAILQ_FOREACH(pp, &qmp->callback_list, next) {
+    XEN_STAILQ_FOREACH(pp, &qmp->callback_list, next) {
         free(tmp);
         tmp = pp;
     }
@@ -547,7 +546,7 @@ static char *qmp_send_prepare(libxl__gc *gc, libxl__qmp_handler *qmp,
     elm->callback = callback;
     elm->opaque = opaque;
     elm->context = context;
-    LIBXL_STAILQ_INSERT_TAIL(&qmp->callback_list, elm, next);
+    XEN_STAILQ_INSERT_TAIL(&qmp->callback_list, elm, next);
 
     LOGD(DEBUG, qmp->domid, "next qmp command: '%s'", buf);
 
tools/libs/light/libxl_stream_read.c +10 -10
index 99a6714e76..e64e8f0ead 100644
@@ -214,7 +214,7 @@ void libxl__stream_read_init(libxl__stream_read_state *stream)
     stream->sync_teardown = false;
     FILLZERO(stream->dc);
     FILLZERO(stream->hdr);
-    LIBXL_STAILQ_INIT(&stream->record_queue);
+    XEN_STAILQ_INIT(&stream->record_queue);
     stream->phase = SRS_PHASE_NORMAL;
     stream->recursion_guard = false;
     stream->incoming_record = NULL;
@@ -402,7 +402,7 @@ static void stream_continue(libxl__egc *egc,
          * processing the record.  There should never be two records
          * in the queue.
          */
-        if (LIBXL_STAILQ_EMPTY(&stream->record_queue))
+        if (XEN_STAILQ_EMPTY(&stream->record_queue))
             setup_read_record(egc, stream);
         else {
             if (process_record(egc, stream))
@@ -412,7 +412,7 @@ static void stream_continue(libxl__egc *egc,
              * process_record() had better have consumed the one and
              * only record in the queue.
              */
-            assert(LIBXL_STAILQ_EMPTY(&stream->record_queue));
+            assert(XEN_STAILQ_EMPTY(&stream->record_queue));
         }
         break;
 
@@ -428,7 +428,7 @@ static void stream_continue(libxl__egc *egc,
          * the tail to spot the CHECKPOINT_END record, and switch to
          * the unbuffering phase.
          */
-        libxl__sr_record_buf *rec = LIBXL_STAILQ_LAST(
+        libxl__sr_record_buf *rec = XEN_STAILQ_LAST(
             &stream->record_queue, libxl__sr_record_buf, entry);
 
         assert(stream->in_checkpoint);
@@ -537,7 +537,7 @@ static void record_body_done(libxl__egc *egc,
     if (rc)
         goto err;
 
-    LIBXL_STAILQ_INSERT_TAIL(&stream->record_queue, rec, entry);
+    XEN_STAILQ_INSERT_TAIL(&stream->record_queue, rec, entry);
     stream->incoming_record = NULL;
 
     stream_continue(egc, stream);
@@ -567,9 +567,9 @@ static bool process_record(libxl__egc *egc,
     int rc = 0;
 
     /* Pop a record from the head of the queue. */
-    assert(!LIBXL_STAILQ_EMPTY(&stream->record_queue));
-    rec = LIBXL_STAILQ_FIRST(&stream->record_queue);
-    LIBXL_STAILQ_REMOVE_HEAD(&stream->record_queue, entry);
+    assert(!XEN_STAILQ_EMPTY(&stream->record_queue));
+    rec = XEN_STAILQ_FIRST(&stream->record_queue);
+    XEN_STAILQ_REMOVE_HEAD(&stream->record_queue, entry);
 
     LOG(DEBUG, "Record: %u, length %u", rec->hdr.type, rec->hdr.length);
 
@@ -813,9 +813,9 @@ static void stream_done(libxl__egc *egc,
 
     /* The record queue had better be empty if the stream believes
      * itself to have been successful. */
-    assert(LIBXL_STAILQ_EMPTY(&stream->record_queue) || stream->rc);
+    assert(XEN_STAILQ_EMPTY(&stream->record_queue) || stream->rc);
 
-    LIBXL_STAILQ_FOREACH_SAFE(rec, &stream->record_queue, entry, trec)
+    XEN_STAILQ_FOREACH_SAFE(rec, &stream->record_queue, entry, trec)
         free_record(rec);
 
     if (!stream->back_channel) {
Signature · 1 line
2.34.1
#3 lore raw

PATCH v2 3/5 tools/libs/toolcore: replace _xentoolcore_list.h with _xen_list.h

In reply to Juergen Gross

Remove generating _xentoolcore_list.h and use the common _xen_list.h instead.

---
 .gitignore                           | 1 -
 tools/include/xentoolcore_internal.h | 4 ++--
 tools/libs/toolcore/Makefile         | 8 --------
 3 files changed, 2 insertions(+), 11 deletions(-)
.gitignore +0 -1
index 3f9d55ba87..afe78c787c 100644
@@ -227,7 +227,6 @@ tools/hotplug/NetBSD/rc.d/xencommons
 tools/hotplug/NetBSD/rc.d/xendriverdomain
 tools/include/acpi
 tools/include/_libxl*.h
-tools/include/_xentoolcore_list.h
 tools/include/xen/*
 tools/include/xen-xsm/*
 tools/include/xen-foreign/*.(c|h|size)
tools/include/xentoolcore_internal.h +2 -2
index 04f5848f09..deccefd612 100644
@@ -27,7 +27,7 @@
 #include <stddef.h>
 
 #include "xentoolcore.h"
-#include "_xentoolcore_list.h"
+#include "_xen_list.h"
 
 /*---------- active handle registration ----------*/
 
@@ -87,7 +87,7 @@ typedef int Xentoolcore__Restrict_Callback(Xentoolcore__Active_Handle*,
 
 struct Xentoolcore__Active_Handle {
     Xentoolcore__Restrict_Callback *restrict_callback;
-    XENTOOLCORE_LIST_ENTRY(Xentoolcore__Active_Handle) entry;
+    XEN_LIST_ENTRY(Xentoolcore__Active_Handle) entry;
 };
 
 void xentoolcore__register_active_handle(Xentoolcore__Active_Handle*);
tools/libs/toolcore/Makefile +0 -8
index ed4ae00694..9c013b2879 100644
@@ -3,7 +3,6 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR	= 1
 MINOR	= 0
-AUTOINCS := $(XEN_INCLUDE)/_xentoolcore_list.h
 
 LIBHEADER := xentoolcore.h
 
@@ -12,10 +11,3 @@ SRCS-y	+= handlereg.c
 include $(XEN_ROOT)/tools/libs/libs.mk
 
 PKG_CONFIG_DESC := Central support for Xen Hypervisor userland libraries
-
-$(LIB_OBJS): $(AUTOINCS)
-$(PIC_OBJS): $(AUTOINCS)
-
-$(XEN_INCLUDE)/_xentoolcore_list.h: $(XEN_INCLUDE)/xen-external/bsd-sys-queue-h-seddery $(XEN_INCLUDE)/xen-external/bsd-sys-queue.h
-	$(PERL) $^ --prefix=xentoolcore >$(notdir $@).new
-	$(call move-if-changed,$(notdir $@).new,$@)
Signature · 1 line
2.34.1
#4 lore raw

PATCH v2 4/5 tools/libs/evtchn: use _xen_list.h

In reply to Juergen Gross

Instead of including xen-external/bsd-sys-queue.h use the header _xen_list.h in minios.c.

---
 tools/libs/evtchn/minios.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
tools/libs/evtchn/minios.c +10 -10
index 30f98bc7e4..65cfccfd09 100644
@@ -20,7 +20,7 @@
  * Split off from xc_minios.c
  */
 
-#include "xen-external/bsd-sys-queue.h"
+#include "_xen_list.h"
 #include <mini-os/types.h>
 #include <mini-os/os.h>
 #include <mini-os/lib.h>
@@ -38,10 +38,10 @@
 
 #include "private.h"
 
-LIST_HEAD(port_list, port_info);
+XEN_LIST_HEAD(port_list, struct port_info);
 
 struct port_info {
-    LIST_ENTRY(port_info) list;
+    XEN_LIST_ENTRY(struct port_info) list;
     evtchn_port_t port;
     bool pending;
     bool bound;
@@ -62,7 +62,7 @@ static struct port_info *port_alloc(xenevtchn_handle *xce)
     port_info->port = -1;
     port_info->bound = false;
 
-    LIST_INSERT_HEAD(port_list, port_info, list);
+    XEN_LIST_INSERT_HEAD(port_list, port_info, list);
 
     return port_info;
 }
@@ -72,7 +72,7 @@ static void port_dealloc(struct port_info *port_info)
     if ( port_info->bound )
         unbind_evtchn(port_info->port);
 
-    LIST_REMOVE(port_info, list);
+    XEN_LIST_REMOVE(port_info, list);
     free(port_info);
 }
 
@@ -81,7 +81,7 @@ static int evtchn_close_fd(struct file *file)
     struct port_info *port_info, *tmp;
     struct port_list *port_list = file->dev;
 
-    LIST_FOREACH_SAFE(port_info, port_list, list, tmp)
+    XEN_LIST_FOREACH_SAFE(port_info, port_list, list, tmp)
         port_dealloc(port_info);
     free(port_list);
 
@@ -126,7 +126,7 @@ int osdep_evtchn_open(xenevtchn_handle *xce, unsigned int flags)
     }
 
     file->dev = list;
-    LIST_INIT(list);
+    XEN_LIST_INIT(list);
     xce->fd = fd;
     printf("evtchn_open() -> %d\n", fd);
 
@@ -173,7 +173,7 @@ static void evtchn_handler(evtchn_port_t port, struct pt_regs *regs, void *data)
     assert(file);
     port_list = file->dev;
     mask_evtchn(port);
-    LIST_FOREACH(port_info, port_list, list)
+    XEN_LIST_FOREACH(port_info, port_list, list)
     {
         if ( port_info->port == port )
             goto found;
@@ -257,7 +257,7 @@ int xenevtchn_unbind(xenevtchn_handle *xce, evtchn_port_t port)
     struct port_info *port_info;
     struct port_list *port_list = file->dev;
 
-    LIST_FOREACH(port_info, port_list, list)
+    XEN_LIST_FOREACH(port_info, port_list, list)
     {
         if ( port_info->port == port )
         {
@@ -314,7 +314,7 @@ xenevtchn_port_or_error_t xenevtchn_pending(xenevtchn_handle *xce)
 
     file->read = false;
 
-    LIST_FOREACH(port_info, port_list, list)
+    XEN_LIST_FOREACH(port_info, port_list, list)
     {
         if ( port_info->port != -1 && port_info->pending )
         {
Signature · 1 line
2.34.1
#5 lore raw

PATCH v2 5/5 tools/include: remove xen-external directory

In reply to Juergen Gross

There is no user of tools/include/xen-external/* left. Remove it.

---
 tools/include/xen-external/README             |   24 -
 tools/include/xen-external/bsd-COPYRIGHT      |  126 --
 tools/include/xen-external/bsd-queue.3        | 1044 -----------------
 .../xen-external/bsd-sys-queue-h-seddery      |   74 --
 tools/include/xen-external/bsd-sys-queue.h    |  637 ----------
 5 files changed, 1905 deletions(-)
 delete mode 100644 tools/include/xen-external/README
 delete mode 100644 tools/include/xen-external/bsd-COPYRIGHT
 delete mode 100644 tools/include/xen-external/bsd-queue.3
 delete mode 100755 tools/include/xen-external/bsd-sys-queue-h-seddery
 delete mode 100644 tools/include/xen-external/bsd-sys-queue.h
tools/include/xen-external/README deleted +0 -24
deleted file mode 100644
index 93c2bc9cd8..0000000000
@@ -1,24 +0,0 @@
-WARNING - DO NOT EDIT THINGS IN THIS DIRECTORY
-----------------------------------------------
-
-These files were obtained elsewhere and should only be updated by
-copying new versions from the source location, as documented below:
-
-bsd-COPYRIGHT
-bsd-sys-queue.h
-bsd-queue.3
-
-  Obtained from the FreeBSD SVN using the following commands:
-    svn co -r 221843 svn://svn.freebsd.org/base/head/sys/sys/
-    svn co -r 221843 svn://svn.freebsd.org/base/head/share/man/man3
-    svn cat -r 221843 http://svn.freebsd.org/base/head/COPYRIGHT >tools/libxl/external/bsd-COPYRIGHT
-
-Exceptions:
-
-README
-
-  This file
-
-bsd-sys-queue-h-seddery
-
-  Script to transform the above into a new namespace.
tools/include/xen-external/bsd-COPYRIGHT deleted +0 -126

126 lines not on this page · raw message

tools/include/xen-external/bsd-queue.3 deleted +0 -1044

1,044 lines not on this page · raw message

tools/include/xen-external/bsd-sys-queue-h-seddery deleted +0 -74

74 lines not on this page · raw message

tools/include/xen-external/bsd-sys-queue.h deleted +0 -637

637 lines not on this page · raw message

Signature · 1 line
2.34.1
#6 lore raw
In reply to Juergen Gross
Quoted 6 lines · Juergen Gross

The tools/include/xen-external directory contains a header file from FreeBSD used to generate Xen header files. This series is replacing the complete directory by a single header with the same semantics.

Changes in V2:
- remove stale comment in patch 1

Just need to fix the build now, otherwise, the series looks fine:
https://gitlab.com/xen-project/patchew/xen/-/pipelines/464803007
^ xentoolcore conversion seems unfinished.

Thanks,

Signature · 1 line
Anthony PERARD
#7 lore raw
Quoted 11 lines · Anthony PERARD
Quoted 6 lines · Juergen Gross

The tools/include/xen-external directory contains a header file from FreeBSD used to generate Xen header files. This series is replacing the complete directory by a single header with the same semantics.

Changes in V2:
- remove stale comment in patch 1

Just need to fix the build now, otherwise, the series looks fine:
https://gitlab.com/xen-project/patchew/xen/-/pipelines/464803007
^ xentoolcore conversion seems unfinished.

Hmm, weird.

Seems I did only an incremental build, but I think it should have failed nevertheless. I suspect something is wrong with the dependencies.

Juergen

#8 lore raw
Quoted 9 lines · Juergen Gross
Quoted 8 lines · Anthony PERARD
Quoted 6 lines · Juergen Gross

The tools/include/xen-external directory contains a header file from FreeBSD used to generate Xen header files. This series is replacing the complete directory by a single header with the same semantics.

Changes in V2:
- remove stale comment in patch 1

Quoted 8 lines
Quoted 3 lines

Just need to fix the build now, otherwise, the series looks fine:
https://gitlab.com/xen-project/patchew/xen/-/pipelines/464803007
^ xentoolcore conversion seems unfinished.

Hmm, weird.

Seems I did only an incremental build, but I think it should have failed nevertheless. I suspect something is wrong with the dependencies.

Indeed, the dependencies aren't loaded. I've prepared a patch:

https://lore.kernel.org/xen-devel/[email protected]/

Thanks,

Signature · 1 line
Anthony PERARD