xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/12] tools: move more libraries into tools/libs
@ 2020-07-15 16:24 Ian Jackson
  2020-07-15 16:24 ` [PATCH 1/1] docs/process/branching-checklist: Get osstest branch right Ian Jackson
                   ` (13 more replies)
  0 siblings, 14 replies; 27+ messages in thread
From: Ian Jackson @ 2020-07-15 16:24 UTC (permalink / raw)
  To: xen-devel, xen-devel
  Cc: Stefano Stabellini, Julien Grall, Wei Liu, Andrew Cooper,
	ian.jackson, George Dunlap, Marek Marczykowski-Górecki,
	Stewart Hildebrand, Josh Whitehead, Jan Beulich, Anthony PERARD,
	Samuel Thibault

[ NB: this patch series is actually from Juergen Gross.

  It is being experiemntally handled as a Merge Reqeust in gitlab, in
  part to see what problems there are with that workflow that will
  need extra tooling or whatever.

  I have manually generated this series using git-format-patch,
  scripts/add_maintainers.pl, and git-send-email.  I expect that if we
  adopt this as a real workflow, we will want to make a robot do some
  of that.

  I have set replies to go to the Gitlab comment thread and to
  xen-devel.  Again this is experimental.  We are likely to need
  something to automatically collect acks, at the very least.

  Reviewers: for now, please review this series as normal.  You may
  reply to the messages by email.  Please, for now, send your replies
  to gitlab and to the mailing list.  I think I have set the reply-to
  appropriately.

  Alternatively you may review the code in the gitlab web UI.  But
  please do not use the line-by-line comment system: write only to the
  main MR discussion thread.

  Thanks, Ian ]

Move some more libraries under tools/libs, including libxenctrl. This
is resulting in a lot of cleanup work regarding building libs and
restructuring of the tools directory.

I have (for now) left out some more libraries like libxenguest and
libxl, but I can have a try moving those, too, if wanted.

Please note that patch 8 ("tools: move libxenctrl below tools/libs")
needs the related mini-os and qemu-trad patches applied in order to
not break the build:

https://lists.xen.org/archives/html/xen-devel/2020-07/msg00548.html

https://lists.xen.org/archives/html/xen-devel/2020-07/msg00617.html



Juergen Gross (12):
  stubdom: add stubdom/mini-os.mk for Xen paths used by Mini-OS
  tools: switch XEN_LIBXEN* make variables to lower case (XEN_libxen*)
  tools: add a copy of library headers in tools/include
  tools: don't call make recursively from libs.mk
  tools: define ROUNDUP() in tools/include/xen-tools/libs.h
  tools/misc: don't use libxenctrl internals from misc tools
  tools/libxc: untangle libxenctrl from libxenguest
  tools: move libxenctrl below tools/libs
  tools: split libxenstore into new tools/libs/store directory
  tools: split libxenvchan into new tools/libs/vchan directory
  tools: split libxenstat into new tools/libs/stat directory
  tools: generate most contents of library make variables

 .gitignore                                    |  29 +++-
 MAINTAINERS                                   |   2 +-
 stubdom/Makefile                              |  29 +++-
 stubdom/grub/kexec.c                          |   2 +-
 stubdom/mini-os.mk                            |  17 ++
 tools/Makefile                                |  15 +-
 tools/Rules.mk                                | 142 ++++++---------
 tools/console/daemon/io.c                     |   6 +-
 tools/golang/xenlight/Makefile                |   4 +-
 tools/helpers/init-xenstore-domain.c          |   2 +-
 tools/include/xen-tools/libs.h                |   4 +
 tools/libs/Makefile                           |   4 +
 tools/libs/call/Makefile                      |   3 +-
 tools/libs/call/buffer.c                      |   3 +-
 tools/libs/ctrl/Makefile                      |  68 ++++++++
 tools/{libxc => libs/ctrl}/include/xenctrl.h  |   0
 .../ctrl}/include/xenctrl_compat.h            |   0
 .../ctrl/include/xenctrl_dom.h}               |  10 +-
 tools/libs/ctrl/libxenctrl.map                |   3 +
 tools/{libxc => libs/ctrl}/xc_altp2m.c        |   0
 tools/{libxc => libs/ctrl}/xc_arinc653.c      |   0
 tools/{libxc => libs/ctrl}/xc_bitops.h        |   0
 tools/{libxc => libs/ctrl}/xc_core.c          |   5 +-
 tools/{libxc => libs/ctrl}/xc_core.h          |   2 +-
 tools/{libxc => libs/ctrl}/xc_core_arm.c      |   2 +-
 tools/{libxc => libs/ctrl}/xc_core_arm.h      |   0
 tools/{libxc => libs/ctrl}/xc_core_x86.c      |   6 +-
 tools/{libxc => libs/ctrl}/xc_core_x86.h      |   0
 tools/{libxc => libs/ctrl}/xc_cpu_hotplug.c   |   0
 tools/{libxc => libs/ctrl}/xc_cpupool.c       |   0
 tools/{libxc => libs/ctrl}/xc_csched.c        |   0
 tools/{libxc => libs/ctrl}/xc_csched2.c       |   0
 .../ctrl}/xc_devicemodel_compat.c             |   0
 tools/{libxc => libs/ctrl}/xc_domain.c        | 129 +-------------
 tools/{libxc => libs/ctrl}/xc_evtchn.c        |   0
 tools/{libxc => libs/ctrl}/xc_evtchn_compat.c |   0
 tools/{libxc => libs/ctrl}/xc_flask.c         |   0
 .../{libxc => libs/ctrl}/xc_foreign_memory.c  |   0
 tools/{libxc => libs/ctrl}/xc_freebsd.c       |   0
 tools/{libxc => libs/ctrl}/xc_gnttab.c        |   0
 tools/{libxc => libs/ctrl}/xc_gnttab_compat.c |   0
 tools/{libxc => libs/ctrl}/xc_hcall_buf.c     |   1 -
 tools/{libxc => libs/ctrl}/xc_kexec.c         |   0
 tools/{libxc => libs/ctrl}/xc_linux.c         |   0
 tools/{libxc => libs/ctrl}/xc_mem_access.c    |   0
 tools/{libxc => libs/ctrl}/xc_mem_paging.c    |   0
 tools/{libxc => libs/ctrl}/xc_memshr.c        |   0
 tools/{libxc => libs/ctrl}/xc_minios.c        |   0
 tools/{libxc => libs/ctrl}/xc_misc.c          |   0
 tools/{libxc => libs/ctrl}/xc_monitor.c       |   0
 tools/{libxc => libs/ctrl}/xc_msr_x86.h       |   0
 tools/{libxc => libs/ctrl}/xc_netbsd.c        |   0
 tools/{libxc => libs/ctrl}/xc_pagetab.c       |   0
 tools/{libxc => libs/ctrl}/xc_physdev.c       |   0
 tools/{libxc => libs/ctrl}/xc_pm.c            |   0
 tools/{libxc => libs/ctrl}/xc_private.c       |   3 +-
 tools/{libxc => libs/ctrl}/xc_private.h       |  36 ++++
 tools/{libxc => libs/ctrl}/xc_psr.c           |   0
 tools/{libxc => libs/ctrl}/xc_resource.c      |   0
 tools/{libxc => libs/ctrl}/xc_resume.c        |   2 -
 tools/{libxc => libs/ctrl}/xc_rt.c            |   0
 tools/{libxc => libs/ctrl}/xc_solaris.c       |   0
 tools/{libxc => libs/ctrl}/xc_tbuf.c          |   0
 tools/{libxc => libs/ctrl}/xc_vm_event.c      |   0
 .../ctrl/xenctrl.pc.in}                       |   0
 tools/libs/devicemodel/Makefile               |   3 +-
 tools/libs/evtchn/Makefile                    |   3 +-
 tools/libs/foreignmemory/Makefile             |   3 +-
 tools/libs/foreignmemory/linux.c              |   3 +-
 tools/libs/gnttab/Makefile                    |   3 +-
 tools/libs/gnttab/private.h                   |   3 -
 tools/libs/hypfs/Makefile                     |   3 +-
 tools/libs/libs.mk                            |  34 +++-
 .../{xenstat/libxenstat => libs/stat}/COPYING |   0
 .../libxenstat => libs/stat}/Makefile         |  97 +++--------
 .../stat}/bindings/swig/perl/.empty           |   0
 .../stat}/bindings/swig/python/.empty         |   0
 .../stat}/bindings/swig/xenstat.i             |   0
 .../src => libs/stat/include}/xenstat.h       |   3 +
 tools/libs/stat/libxenstat.map                |  54 ++++++
 .../libxenstat/src => libs/stat}/xenstat.c    |   0
 .../libxenstat => libs/stat}/xenstat.pc.in    |   2 +-
 .../src => libs/stat}/xenstat_freebsd.c       |   0
 .../src => libs/stat}/xenstat_linux.c         |   4 +-
 .../src => libs/stat}/xenstat_netbsd.c        |   0
 .../src => libs/stat}/xenstat_priv.h          |   0
 .../src => libs/stat}/xenstat_qmp.c           |   0
 .../src => libs/stat}/xenstat_solaris.c       |   0
 tools/libs/store/Makefile                     |  65 +++++++
 .../store}/include/compat/xs.h                |   0
 .../store}/include/compat/xs_lib.h            |   0
 .../store}/include/xenstore.h                 |   0
 tools/libs/store/libxenstore.map              |  49 ++++++
 tools/{xenstore => libs/store}/xenstore.pc.in |   0
 tools/{xenstore => libs/store}/xs.c           |   0
 tools/libs/toolcore/Makefile                  |   2 +-
 tools/libs/toollog/Makefile                   |   2 +-
 tools/libs/vchan/Makefile                     |  18 ++
 .../vchan/include}/libxenvchan.h              |   0
 tools/{libvchan => libs/vchan}/init.c         |   0
 tools/{libvchan => libs/vchan}/io.c           |   0
 tools/libs/vchan/libxenvchan.map              |  16 ++
 tools/{libvchan => libs/vchan}/xenvchan.pc.in |   0
 tools/libvchan/Makefile                       |  95 -----------
 tools/libxc/Makefile                          | 161 +++++-------------
 tools/libxc/include/xenguest.h                |   8 +-
 tools/libxc/xc_efi.h                          | 158 -----------------
 tools/libxc/xc_elf.h                          |  16 --
 .../libxc/{xc_cpuid_x86.c => xg_cpuid_x86.c}  |   0
 tools/libxc/{xc_dom_arm.c => xg_dom_arm.c}    |   2 +-
 ...imageloader.c => xg_dom_armzimageloader.c} |   2 +-
 ...{xc_dom_binloader.c => xg_dom_binloader.c} |   2 +-
 tools/libxc/{xc_dom_boot.c => xg_dom_boot.c}  |   2 +-
 ...bzimageloader.c => xg_dom_bzimageloader.c} |   2 +-
 ...m_compat_linux.c => xg_dom_compat_linux.c} |   2 +-
 tools/libxc/{xc_dom_core.c => xg_dom_core.c}  |   2 +-
 ...c_dom_decompress.h => xg_dom_decompress.h} |   4 +-
 ...compress_lz4.c => xg_dom_decompress_lz4.c} |   2 +-
 ...ss_unsafe.c => xg_dom_decompress_unsafe.c} |   2 +-
 ...ss_unsafe.h => xg_dom_decompress_unsafe.h} |   2 +-
 ...ip2.c => xg_dom_decompress_unsafe_bzip2.c} |   2 +-
 ...lzma.c => xg_dom_decompress_unsafe_lzma.c} |   2 +-
 ...o1x.c => xg_dom_decompress_unsafe_lzo1x.c} |   2 +-
 ...afe_xz.c => xg_dom_decompress_unsafe_xz.c} |   2 +-
 ...{xc_dom_elfloader.c => xg_dom_elfloader.c} |   2 +-
 ...{xc_dom_hvmloader.c => xg_dom_hvmloader.c} |   2 +-
 tools/libxc/{xc_dom_x86.c => xg_dom_x86.c}    |   2 +-
 tools/libxc/xg_domain.c                       | 149 ++++++++++++++++
 .../libxc/{xc_nomigrate.c => xg_nomigrate.c}  |   0
 .../{xc_offline_page.c => xg_offline_page.c}  |   2 +-
 tools/libxc/xg_private.h                      |  23 ---
 tools/libxc/xg_save_restore.h                 |  13 --
 .../libxc/{xc_sr_common.c => xg_sr_common.c}  |   2 +-
 .../libxc/{xc_sr_common.h => xg_sr_common.h}  |   4 +-
 ...{xc_sr_common_x86.c => xg_sr_common_x86.c} |   2 +-
 ...{xc_sr_common_x86.h => xg_sr_common_x86.h} |   2 +-
 ..._common_x86_pv.c => xg_sr_common_x86_pv.c} |   2 +-
 ..._common_x86_pv.h => xg_sr_common_x86_pv.h} |   2 +-
 .../{xc_sr_restore.c => xg_sr_restore.c}      |   2 +-
 ...tore_x86_hvm.c => xg_sr_restore_x86_hvm.c} |   2 +-
 ...estore_x86_pv.c => xg_sr_restore_x86_pv.c} |   2 +-
 tools/libxc/{xc_sr_save.c => xg_sr_save.c}    |   2 +-
 ...sr_save_x86_hvm.c => xg_sr_save_x86_hvm.c} |   2 +-
 ...c_sr_save_x86_pv.c => xg_sr_save_x86_pv.c} |   2 +-
 ..._stream_format.h => xg_sr_stream_format.h} |   0
 tools/libxc/{xc_suspend.c => xg_suspend.c}    |   0
 tools/libxl/Makefile                          |   2 +-
 tools/libxl/libxl_arm.c                       |   2 +-
 tools/libxl/libxl_arm.h                       |   2 +-
 tools/libxl/libxl_create.c                    |   2 +-
 tools/libxl/libxl_dm.c                        |   2 +-
 tools/libxl/libxl_dom.c                       |   2 +-
 tools/libxl/libxl_internal.h                  |   5 +-
 tools/libxl/libxl_vnuma.c                     |   2 +-
 tools/libxl/libxl_x86.c                       |   2 +-
 tools/libxl/libxl_x86_acpi.c                  |   2 +-
 tools/misc/Makefile                           |   5 +-
 tools/misc/xen-hptool.c                       |   8 +-
 tools/misc/xen-mfndump.c                      |  70 ++++----
 tools/python/Makefile                         |   2 +-
 tools/python/setup.py                         |  12 +-
 tools/python/xen/lowlevel/xc/xc.c             |   2 +-
 tools/vchan/Makefile                          |  37 ++++
 tools/{libvchan => vchan}/node-select.c       |   0
 tools/{libvchan => vchan}/node.c              |   0
 .../{libvchan => vchan}/vchan-socket-proxy.c  |   0
 tools/xcutils/readnotes.c                     |   2 +-
 tools/xenstat/Makefile                        |  10 --
 tools/xenstore/Makefile                       |  82 +--------
 tools/xenstore/{include => }/xenstore_lib.h   |   0
 tools/xenstore/xenstored_core.c               |   2 -
 tools/{xenstat => }/xentop/Makefile           |   2 +-
 tools/{xenstat => }/xentop/TODO               |   0
 tools/{xenstat => }/xentop/xentop.c           |   0
 174 files changed, 856 insertions(+), 986 deletions(-)
 create mode 100644 stubdom/mini-os.mk
 create mode 100644 tools/libs/ctrl/Makefile
 rename tools/{libxc => libs/ctrl}/include/xenctrl.h (100%)
 rename tools/{libxc => libs/ctrl}/include/xenctrl_compat.h (100%)
 rename tools/{libxc/include/xc_dom.h => libs/ctrl/include/xenctrl_dom.h} (98%)
 create mode 100644 tools/libs/ctrl/libxenctrl.map
 rename tools/{libxc => libs/ctrl}/xc_altp2m.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_arinc653.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_bitops.h (100%)
 rename tools/{libxc => libs/ctrl}/xc_core.c (99%)
 rename tools/{libxc => libs/ctrl}/xc_core.h (99%)
 rename tools/{libxc => libs/ctrl}/xc_core_arm.c (99%)
 rename tools/{libxc => libs/ctrl}/xc_core_arm.h (100%)
 rename tools/{libxc => libs/ctrl}/xc_core_x86.c (98%)
 rename tools/{libxc => libs/ctrl}/xc_core_x86.h (100%)
 rename tools/{libxc => libs/ctrl}/xc_cpu_hotplug.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_cpupool.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_csched.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_csched2.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_devicemodel_compat.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_domain.c (94%)
 rename tools/{libxc => libs/ctrl}/xc_evtchn.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_evtchn_compat.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_flask.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_foreign_memory.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_freebsd.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_gnttab.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_gnttab_compat.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_hcall_buf.c (99%)
 rename tools/{libxc => libs/ctrl}/xc_kexec.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_linux.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_mem_access.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_mem_paging.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_memshr.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_minios.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_misc.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_monitor.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_msr_x86.h (100%)
 rename tools/{libxc => libs/ctrl}/xc_netbsd.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_pagetab.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_physdev.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_pm.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_private.c (99%)
 rename tools/{libxc => libs/ctrl}/xc_private.h (91%)
 rename tools/{libxc => libs/ctrl}/xc_psr.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_resource.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_resume.c (99%)
 rename tools/{libxc => libs/ctrl}/xc_rt.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_solaris.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_tbuf.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_vm_event.c (100%)
 rename tools/{libxc/xencontrol.pc.in => libs/ctrl/xenctrl.pc.in} (100%)
 rename tools/{xenstat/libxenstat => libs/stat}/COPYING (100%)
 rename tools/{xenstat/libxenstat => libs/stat}/Makefile (56%)
 rename tools/{xenstat/libxenstat => libs/stat}/bindings/swig/perl/.empty (100%)
 rename tools/{xenstat/libxenstat => libs/stat}/bindings/swig/python/.empty (100%)
 rename tools/{xenstat/libxenstat => libs/stat}/bindings/swig/xenstat.i (100%)
 rename tools/{xenstat/libxenstat/src => libs/stat/include}/xenstat.h (98%)
 create mode 100644 tools/libs/stat/libxenstat.map
 rename tools/{xenstat/libxenstat/src => libs/stat}/xenstat.c (100%)
 rename tools/{xenstat/libxenstat => libs/stat}/xenstat.pc.in (82%)
 rename tools/{xenstat/libxenstat/src => libs/stat}/xenstat_freebsd.c (100%)
 rename tools/{xenstat/libxenstat/src => libs/stat}/xenstat_linux.c (98%)
 rename tools/{xenstat/libxenstat/src => libs/stat}/xenstat_netbsd.c (100%)
 rename tools/{xenstat/libxenstat/src => libs/stat}/xenstat_priv.h (100%)
 rename tools/{xenstat/libxenstat/src => libs/stat}/xenstat_qmp.c (100%)
 rename tools/{xenstat/libxenstat/src => libs/stat}/xenstat_solaris.c (100%)
 create mode 100644 tools/libs/store/Makefile
 rename tools/{xenstore => libs/store}/include/compat/xs.h (100%)
 rename tools/{xenstore => libs/store}/include/compat/xs_lib.h (100%)
 rename tools/{xenstore => libs/store}/include/xenstore.h (100%)
 create mode 100644 tools/libs/store/libxenstore.map
 rename tools/{xenstore => libs/store}/xenstore.pc.in (100%)
 rename tools/{xenstore => libs/store}/xs.c (100%)
 create mode 100644 tools/libs/vchan/Makefile
 rename tools/{libvchan => libs/vchan/include}/libxenvchan.h (100%)
 rename tools/{libvchan => libs/vchan}/init.c (100%)
 rename tools/{libvchan => libs/vchan}/io.c (100%)
 create mode 100644 tools/libs/vchan/libxenvchan.map
 rename tools/{libvchan => libs/vchan}/xenvchan.pc.in (100%)
 delete mode 100644 tools/libvchan/Makefile
 delete mode 100644 tools/libxc/xc_efi.h
 delete mode 100644 tools/libxc/xc_elf.h
 rename tools/libxc/{xc_cpuid_x86.c => xg_cpuid_x86.c} (100%)
 rename tools/libxc/{xc_dom_arm.c => xg_dom_arm.c} (99%)
 rename tools/libxc/{xc_dom_armzimageloader.c => xg_dom_armzimageloader.c} (99%)
 rename tools/libxc/{xc_dom_binloader.c => xg_dom_binloader.c} (99%)
 rename tools/libxc/{xc_dom_boot.c => xg_dom_boot.c} (99%)
 rename tools/libxc/{xc_dom_bzimageloader.c => xg_dom_bzimageloader.c} (99%)
 rename tools/libxc/{xc_dom_compat_linux.c => xg_dom_compat_linux.c} (99%)
 rename tools/libxc/{xc_dom_core.c => xg_dom_core.c} (99%)
 rename tools/libxc/{xc_dom_decompress.h => xg_dom_decompress.h} (62%)
 rename tools/libxc/{xc_dom_decompress_lz4.c => xg_dom_decompress_lz4.c} (98%)
 rename tools/libxc/{xc_dom_decompress_unsafe.c => xg_dom_decompress_unsafe.c} (96%)
 rename tools/libxc/{xc_dom_decompress_unsafe.h => xg_dom_decompress_unsafe.h} (97%)
 rename tools/libxc/{xc_dom_decompress_unsafe_bzip2.c => xg_dom_decompress_unsafe_bzip2.c} (87%)
 rename tools/libxc/{xc_dom_decompress_unsafe_lzma.c => xg_dom_decompress_unsafe_lzma.c} (87%)
 rename tools/libxc/{xc_dom_decompress_unsafe_lzo1x.c => xg_dom_decompress_unsafe_lzo1x.c} (96%)
 rename tools/libxc/{xc_dom_decompress_unsafe_xz.c => xg_dom_decompress_unsafe_xz.c} (95%)
 rename tools/libxc/{xc_dom_elfloader.c => xg_dom_elfloader.c} (99%)
 rename tools/libxc/{xc_dom_hvmloader.c => xg_dom_hvmloader.c} (99%)
 rename tools/libxc/{xc_dom_x86.c => xg_dom_x86.c} (99%)
 create mode 100644 tools/libxc/xg_domain.c
 rename tools/libxc/{xc_nomigrate.c => xg_nomigrate.c} (100%)
 rename tools/libxc/{xc_offline_page.c => xg_offline_page.c} (99%)
 rename tools/libxc/{xc_sr_common.c => xg_sr_common.c} (99%)
 rename tools/libxc/{xc_sr_common.h => xg_sr_common.h} (99%)
 rename tools/libxc/{xc_sr_common_x86.c => xg_sr_common_x86.c} (99%)
 rename tools/libxc/{xc_sr_common_x86.h => xg_sr_common_x86.h} (98%)
 rename tools/libxc/{xc_sr_common_x86_pv.c => xg_sr_common_x86_pv.c} (99%)
 rename tools/libxc/{xc_sr_common_x86_pv.h => xg_sr_common_x86_pv.h} (98%)
 rename tools/libxc/{xc_sr_restore.c => xg_sr_restore.c} (99%)
 rename tools/libxc/{xc_sr_restore_x86_hvm.c => xg_sr_restore_x86_hvm.c} (99%)
 rename tools/libxc/{xc_sr_restore_x86_pv.c => xg_sr_restore_x86_pv.c} (99%)
 rename tools/libxc/{xc_sr_save.c => xg_sr_save.c} (99%)
 rename tools/libxc/{xc_sr_save_x86_hvm.c => xg_sr_save_x86_hvm.c} (99%)
 rename tools/libxc/{xc_sr_save_x86_pv.c => xg_sr_save_x86_pv.c} (99%)
 rename tools/libxc/{xc_sr_stream_format.h => xg_sr_stream_format.h} (100%)
 rename tools/libxc/{xc_suspend.c => xg_suspend.c} (100%)
 create mode 100644 tools/vchan/Makefile
 rename tools/{libvchan => vchan}/node-select.c (100%)
 rename tools/{libvchan => vchan}/node.c (100%)
 rename tools/{libvchan => vchan}/vchan-socket-proxy.c (100%)
 delete mode 100644 tools/xenstat/Makefile
 rename tools/xenstore/{include => }/xenstore_lib.h (100%)
 rename tools/{xenstat => }/xentop/Makefile (97%)
 rename tools/{xenstat => }/xentop/TODO (100%)
 rename tools/{xenstat => }/xentop/xentop.c (100%)

-- 
2.20.1



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

* [PATCH 1/1] docs/process/branching-checklist: Get osstest branch right
  2020-07-15 16:24 [PATCH 00/12] tools: move more libraries into tools/libs Ian Jackson
@ 2020-07-15 16:24 ` Ian Jackson
  2020-08-18 12:41   ` Ian Jackson
  2020-07-15 16:25 ` [PATCH 01/12] stubdom: add stubdom/mini-os.mk for Xen paths used by Mini-OS Ian Jackson
                   ` (12 subsequent siblings)
  13 siblings, 1 reply; 27+ messages in thread
From: Ian Jackson @ 2020-07-15 16:24 UTC (permalink / raw)
  To: xen-devel
  Cc: Stefano Stabellini, Julien Grall, Wei Liu, Andrew Cooper,
	ian.jackson, George Dunlap, Jan Beulich

The runes for this manual osstest were wrong.  It needs to run as
osstest, and cr-for-branches should be run from testing.git.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 docs/process/branching-checklist.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/docs/process/branching-checklist.txt b/docs/process/branching-checklist.txt
index e286e65962..0e83272caa 100644
--- a/docs/process/branching-checklist.txt
+++ b/docs/process/branching-checklist.txt
@@ -86,8 +86,8 @@ including turning off debug.
 
 Set off a manual osstest run, since the osstest cr-for-branches change
 will take a while to take effect:
-  ssh osstest.test-lab
-  cd branches/for-xen-$v-testing.git
+  ssh osstest@osstest.test-lab
+  cd testing.git
   screen -S $v
   BRANCHES=xen-$v-testing ./cr-for-branches branches -w "./cr-daily-branch --real"
 
-- 
2.20.1



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

* [PATCH 01/12] stubdom: add stubdom/mini-os.mk for Xen paths used by Mini-OS
  2020-07-15 16:24 [PATCH 00/12] tools: move more libraries into tools/libs Ian Jackson
  2020-07-15 16:24 ` [PATCH 1/1] docs/process/branching-checklist: Get osstest branch right Ian Jackson
@ 2020-07-15 16:25 ` Ian Jackson
  2020-07-18 18:18   ` Samuel Thibault
  2020-07-15 16:25 ` [PATCH 02/12] tools: switch XEN_LIBXEN* make variables to lower case (XEN_libxen*) Ian Jackson
                   ` (11 subsequent siblings)
  13 siblings, 1 reply; 27+ messages in thread
From: Ian Jackson @ 2020-07-15 16:25 UTC (permalink / raw)
  To: xen-devel; +Cc: Juergen Gross, Samuel Thibault, ian.jackson

From: Juergen Gross <jgross@suse.com>

stubdom/mini-os.mk should contain paths used by Mini-OS when built as
stubdom.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 stubdom/mini-os.mk | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 stubdom/mini-os.mk

diff --git a/stubdom/mini-os.mk b/stubdom/mini-os.mk
new file mode 100644
index 0000000000..32528bb91f
--- /dev/null
+++ b/stubdom/mini-os.mk
@@ -0,0 +1,17 @@
+# Included by Mini-OS stubdom builds to set variables depending on Xen
+# internal paths.
+#
+# Input variables are:
+# XEN_ROOT
+# MINIOS_TARGET_ARCH
+
+XENSTORE_CPPFLAGS = -isystem $(XEN_ROOT)/tools/xenstore/include
+TOOLCORE_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/toolcore
+TOOLLOG_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/toollog
+EVTCHN_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/evtchn
+GNTTAB_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/gnttab
+CALL_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/call
+FOREIGNMEMORY_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/foreignmemory
+DEVICEMODEL_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/devicemodel
+CTRL_PATH = $(XEN_ROOT)/stubdom/libxc-$(MINIOS_TARGET_ARCH)
+GUEST_PATH = $(XEN_ROOT)/stubdom/libxc-$(MINIOS_TARGET_ARCH)
-- 
2.20.1



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

* [PATCH 02/12] tools: switch XEN_LIBXEN* make variables to lower case (XEN_libxen*)
  2020-07-15 16:24 [PATCH 00/12] tools: move more libraries into tools/libs Ian Jackson
  2020-07-15 16:24 ` [PATCH 1/1] docs/process/branching-checklist: Get osstest branch right Ian Jackson
  2020-07-15 16:25 ` [PATCH 01/12] stubdom: add stubdom/mini-os.mk for Xen paths used by Mini-OS Ian Jackson
@ 2020-07-15 16:25 ` Ian Jackson
  2020-07-21 13:30   ` Wei Liu
  2020-07-15 16:25 ` [PATCH 03/12] tools: add a copy of library headers in tools/include Ian Jackson
                   ` (10 subsequent siblings)
  13 siblings, 1 reply; 27+ messages in thread
From: Ian Jackson @ 2020-07-15 16:25 UTC (permalink / raw)
  To: xen-devel; +Cc: Juergen Gross, ian.jackson, George Dunlap, Wei Liu

From: Juergen Gross <jgross@suse.com>

In order to harmonize names of library related make variables switch
XEN_LIBXEN* names to XEN_libxen*, as all other related variables (e.g.
CFLAGS_libxen*, SHDEPS_libxen*, ...) already use this pattern.

Rename XEN_LIBXC to XEN_libxenctrl, XEN_XENSTORE to XEN_libxenstore,
XEN_XENLIGHT to XEN_libxenlight, XEN_XLUTIL to XEN_libxlutil, and
XEN_LIBVCHAN to XEN_libxenvchan for the same reason.

Introduce XEN_libxenguest with the same value as XEN_libxenctrl.

No functional change.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 tools/Rules.mk                    | 120 +++++++++++++++---------------
 tools/golang/xenlight/Makefile    |   4 +-
 tools/libs/call/Makefile          |   2 +-
 tools/libs/devicemodel/Makefile   |   2 +-
 tools/libs/evtchn/Makefile        |   2 +-
 tools/libs/foreignmemory/Makefile |   2 +-
 tools/libs/gnttab/Makefile        |   2 +-
 tools/libs/hypfs/Makefile         |   2 +-
 tools/libs/toolcore/Makefile      |   2 +-
 tools/libs/toollog/Makefile       |   2 +-
 tools/libvchan/Makefile           |   2 +-
 tools/libxc/Makefile              |   2 +-
 tools/xenstat/libxenstat/Makefile |   2 +-
 tools/xenstore/Makefile           |   2 +-
 14 files changed, 75 insertions(+), 73 deletions(-)

diff --git a/tools/Rules.mk b/tools/Rules.mk
index 5ed5664bf7..b42e50ebf6 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -12,21 +12,23 @@ INSTALL = $(XEN_ROOT)/tools/cross-install
 LDFLAGS += $(PREPEND_LDFLAGS_XEN_TOOLS)
 
 XEN_INCLUDE        = $(XEN_ROOT)/tools/include
-XEN_LIBXENTOOLCORE  = $(XEN_ROOT)/tools/libs/toolcore
-XEN_LIBXENTOOLLOG  = $(XEN_ROOT)/tools/libs/toollog
-XEN_LIBXENEVTCHN   = $(XEN_ROOT)/tools/libs/evtchn
-XEN_LIBXENGNTTAB   = $(XEN_ROOT)/tools/libs/gnttab
-XEN_LIBXENCALL     = $(XEN_ROOT)/tools/libs/call
-XEN_LIBXENFOREIGNMEMORY = $(XEN_ROOT)/tools/libs/foreignmemory
-XEN_LIBXENDEVICEMODEL = $(XEN_ROOT)/tools/libs/devicemodel
-XEN_LIBXENHYPFS    = $(XEN_ROOT)/tools/libs/hypfs
-XEN_LIBXC          = $(XEN_ROOT)/tools/libxc
-XEN_XENLIGHT       = $(XEN_ROOT)/tools/libxl
+XEN_libxentoolcore = $(XEN_ROOT)/tools/libs/toolcore
+XEN_libxentoollog  = $(XEN_ROOT)/tools/libs/toollog
+XEN_libxenevtchn   = $(XEN_ROOT)/tools/libs/evtchn
+XEN_libxengnttab   = $(XEN_ROOT)/tools/libs/gnttab
+XEN_libxencall     = $(XEN_ROOT)/tools/libs/call
+XEN_libxenforeignmemory = $(XEN_ROOT)/tools/libs/foreignmemory
+XEN_libxendevicemodel = $(XEN_ROOT)/tools/libs/devicemodel
+XEN_libxenhypfs    = $(XEN_ROOT)/tools/libs/hypfs
+XEN_libxenctrl     = $(XEN_ROOT)/tools/libxc
+# Currently libxenguest lives in the same directory as libxenctrl
+XEN_libxenguest    = $(XEN_libxenctrl)
+XEN_libxenlight    = $(XEN_ROOT)/tools/libxl
 # Currently libxlutil lives in the same directory as libxenlight
-XEN_XLUTIL         = $(XEN_XENLIGHT)
-XEN_XENSTORE       = $(XEN_ROOT)/tools/xenstore
-XEN_LIBXENSTAT     = $(XEN_ROOT)/tools/xenstat/libxenstat/src
-XEN_LIBVCHAN       = $(XEN_ROOT)/tools/libvchan
+XEN_libxlutil      = $(XEN_libxenlight)
+XEN_libxenstore    = $(XEN_ROOT)/tools/xenstore
+XEN_libxenstat     = $(XEN_ROOT)/tools/xenstat/libxenstat/src
+XEN_libxenvchan    = $(XEN_ROOT)/tools/libvchan
 
 CFLAGS_xeninclude = -I$(XEN_INCLUDE)
 
@@ -97,75 +99,75 @@ endif
 # Consumers of libfoo should not directly use $(SHDEPS_libfoo) or
 # $(SHLIB_libfoo)
 
-CFLAGS_libxentoollog = -I$(XEN_LIBXENTOOLLOG)/include $(CFLAGS_xeninclude)
+CFLAGS_libxentoollog = -I$(XEN_libxentoollog)/include $(CFLAGS_xeninclude)
 SHDEPS_libxentoollog =
-LDLIBS_libxentoollog = $(SHDEPS_libxentoollog) $(XEN_LIBXENTOOLLOG)/libxentoollog$(libextension)
-SHLIB_libxentoollog  = $(SHDEPS_libxentoollog) -Wl,-rpath-link=$(XEN_LIBXENTOOLLOG)
+LDLIBS_libxentoollog = $(SHDEPS_libxentoollog) $(XEN_libxentoollog)/libxentoollog$(libextension)
+SHLIB_libxentoollog  = $(SHDEPS_libxentoollog) -Wl,-rpath-link=$(XEN_libxentoollog)
 
-CFLAGS_libxentoolcore = -I$(XEN_LIBXENTOOLCORE)/include $(CFLAGS_xeninclude)
+CFLAGS_libxentoolcore = -I$(XEN_libxentoolcore)/include $(CFLAGS_xeninclude)
 SHDEPS_libxentoolcore =
-LDLIBS_libxentoolcore = $(SHDEPS_libxentoolcore) $(XEN_LIBXENTOOLCORE)/libxentoolcore$(libextension)
-SHLIB_libxentoolcore  = $(SHDEPS_libxentoolcore) -Wl,-rpath-link=$(XEN_LIBXENTOOLCORE)
+LDLIBS_libxentoolcore = $(SHDEPS_libxentoolcore) $(XEN_libxentoolcore)/libxentoolcore$(libextension)
+SHLIB_libxentoolcore  = $(SHDEPS_libxentoolcore) -Wl,-rpath-link=$(XEN_libxentoolcore)
 
-CFLAGS_libxenevtchn = -I$(XEN_LIBXENEVTCHN)/include $(CFLAGS_xeninclude)
+CFLAGS_libxenevtchn = -I$(XEN_libxenevtchn)/include $(CFLAGS_xeninclude)
 SHDEPS_libxenevtchn = $(SHLIB_libxentoolcore)
-LDLIBS_libxenevtchn = $(SHDEPS_libxenevtchn) $(XEN_LIBXENEVTCHN)/libxenevtchn$(libextension)
-SHLIB_libxenevtchn  = $(SHDEPS_libxenevtchn) -Wl,-rpath-link=$(XEN_LIBXENEVTCHN)
+LDLIBS_libxenevtchn = $(SHDEPS_libxenevtchn) $(XEN_libxenevtchn)/libxenevtchn$(libextension)
+SHLIB_libxenevtchn  = $(SHDEPS_libxenevtchn) -Wl,-rpath-link=$(XEN_libxenevtchn)
 
-CFLAGS_libxengnttab = -I$(XEN_LIBXENGNTTAB)/include $(CFLAGS_xeninclude)
+CFLAGS_libxengnttab = -I$(XEN_libxengnttab)/include $(CFLAGS_xeninclude)
 SHDEPS_libxengnttab = $(SHLIB_libxentoollog) $(SHLIB_libxentoolcore)
-LDLIBS_libxengnttab = $(SHDEPS_libxengnttab) $(XEN_LIBXENGNTTAB)/libxengnttab$(libextension)
-SHLIB_libxengnttab  = $(SHDEPS_libxengnttab) -Wl,-rpath-link=$(XEN_LIBXENGNTTAB)
+LDLIBS_libxengnttab = $(SHDEPS_libxengnttab) $(XEN_libxengnttab)/libxengnttab$(libextension)
+SHLIB_libxengnttab  = $(SHDEPS_libxengnttab) -Wl,-rpath-link=$(XEN_libxengnttab)
 
-CFLAGS_libxencall = -I$(XEN_LIBXENCALL)/include $(CFLAGS_xeninclude)
+CFLAGS_libxencall = -I$(XEN_libxencall)/include $(CFLAGS_xeninclude)
 SHDEPS_libxencall = $(SHLIB_libxentoolcore)
-LDLIBS_libxencall = $(SHDEPS_libxencall) $(XEN_LIBXENCALL)/libxencall$(libextension)
-SHLIB_libxencall  = $(SHDEPS_libxencall) -Wl,-rpath-link=$(XEN_LIBXENCALL)
+LDLIBS_libxencall = $(SHDEPS_libxencall) $(XEN_libxencall)/libxencall$(libextension)
+SHLIB_libxencall  = $(SHDEPS_libxencall) -Wl,-rpath-link=$(XEN_libxencall)
 
-CFLAGS_libxenforeignmemory = -I$(XEN_LIBXENFOREIGNMEMORY)/include $(CFLAGS_xeninclude)
+CFLAGS_libxenforeignmemory = -I$(XEN_libxenforeignmemory)/include $(CFLAGS_xeninclude)
 SHDEPS_libxenforeignmemory = $(SHLIB_libxentoolcore)
-LDLIBS_libxenforeignmemory = $(SHDEPS_libxenforeignmemory) $(XEN_LIBXENFOREIGNMEMORY)/libxenforeignmemory$(libextension)
-SHLIB_libxenforeignmemory  = $(SHDEPS_libxenforeignmemory) -Wl,-rpath-link=$(XEN_LIBXENFOREIGNMEMORY)
+LDLIBS_libxenforeignmemory = $(SHDEPS_libxenforeignmemory) $(XEN_libxenforeignmemory)/libxenforeignmemory$(libextension)
+SHLIB_libxenforeignmemory  = $(SHDEPS_libxenforeignmemory) -Wl,-rpath-link=$(XEN_libxenforeignmemory)
 
-CFLAGS_libxendevicemodel = -I$(XEN_LIBXENDEVICEMODEL)/include $(CFLAGS_xeninclude)
+CFLAGS_libxendevicemodel = -I$(XEN_libxendevicemodel)/include $(CFLAGS_xeninclude)
 SHDEPS_libxendevicemodel = $(SHLIB_libxentoollog) $(SHLIB_libxentoolcore) $(SHLIB_libxencall)
-LDLIBS_libxendevicemodel = $(SHDEPS_libxendevicemodel) $(XEN_LIBXENDEVICEMODEL)/libxendevicemodel$(libextension)
-SHLIB_libxendevicemodel  = $(SHDEPS_libxendevicemodel) -Wl,-rpath-link=$(XEN_LIBXENDEVICEMODEL)
+LDLIBS_libxendevicemodel = $(SHDEPS_libxendevicemodel) $(XEN_libxendevicemodel)/libxendevicemodel$(libextension)
+SHLIB_libxendevicemodel  = $(SHDEPS_libxendevicemodel) -Wl,-rpath-link=$(XEN_libxendevicemodel)
 
-CFLAGS_libxenhypfs = -I$(XEN_LIBXENHYPFS)/include $(CFLAGS_xeninclude)
+CFLAGS_libxenhypfs = -I$(XEN_libxenhypfs)/include $(CFLAGS_xeninclude)
 SHDEPS_libxenhypfs = $(SHLIB_libxentoollog) $(SHLIB_libxentoolcore) $(SHLIB_libxencall)
-LDLIBS_libxenhypfs = $(SHDEPS_libxenhypfs) $(XEN_LIBXENHYPFS)/libxenhypfs$(libextension)
-SHLIB_libxenhypfs  = $(SHDEPS_libxenhypfs) -Wl,-rpath-link=$(XEN_LIBXENHYPFS)
+LDLIBS_libxenhypfs = $(SHDEPS_libxenhypfs) $(XEN_libxenhypfs)/libxenhypfs$(libextension)
+SHLIB_libxenhypfs  = $(SHDEPS_libxenhypfs) -Wl,-rpath-link=$(XEN_libxenhypfs)
 
 # code which compiles against libxenctrl get __XEN_TOOLS__ and
 # therefore sees the unstable hypercall interfaces.
-CFLAGS_libxenctrl = -I$(XEN_LIBXC)/include $(CFLAGS_libxentoollog) $(CFLAGS_libxenforeignmemory) $(CFLAGS_libxendevicemodel) $(CFLAGS_xeninclude) -D__XEN_TOOLS__
+CFLAGS_libxenctrl = -I$(XEN_libxenctrl)/include $(CFLAGS_libxentoollog) $(CFLAGS_libxenforeignmemory) $(CFLAGS_libxendevicemodel) $(CFLAGS_xeninclude) -D__XEN_TOOLS__
 SHDEPS_libxenctrl = $(SHLIB_libxentoollog) $(SHLIB_libxenevtchn) $(SHLIB_libxengnttab) $(SHLIB_libxencall) $(SHLIB_libxenforeignmemory) $(SHLIB_libxendevicemodel)
-LDLIBS_libxenctrl = $(SHDEPS_libxenctrl) $(XEN_LIBXC)/libxenctrl$(libextension)
-SHLIB_libxenctrl  = $(SHDEPS_libxenctrl) -Wl,-rpath-link=$(XEN_LIBXC)
+LDLIBS_libxenctrl = $(SHDEPS_libxenctrl) $(XEN_libxenctrl)/libxenctrl$(libextension)
+SHLIB_libxenctrl  = $(SHDEPS_libxenctrl) -Wl,-rpath-link=$(XEN_libxenctrl)
 
-CFLAGS_libxenguest = -I$(XEN_LIBXC)/include $(CFLAGS_libxenevtchn) $(CFLAGS_libxenforeignmemory) $(CFLAGS_xeninclude)
+CFLAGS_libxenguest = -I$(XEN_libxenguest)/include $(CFLAGS_libxenevtchn) $(CFLAGS_libxenforeignmemory) $(CFLAGS_xeninclude)
 SHDEPS_libxenguest = $(SHLIB_libxenevtchn)
-LDLIBS_libxenguest = $(SHDEPS_libxenguest) $(XEN_LIBXC)/libxenguest$(libextension)
-SHLIB_libxenguest  = $(SHDEPS_libxenguest) -Wl,-rpath-link=$(XEN_LIBXC)
+LDLIBS_libxenguest = $(SHDEPS_libxenguest) $(XEN_libxenguest)/libxenguest$(libextension)
+SHLIB_libxenguest  = $(SHDEPS_libxenguest) -Wl,-rpath-link=$(XEN_libxenguest)
 
-CFLAGS_libxenstore = -I$(XEN_XENSTORE)/include $(CFLAGS_xeninclude)
+CFLAGS_libxenstore = -I$(XEN_libxenstore)/include $(CFLAGS_xeninclude)
 SHDEPS_libxenstore = $(SHLIB_libxentoolcore)
-LDLIBS_libxenstore = $(SHDEPS_libxenstore) $(XEN_XENSTORE)/libxenstore$(libextension)
-SHLIB_libxenstore  = $(SHDEPS_libxenstore) -Wl,-rpath-link=$(XEN_XENSTORE)
+LDLIBS_libxenstore = $(SHDEPS_libxenstore) $(XEN_libxenstore)/libxenstore$(libextension)
+SHLIB_libxenstore  = $(SHDEPS_libxenstore) -Wl,-rpath-link=$(XEN_libxenstore)
 ifeq ($(CONFIG_Linux),y)
 LDLIBS_libxenstore += -ldl
 endif
 
-CFLAGS_libxenstat  = -I$(XEN_LIBXENSTAT)
+CFLAGS_libxenstat  = -I$(XEN_libxenstat)
 SHDEPS_libxenstat  = $(SHLIB_libxenctrl) $(SHLIB_libxenstore)
-LDLIBS_libxenstat  = $(SHDEPS_libxenstat) $(XEN_LIBXENSTAT)/libxenstat$(libextension)
-SHLIB_libxenstat   = $(SHDEPS_libxenstat) -Wl,-rpath-link=$(XEN_LIBXENSTAT)
+LDLIBS_libxenstat  = $(SHDEPS_libxenstat) $(XEN_libxenstat)/libxenstat$(libextension)
+SHLIB_libxenstat   = $(SHDEPS_libxenstat) -Wl,-rpath-link=$(XEN_libxenstat)
 
-CFLAGS_libxenvchan = -I$(XEN_LIBVCHAN) $(CFLAGS_libxengnttab) $(CFLAGS_libxenevtchn)
+CFLAGS_libxenvchan = -I$(XEN_libxenvchan) $(CFLAGS_libxengnttab) $(CFLAGS_libxenevtchn)
 SHDEPS_libxenvchan = $(SHLIB_libxentoollog) $(SHLIB_libxenstore) $(SHLIB_libxenevtchn) $(SHLIB_libxengnttab)
-LDLIBS_libxenvchan = $(SHDEPS_libxenvchan) $(XEN_LIBVCHAN)/libxenvchan$(libextension)
-SHLIB_libxenvchan  = $(SHDEPS_libxenvchan) -Wl,-rpath-link=$(XEN_LIBVCHAN)
+LDLIBS_libxenvchan = $(SHDEPS_libxenvchan) $(XEN_libxenvchan)/libxenvchan$(libextension)
+SHLIB_libxenvchan  = $(SHDEPS_libxenvchan) -Wl,-rpath-link=$(XEN_libxenvchan)
 
 ifeq ($(debug),y)
 # Disable optimizations
@@ -176,15 +178,15 @@ else
 CFLAGS += -O2 -fomit-frame-pointer
 endif
 
-CFLAGS_libxenlight = -I$(XEN_XENLIGHT) $(CFLAGS_libxenctrl) $(CFLAGS_xeninclude)
+CFLAGS_libxenlight = -I$(XEN_libxenlight) $(CFLAGS_libxenctrl) $(CFLAGS_xeninclude)
 SHDEPS_libxenlight = $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(SHLIB_libxenhypfs)
-LDLIBS_libxenlight = $(SHDEPS_libxenlight) $(XEN_XENLIGHT)/libxenlight$(libextension)
-SHLIB_libxenlight  = $(SHDEPS_libxenlight) -Wl,-rpath-link=$(XEN_XENLIGHT)
+LDLIBS_libxenlight = $(SHDEPS_libxenlight) $(XEN_libxenlight)/libxenlight$(libextension)
+SHLIB_libxenlight  = $(SHDEPS_libxenlight) -Wl,-rpath-link=$(XEN_libxenlight)
 
-CFLAGS_libxlutil = -I$(XEN_XLUTIL)
+CFLAGS_libxlutil = -I$(XEN_libxlutil)
 SHDEPS_libxlutil = $(SHLIB_libxenlight)
-LDLIBS_libxlutil = $(SHDEPS_libxlutil) $(XEN_XLUTIL)/libxlutil$(libextension)
-SHLIB_libxlutil  = $(SHDEPS_libxlutil) -Wl,-rpath-link=$(XEN_XLUTIL)
+LDLIBS_libxlutil = $(SHDEPS_libxlutil) $(XEN_libxlutil)/libxlutil$(libextension)
+SHLIB_libxlutil  = $(SHDEPS_libxlutil) -Wl,-rpath-link=$(XEN_libxlutil)
 
 CFLAGS += -D__XEN_INTERFACE_VERSION__=__XEN_LATEST_INTERFACE_VERSION__
 
diff --git a/tools/golang/xenlight/Makefile b/tools/golang/xenlight/Makefile
index eac9dbf12a..a83fff7573 100644
--- a/tools/golang/xenlight/Makefile
+++ b/tools/golang/xenlight/Makefile
@@ -30,11 +30,11 @@ idl-gen: $(GOXL_GEN_FILES)
 #
 # NB that because the users of this library need to be able to
 # recompile the library from source, it needs to include '-lxenlight'
-# in the LDFLAGS; and thus we need to add -L$(XEN_XENLIGHT) here
+# in the LDFLAGS; and thus we need to add -L$(XEN_libxenlight) here
 # so that it can find the actual library.
 .PHONY: build
 build: xenlight.go $(GOXL_GEN_FILES)
-	CGO_CFLAGS="$(CFLAGS_libxenlight) $(CFLAGS_libxentoollog)" CGO_LDFLAGS="$(LDLIBS_libxenlight) $(LDLIBS_libxentoollog) -L$(XEN_XENLIGHT) -L$(XEN_LIBXENTOOLLOG)" $(GO) build -x
+	CGO_CFLAGS="$(CFLAGS_libxenlight) $(CFLAGS_libxentoollog)" CGO_LDFLAGS="$(LDLIBS_libxenlight) $(LDLIBS_libxentoollog) -L$(XEN_libxenlight) -L$(XEN_libxentoollog)" $(GO) build -x
 
 .PHONY: install
 install: build
diff --git a/tools/libs/call/Makefile b/tools/libs/call/Makefile
index 7f6dc3fcbd..7994b411fa 100644
--- a/tools/libs/call/Makefile
+++ b/tools/libs/call/Makefile
@@ -15,5 +15,5 @@ SRCS-$(CONFIG_MiniOS)  += minios.c
 
 include $(XEN_ROOT)/tools/libs/libs.mk
 
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_LIBXENCALL)/include
+$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxencall)/include
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
diff --git a/tools/libs/devicemodel/Makefile b/tools/libs/devicemodel/Makefile
index 61bfa35273..d9d1d1b850 100644
--- a/tools/libs/devicemodel/Makefile
+++ b/tools/libs/devicemodel/Makefile
@@ -15,5 +15,5 @@ SRCS-$(CONFIG_MiniOS)  += compat.c
 
 include $(XEN_ROOT)/tools/libs/libs.mk
 
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_LIBXENDEVICEMODEL)/include
+$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxendevicemodel)/include
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
diff --git a/tools/libs/evtchn/Makefile b/tools/libs/evtchn/Makefile
index 9206f622ef..d7aa4d402f 100644
--- a/tools/libs/evtchn/Makefile
+++ b/tools/libs/evtchn/Makefile
@@ -15,4 +15,4 @@ SRCS-$(CONFIG_MiniOS)  += minios.c
 
 include $(XEN_ROOT)/tools/libs/libs.mk
 
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_LIBXENEVTCHN)/include
+$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxenevtchn)/include
diff --git a/tools/libs/foreignmemory/Makefile b/tools/libs/foreignmemory/Makefile
index 28f1bddc96..823989681d 100644
--- a/tools/libs/foreignmemory/Makefile
+++ b/tools/libs/foreignmemory/Makefile
@@ -15,5 +15,5 @@ SRCS-$(CONFIG_MiniOS)  += minios.c
 
 include $(XEN_ROOT)/tools/libs/libs.mk
 
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_LIBXENFOREIGNMEMORY)/include
+$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxenforeignmemory)/include
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
diff --git a/tools/libs/gnttab/Makefile b/tools/libs/gnttab/Makefile
index 2da8fbbb7f..c0fffdac71 100644
--- a/tools/libs/gnttab/Makefile
+++ b/tools/libs/gnttab/Makefile
@@ -17,5 +17,5 @@ SRCS-$(CONFIG_NetBSD)  += gnttab_unimp.c gntshr_unimp.c
 
 include $(XEN_ROOT)/tools/libs/libs.mk
 
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_LIBXENGNTTAB)/include
+$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxengnttab)/include
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
diff --git a/tools/libs/hypfs/Makefile b/tools/libs/hypfs/Makefile
index 06dd449929..b4c41f6189 100644
--- a/tools/libs/hypfs/Makefile
+++ b/tools/libs/hypfs/Makefile
@@ -12,5 +12,5 @@ SRCS-y                 += core.c
 
 include ../libs.mk
 
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_LIBXENHYPFS)/include
+$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxenhypfs)/include
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
diff --git a/tools/libs/toolcore/Makefile b/tools/libs/toolcore/Makefile
index 9c5a92d93f..85ff2b26fd 100644
--- a/tools/libs/toolcore/Makefile
+++ b/tools/libs/toolcore/Makefile
@@ -10,7 +10,7 @@ SRCS-y	+= handlereg.c
 
 include $(XEN_ROOT)/tools/libs/libs.mk
 
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_LIBXENTOOLCORE)/include
+$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxentoolcore)/include
 
 $(LIB_OBJS): $(AUTOINCS)
 $(PIC_OBJS): $(AUTOINCS)
diff --git a/tools/libs/toollog/Makefile b/tools/libs/toollog/Makefile
index 9156e5d08e..2d3ae4e627 100644
--- a/tools/libs/toollog/Makefile
+++ b/tools/libs/toollog/Makefile
@@ -10,4 +10,4 @@ SRCS-y	+= xtl_logger_stdio.c
 
 include $(XEN_ROOT)/tools/libs/libs.mk
 
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_LIBXENTOOLLOG)/include
+$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxentoollog)/include
diff --git a/tools/libvchan/Makefile b/tools/libvchan/Makefile
index 913bcc8884..025a935cb7 100644
--- a/tools/libvchan/Makefile
+++ b/tools/libvchan/Makefile
@@ -35,7 +35,7 @@ endif
 PKG_CONFIG_LOCAL := $(foreach pc,$(PKG_CONFIG),$(PKG_CONFIG_DIR)/$(pc))
 
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_PREFIX = $(XEN_ROOT)
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_LIBVCHAN)
+$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxenvchan)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
 
diff --git a/tools/libxc/Makefile b/tools/libxc/Makefile
index fae5969a73..1e64116bd4 100644
--- a/tools/libxc/Makefile
+++ b/tools/libxc/Makefile
@@ -168,7 +168,7 @@ endif
 PKG_CONFIG_LOCAL := $(foreach pc,$(PKG_CONFIG),$(PKG_CONFIG_DIR)/$(pc))
 
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_PREFIX = $(XEN_ROOT)
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_LIBXC)/include
+$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxenctrl)/include
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
 
diff --git a/tools/xenstat/libxenstat/Makefile b/tools/xenstat/libxenstat/Makefile
index 03cb212e3b..3d05ecdd9f 100644
--- a/tools/xenstat/libxenstat/Makefile
+++ b/tools/xenstat/libxenstat/Makefile
@@ -50,7 +50,7 @@ endif
 PKG_CONFIG_LOCAL := $(foreach pc,$(PKG_CONFIG),$(PKG_CONFIG_DIR)/$(pc))
 
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_PREFIX = $(XEN_ROOT)
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_LIBXENSTAT)
+$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxenstat)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
 
 .PHONY: all
diff --git a/tools/xenstore/Makefile b/tools/xenstore/Makefile
index 445e9911b2..0a64ac1571 100644
--- a/tools/xenstore/Makefile
+++ b/tools/xenstore/Makefile
@@ -128,7 +128,7 @@ endif
 PKG_CONFIG_LOCAL := $(foreach pc,$(PKG_CONFIG),$(PKG_CONFIG_DIR)/$(pc))
 
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_PREFIX = $(XEN_ROOT)
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_XENSTORE)/include
+$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxenstore)/include
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
 
-- 
2.20.1



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

* [PATCH 03/12] tools: add a copy of library headers in tools/include
  2020-07-15 16:24 [PATCH 00/12] tools: move more libraries into tools/libs Ian Jackson
                   ` (2 preceding siblings ...)
  2020-07-15 16:25 ` [PATCH 02/12] tools: switch XEN_LIBXEN* make variables to lower case (XEN_libxen*) Ian Jackson
@ 2020-07-15 16:25 ` Ian Jackson
  2020-07-15 16:25 ` [PATCH 04/12] tools: don't call make recursively from libs.mk Ian Jackson
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 27+ messages in thread
From: Ian Jackson @ 2020-07-15 16:25 UTC (permalink / raw)
  To: xen-devel
  Cc: Juergen Gross, Stefano Stabellini, Julien Grall, Wei Liu,
	Andrew Cooper, ian.jackson, George Dunlap, Jan Beulich

From: Juergen Gross <jgross@suse.com>

The headers.chk target in tools/Rules.mk tries to compile all headers
stand alone for testing them not to include any internal header.

Unfortunately the headers tested against are not complete, as any
header for a Xen library is not included in the include path of the
test compile run, resulting in a failure in case any of the tested
headers in including an official Xen library header.

Fix that by copying the official headers located in
tools/libs/*/include to tools/include.

In order to support libraries with header name other than xen<lib>.h
or with multiple headers add a LIBHEADER make variable a lib specific
Makefile can set in that case.

Move the headers.chk target from Rules.mk to libs.mk as it is used
for libraries in tools/libs only.

Add NO_HEADERS_CHK variable to skip checking headers as this will be
needed e.g. for libxenctrl.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 .gitignore         |  1 +
 tools/Rules.mk     |  8 --------
 tools/libs/libs.mk | 26 +++++++++++++++++++++++---
 3 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/.gitignore b/.gitignore
index 36ce2ea104..5ea48af818 100644
--- a/.gitignore
+++ b/.gitignore
@@ -188,6 +188,7 @@ tools/hotplug/Linux/xendomains
 tools/hotplug/NetBSD/rc.d/xencommons
 tools/hotplug/NetBSD/rc.d/xendriverdomain
 tools/include/acpi
+tools/include/*.h
 tools/include/xen/*
 tools/include/xen-xsm/*
 tools/include/xen-foreign/*.(c|h|size)
diff --git a/tools/Rules.mk b/tools/Rules.mk
index b42e50ebf6..5d699cfd39 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -225,14 +225,6 @@ INSTALL_PYTHON_PROG = \
 %.opic: %.S
 	$(CC) $(CPPFLAGS) -DPIC $(CFLAGS) $(CFLAGS.opic) -fPIC -c -o $@ $< $(APPEND_CFLAGS)
 
-headers.chk:
-	for i in $(filter %.h,$^); do \
-	    $(CC) -x c -ansi -Wall -Werror $(CFLAGS_xeninclude) \
-	          -S -o /dev/null $$i || exit 1; \
-	    echo $$i; \
-	done >$@.new
-	mv $@.new $@
-
 subdirs-all subdirs-clean subdirs-install subdirs-distclean subdirs-uninstall: .phony
 	@set -e; for subdir in $(SUBDIRS) $(SUBDIRS-y); do \
 		$(MAKE) subdir-$(patsubst subdirs-%,%,$@)-$$subdir; \
diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index 8027ae7400..8045c00e9a 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -34,6 +34,10 @@ endif
 
 PKG_CONFIG_LOCAL := $(foreach pc,$(PKG_CONFIG),$(PKG_CONFIG_DIR)/$(pc))
 
+LIBHEADER ?= xen$(LIBNAME).h
+LIBHEADERS = $(foreach h, $(LIBHEADER), include/$(h))
+LIBHEADERSGLOB = $(foreach h, $(LIBHEADER), $(XEN_ROOT)/tools/include/$(h))
+
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_PREFIX = $(XEN_ROOT)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
 
@@ -47,7 +51,22 @@ build:
 .PHONY: libs
 libs: headers.chk $(LIB) $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL)
 
-headers.chk: $(wildcard include/*.h) $(AUTOINCS)
+ifneq ($(NO_HEADERS_CHK),y)
+headers.chk:
+	for i in $(filter %.h,$^); do \
+	    $(CC) -x c -ansi -Wall -Werror $(CFLAGS_xeninclude) \
+	          -S -o /dev/null $$i || exit 1; \
+	    echo $$i; \
+	done >$@.new
+	mv $@.new $@
+else
+.PHONY: headers.chk
+endif
+
+headers.chk: $(LIBHEADERSGLOB) $(AUTOINCS)
+
+$(LIBHEADERSGLOB): $(LIBHEADERS)
+	for i in $(realpath $(LIBHEADERS)); do ln -sf $$i $(XEN_ROOT)/tools/include; done
 
 libxen$(LIBNAME).a: $(LIB_OBJS)
 	$(AR) rc $@ $^
@@ -68,13 +87,13 @@ install: build
 	$(INSTALL_DATA) libxen$(LIBNAME).a $(DESTDIR)$(libdir)
 	$(SYMLINK_SHLIB) libxen$(LIBNAME).so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)/libxen$(LIBNAME).so.$(MAJOR)
 	$(SYMLINK_SHLIB) libxen$(LIBNAME).so.$(MAJOR) $(DESTDIR)$(libdir)/libxen$(LIBNAME).so
-	$(INSTALL_DATA) include/xen$(LIBNAME).h $(DESTDIR)$(includedir)
+	for i in $(LIBHEADERS); do $(INSTALL_DATA) $$i $(DESTDIR)$(includedir); done
 	$(INSTALL_DATA) xen$(LIBNAME).pc $(DESTDIR)$(PKG_INSTALLDIR)
 
 .PHONY: uninstall
 uninstall:
 	rm -f $(DESTDIR)$(PKG_INSTALLDIR)/xen$(LIBNAME).pc
-	rm -f $(DESTDIR)$(includedir)/xen$(LIBNAME).h
+	for i in $(LIBHEADER); do rm -f $(DESTDIR)$(includedir)/$(LIBHEADER); done
 	rm -f $(DESTDIR)$(libdir)/libxen$(LIBNAME).so
 	rm -f $(DESTDIR)$(libdir)/libxen$(LIBNAME).so.$(MAJOR)
 	rm -f $(DESTDIR)$(libdir)/libxen$(LIBNAME).so.$(MAJOR).$(MINOR)
@@ -90,6 +109,7 @@ clean:
 	rm -f libxen$(LIBNAME).so.$(MAJOR).$(MINOR) libxen$(LIBNAME).so.$(MAJOR)
 	rm -f headers.chk
 	rm -f xen$(LIBNAME).pc
+	rm -f $(LIBHEADERSGLOB)
 
 .PHONY: distclean
 distclean: clean
-- 
2.20.1



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

* [PATCH 04/12] tools: don't call make recursively from libs.mk
  2020-07-15 16:24 [PATCH 00/12] tools: move more libraries into tools/libs Ian Jackson
                   ` (3 preceding siblings ...)
  2020-07-15 16:25 ` [PATCH 03/12] tools: add a copy of library headers in tools/include Ian Jackson
@ 2020-07-15 16:25 ` Ian Jackson
  2020-07-15 16:54   ` Ian Jackson
  2020-07-15 16:25 ` [PATCH 05/12] tools: define ROUNDUP() in tools/include/xen-tools/libs.h Ian Jackson
                   ` (8 subsequent siblings)
  13 siblings, 1 reply; 27+ messages in thread
From: Ian Jackson @ 2020-07-15 16:25 UTC (permalink / raw)
  To: xen-devel; +Cc: Juergen Gross, ian.jackson, Wei Liu

From: Juergen Gross <jgross@suse.com>

During build of a xen library make is called again via libs.mk. This is
not necessary as the same can be achieved by a simple dependency.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 tools/libs/libs.mk | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index 8045c00e9a..764f5441e2 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -45,8 +45,7 @@ $(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
 all: build
 
 .PHONY: build
-build:
-	$(MAKE) libs
+build: libs
 
 .PHONY: libs
 libs: headers.chk $(LIB) $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL)
-- 
2.20.1



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

* [PATCH 05/12] tools: define ROUNDUP() in tools/include/xen-tools/libs.h
  2020-07-15 16:24 [PATCH 00/12] tools: move more libraries into tools/libs Ian Jackson
                   ` (4 preceding siblings ...)
  2020-07-15 16:25 ` [PATCH 04/12] tools: don't call make recursively from libs.mk Ian Jackson
@ 2020-07-15 16:25 ` Ian Jackson
  2020-07-15 16:25 ` [PATCH 06/12] tools/misc: don't use libxenctrl internals from misc tools Ian Jackson
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 27+ messages in thread
From: Ian Jackson @ 2020-07-15 16:25 UTC (permalink / raw)
  To: xen-devel; +Cc: Juergen Gross, Anthony PERARD, ian.jackson, Wei Liu

From: Juergen Gross <jgross@suse.com>

Today there are multiple copies of the ROUNDUP() macro in various
sources and headers. Define it once in tools/include/xen-tools/libs.h.

Using xen-tools/libs.h enables removing copies of MIN() and MAX(), too.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 tools/console/daemon/io.c        | 6 +-----
 tools/include/xen-tools/libs.h   | 4 ++++
 tools/libs/call/buffer.c         | 3 +--
 tools/libs/foreignmemory/linux.c | 3 +--
 tools/libs/gnttab/private.h      | 3 ---
 tools/libxc/xg_private.h         | 1 -
 tools/libxl/libxl_internal.h     | 3 ---
 tools/xenstore/xenstored_core.c  | 2 --
 8 files changed, 7 insertions(+), 18 deletions(-)

diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c
index a43c57edad..4af27ffc5d 100644
--- a/tools/console/daemon/io.c
+++ b/tools/console/daemon/io.c
@@ -49,9 +49,7 @@
 #include <sys/ioctl.h>
 #include <libutil.h>
 #endif
-
-#define MAX(a, b) (((a) > (b)) ? (a) : (b))
-#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#include <xen-tools/libs.h>
 
 /* Each 10 bits takes ~ 3 digits, plus one, plus one for nul terminator. */
 #define MAX_STRLEN(x) ((sizeof(x) * CHAR_BIT + CHAR_BIT-1) / 10 * 3 + 2)
@@ -80,8 +78,6 @@ static struct pollfd  *fds;
 static unsigned int current_array_size;
 static unsigned int nr_fds;
 
-#define ROUNDUP(_x,_w) (((unsigned long)(_x)+(1UL<<(_w))-1) & ~((1UL<<(_w))-1))
-
 struct buffer {
 	char *data;
 	size_t consumed;
diff --git a/tools/include/xen-tools/libs.h b/tools/include/xen-tools/libs.h
index cc7dfc8c64..a16e0c3807 100644
--- a/tools/include/xen-tools/libs.h
+++ b/tools/include/xen-tools/libs.h
@@ -59,4 +59,8 @@
     })
 #endif
 
+#ifndef ROUNDUP
+#define ROUNDUP(_x,_w) (((unsigned long)(_x)+(1UL<<(_w))-1) & ~((1UL<<(_w))-1))
+#endif
+
 #endif	/* __XEN_TOOLS_LIBS__ */
diff --git a/tools/libs/call/buffer.c b/tools/libs/call/buffer.c
index 0b6af2db60..085674d882 100644
--- a/tools/libs/call/buffer.c
+++ b/tools/libs/call/buffer.c
@@ -16,14 +16,13 @@
 #include <errno.h>
 #include <string.h>
 #include <pthread.h>
+#include <xen-tools/libs.h>
 
 #include "private.h"
 
 #define DBGPRINTF(_m...) \
     xtl_log(xcall->logger, XTL_DEBUG, -1, "xencall:buffer", _m)
 
-#define ROUNDUP(_x,_w) (((unsigned long)(_x)+(1UL<<(_w))-1) & ~((1UL<<(_w))-1))
-
 pthread_mutex_t cache_mutex = PTHREAD_MUTEX_INITIALIZER;
 
 static void cache_lock(xencall_handle *xcall)
diff --git a/tools/libs/foreignmemory/linux.c b/tools/libs/foreignmemory/linux.c
index 8daa5828e3..fe73d5ab72 100644
--- a/tools/libs/foreignmemory/linux.c
+++ b/tools/libs/foreignmemory/linux.c
@@ -25,11 +25,10 @@
 
 #include <sys/mman.h>
 #include <sys/ioctl.h>
+#include <xen-tools/libs.h>
 
 #include "private.h"
 
-#define ROUNDUP(_x,_w) (((unsigned long)(_x)+(1UL<<(_w))-1) & ~((1UL<<(_w))-1))
-
 #ifndef O_CLOEXEC
 #define O_CLOEXEC 0
 #endif
diff --git a/tools/libs/gnttab/private.h b/tools/libs/gnttab/private.h
index c5e23639b1..eb6a6abe54 100644
--- a/tools/libs/gnttab/private.h
+++ b/tools/libs/gnttab/private.h
@@ -5,9 +5,6 @@
 #include <xentoolcore_internal.h>
 #include <xengnttab.h>
 
-/* Set of macros/defines used by both Linux and FreeBSD */
-#define ROUNDUP(_x,_w) (((unsigned long)(_x)+(1UL<<(_w))-1) & ~((1UL<<(_w))-1))
-
 #define GTERROR(_l, _f...) xtl_log(_l, XTL_ERROR, errno, "gnttab", _f)
 #define GSERROR(_l, _f...) xtl_log(_l, XTL_ERROR, errno, "gntshr", _f)
 
diff --git a/tools/libxc/xg_private.h b/tools/libxc/xg_private.h
index f0a4b2c616..40b5baecde 100644
--- a/tools/libxc/xg_private.h
+++ b/tools/libxc/xg_private.h
@@ -95,7 +95,6 @@ typedef uint64_t x86_pgentry_t;
 #define PAGE_SIZE_X86           (1UL << PAGE_SHIFT_X86)
 #define PAGE_MASK_X86           (~(PAGE_SIZE_X86-1))
 
-#define ROUNDUP(_x,_w) (((unsigned long)(_x)+(1UL<<(_w))-1) & ~((1UL<<(_w))-1))
 #define NRPAGES(x) (ROUNDUP(x, PAGE_SHIFT) >> PAGE_SHIFT)
 
 
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 94a23179d3..c63d0686fd 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -132,9 +132,6 @@
 #define MB(_mb)     (_AC(_mb, ULL) << 20)
 #define GB(_gb)     (_AC(_gb, ULL) << 30)
 
-#define ROUNDUP(_val, _order)                                           \
-    (((unsigned long)(_val)+(1UL<<(_order))-1) & ~((1UL<<(_order))-1))
-
 #define DIV_ROUNDUP(n, d) (((n) + (d) - 1) / (d))
 
 #define MASK_EXTR(v, m) (((v) & (m)) / ((m) & -(m)))
diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 7bd959f28b..9700772d40 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -73,8 +73,6 @@ static unsigned int nr_fds;
 static int sock = -1;
 static int ro_sock = -1;
 
-#define ROUNDUP(_x, _w) (((unsigned long)(_x)+(1UL<<(_w))-1) & ~((1UL<<(_w))-1))
-
 static bool verbose = false;
 LIST_HEAD(connections);
 int tracefd = -1;
-- 
2.20.1



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

* [PATCH 06/12] tools/misc: don't use libxenctrl internals from misc tools
  2020-07-15 16:24 [PATCH 00/12] tools: move more libraries into tools/libs Ian Jackson
                   ` (5 preceding siblings ...)
  2020-07-15 16:25 ` [PATCH 05/12] tools: define ROUNDUP() in tools/include/xen-tools/libs.h Ian Jackson
@ 2020-07-15 16:25 ` Ian Jackson
  2020-07-15 17:00   ` Ian Jackson
  2020-07-15 16:25 ` [PATCH 07/12] tools/libxc: untangle libxenctrl from libxenguest Ian Jackson
                   ` (6 subsequent siblings)
  13 siblings, 1 reply; 27+ messages in thread
From: Ian Jackson @ 2020-07-15 16:25 UTC (permalink / raw)
  To: xen-devel; +Cc: Juergen Gross, ian.jackson, Wei Liu

From: Juergen Gross <jgross@suse.com>

xen-hptool and xen-mfndump are using internals from libxenctrl e.g. by
including private headers. Fix that by using either the correct
official headers or use other means.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 tools/libxc/xg_save_restore.h |  4 --
 tools/misc/Makefile           |  4 --
 tools/misc/xen-hptool.c       |  8 ++--
 tools/misc/xen-mfndump.c      | 70 +++++++++++++++++++----------------
 4 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/tools/libxc/xg_save_restore.h b/tools/libxc/xg_save_restore.h
index 303081df0d..b904296997 100644
--- a/tools/libxc/xg_save_restore.h
+++ b/tools/libxc/xg_save_restore.h
@@ -109,10 +109,6 @@ static inline int get_platform_info(xc_interface *xch, uint32_t dom,
 #define M2P_SIZE(_m)    ROUNDUP(((_m) * sizeof(xen_pfn_t)), M2P_SHIFT)
 #define M2P_CHUNKS(_m)  (M2P_SIZE((_m)) >> M2P_SHIFT)
 
-/* Returns TRUE if the PFN is currently mapped */
-#define is_mapped(pfn_type) (!((pfn_type) & 0x80000000UL))
-
-
 #define GET_FIELD(_p, _f, _w) (((_w) == 8) ? ((_p)->x64._f) : ((_p)->x32._f))
 
 #define SET_FIELD(_p, _f, _v, _w) do {          \
diff --git a/tools/misc/Makefile b/tools/misc/Makefile
index 9fdb13597f..4e2e8f3b17 100644
--- a/tools/misc/Makefile
+++ b/tools/misc/Makefile
@@ -93,15 +93,11 @@ xenhypfs: xenhypfs.o
 xenlockprof: xenlockprof.o
 	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
-# xen-hptool incorrectly uses libxc internals
-xen-hptool.o: CFLAGS += -I$(XEN_ROOT)/tools/libxc $(CFLAGS_libxencall)
 xen-hptool: xen-hptool.o
 	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenevtchn) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(APPEND_LDFLAGS)
 
 xenhypfs.o: CFLAGS += $(CFLAGS_libxenhypfs)
 
-# xen-mfndump incorrectly uses libxc internals
-xen-mfndump.o: CFLAGS += -I$(XEN_ROOT)/tools/libxc $(CFLAGS_libxencall)
 xen-mfndump: xen-mfndump.o
 	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenevtchn) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(APPEND_LDFLAGS)
 
diff --git a/tools/misc/xen-hptool.c b/tools/misc/xen-hptool.c
index 6e27d9cf43..7f17f24942 100644
--- a/tools/misc/xen-hptool.c
+++ b/tools/misc/xen-hptool.c
@@ -1,9 +1,11 @@
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
 #include <xenevtchn.h>
 #include <xenctrl.h>
-#include <xc_private.h>
-#include <xc_core.h>
+#include <xenguest.h>
 #include <xenstore.h>
-#include <unistd.h>
+#include <xen-tools/libs.h>
 
 static xc_interface *xch;
 
diff --git a/tools/misc/xen-mfndump.c b/tools/misc/xen-mfndump.c
index 858bd0e26b..39ab00eb55 100644
--- a/tools/misc/xen-mfndump.c
+++ b/tools/misc/xen-mfndump.c
@@ -1,11 +1,17 @@
-#define XC_WANT_COMPAT_MAP_FOREIGN_API
-#include <xenctrl.h>
-#include <xc_private.h>
-#include <xc_core.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
 #include <unistd.h>
 #include <inttypes.h>
 
-#include "xg_save_restore.h"
+#define XC_WANT_COMPAT_MAP_FOREIGN_API
+#include <xenctrl.h>
+#include <xenguest.h>
+
+#include <xen-tools/libs.h>
+
+#define M2P_SIZE(_m)    ROUNDUP(((_m) * sizeof(xen_pfn_t)), 21)
+#define is_mapped(pfn_type) (!((pfn_type) & 0x80000000UL))
 
 static xc_interface *xch;
 
@@ -41,13 +47,13 @@ int dump_m2p_func(int argc, char *argv[])
     /* Map M2P and obtain gpfn */
     if ( xc_maximum_ram_page(xch, &max_mfn) < 0 )
     {
-        ERROR("Failed to get the maximum mfn");
+        fprintf(stderr, "Failed to get the maximum mfn");
         return -1;
     }
 
     if ( !(m2p_table = xc_map_m2p(xch, max_mfn, PROT_READ, NULL)) )
     {
-        ERROR("Failed to map live M2P table");
+        fprintf(stderr, "Failed to map live M2P table");
         return -1;
     }
 
@@ -80,7 +86,7 @@ int dump_p2m_func(int argc, char *argv[])
     if ( xc_domain_getinfo(xch, domid, 1, &info) != 1 ||
          info.domid != domid )
     {
-        ERROR("Failed to obtain info for domain %d\n", domid);
+        fprintf(stderr, "Failed to obtain info for domain %d\n", domid);
         return -1;
     }
 
@@ -88,7 +94,7 @@ int dump_p2m_func(int argc, char *argv[])
     memset(&minfo, 0, sizeof(minfo));
     if ( xc_map_domain_meminfo(xch, domid, &minfo) )
     {
-        ERROR("Could not map domain %d memory information\n", domid);
+        fprintf(stderr, "Could not map domain %d memory information\n", domid);
         return -1;
     }
 
@@ -167,7 +173,7 @@ int dump_ptes_func(int argc, char *argv[])
     if ( xc_domain_getinfo(xch, domid, 1, &info) != 1 ||
          info.domid != domid )
     {
-        ERROR("Failed to obtain info for domain %d\n", domid);
+        fprintf(stderr, "Failed to obtain info for domain %d\n", domid);
         return -1;
     }
 
@@ -175,7 +181,7 @@ int dump_ptes_func(int argc, char *argv[])
     memset(&minfo, 0, sizeof(minfo));
     if ( xc_map_domain_meminfo(xch, domid, &minfo) )
     {
-        ERROR("Could not map domain %d memory information\n", domid);
+        fprintf(stderr, "Could not map domain %d memory information\n", domid);
         return -1;
     }
 
@@ -185,35 +191,35 @@ int dump_ptes_func(int argc, char *argv[])
          !(m2p_table = xc_map_m2p(xch, max_mfn, PROT_READ, NULL)) )
     {
         xc_unmap_domain_meminfo(xch, &minfo);
-        ERROR("Failed to map live M2P table");
+        fprintf(stderr, "Failed to map live M2P table");
         return -1;
     }
 
     pfn = m2p_table[mfn];
     if ( pfn >= minfo.p2m_size )
     {
-        ERROR("pfn 0x%lx out of range for domain %d\n", pfn, domid);
+        fprintf(stderr, "pfn 0x%lx out of range for domain %d\n", pfn, domid);
         rc = -1;
         goto out;
     }
 
     if ( !(minfo.pfn_type[pfn] & XEN_DOMCTL_PFINFO_LTABTYPE_MASK) )
     {
-        ERROR("pfn 0x%lx for domain %d is not a PT\n", pfn, domid);
+        fprintf(stderr, "pfn 0x%lx for domain %d is not a PT\n", pfn, domid);
         rc = -1;
         goto out;
     }
 
-    page = xc_map_foreign_range(xch, domid, PAGE_SIZE, PROT_READ,
+    page = xc_map_foreign_range(xch, domid, XC_PAGE_SIZE, PROT_READ,
                                 minfo.p2m_table[pfn]);
     if ( !page )
     {
-        ERROR("Failed to map 0x%lx\n", minfo.p2m_table[pfn]);
+        fprintf(stderr, "Failed to map 0x%lx\n", minfo.p2m_table[pfn]);
         rc = -1;
         goto out;
     }
 
-    pte_num = PAGE_SIZE / 8;
+    pte_num = XC_PAGE_SIZE / 8;
 
     printf(" --- Dumping %d PTEs for domain %d ---\n", pte_num, domid);
     printf(" Guest Width: %u, PT Levels: %u P2M size: = %lu\n",
@@ -249,7 +255,7 @@ int dump_ptes_func(int argc, char *argv[])
 
  out:
     if ( page )
-        munmap(page, PAGE_SIZE);
+        munmap(page, XC_PAGE_SIZE);
     xc_unmap_domain_meminfo(xch, &minfo);
     munmap(m2p_table, M2P_SIZE(max_mfn));
     return rc;
@@ -275,7 +281,7 @@ int lookup_pte_func(int argc, char *argv[])
     if ( xc_domain_getinfo(xch, domid, 1, &info) != 1 ||
          info.domid != domid )
     {
-        ERROR("Failed to obtain info for domain %d\n", domid);
+        fprintf(stderr, "Failed to obtain info for domain %d\n", domid);
         return -1;
     }
 
@@ -283,11 +289,11 @@ int lookup_pte_func(int argc, char *argv[])
     memset(&minfo, 0, sizeof(minfo));
     if ( xc_map_domain_meminfo(xch, domid, &minfo) )
     {
-        ERROR("Could not map domain %d memory information\n", domid);
+        fprintf(stderr, "Could not map domain %d memory information\n", domid);
         return -1;
     }
 
-    pte_num = PAGE_SIZE / 8;
+    pte_num = XC_PAGE_SIZE / 8;
 
     printf(" --- Lookig for PTEs mapping mfn 0x%lx for domain %d ---\n",
            mfn, domid);
@@ -299,7 +305,7 @@ int lookup_pte_func(int argc, char *argv[])
         if ( !(minfo.pfn_type[i] & XEN_DOMCTL_PFINFO_LTABTYPE_MASK) )
             continue;
 
-        page = xc_map_foreign_range(xch, domid, PAGE_SIZE, PROT_READ,
+        page = xc_map_foreign_range(xch, domid, XC_PAGE_SIZE, PROT_READ,
                                     minfo.p2m_table[i]);
         if ( !page )
             continue;
@@ -309,15 +315,15 @@ int lookup_pte_func(int argc, char *argv[])
             uint64_t pte = ((const uint64_t*)page)[j];
 
 #define __MADDR_BITS_X86  ((minfo.guest_width == 8) ? 52 : 44)
-#define __MFN_MASK_X86    ((1ULL << (__MADDR_BITS_X86 - PAGE_SHIFT_X86)) - 1)
-            if ( ((pte >> PAGE_SHIFT_X86) & __MFN_MASK_X86) == mfn)
+#define __MFN_MASK_X86    ((1ULL << (__MADDR_BITS_X86 - XC_PAGE_SHIFT)) - 1)
+            if ( ((pte >> XC_PAGE_SHIFT) & __MFN_MASK_X86) == mfn)
                 printf("  0x%lx <-- [0x%lx][%lu]: 0x%"PRIx64"\n",
                        mfn, minfo.p2m_table[i], j, pte);
 #undef __MADDR_BITS_X86
 #undef __MFN_MASK_X8
         }
 
-        munmap(page, PAGE_SIZE);
+        munmap(page, XC_PAGE_SIZE);
         page = NULL;
     }
 
@@ -348,15 +354,15 @@ int memcmp_mfns_func(int argc, char *argv[])
          xc_domain_getinfo(xch, domid2, 1, &info2) != 1 ||
          info1.domid != domid1 || info2.domid != domid2)
     {
-        ERROR("Failed to obtain info for domains\n");
+        fprintf(stderr, "Failed to obtain info for domains\n");
         return -1;
     }
 
-    page1 = xc_map_foreign_range(xch, domid1, PAGE_SIZE, PROT_READ, mfn1);
-    page2 = xc_map_foreign_range(xch, domid2, PAGE_SIZE, PROT_READ, mfn2);
+    page1 = xc_map_foreign_range(xch, domid1, XC_PAGE_SIZE, PROT_READ, mfn1);
+    page2 = xc_map_foreign_range(xch, domid2, XC_PAGE_SIZE, PROT_READ, mfn2);
     if ( !page1 || !page2 )
     {
-        ERROR("Failed to map either 0x%lx[dom %d] or 0x%lx[dom %d]\n",
+        fprintf(stderr, "Failed to map either 0x%lx[dom %d] or 0x%lx[dom %d]\n",
               mfn1, domid1, mfn2, domid2);
         rc = -1;
         goto out;
@@ -365,13 +371,13 @@ int memcmp_mfns_func(int argc, char *argv[])
     printf(" --- Comparing the content of 2 MFNs ---\n");
     printf(" 1: 0x%lx[dom %d], 2: 0x%lx[dom %d]\n",
            mfn1, domid1, mfn2, domid2);
-    printf("  memcpy(1, 2) = %d\n", memcmp(page1, page2, PAGE_SIZE));
+    printf("  memcpy(1, 2) = %d\n", memcmp(page1, page2, XC_PAGE_SIZE));
 
  out:
     if ( page1 )
-        munmap(page1, PAGE_SIZE);
+        munmap(page1, XC_PAGE_SIZE);
     if ( page2 )
-        munmap(page2, PAGE_SIZE);
+        munmap(page2, XC_PAGE_SIZE);
     return rc;
 }
 
-- 
2.20.1



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

* [PATCH 07/12] tools/libxc: untangle libxenctrl from libxenguest
  2020-07-15 16:24 [PATCH 00/12] tools: move more libraries into tools/libs Ian Jackson
                   ` (6 preceding siblings ...)
  2020-07-15 16:25 ` [PATCH 06/12] tools/misc: don't use libxenctrl internals from misc tools Ian Jackson
@ 2020-07-15 16:25 ` Ian Jackson
  2020-07-15 17:07   ` Ian Jackson
  2020-07-15 16:25 ` [PATCH 08/12] tools: move libxenctrl below tools/libs Ian Jackson
                   ` (5 subsequent siblings)
  13 siblings, 1 reply; 27+ messages in thread
From: Ian Jackson @ 2020-07-15 16:25 UTC (permalink / raw)
  To: xen-devel
  Cc: Juergen Gross, Wei Liu, ian.jackson,
	Marek Marczykowski-Górecki, Anthony PERARD, Samuel Thibault

From: Juergen Gross <jgross@suse.com>

Sources of libxenctrl and libxenguest are completely entangled. In
practice libxenguest is a user of libxenctrl, so don't let any source
libxenctrl include xg_private.h.

This can be achieved by moving all definitions used by libxenctrl from
xg_private.h to xc_private.h. Additionally xc_dom.h needs to be
exported, so rename it to xenctrl_dom.h.

Rename all libxenguest sources from xc_* to xg_*.

Move xc_[un]map_domain_meminfo() fnctions to new source xg_domain.c as
they are defined in include/xenguest.h and should be in libxenguest.

Remove xc_efi.h and xc_elf.h as they aren't used anywhere.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 stubdom/grub/kexec.c                          |   2 +-
 tools/helpers/init-xenstore-domain.c          |   2 +-
 tools/libxc/Makefile                          |  64 +++----
 .../libxc/include/{xc_dom.h => xenctrl_dom.h} |  10 +-
 tools/libxc/include/xenguest.h                |   8 +-
 tools/libxc/xc_core.c                         |   5 +-
 tools/libxc/xc_core.h                         |   2 +-
 tools/libxc/xc_core_arm.c                     |   2 +-
 tools/libxc/xc_core_x86.c                     |   6 +-
 tools/libxc/xc_domain.c                       | 129 +-------------
 tools/libxc/xc_efi.h                          | 158 ------------------
 tools/libxc/xc_elf.h                          |  16 --
 tools/libxc/xc_hcall_buf.c                    |   1 -
 tools/libxc/xc_private.c                      |   3 +-
 tools/libxc/xc_private.h                      |  36 ++++
 tools/libxc/xc_resume.c                       |   2 -
 .../libxc/{xc_cpuid_x86.c => xg_cpuid_x86.c}  |   0
 tools/libxc/{xc_dom_arm.c => xg_dom_arm.c}    |   2 +-
 ...imageloader.c => xg_dom_armzimageloader.c} |   2 +-
 ...{xc_dom_binloader.c => xg_dom_binloader.c} |   2 +-
 tools/libxc/{xc_dom_boot.c => xg_dom_boot.c}  |   2 +-
 ...bzimageloader.c => xg_dom_bzimageloader.c} |   2 +-
 ...m_compat_linux.c => xg_dom_compat_linux.c} |   2 +-
 tools/libxc/{xc_dom_core.c => xg_dom_core.c}  |   2 +-
 ...c_dom_decompress.h => xg_dom_decompress.h} |   4 +-
 ...compress_lz4.c => xg_dom_decompress_lz4.c} |   2 +-
 ...ss_unsafe.c => xg_dom_decompress_unsafe.c} |   2 +-
 ...ss_unsafe.h => xg_dom_decompress_unsafe.h} |   2 +-
 ...ip2.c => xg_dom_decompress_unsafe_bzip2.c} |   2 +-
 ...lzma.c => xg_dom_decompress_unsafe_lzma.c} |   2 +-
 ...o1x.c => xg_dom_decompress_unsafe_lzo1x.c} |   2 +-
 ...afe_xz.c => xg_dom_decompress_unsafe_xz.c} |   2 +-
 ...{xc_dom_elfloader.c => xg_dom_elfloader.c} |   2 +-
 ...{xc_dom_hvmloader.c => xg_dom_hvmloader.c} |   2 +-
 tools/libxc/{xc_dom_x86.c => xg_dom_x86.c}    |   2 +-
 tools/libxc/xg_domain.c                       | 149 +++++++++++++++++
 .../libxc/{xc_nomigrate.c => xg_nomigrate.c}  |   0
 .../{xc_offline_page.c => xg_offline_page.c}  |   2 +-
 tools/libxc/xg_private.h                      |  22 ---
 tools/libxc/xg_save_restore.h                 |   9 -
 .../libxc/{xc_sr_common.c => xg_sr_common.c}  |   2 +-
 .../libxc/{xc_sr_common.h => xg_sr_common.h}  |   4 +-
 ...{xc_sr_common_x86.c => xg_sr_common_x86.c} |   2 +-
 ...{xc_sr_common_x86.h => xg_sr_common_x86.h} |   2 +-
 ..._common_x86_pv.c => xg_sr_common_x86_pv.c} |   2 +-
 ..._common_x86_pv.h => xg_sr_common_x86_pv.h} |   2 +-
 .../{xc_sr_restore.c => xg_sr_restore.c}      |   2 +-
 ...tore_x86_hvm.c => xg_sr_restore_x86_hvm.c} |   2 +-
 ...estore_x86_pv.c => xg_sr_restore_x86_pv.c} |   2 +-
 tools/libxc/{xc_sr_save.c => xg_sr_save.c}    |   2 +-
 ...sr_save_x86_hvm.c => xg_sr_save_x86_hvm.c} |   2 +-
 ...c_sr_save_x86_pv.c => xg_sr_save_x86_pv.c} |   2 +-
 ..._stream_format.h => xg_sr_stream_format.h} |   0
 tools/libxc/{xc_suspend.c => xg_suspend.c}    |   0
 tools/libxl/libxl_arm.c                       |   2 +-
 tools/libxl/libxl_arm.h                       |   2 +-
 tools/libxl/libxl_create.c                    |   2 +-
 tools/libxl/libxl_dm.c                        |   2 +-
 tools/libxl/libxl_dom.c                       |   2 +-
 tools/libxl/libxl_internal.h                  |   2 +-
 tools/libxl/libxl_vnuma.c                     |   2 +-
 tools/libxl/libxl_x86.c                       |   2 +-
 tools/libxl/libxl_x86_acpi.c                  |   2 +-
 tools/python/xen/lowlevel/xc/xc.c             |   2 +-
 tools/xcutils/readnotes.c                     |   2 +-
 65 files changed, 284 insertions(+), 430 deletions(-)
 rename tools/libxc/include/{xc_dom.h => xenctrl_dom.h} (98%)
 delete mode 100644 tools/libxc/xc_efi.h
 delete mode 100644 tools/libxc/xc_elf.h
 rename tools/libxc/{xc_cpuid_x86.c => xg_cpuid_x86.c} (100%)
 rename tools/libxc/{xc_dom_arm.c => xg_dom_arm.c} (99%)
 rename tools/libxc/{xc_dom_armzimageloader.c => xg_dom_armzimageloader.c} (99%)
 rename tools/libxc/{xc_dom_binloader.c => xg_dom_binloader.c} (99%)
 rename tools/libxc/{xc_dom_boot.c => xg_dom_boot.c} (99%)
 rename tools/libxc/{xc_dom_bzimageloader.c => xg_dom_bzimageloader.c} (99%)
 rename tools/libxc/{xc_dom_compat_linux.c => xg_dom_compat_linux.c} (99%)
 rename tools/libxc/{xc_dom_core.c => xg_dom_core.c} (99%)
 rename tools/libxc/{xc_dom_decompress.h => xg_dom_decompress.h} (62%)
 rename tools/libxc/{xc_dom_decompress_lz4.c => xg_dom_decompress_lz4.c} (98%)
 rename tools/libxc/{xc_dom_decompress_unsafe.c => xg_dom_decompress_unsafe.c} (96%)
 rename tools/libxc/{xc_dom_decompress_unsafe.h => xg_dom_decompress_unsafe.h} (97%)
 rename tools/libxc/{xc_dom_decompress_unsafe_bzip2.c => xg_dom_decompress_unsafe_bzip2.c} (87%)
 rename tools/libxc/{xc_dom_decompress_unsafe_lzma.c => xg_dom_decompress_unsafe_lzma.c} (87%)
 rename tools/libxc/{xc_dom_decompress_unsafe_lzo1x.c => xg_dom_decompress_unsafe_lzo1x.c} (96%)
 rename tools/libxc/{xc_dom_decompress_unsafe_xz.c => xg_dom_decompress_unsafe_xz.c} (95%)
 rename tools/libxc/{xc_dom_elfloader.c => xg_dom_elfloader.c} (99%)
 rename tools/libxc/{xc_dom_hvmloader.c => xg_dom_hvmloader.c} (99%)
 rename tools/libxc/{xc_dom_x86.c => xg_dom_x86.c} (99%)
 create mode 100644 tools/libxc/xg_domain.c
 rename tools/libxc/{xc_nomigrate.c => xg_nomigrate.c} (100%)
 rename tools/libxc/{xc_offline_page.c => xg_offline_page.c} (99%)
 rename tools/libxc/{xc_sr_common.c => xg_sr_common.c} (99%)
 rename tools/libxc/{xc_sr_common.h => xg_sr_common.h} (99%)
 rename tools/libxc/{xc_sr_common_x86.c => xg_sr_common_x86.c} (99%)
 rename tools/libxc/{xc_sr_common_x86.h => xg_sr_common_x86.h} (98%)
 rename tools/libxc/{xc_sr_common_x86_pv.c => xg_sr_common_x86_pv.c} (99%)
 rename tools/libxc/{xc_sr_common_x86_pv.h => xg_sr_common_x86_pv.h} (98%)
 rename tools/libxc/{xc_sr_restore.c => xg_sr_restore.c} (99%)
 rename tools/libxc/{xc_sr_restore_x86_hvm.c => xg_sr_restore_x86_hvm.c} (99%)
 rename tools/libxc/{xc_sr_restore_x86_pv.c => xg_sr_restore_x86_pv.c} (99%)
 rename tools/libxc/{xc_sr_save.c => xg_sr_save.c} (99%)
 rename tools/libxc/{xc_sr_save_x86_hvm.c => xg_sr_save_x86_hvm.c} (99%)
 rename tools/libxc/{xc_sr_save_x86_pv.c => xg_sr_save_x86_pv.c} (99%)
 rename tools/libxc/{xc_sr_stream_format.h => xg_sr_stream_format.h} (100%)
 rename tools/libxc/{xc_suspend.c => xg_suspend.c} (100%)

diff --git a/stubdom/grub/kexec.c b/stubdom/grub/kexec.c
index 0e68b969a2..24001220a9 100644
--- a/stubdom/grub/kexec.c
+++ b/stubdom/grub/kexec.c
@@ -20,7 +20,7 @@
 #include <sys/mman.h>
 
 #include <xenctrl.h>
-#include <xc_dom.h>
+#include <xenctrl_dom.h>
 
 #include <kernel.h>
 #include <console.h>
diff --git a/tools/helpers/init-xenstore-domain.c b/tools/helpers/init-xenstore-domain.c
index 4ce8299c3c..5bdb48dc80 100644
--- a/tools/helpers/init-xenstore-domain.c
+++ b/tools/helpers/init-xenstore-domain.c
@@ -8,7 +8,7 @@
 #include <sys/ioctl.h>
 #include <sys/mman.h>
 #include <xenctrl.h>
-#include <xc_dom.h>
+#include <xenctrl_dom.h>
 #include <xenstore.h>
 #include <xen/sys/xenbus_dev.h>
 #include <xen-xsm/flask/flask.h>
diff --git a/tools/libxc/Makefile b/tools/libxc/Makefile
index 1e64116bd4..6f94b5bb4c 100644
--- a/tools/libxc/Makefile
+++ b/tools/libxc/Makefile
@@ -52,20 +52,22 @@ CTRL_SRCS-y       += xc_gnttab_compat.c
 CTRL_SRCS-y       += xc_devicemodel_compat.c
 
 GUEST_SRCS-y :=
-GUEST_SRCS-y += xg_private.c xc_suspend.c
+GUEST_SRCS-y += xg_private.c
+GUEST_SRCS-y += xg_domain.c
+GUEST_SRCS-y += xg_suspend.c
 ifeq ($(CONFIG_MIGRATE),y)
-GUEST_SRCS-y += xc_sr_common.c
-GUEST_SRCS-$(CONFIG_X86) += xc_sr_common_x86.c
-GUEST_SRCS-$(CONFIG_X86) += xc_sr_common_x86_pv.c
-GUEST_SRCS-$(CONFIG_X86) += xc_sr_restore_x86_pv.c
-GUEST_SRCS-$(CONFIG_X86) += xc_sr_restore_x86_hvm.c
-GUEST_SRCS-$(CONFIG_X86) += xc_sr_save_x86_pv.c
-GUEST_SRCS-$(CONFIG_X86) += xc_sr_save_x86_hvm.c
-GUEST_SRCS-y += xc_sr_restore.c
-GUEST_SRCS-y += xc_sr_save.c
-GUEST_SRCS-y += xc_offline_page.c
+GUEST_SRCS-y += xg_sr_common.c
+GUEST_SRCS-$(CONFIG_X86) += xg_sr_common_x86.c
+GUEST_SRCS-$(CONFIG_X86) += xg_sr_common_x86_pv.c
+GUEST_SRCS-$(CONFIG_X86) += xg_sr_restore_x86_pv.c
+GUEST_SRCS-$(CONFIG_X86) += xg_sr_restore_x86_hvm.c
+GUEST_SRCS-$(CONFIG_X86) += xg_sr_save_x86_pv.c
+GUEST_SRCS-$(CONFIG_X86) += xg_sr_save_x86_hvm.c
+GUEST_SRCS-y += xg_sr_restore.c
+GUEST_SRCS-y += xg_sr_save.c
+GUEST_SRCS-y += xg_offline_page.c
 else
-GUEST_SRCS-y += xc_nomigrate.c
+GUEST_SRCS-y += xg_nomigrate.c
 endif
 
 vpath %.c ../../xen/common/libelf
@@ -86,25 +88,26 @@ GUEST_SRCS-y                 += cpuid.c msr.c
 endif
 
 # new domain builder
-GUEST_SRCS-y                 += xc_dom_core.c xc_dom_boot.c
-GUEST_SRCS-y                 += xc_dom_elfloader.c
-GUEST_SRCS-$(CONFIG_X86)     += xc_dom_bzimageloader.c
-GUEST_SRCS-$(CONFIG_X86)     += xc_dom_decompress_lz4.c
-GUEST_SRCS-$(CONFIG_X86)     += xc_dom_hvmloader.c
-GUEST_SRCS-$(CONFIG_ARM)     += xc_dom_armzimageloader.c
-GUEST_SRCS-y                 += xc_dom_binloader.c
-GUEST_SRCS-y                 += xc_dom_compat_linux.c
-
-GUEST_SRCS-$(CONFIG_X86)     += xc_dom_x86.c
-GUEST_SRCS-$(CONFIG_X86)     += xc_cpuid_x86.c
-GUEST_SRCS-$(CONFIG_ARM)     += xc_dom_arm.c
+GUEST_SRCS-y                 += xg_dom_core.c
+GUEST_SRCS-y                 += xg_dom_boot.c
+GUEST_SRCS-y                 += xg_dom_elfloader.c
+GUEST_SRCS-$(CONFIG_X86)     += xg_dom_bzimageloader.c
+GUEST_SRCS-$(CONFIG_X86)     += xg_dom_decompress_lz4.c
+GUEST_SRCS-$(CONFIG_X86)     += xg_dom_hvmloader.c
+GUEST_SRCS-$(CONFIG_ARM)     += xg_dom_armzimageloader.c
+GUEST_SRCS-y                 += xg_dom_binloader.c
+GUEST_SRCS-y                 += xg_dom_compat_linux.c
+
+GUEST_SRCS-$(CONFIG_X86)     += xg_dom_x86.c
+GUEST_SRCS-$(CONFIG_X86)     += xg_cpuid_x86.c
+GUEST_SRCS-$(CONFIG_ARM)     += xg_dom_arm.c
 
 ifeq ($(CONFIG_LIBXC_MINIOS),y)
-GUEST_SRCS-y                 += xc_dom_decompress_unsafe.c
-GUEST_SRCS-y                 += xc_dom_decompress_unsafe_bzip2.c
-GUEST_SRCS-y                 += xc_dom_decompress_unsafe_lzma.c
-GUEST_SRCS-y                 += xc_dom_decompress_unsafe_lzo1x.c
-GUEST_SRCS-y                 += xc_dom_decompress_unsafe_xz.c
+GUEST_SRCS-y                 += xg_dom_decompress_unsafe.c
+GUEST_SRCS-y                 += xg_dom_decompress_unsafe_bzip2.c
+GUEST_SRCS-y                 += xg_dom_decompress_unsafe_lzma.c
+GUEST_SRCS-y                 += xg_dom_decompress_unsafe_lzo1x.c
+GUEST_SRCS-y                 += xg_dom_decompress_unsafe_xz.c
 endif
 
 -include $(XEN_TARGET_ARCH)/Makefile
@@ -190,7 +193,7 @@ install: build
 	$(INSTALL_DATA) libxenctrl.a $(DESTDIR)$(libdir)
 	$(SYMLINK_SHLIB) libxenctrl.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)/libxenctrl.so.$(MAJOR)
 	$(SYMLINK_SHLIB) libxenctrl.so.$(MAJOR) $(DESTDIR)$(libdir)/libxenctrl.so
-	$(INSTALL_DATA) include/xenctrl.h include/xenctrl_compat.h $(DESTDIR)$(includedir)
+	$(INSTALL_DATA) include/xenctrl.h include/xenctrl_compat.h include/xenctrl_dom.h $(DESTDIR)$(includedir)
 	$(INSTALL_SHLIB) libxenguest.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)
 	$(INSTALL_DATA) libxenguest.a $(DESTDIR)$(libdir)
 	$(SYMLINK_SHLIB) libxenguest.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)/libxenguest.so.$(MAJOR)
@@ -210,6 +213,7 @@ uninstall:
 	rm -f $(DESTDIR)$(PKG_INSTALLDIR)/xencontrol.pc
 	rm -f $(DESTDIR)$(includedir)/xenctrl.h
 	rm -f $(DESTDIR)$(includedir)/xenctrl_compat.h
+	rm -f $(DESTDIR)$(includedir)/xenctrl_dom.h
 	rm -f $(DESTDIR)$(libdir)/libxenctrl.so
 	rm -f $(DESTDIR)$(libdir)/libxenctrl.so.$(MAJOR)
 	rm -f $(DESTDIR)$(libdir)/libxenctrl.so.$(MAJOR).$(MINOR)
diff --git a/tools/libxc/include/xc_dom.h b/tools/libxc/include/xenctrl_dom.h
similarity index 98%
rename from tools/libxc/include/xc_dom.h
rename to tools/libxc/include/xenctrl_dom.h
index 52a4d6c8c0..40b85b7755 100644
--- a/tools/libxc/include/xc_dom.h
+++ b/tools/libxc/include/xenctrl_dom.h
@@ -17,9 +17,7 @@
 #define _XC_DOM_H
 
 #include <xen/libelf/libelf.h>
-#include <xenguest.h>
 
-#define INVALID_PFN ((xen_pfn_t)-1)
 #define X86_HVM_NR_SPECIAL_PAGES    8
 #define X86_HVM_END_SPECIAL_REGION  0xff000u
 #define XG_MAX_MODULES 2
@@ -38,6 +36,12 @@ struct xc_dom_seg {
     xen_pfn_t pages;
 };
 
+struct xc_hvm_firmware_module {
+    uint8_t  *data;
+    uint32_t  length;
+    uint64_t  guest_addr_out;
+};
+
 struct xc_dom_mem {
     struct xc_dom_mem *next;
     void *ptr;
@@ -255,6 +259,8 @@ struct xc_dom_arch {
     int (*setup_pgtables) (struct xc_dom_image * dom);
 
     /* arch-specific data structs setup */
+    /* in Mini-OS environment start_info might be a macro, avoid collision. */
+#undef start_info
     int (*start_info) (struct xc_dom_image * dom);
     int (*shared_info) (struct xc_dom_image * dom, void *shared_info);
     int (*vcpu) (struct xc_dom_image * dom);
diff --git a/tools/libxc/include/xenguest.h b/tools/libxc/include/xenguest.h
index 7a12d21ff2..4643384790 100644
--- a/tools/libxc/include/xenguest.h
+++ b/tools/libxc/include/xenguest.h
@@ -22,6 +22,8 @@
 #ifndef XENGUEST_H
 #define XENGUEST_H
 
+#include <xenctrl_dom.h>
+
 #define XC_NUMA_NO_NODE   (~0U)
 
 #define XCFLAGS_LIVE      (1 << 0)
@@ -249,12 +251,6 @@ int xc_linux_build(xc_interface *xch,
                    unsigned int console_evtchn,
                    unsigned long *console_mfn);
 
-struct xc_hvm_firmware_module {
-    uint8_t  *data;
-    uint32_t  length;
-    uint64_t  guest_addr_out;
-};
-
 /*
  * Sets *lockfd to -1.
  * Has deallocated everything even on error.
diff --git a/tools/libxc/xc_core.c b/tools/libxc/xc_core.c
index 2ee1d205b4..e8c6fb96f9 100644
--- a/tools/libxc/xc_core.c
+++ b/tools/libxc/xc_core.c
@@ -60,12 +60,13 @@
  *
  */
 
-#include "xg_private.h"
+#include "xc_private.h"
 #include "xc_core.h"
-#include "xc_dom.h"
 #include <stdlib.h>
 #include <unistd.h>
 
+#include <xen/libelf/libelf.h>
+
 /* number of pages to write at a time */
 #define DUMP_INCREMENT (4 * 1024)
 
diff --git a/tools/libxc/xc_core.h b/tools/libxc/xc_core.h
index ed7ed53ca5..36fb755da2 100644
--- a/tools/libxc/xc_core.h
+++ b/tools/libxc/xc_core.h
@@ -21,7 +21,7 @@
 #define XC_CORE_H
 
 #include "xen/version.h"
-#include "xg_private.h"
+#include "xc_private.h"
 #include "xen/libelf/elfstructs.h"
 
 /* section names */
diff --git a/tools/libxc/xc_core_arm.c b/tools/libxc/xc_core_arm.c
index c3c492c971..7b587b4cc5 100644
--- a/tools/libxc/xc_core_arm.c
+++ b/tools/libxc/xc_core_arm.c
@@ -16,7 +16,7 @@
  *
  */
 
-#include "xg_private.h"
+#include "xc_private.h"
 #include "xc_core.h"
 
 #include <xen-tools/libs.h>
diff --git a/tools/libxc/xc_core_x86.c b/tools/libxc/xc_core_x86.c
index 54852a2d1a..cb76e6207b 100644
--- a/tools/libxc/xc_core_x86.c
+++ b/tools/libxc/xc_core_x86.c
@@ -17,12 +17,10 @@
  *
  */
 
-#include "xg_private.h"
+#include "xc_private.h"
 #include "xc_core.h"
 #include <xen/hvm/e820.h>
 
-#define GET_FIELD(_p, _f) ((dinfo->guest_width==8) ? ((_p)->x64._f) : ((_p)->x32._f))
-
 int
 xc_core_arch_gpfn_may_present(struct xc_core_arch_context *arch_ctxt,
                               unsigned long pfn)
@@ -98,7 +96,7 @@ xc_core_arch_map_p2m_rw(xc_interface *xch, struct domain_info_context *dinfo, xc
 
     live_p2m_frame_list_list =
         xc_map_foreign_range(xch, dom, PAGE_SIZE, PROT_READ,
-                             GET_FIELD(live_shinfo, arch.pfn_to_mfn_frame_list_list));
+                             GET_FIELD(live_shinfo, arch.pfn_to_mfn_frame_list_list, dinfo->guest_width));
 
     if ( !live_p2m_frame_list_list )
     {
diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
index 71829c2bce..43fab50c06 100644
--- a/tools/libxc/xc_domain.c
+++ b/tools/libxc/xc_domain.c
@@ -21,8 +21,7 @@
 
 #include "xc_private.h"
 #include "xc_core.h"
-#include "xg_private.h"
-#include "xg_save_restore.h"
+#include "xc_private.h"
 #include <xen/memory.h>
 #include <xen/hvm/hvm_op.h>
 
@@ -1892,132 +1891,6 @@ int xc_domain_unbind_pt_spi_irq(xc_interface *xch,
                                         PT_IRQ_TYPE_SPI, 0, 0, 0, 0, spi));
 }
 
-int xc_unmap_domain_meminfo(xc_interface *xch, struct xc_domain_meminfo *minfo)
-{
-    struct domain_info_context _di = { .guest_width = minfo->guest_width,
-                                       .p2m_size = minfo->p2m_size};
-    struct domain_info_context *dinfo = &_di;
-
-    free(minfo->pfn_type);
-    if ( minfo->p2m_table )
-        munmap(minfo->p2m_table, P2M_FL_ENTRIES * PAGE_SIZE);
-    minfo->p2m_table = NULL;
-
-    return 0;
-}
-
-int xc_map_domain_meminfo(xc_interface *xch, uint32_t domid,
-                          struct xc_domain_meminfo *minfo)
-{
-    struct domain_info_context _di;
-    struct domain_info_context *dinfo = &_di;
-
-    xc_dominfo_t info;
-    shared_info_any_t *live_shinfo;
-    xen_capabilities_info_t xen_caps = "";
-    int i;
-
-    /* Only be initialized once */
-    if ( minfo->pfn_type || minfo->p2m_table )
-    {
-        errno = EINVAL;
-        return -1;
-    }
-
-    if ( xc_domain_getinfo(xch, domid, 1, &info) != 1 )
-    {
-        PERROR("Could not get domain info");
-        return -1;
-    }
-
-    if ( xc_domain_get_guest_width(xch, domid, &minfo->guest_width) )
-    {
-        PERROR("Could not get domain address size");
-        return -1;
-    }
-    _di.guest_width = minfo->guest_width;
-
-    /* Get page table levels (see get_platform_info() in xg_save_restore.h */
-    if ( xc_version(xch, XENVER_capabilities, &xen_caps) )
-    {
-        PERROR("Could not get Xen capabilities (for page table levels)");
-        return -1;
-    }
-    if ( strstr(xen_caps, "xen-3.0-x86_64") )
-        /* Depends on whether it's a compat 32-on-64 guest */
-        minfo->pt_levels = ( (minfo->guest_width == 8) ? 4 : 3 );
-    else if ( strstr(xen_caps, "xen-3.0-x86_32p") )
-        minfo->pt_levels = 3;
-    else if ( strstr(xen_caps, "xen-3.0-x86_32") )
-        minfo->pt_levels = 2;
-    else
-    {
-        errno = EFAULT;
-        return -1;
-    }
-
-    /* We need the shared info page for mapping the P2M */
-    live_shinfo = xc_map_foreign_range(xch, domid, PAGE_SIZE, PROT_READ,
-                                       info.shared_info_frame);
-    if ( !live_shinfo )
-    {
-        PERROR("Could not map the shared info frame (MFN 0x%lx)",
-               info.shared_info_frame);
-        return -1;
-    }
-
-    if ( xc_core_arch_map_p2m_writable(xch, minfo->guest_width, &info,
-                                       live_shinfo, &minfo->p2m_table,
-                                       &minfo->p2m_size) )
-    {
-        PERROR("Could not map the P2M table");
-        munmap(live_shinfo, PAGE_SIZE);
-        return -1;
-    }
-    munmap(live_shinfo, PAGE_SIZE);
-    _di.p2m_size = minfo->p2m_size;
-
-    /* Make space and prepare for getting the PFN types */
-    minfo->pfn_type = calloc(sizeof(*minfo->pfn_type), minfo->p2m_size);
-    if ( !minfo->pfn_type )
-    {
-        PERROR("Could not allocate memory for the PFN types");
-        goto failed;
-    }
-    for ( i = 0; i < minfo->p2m_size; i++ )
-        minfo->pfn_type[i] = xc_pfn_to_mfn(i, minfo->p2m_table,
-                                           minfo->guest_width);
-
-    /* Retrieve PFN types in batches */
-    for ( i = 0; i < minfo->p2m_size ; i+=1024 )
-    {
-        int count = ((minfo->p2m_size - i ) > 1024 ) ?
-                        1024: (minfo->p2m_size - i);
-
-        if ( xc_get_pfn_type_batch(xch, domid, count, minfo->pfn_type + i) )
-        {
-            PERROR("Could not get %d-eth batch of PFN types", (i+1)/1024);
-            goto failed;
-        }
-    }
-
-    return 0;
-
-failed:
-    if ( minfo->pfn_type )
-    {
-        free(minfo->pfn_type);
-        minfo->pfn_type = NULL;
-    }
-    if ( minfo->p2m_table )
-    {
-        munmap(minfo->p2m_table, P2M_FL_ENTRIES * PAGE_SIZE);
-        minfo->p2m_table = NULL;
-    }
-
-    return -1;
-}
-
 int xc_domain_memory_mapping(
     xc_interface *xch,
     uint32_t domid,
diff --git a/tools/libxc/xc_efi.h b/tools/libxc/xc_efi.h
deleted file mode 100644
index dbe105be8f..0000000000
--- a/tools/libxc/xc_efi.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Extensible Firmware Interface
- * Based on 'Extensible Firmware Interface Specification' version 0.9, April 30, 1999
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; If not, see <http://www.gnu.org/licenses/>.
- *
- * Copyright (C) 1999 VA Linux Systems
- * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
- * Copyright (C) 1999, 2002-2003 Hewlett-Packard Co.
- *      David Mosberger-Tang <davidm@hpl.hp.com>
- *      Stephane Eranian <eranian@hpl.hp.com>
- */
-
-#ifndef XC_EFI_H
-#define XC_EFI_H
-
-/* definitions from xen/include/asm-ia64/linux-xen/linux/efi.h */
-
-typedef struct {
-        uint8_t b[16];
-} efi_guid_t;
-
-#define EFI_GUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) \
-((efi_guid_t) \
-{{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
-  (b) & 0xff, ((b) >> 8) & 0xff, \
-  (c) & 0xff, ((c) >> 8) & 0xff, \
-  (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
-
-/*
- * Generic EFI table header
- */
-typedef struct {
-	uint64_t signature;
-	uint32_t revision;
-	uint32_t headersize;
-	uint32_t crc32;
-	uint32_t reserved;
-} efi_table_hdr_t;
-
-/*
- * Memory map descriptor:
- */
-
-/* Memory types: */
-#define EFI_RESERVED_TYPE                0
-#define EFI_LOADER_CODE                  1
-#define EFI_LOADER_DATA                  2
-#define EFI_BOOT_SERVICES_CODE           3
-#define EFI_BOOT_SERVICES_DATA           4
-#define EFI_RUNTIME_SERVICES_CODE        5
-#define EFI_RUNTIME_SERVICES_DATA        6
-#define EFI_CONVENTIONAL_MEMORY          7
-#define EFI_UNUSABLE_MEMORY              8
-#define EFI_ACPI_RECLAIM_MEMORY          9
-#define EFI_ACPI_MEMORY_NVS             10
-#define EFI_MEMORY_MAPPED_IO            11
-#define EFI_MEMORY_MAPPED_IO_PORT_SPACE 12
-#define EFI_PAL_CODE                    13
-#define EFI_MAX_MEMORY_TYPE             14
-
-/* Attribute values: */
-#define EFI_MEMORY_UC           ((uint64_t)0x0000000000000001ULL)    /* uncached */
-#define EFI_MEMORY_WC           ((uint64_t)0x0000000000000002ULL)    /* write-coalescing */
-#define EFI_MEMORY_WT           ((uint64_t)0x0000000000000004ULL)    /* write-through */
-#define EFI_MEMORY_WB           ((uint64_t)0x0000000000000008ULL)    /* write-back */
-#define EFI_MEMORY_WP           ((uint64_t)0x0000000000001000ULL)    /* write-protect */
-#define EFI_MEMORY_RP           ((uint64_t)0x0000000000002000ULL)    /* read-protect */
-#define EFI_MEMORY_XP           ((uint64_t)0x0000000000004000ULL)    /* execute-protect */
-#define EFI_MEMORY_RUNTIME      ((uint64_t)0x8000000000000000ULL)    /* range requires runtime mapping */
-#define EFI_MEMORY_DESCRIPTOR_VERSION   1
-
-#define EFI_PAGE_SHIFT          12
-
-/*
- * For current x86 implementations of EFI, there is
- * additional padding in the mem descriptors.  This is not
- * the case in ia64.  Need to have this fixed in the f/w.
- */
-typedef struct {
-        uint32_t type;
-        uint32_t pad;
-        uint64_t phys_addr;
-        uint64_t virt_addr;
-        uint64_t num_pages;
-        uint64_t attribute;
-#if defined (__i386__)
-        uint64_t pad1;
-#endif
-} efi_memory_desc_t;
-
-/*
- * EFI Runtime Services table
- */
-#define EFI_RUNTIME_SERVICES_SIGNATURE	((uint64_t)0x5652453544e5552ULL)
-#define EFI_RUNTIME_SERVICES_REVISION	0x00010000
-
-typedef struct {
-	efi_table_hdr_t hdr;
-	unsigned long get_time;
-	unsigned long set_time;
-	unsigned long get_wakeup_time;
-	unsigned long set_wakeup_time;
-	unsigned long set_virtual_address_map;
-	unsigned long convert_pointer;
-	unsigned long get_variable;
-	unsigned long get_next_variable;
-	unsigned long set_variable;
-	unsigned long get_next_high_mono_count;
-	unsigned long reset_system;
-} efi_runtime_services_t;
-
-/*
- *  EFI Configuration Table and GUID definitions
- */
-#define NULL_GUID \
-    EFI_GUID(  0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 )
-#define ACPI_20_TABLE_GUID    \
-    EFI_GUID(  0x8868e871, 0xe4f1, 0x11d3, 0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 )
-#define SAL_SYSTEM_TABLE_GUID    \
-    EFI_GUID(  0xeb9d2d32, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d )
-
-typedef struct {
-	efi_guid_t guid;
-	unsigned long table;
-} efi_config_table_t;
-
-#define EFI_SYSTEM_TABLE_SIGNATURE ((uint64_t)0x5453595320494249ULL)
-#define EFI_SYSTEM_TABLE_REVISION  ((1 << 16) | 00)
-
-typedef struct {
-	efi_table_hdr_t hdr;
-	unsigned long fw_vendor;	/* physical addr of CHAR16 vendor string */
-	uint32_t fw_revision;
-	unsigned long con_in_handle;
-	unsigned long con_in;
-	unsigned long con_out_handle;
-	unsigned long con_out;
-	unsigned long stderr_handle;
-	unsigned long stderr;
-	efi_runtime_services_t *runtime;
-	unsigned long boottime;
-	unsigned long nr_tables;
-	unsigned long tables;
-} efi_system_table_t;
-
-#endif /* XC_EFI_H */
diff --git a/tools/libxc/xc_elf.h b/tools/libxc/xc_elf.h
deleted file mode 100644
index acbc0280bd..0000000000
--- a/tools/libxc/xc_elf.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <xen/libelf/elfstructs.h>
diff --git a/tools/libxc/xc_hcall_buf.c b/tools/libxc/xc_hcall_buf.c
index c1230a1e2b..200671f36f 100644
--- a/tools/libxc/xc_hcall_buf.c
+++ b/tools/libxc/xc_hcall_buf.c
@@ -19,7 +19,6 @@
 #include <string.h>
 
 #include "xc_private.h"
-#include "xg_private.h"
 
 xc_hypercall_buffer_t XC__HYPERCALL_BUFFER_NAME(HYPERCALL_BUFFER_NULL) = {
     .hbuf = NULL,
diff --git a/tools/libxc/xc_private.c b/tools/libxc/xc_private.c
index 90974d572e..8af96b1b7e 100644
--- a/tools/libxc/xc_private.c
+++ b/tools/libxc/xc_private.c
@@ -18,8 +18,7 @@
  */
 
 #include "xc_private.h"
-#include "xg_private.h"
-#include "xc_dom.h"
+#include "xenctrl_dom.h"
 #include <stdarg.h>
 #include <stdlib.h>
 #include <unistd.h>
diff --git a/tools/libxc/xc_private.h b/tools/libxc/xc_private.h
index c77edb3c4c..f0b5f83ac8 100644
--- a/tools/libxc/xc_private.h
+++ b/tools/libxc/xc_private.h
@@ -26,6 +26,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <stdlib.h>
+#include <limits.h>
 #include <sys/ioctl.h>
 
 #include "_paths.h"
@@ -62,6 +63,39 @@ struct iovec {
 #include <sys/uio.h>
 #endif
 
+#define ROUNDUP(_x,_w) (((unsigned long)(_x)+(1UL<<(_w))-1) & ~((1UL<<(_w))-1))
+
+#define GET_FIELD(_p, _f, _w) (((_w) == 8) ? ((_p)->x64._f) : ((_p)->x32._f))
+
+#define SET_FIELD(_p, _f, _v, _w) do {          \
+    if ((_w) == 8)                              \
+        (_p)->x64._f = (_v);                    \
+    else                                        \
+        (_p)->x32._f = (_v);                    \
+} while (0)
+
+/* XXX SMH: following skanky macros rely on variable p2m_size being set */
+/* XXX TJD: also, "guest_width" should be the guest's sizeof(unsigned long) */
+
+struct domain_info_context {
+    unsigned int guest_width;
+    unsigned long p2m_size;
+};
+
+/* Number of xen_pfn_t in a page */
+#define FPP             (PAGE_SIZE/(dinfo->guest_width))
+
+/* Number of entries in the pfn_to_mfn_frame_list_list */
+#define P2M_FLL_ENTRIES (((dinfo->p2m_size)+(FPP*FPP)-1)/(FPP*FPP))
+
+/* Number of entries in the pfn_to_mfn_frame_list */
+#define P2M_FL_ENTRIES  (((dinfo->p2m_size)+FPP-1)/FPP)
+
+/* Size in bytes of the pfn_to_mfn_frame_list     */
+#define P2M_GUEST_FL_SIZE ((P2M_FL_ENTRIES) * (dinfo->guest_width))
+#define P2M_TOOLS_FL_SIZE ((P2M_FL_ENTRIES) *                           \
+                           max_t(size_t, sizeof(xen_pfn_t), dinfo->guest_width))
+
 #define DECLARE_DOMCTL struct xen_domctl domctl
 #define DECLARE_SYSCTL struct xen_sysctl sysctl
 #define DECLARE_PHYSDEV_OP struct physdev_op physdev_op
@@ -75,6 +109,8 @@ struct iovec {
 #define PAGE_SIZE               XC_PAGE_SIZE
 #define PAGE_MASK               XC_PAGE_MASK
 
+#define INVALID_PFN ((xen_pfn_t)-1)
+
 /*
 ** Define max dirty page cache to permit during save/restore -- need to balance 
 ** keeping cache usage down with CPU impact of invalidating too often.
diff --git a/tools/libxc/xc_resume.c b/tools/libxc/xc_resume.c
index c169204fac..94c6c9fb31 100644
--- a/tools/libxc/xc_resume.c
+++ b/tools/libxc/xc_resume.c
@@ -14,8 +14,6 @@
  */
 
 #include "xc_private.h"
-#include "xg_private.h"
-#include "xg_save_restore.h"
 
 #if defined(__i386__) || defined(__x86_64__)
 
diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xg_cpuid_x86.c
similarity index 100%
rename from tools/libxc/xc_cpuid_x86.c
rename to tools/libxc/xg_cpuid_x86.c
diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xg_dom_arm.c
similarity index 99%
rename from tools/libxc/xc_dom_arm.c
rename to tools/libxc/xg_dom_arm.c
index 931404c222..3f66f1d890 100644
--- a/tools/libxc/xc_dom_arm.c
+++ b/tools/libxc/xg_dom_arm.c
@@ -24,7 +24,7 @@
 #include <xen-tools/libs.h>
 
 #include "xg_private.h"
-#include "xc_dom.h"
+#include "xenctrl_dom.h"
 
 #define NR_MAGIC_PAGES 4
 #define CONSOLE_PFN_OFFSET 0
diff --git a/tools/libxc/xc_dom_armzimageloader.c b/tools/libxc/xg_dom_armzimageloader.c
similarity index 99%
rename from tools/libxc/xc_dom_armzimageloader.c
rename to tools/libxc/xg_dom_armzimageloader.c
index 0df8c2a4b1..4246c8e5fa 100644
--- a/tools/libxc/xc_dom_armzimageloader.c
+++ b/tools/libxc/xg_dom_armzimageloader.c
@@ -25,7 +25,7 @@
 #include <inttypes.h>
 
 #include "xg_private.h"
-#include "xc_dom.h"
+#include "xenctrl_dom.h"
 
 #include <arpa/inet.h> /* XXX ntohl is not the right function... */
 
diff --git a/tools/libxc/xc_dom_binloader.c b/tools/libxc/xg_dom_binloader.c
similarity index 99%
rename from tools/libxc/xc_dom_binloader.c
rename to tools/libxc/xg_dom_binloader.c
index d6f7f2a500..870a921427 100644
--- a/tools/libxc/xc_dom_binloader.c
+++ b/tools/libxc/xg_dom_binloader.c
@@ -83,7 +83,7 @@
 #include <inttypes.h>
 
 #include "xg_private.h"
-#include "xc_dom.h"
+#include "xenctrl_dom.h"
 
 #define round_pgup(_p)    (((_p)+(PAGE_SIZE_X86-1))&PAGE_MASK_X86)
 #define round_pgdown(_p)  ((_p)&PAGE_MASK_X86)
diff --git a/tools/libxc/xc_dom_boot.c b/tools/libxc/xg_dom_boot.c
similarity index 99%
rename from tools/libxc/xc_dom_boot.c
rename to tools/libxc/xg_dom_boot.c
index bb599b33ba..1e31e92244 100644
--- a/tools/libxc/xc_dom_boot.c
+++ b/tools/libxc/xg_dom_boot.c
@@ -31,7 +31,7 @@
 #include <zlib.h>
 
 #include "xg_private.h"
-#include "xc_dom.h"
+#include "xenctrl_dom.h"
 #include "xc_core.h"
 #include <xen/hvm/params.h>
 #include <xen/grant_table.h>
diff --git a/tools/libxc/xc_dom_bzimageloader.c b/tools/libxc/xg_dom_bzimageloader.c
similarity index 99%
rename from tools/libxc/xc_dom_bzimageloader.c
rename to tools/libxc/xg_dom_bzimageloader.c
index a7d70cc7c6..f959a77602 100644
--- a/tools/libxc/xc_dom_bzimageloader.c
+++ b/tools/libxc/xg_dom_bzimageloader.c
@@ -32,7 +32,7 @@
 #include <inttypes.h>
 
 #include "xg_private.h"
-#include "xc_dom_decompress.h"
+#include "xg_dom_decompress.h"
 
 #include <xen-tools/libs.h>
 
diff --git a/tools/libxc/xc_dom_compat_linux.c b/tools/libxc/xg_dom_compat_linux.c
similarity index 99%
rename from tools/libxc/xc_dom_compat_linux.c
rename to tools/libxc/xg_dom_compat_linux.c
index b3d43feed9..b645f0b14b 100644
--- a/tools/libxc/xc_dom_compat_linux.c
+++ b/tools/libxc/xg_dom_compat_linux.c
@@ -30,7 +30,7 @@
 
 #include "xenctrl.h"
 #include "xg_private.h"
-#include "xc_dom.h"
+#include "xenctrl_dom.h"
 
 /* ------------------------------------------------------------------------ */
 
diff --git a/tools/libxc/xc_dom_core.c b/tools/libxc/xg_dom_core.c
similarity index 99%
rename from tools/libxc/xc_dom_core.c
rename to tools/libxc/xg_dom_core.c
index 327c8a8575..1c91cce315 100644
--- a/tools/libxc/xc_dom_core.c
+++ b/tools/libxc/xg_dom_core.c
@@ -32,7 +32,7 @@
 #include <assert.h>
 
 #include "xg_private.h"
-#include "xc_dom.h"
+#include "xenctrl_dom.h"
 #include "_paths.h"
 
 /* ------------------------------------------------------------------------ */
diff --git a/tools/libxc/xc_dom_decompress.h b/tools/libxc/xg_dom_decompress.h
similarity index 62%
rename from tools/libxc/xc_dom_decompress.h
rename to tools/libxc/xg_dom_decompress.h
index 42cefa3f0e..c5ab2e59eb 100644
--- a/tools/libxc/xc_dom_decompress.h
+++ b/tools/libxc/xg_dom_decompress.h
@@ -1,7 +1,7 @@
 #ifndef __MINIOS__
-# include "xc_dom.h"
+# include "xenctrl_dom.h"
 #else
-# include "xc_dom_decompress_unsafe.h"
+# include "xg_dom_decompress_unsafe.h"
 #endif
 
 int xc_try_lz4_decode(struct xc_dom_image *dom, void **blob, size_t *size);
diff --git a/tools/libxc/xc_dom_decompress_lz4.c b/tools/libxc/xg_dom_decompress_lz4.c
similarity index 98%
rename from tools/libxc/xc_dom_decompress_lz4.c
rename to tools/libxc/xg_dom_decompress_lz4.c
index b6a33f27a8..97ba620d86 100644
--- a/tools/libxc/xc_dom_decompress_lz4.c
+++ b/tools/libxc/xg_dom_decompress_lz4.c
@@ -4,7 +4,7 @@
 #include <stdint.h>
 
 #include "xg_private.h"
-#include "xc_dom_decompress.h"
+#include "xg_dom_decompress.h"
 
 #define CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
 
diff --git a/tools/libxc/xc_dom_decompress_unsafe.c b/tools/libxc/xg_dom_decompress_unsafe.c
similarity index 96%
rename from tools/libxc/xc_dom_decompress_unsafe.c
rename to tools/libxc/xg_dom_decompress_unsafe.c
index 164e35558f..21d964787d 100644
--- a/tools/libxc/xc_dom_decompress_unsafe.c
+++ b/tools/libxc/xg_dom_decompress_unsafe.c
@@ -3,7 +3,7 @@
 #include <inttypes.h>
 
 #include "xg_private.h"
-#include "xc_dom_decompress_unsafe.h"
+#include "xg_dom_decompress_unsafe.h"
 
 static struct xc_dom_image *unsafe_dom;
 static unsigned char *output_blob;
diff --git a/tools/libxc/xc_dom_decompress_unsafe.h b/tools/libxc/xg_dom_decompress_unsafe.h
similarity index 97%
rename from tools/libxc/xc_dom_decompress_unsafe.h
rename to tools/libxc/xg_dom_decompress_unsafe.h
index 64f68864b1..fb84b6add8 100644
--- a/tools/libxc/xc_dom_decompress_unsafe.h
+++ b/tools/libxc/xg_dom_decompress_unsafe.h
@@ -1,4 +1,4 @@
-#include "xc_dom.h"
+#include "xenctrl_dom.h"
 
 typedef int decompress_fn(unsigned char *inbuf, unsigned int len,
                           int (*fill)(void*, unsigned int),
diff --git a/tools/libxc/xc_dom_decompress_unsafe_bzip2.c b/tools/libxc/xg_dom_decompress_unsafe_bzip2.c
similarity index 87%
rename from tools/libxc/xc_dom_decompress_unsafe_bzip2.c
rename to tools/libxc/xg_dom_decompress_unsafe_bzip2.c
index 4dcabe4061..9d3709e6cc 100644
--- a/tools/libxc/xc_dom_decompress_unsafe_bzip2.c
+++ b/tools/libxc/xg_dom_decompress_unsafe_bzip2.c
@@ -3,7 +3,7 @@
 #include <inttypes.h>
 
 #include "xg_private.h"
-#include "xc_dom_decompress_unsafe.h"
+#include "xg_dom_decompress_unsafe.h"
 
 #include "../../xen/common/bunzip2.c"
 
diff --git a/tools/libxc/xc_dom_decompress_unsafe_lzma.c b/tools/libxc/xg_dom_decompress_unsafe_lzma.c
similarity index 87%
rename from tools/libxc/xc_dom_decompress_unsafe_lzma.c
rename to tools/libxc/xg_dom_decompress_unsafe_lzma.c
index 4ee8cdbab1..5d178f0c43 100644
--- a/tools/libxc/xc_dom_decompress_unsafe_lzma.c
+++ b/tools/libxc/xg_dom_decompress_unsafe_lzma.c
@@ -3,7 +3,7 @@
 #include <inttypes.h>
 
 #include "xg_private.h"
-#include "xc_dom_decompress_unsafe.h"
+#include "xg_dom_decompress_unsafe.h"
 
 #include "../../xen/common/unlzma.c"
 
diff --git a/tools/libxc/xc_dom_decompress_unsafe_lzo1x.c b/tools/libxc/xg_dom_decompress_unsafe_lzo1x.c
similarity index 96%
rename from tools/libxc/xc_dom_decompress_unsafe_lzo1x.c
rename to tools/libxc/xg_dom_decompress_unsafe_lzo1x.c
index 59888b9da2..a4f8ebd42d 100644
--- a/tools/libxc/xc_dom_decompress_unsafe_lzo1x.c
+++ b/tools/libxc/xg_dom_decompress_unsafe_lzo1x.c
@@ -5,7 +5,7 @@
 #include <stdint.h>
 
 #include "xg_private.h"
-#include "xc_dom_decompress_unsafe.h"
+#include "xg_dom_decompress_unsafe.h"
 
 typedef uint8_t u8;
 typedef uint32_t u32;
diff --git a/tools/libxc/xc_dom_decompress_unsafe_xz.c b/tools/libxc/xg_dom_decompress_unsafe_xz.c
similarity index 95%
rename from tools/libxc/xc_dom_decompress_unsafe_xz.c
rename to tools/libxc/xg_dom_decompress_unsafe_xz.c
index fe7a7f49b4..ff6824b38d 100644
--- a/tools/libxc/xc_dom_decompress_unsafe_xz.c
+++ b/tools/libxc/xg_dom_decompress_unsafe_xz.c
@@ -6,7 +6,7 @@
 #include <inttypes.h>
 
 #include "xg_private.h"
-#include "xc_dom_decompress_unsafe.h"
+#include "xg_dom_decompress_unsafe.h"
 
 // TODO
 #define XZ_DEC_X86
diff --git a/tools/libxc/xc_dom_elfloader.c b/tools/libxc/xg_dom_elfloader.c
similarity index 99%
rename from tools/libxc/xc_dom_elfloader.c
rename to tools/libxc/xg_dom_elfloader.c
index b327db219d..7043c3bbba 100644
--- a/tools/libxc/xc_dom_elfloader.c
+++ b/tools/libxc/xg_dom_elfloader.c
@@ -26,7 +26,7 @@
 #include <inttypes.h>
 
 #include "xg_private.h"
-#include "xc_dom.h"
+#include "xenctrl_dom.h"
 #include "xc_bitops.h"
 
 #define XEN_VER "xen-3.0"
diff --git a/tools/libxc/xc_dom_hvmloader.c b/tools/libxc/xg_dom_hvmloader.c
similarity index 99%
rename from tools/libxc/xc_dom_hvmloader.c
rename to tools/libxc/xg_dom_hvmloader.c
index 3f0bd65547..995a0f3dc3 100644
--- a/tools/libxc/xc_dom_hvmloader.c
+++ b/tools/libxc/xg_dom_hvmloader.c
@@ -26,7 +26,7 @@
 #include <assert.h>
 
 #include "xg_private.h"
-#include "xc_dom.h"
+#include "xenctrl_dom.h"
 #include "xc_bitops.h"
 
 /* ------------------------------------------------------------------------ */
diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xg_dom_x86.c
similarity index 99%
rename from tools/libxc/xc_dom_x86.c
rename to tools/libxc/xg_dom_x86.c
index 9439805eaa..842dbcccdd 100644
--- a/tools/libxc/xc_dom_x86.c
+++ b/tools/libxc/xg_dom_x86.c
@@ -38,7 +38,7 @@
 #include <xen-tools/libs.h>
 
 #include "xg_private.h"
-#include "xc_dom.h"
+#include "xenctrl_dom.h"
 #include "xenctrl.h"
 
 /* ------------------------------------------------------------------------ */
diff --git a/tools/libxc/xg_domain.c b/tools/libxc/xg_domain.c
new file mode 100644
index 0000000000..e982f7f077
--- /dev/null
+++ b/tools/libxc/xg_domain.c
@@ -0,0 +1,149 @@
+/******************************************************************************
+ * xc_domain.c
+ *
+ * API for manipulating and obtaining information on domains.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright (c) 2003, K A Fraser.
+ */
+
+#include "xg_private.h"
+#include "xc_core.h"
+
+int xc_unmap_domain_meminfo(xc_interface *xch, struct xc_domain_meminfo *minfo)
+{
+    struct domain_info_context _di = { .guest_width = minfo->guest_width,
+                                       .p2m_size = minfo->p2m_size};
+    struct domain_info_context *dinfo = &_di;
+
+    free(minfo->pfn_type);
+    if ( minfo->p2m_table )
+        munmap(minfo->p2m_table, P2M_FL_ENTRIES * PAGE_SIZE);
+    minfo->p2m_table = NULL;
+
+    return 0;
+}
+
+int xc_map_domain_meminfo(xc_interface *xch, uint32_t domid,
+                          struct xc_domain_meminfo *minfo)
+{
+    struct domain_info_context _di;
+    struct domain_info_context *dinfo = &_di;
+
+    xc_dominfo_t info;
+    shared_info_any_t *live_shinfo;
+    xen_capabilities_info_t xen_caps = "";
+    int i;
+
+    /* Only be initialized once */
+    if ( minfo->pfn_type || minfo->p2m_table )
+    {
+        errno = EINVAL;
+        return -1;
+    }
+
+    if ( xc_domain_getinfo(xch, domid, 1, &info) != 1 )
+    {
+        PERROR("Could not get domain info");
+        return -1;
+    }
+
+    if ( xc_domain_get_guest_width(xch, domid, &minfo->guest_width) )
+    {
+        PERROR("Could not get domain address size");
+        return -1;
+    }
+    _di.guest_width = minfo->guest_width;
+
+    /* Get page table levels (see get_platform_info() in xg_save_restore.h */
+    if ( xc_version(xch, XENVER_capabilities, &xen_caps) )
+    {
+        PERROR("Could not get Xen capabilities (for page table levels)");
+        return -1;
+    }
+    if ( strstr(xen_caps, "xen-3.0-x86_64") )
+        /* Depends on whether it's a compat 32-on-64 guest */
+        minfo->pt_levels = ( (minfo->guest_width == 8) ? 4 : 3 );
+    else if ( strstr(xen_caps, "xen-3.0-x86_32p") )
+        minfo->pt_levels = 3;
+    else if ( strstr(xen_caps, "xen-3.0-x86_32") )
+        minfo->pt_levels = 2;
+    else
+    {
+        errno = EFAULT;
+        return -1;
+    }
+
+    /* We need the shared info page for mapping the P2M */
+    live_shinfo = xc_map_foreign_range(xch, domid, PAGE_SIZE, PROT_READ,
+                                       info.shared_info_frame);
+    if ( !live_shinfo )
+    {
+        PERROR("Could not map the shared info frame (MFN 0x%lx)",
+               info.shared_info_frame);
+        return -1;
+    }
+
+    if ( xc_core_arch_map_p2m_writable(xch, minfo->guest_width, &info,
+                                       live_shinfo, &minfo->p2m_table,
+                                       &minfo->p2m_size) )
+    {
+        PERROR("Could not map the P2M table");
+        munmap(live_shinfo, PAGE_SIZE);
+        return -1;
+    }
+    munmap(live_shinfo, PAGE_SIZE);
+    _di.p2m_size = minfo->p2m_size;
+
+    /* Make space and prepare for getting the PFN types */
+    minfo->pfn_type = calloc(sizeof(*minfo->pfn_type), minfo->p2m_size);
+    if ( !minfo->pfn_type )
+    {
+        PERROR("Could not allocate memory for the PFN types");
+        goto failed;
+    }
+    for ( i = 0; i < minfo->p2m_size; i++ )
+        minfo->pfn_type[i] = xc_pfn_to_mfn(i, minfo->p2m_table,
+                                           minfo->guest_width);
+
+    /* Retrieve PFN types in batches */
+    for ( i = 0; i < minfo->p2m_size ; i+=1024 )
+    {
+        int count = ((minfo->p2m_size - i ) > 1024 ) ?
+                        1024: (minfo->p2m_size - i);
+
+        if ( xc_get_pfn_type_batch(xch, domid, count, minfo->pfn_type + i) )
+        {
+            PERROR("Could not get %d-eth batch of PFN types", (i+1)/1024);
+            goto failed;
+        }
+    }
+
+    return 0;
+
+failed:
+    if ( minfo->pfn_type )
+    {
+        free(minfo->pfn_type);
+        minfo->pfn_type = NULL;
+    }
+    if ( minfo->p2m_table )
+    {
+        munmap(minfo->p2m_table, P2M_FL_ENTRIES * PAGE_SIZE);
+        minfo->p2m_table = NULL;
+    }
+
+    return -1;
+}
diff --git a/tools/libxc/xc_nomigrate.c b/tools/libxc/xg_nomigrate.c
similarity index 100%
rename from tools/libxc/xc_nomigrate.c
rename to tools/libxc/xg_nomigrate.c
diff --git a/tools/libxc/xc_offline_page.c b/tools/libxc/xg_offline_page.c
similarity index 99%
rename from tools/libxc/xc_offline_page.c
rename to tools/libxc/xg_offline_page.c
index 19538fc436..77e8889b11 100644
--- a/tools/libxc/xc_offline_page.c
+++ b/tools/libxc/xg_offline_page.c
@@ -28,7 +28,7 @@
 #include <xc_core.h>
 
 #include "xc_private.h"
-#include "xc_dom.h"
+#include "xenctrl_dom.h"
 #include "xg_private.h"
 #include "xg_save_restore.h"
 
diff --git a/tools/libxc/xg_private.h b/tools/libxc/xg_private.h
index 40b5baecde..0000b2b9b6 100644
--- a/tools/libxc/xg_private.h
+++ b/tools/libxc/xg_private.h
@@ -97,15 +97,6 @@ typedef uint64_t x86_pgentry_t;
 
 #define NRPAGES(x) (ROUNDUP(x, PAGE_SHIFT) >> PAGE_SHIFT)
 
-
-/* XXX SMH: following skanky macros rely on variable p2m_size being set */
-/* XXX TJD: also, "guest_width" should be the guest's sizeof(unsigned long) */
-
-struct domain_info_context {
-    unsigned int guest_width;
-    unsigned long p2m_size;
-};
-
 static inline xen_pfn_t xc_pfn_to_mfn(xen_pfn_t pfn, xen_pfn_t *p2m,
                                       unsigned gwidth)
 {
@@ -121,19 +112,6 @@ static inline xen_pfn_t xc_pfn_to_mfn(xen_pfn_t pfn, xen_pfn_t *p2m,
     }
 }
 
-/* Number of xen_pfn_t in a page */
-#define FPP             (PAGE_SIZE/(dinfo->guest_width))
-
-/* Number of entries in the pfn_to_mfn_frame_list_list */
-#define P2M_FLL_ENTRIES (((dinfo->p2m_size)+(FPP*FPP)-1)/(FPP*FPP))
-
-/* Number of entries in the pfn_to_mfn_frame_list */
-#define P2M_FL_ENTRIES  (((dinfo->p2m_size)+FPP-1)/FPP)
-
-/* Size in bytes of the pfn_to_mfn_frame_list     */
-#define P2M_GUEST_FL_SIZE ((P2M_FL_ENTRIES) * (dinfo->guest_width))
-#define P2M_TOOLS_FL_SIZE ((P2M_FL_ENTRIES) *                           \
-                           max_t(size_t, sizeof(xen_pfn_t), dinfo->guest_width))
 
 /* Masks for PTE<->PFN conversions */
 #define MADDR_BITS_X86  ((dinfo->guest_width == 8) ? 52 : 44)
diff --git a/tools/libxc/xg_save_restore.h b/tools/libxc/xg_save_restore.h
index b904296997..88120eb54b 100644
--- a/tools/libxc/xg_save_restore.h
+++ b/tools/libxc/xg_save_restore.h
@@ -109,15 +109,6 @@ static inline int get_platform_info(xc_interface *xch, uint32_t dom,
 #define M2P_SIZE(_m)    ROUNDUP(((_m) * sizeof(xen_pfn_t)), M2P_SHIFT)
 #define M2P_CHUNKS(_m)  (M2P_SIZE((_m)) >> M2P_SHIFT)
 
-#define GET_FIELD(_p, _f, _w) (((_w) == 8) ? ((_p)->x64._f) : ((_p)->x32._f))
-
-#define SET_FIELD(_p, _f, _v, _w) do {          \
-    if ((_w) == 8)                              \
-        (_p)->x64._f = (_v);                    \
-    else                                        \
-        (_p)->x32._f = (_v);                    \
-} while (0)
-
 #define UNFOLD_CR3(_c)                                                  \
   ((uint64_t)((dinfo->guest_width == 8)                                 \
               ? ((_c) >> 12)                                            \
diff --git a/tools/libxc/xc_sr_common.c b/tools/libxc/xg_sr_common.c
similarity index 99%
rename from tools/libxc/xc_sr_common.c
rename to tools/libxc/xg_sr_common.c
index 7c54b03414..17567ab133 100644
--- a/tools/libxc/xc_sr_common.c
+++ b/tools/libxc/xg_sr_common.c
@@ -1,6 +1,6 @@
 #include <assert.h>
 
-#include "xc_sr_common.h"
+#include "xg_sr_common.h"
 
 #include <xen-tools/libs.h>
 
diff --git a/tools/libxc/xc_sr_common.h b/tools/libxc/xg_sr_common.h
similarity index 99%
rename from tools/libxc/xc_sr_common.h
rename to tools/libxc/xg_sr_common.h
index f3bdea8006..13fcc47420 100644
--- a/tools/libxc/xc_sr_common.h
+++ b/tools/libxc/xg_sr_common.h
@@ -5,10 +5,10 @@
 
 #include "xg_private.h"
 #include "xg_save_restore.h"
-#include "xc_dom.h"
+#include "xenctrl_dom.h"
 #include "xc_bitops.h"
 
-#include "xc_sr_stream_format.h"
+#include "xg_sr_stream_format.h"
 
 /* String representation of Domain Header types. */
 const char *dhdr_type_to_str(uint32_t type);
diff --git a/tools/libxc/xc_sr_common_x86.c b/tools/libxc/xg_sr_common_x86.c
similarity index 99%
rename from tools/libxc/xc_sr_common_x86.c
rename to tools/libxc/xg_sr_common_x86.c
index 77ea044a74..6f12483907 100644
--- a/tools/libxc/xc_sr_common_x86.c
+++ b/tools/libxc/xg_sr_common_x86.c
@@ -1,4 +1,4 @@
-#include "xc_sr_common_x86.h"
+#include "xg_sr_common_x86.h"
 
 int write_x86_tsc_info(struct xc_sr_context *ctx)
 {
diff --git a/tools/libxc/xc_sr_common_x86.h b/tools/libxc/xg_sr_common_x86.h
similarity index 98%
rename from tools/libxc/xc_sr_common_x86.h
rename to tools/libxc/xg_sr_common_x86.h
index e08d81e0e7..b55758c96d 100644
--- a/tools/libxc/xc_sr_common_x86.h
+++ b/tools/libxc/xg_sr_common_x86.h
@@ -1,7 +1,7 @@
 #ifndef __COMMON_X86__H
 #define __COMMON_X86__H
 
-#include "xc_sr_common.h"
+#include "xg_sr_common.h"
 
 /*
  * Obtains a domains TSC information from Xen and writes a X86_TSC_INFO record
diff --git a/tools/libxc/xc_sr_common_x86_pv.c b/tools/libxc/xg_sr_common_x86_pv.c
similarity index 99%
rename from tools/libxc/xc_sr_common_x86_pv.c
rename to tools/libxc/xg_sr_common_x86_pv.c
index d3d425cb82..cd33406aab 100644
--- a/tools/libxc/xc_sr_common_x86_pv.c
+++ b/tools/libxc/xg_sr_common_x86_pv.c
@@ -1,6 +1,6 @@
 #include <assert.h>
 
-#include "xc_sr_common_x86_pv.h"
+#include "xg_sr_common_x86_pv.h"
 
 xen_pfn_t mfn_to_pfn(struct xc_sr_context *ctx, xen_pfn_t mfn)
 {
diff --git a/tools/libxc/xc_sr_common_x86_pv.h b/tools/libxc/xg_sr_common_x86_pv.h
similarity index 98%
rename from tools/libxc/xc_sr_common_x86_pv.h
rename to tools/libxc/xg_sr_common_x86_pv.h
index 2ed03309af..953b5bfb8d 100644
--- a/tools/libxc/xc_sr_common_x86_pv.h
+++ b/tools/libxc/xg_sr_common_x86_pv.h
@@ -1,7 +1,7 @@
 #ifndef __COMMON_X86_PV_H
 #define __COMMON_X86_PV_H
 
-#include "xc_sr_common_x86.h"
+#include "xg_sr_common_x86.h"
 
 /* Virtual address ranges reserved for hypervisor. */
 #define HYPERVISOR_VIRT_START_X86_64 0xFFFF800000000000ULL
diff --git a/tools/libxc/xc_sr_restore.c b/tools/libxc/xg_sr_restore.c
similarity index 99%
rename from tools/libxc/xc_sr_restore.c
rename to tools/libxc/xg_sr_restore.c
index bc811e6e3a..b57a787519 100644
--- a/tools/libxc/xc_sr_restore.c
+++ b/tools/libxc/xg_sr_restore.c
@@ -2,7 +2,7 @@
 
 #include <assert.h>
 
-#include "xc_sr_common.h"
+#include "xg_sr_common.h"
 
 /*
  * Read and validate the Image and Domain headers.
diff --git a/tools/libxc/xc_sr_restore_x86_hvm.c b/tools/libxc/xg_sr_restore_x86_hvm.c
similarity index 99%
rename from tools/libxc/xc_sr_restore_x86_hvm.c
rename to tools/libxc/xg_sr_restore_x86_hvm.c
index a77624cc9d..d6ea6f3012 100644
--- a/tools/libxc/xc_sr_restore_x86_hvm.c
+++ b/tools/libxc/xg_sr_restore_x86_hvm.c
@@ -1,7 +1,7 @@
 #include <assert.h>
 #include <arpa/inet.h>
 
-#include "xc_sr_common_x86.h"
+#include "xg_sr_common_x86.h"
 
 /*
  * Process an HVM_CONTEXT record from the stream.
diff --git a/tools/libxc/xc_sr_restore_x86_pv.c b/tools/libxc/xg_sr_restore_x86_pv.c
similarity index 99%
rename from tools/libxc/xc_sr_restore_x86_pv.c
rename to tools/libxc/xg_sr_restore_x86_pv.c
index d086271efb..dc50b0f5a8 100644
--- a/tools/libxc/xc_sr_restore_x86_pv.c
+++ b/tools/libxc/xg_sr_restore_x86_pv.c
@@ -1,6 +1,6 @@
 #include <assert.h>
 
-#include "xc_sr_common_x86_pv.h"
+#include "xg_sr_common_x86_pv.h"
 
 static xen_pfn_t pfn_to_mfn(const struct xc_sr_context *ctx, xen_pfn_t pfn)
 {
diff --git a/tools/libxc/xc_sr_save.c b/tools/libxc/xg_sr_save.c
similarity index 99%
rename from tools/libxc/xc_sr_save.c
rename to tools/libxc/xg_sr_save.c
index 80b1d5de1f..d74c72cba6 100644
--- a/tools/libxc/xc_sr_save.c
+++ b/tools/libxc/xg_sr_save.c
@@ -1,7 +1,7 @@
 #include <assert.h>
 #include <arpa/inet.h>
 
-#include "xc_sr_common.h"
+#include "xg_sr_common.h"
 
 /*
  * Writes an Image header and Domain header into the stream.
diff --git a/tools/libxc/xc_sr_save_x86_hvm.c b/tools/libxc/xg_sr_save_x86_hvm.c
similarity index 99%
rename from tools/libxc/xc_sr_save_x86_hvm.c
rename to tools/libxc/xg_sr_save_x86_hvm.c
index 0b2abb26bd..1634a7bc43 100644
--- a/tools/libxc/xc_sr_save_x86_hvm.c
+++ b/tools/libxc/xg_sr_save_x86_hvm.c
@@ -1,6 +1,6 @@
 #include <assert.h>
 
-#include "xc_sr_common_x86.h"
+#include "xg_sr_common_x86.h"
 
 #include <xen/hvm/params.h>
 
diff --git a/tools/libxc/xc_sr_save_x86_pv.c b/tools/libxc/xg_sr_save_x86_pv.c
similarity index 99%
rename from tools/libxc/xc_sr_save_x86_pv.c
rename to tools/libxc/xg_sr_save_x86_pv.c
index c7e246ef4f..4964f1f7b8 100644
--- a/tools/libxc/xc_sr_save_x86_pv.c
+++ b/tools/libxc/xg_sr_save_x86_pv.c
@@ -1,7 +1,7 @@
 #include <assert.h>
 #include <limits.h>
 
-#include "xc_sr_common_x86_pv.h"
+#include "xg_sr_common_x86_pv.h"
 
 /* Check a 64 bit virtual address for being canonical. */
 static inline bool is_canonical_address(xen_vaddr_t vaddr)
diff --git a/tools/libxc/xc_sr_stream_format.h b/tools/libxc/xg_sr_stream_format.h
similarity index 100%
rename from tools/libxc/xc_sr_stream_format.h
rename to tools/libxc/xg_sr_stream_format.h
diff --git a/tools/libxc/xc_suspend.c b/tools/libxc/xg_suspend.c
similarity index 100%
rename from tools/libxc/xc_suspend.c
rename to tools/libxc/xg_suspend.c
diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index 34f8a29056..975a4d730a 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -3,7 +3,7 @@
 #include "libxl_libfdt_compat.h"
 #include "libxl_arm.h"
 
-#include <xc_dom.h>
+#include <xenctrl_dom.h>
 #include <stdbool.h>
 #include <libfdt.h>
 #include <assert.h>
diff --git a/tools/libxl/libxl_arm.h b/tools/libxl/libxl_arm.h
index 8aef210d4c..52c2ab5e3a 100644
--- a/tools/libxl/libxl_arm.h
+++ b/tools/libxl/libxl_arm.h
@@ -17,7 +17,7 @@
 #include "libxl_internal.h"
 #include "libxl_arch.h"
 
-#include <xc_dom.h>
+#include <xenctrl_dom.h>
 
 _hidden
 int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 2814818e34..1031b75159 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -20,7 +20,7 @@
 #include "libxl_internal.h"
 #include "libxl_arch.h"
 
-#include <xc_dom.h>
+#include <xenctrl_dom.h>
 #include <xenguest.h>
 #include <xen/hvm/hvm_info_table.h>
 #include <xen/hvm/e820.h>
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index f2dc5696b9..fec4e0fbe5 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -19,7 +19,7 @@
 
 #include "libxl_internal.h"
 
-#include <xc_dom.h>
+#include <xenctrl_dom.h>
 #include <xen/hvm/e820.h>
 #include <sys/types.h>
 #include <pwd.h>
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index f8661e90d4..e2dca64aa1 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -20,7 +20,7 @@
 #include "libxl_internal.h"
 #include "libxl_arch.h"
 
-#include <xc_dom.h>
+#include <xenctrl_dom.h>
 #include <xen/hvm/hvm_info_table.h>
 #include <xen/hvm/hvm_xs_strings.h>
 #include <xen/hvm/e820.h>
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index c63d0686fd..e16ae9630b 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -57,7 +57,7 @@
 #include <xenctrl.h>
 #include <xenguest.h>
 #include <xenhypfs.h>
-#include <xc_dom.h>
+#include <xenctrl_dom.h>
 
 #include <xen-tools/libs.h>
 
diff --git a/tools/libxl/libxl_vnuma.c b/tools/libxl/libxl_vnuma.c
index 8ec2abb2e6..c2e144ceae 100644
--- a/tools/libxl/libxl_vnuma.c
+++ b/tools/libxl/libxl_vnuma.c
@@ -17,7 +17,7 @@
 #include "libxl_arch.h"
 #include <stdlib.h>
 
-#include <xc_dom.h>
+#include <xenctrl_dom.h>
 
 bool libxl__vnuma_configured(const libxl_domain_build_info *b_info)
 {
diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c
index e57f63282e..7d95506e00 100644
--- a/tools/libxl/libxl_x86.c
+++ b/tools/libxl/libxl_x86.c
@@ -1,7 +1,7 @@
 #include "libxl_internal.h"
 #include "libxl_arch.h"
 
-#include <xc_dom.h>
+#include <xenctrl_dom.h>
 
 int libxl__arch_domain_prepare_config(libxl__gc *gc,
                                       libxl_domain_config *d_config,
diff --git a/tools/libxl/libxl_x86_acpi.c b/tools/libxl/libxl_x86_acpi.c
index ed6610c84e..3df86c7be5 100644
--- a/tools/libxl/libxl_x86_acpi.c
+++ b/tools/libxl/libxl_x86_acpi.c
@@ -18,7 +18,7 @@
 #include <xen/hvm/e820.h>
 #include "libacpi/libacpi.h"
 
-#include <xc_dom.h>
+#include <xenctrl_dom.h>
 
  /* Number of pages holding ACPI tables */
 #define NUM_ACPI_PAGES 16
diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index 8fde5f311f..8c7b184f0b 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -17,7 +17,7 @@
 #include <arpa/inet.h>
 
 #include <xen/elfnote.h>
-#include "xc_dom.h"
+#include "xenctrl_dom.h"
 #include <xen/hvm/hvm_info_table.h>
 #include <xen/hvm/params.h>
 
diff --git a/tools/xcutils/readnotes.c b/tools/xcutils/readnotes.c
index e682dd1a21..a6b7358e70 100644
--- a/tools/xcutils/readnotes.c
+++ b/tools/xcutils/readnotes.c
@@ -12,7 +12,7 @@
 #include <sys/mman.h>
 
 #include <xg_private.h>
-#include <xc_dom.h> /* gunzip bits */
+#include <xenctrl_dom.h> /* gunzip bits */
 
 #include <xen/libelf/libelf.h>
 
-- 
2.20.1



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

* [PATCH 08/12] tools: move libxenctrl below tools/libs
  2020-07-15 16:24 [PATCH 00/12] tools: move more libraries into tools/libs Ian Jackson
                   ` (7 preceding siblings ...)
  2020-07-15 16:25 ` [PATCH 07/12] tools/libxc: untangle libxenctrl from libxenguest Ian Jackson
@ 2020-07-15 16:25 ` Ian Jackson
  2020-07-15 17:08   ` Ian Jackson
  2020-07-18 18:21   ` Samuel Thibault
  2020-07-15 16:25 ` [PATCH 09/12] tools: split libxenstore into new tools/libs/store directory Ian Jackson
                   ` (4 subsequent siblings)
  13 siblings, 2 replies; 27+ messages in thread
From: Ian Jackson @ 2020-07-15 16:25 UTC (permalink / raw)
  To: xen-devel, xen-devel
  Cc: Juergen Gross, Stefano Stabellini, Julien Grall, Wei Liu,
	Andrew Cooper, ian.jackson, George Dunlap,
	Marek Marczykowski-Górecki, Anthony PERARD, Josh Whitehead,
	Jan Beulich, Stewart Hildebrand, Samuel Thibault

From: Juergen Gross <jgross@suse.com>

Today tools/libxc needs to be built after tools/libs as libxenctrl is
depending on some libraries in tools/libs. This in turn blocks moving
other libraries depending on libxenctrl below tools/libs.

So carve out libxenctrl from tools/libxc and move it into
tools/libs/ctrl.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 .gitignore                                    |  7 ++
 MAINTAINERS                                   |  2 +-
 stubdom/Makefile                              | 29 +++++-
 stubdom/mini-os.mk                            |  2 +-
 tools/Makefile                                |  3 +
 tools/Rules.mk                                |  9 +-
 tools/libs/Makefile                           |  1 +
 tools/libs/ctrl/Makefile                      | 69 +++++++++++++
 tools/{libxc => libs/ctrl}/include/xenctrl.h  |  0
 .../ctrl}/include/xenctrl_compat.h            |  0
 .../ctrl}/include/xenctrl_dom.h               |  0
 tools/libs/ctrl/libxenctrl.map                |  3 +
 tools/{libxc => libs/ctrl}/xc_altp2m.c        |  0
 tools/{libxc => libs/ctrl}/xc_arinc653.c      |  0
 tools/{libxc => libs/ctrl}/xc_bitops.h        |  0
 tools/{libxc => libs/ctrl}/xc_core.c          |  0
 tools/{libxc => libs/ctrl}/xc_core.h          |  0
 tools/{libxc => libs/ctrl}/xc_core_arm.c      |  0
 tools/{libxc => libs/ctrl}/xc_core_arm.h      |  0
 tools/{libxc => libs/ctrl}/xc_core_x86.c      |  0
 tools/{libxc => libs/ctrl}/xc_core_x86.h      |  0
 tools/{libxc => libs/ctrl}/xc_cpu_hotplug.c   |  0
 tools/{libxc => libs/ctrl}/xc_cpupool.c       |  0
 tools/{libxc => libs/ctrl}/xc_csched.c        |  0
 tools/{libxc => libs/ctrl}/xc_csched2.c       |  0
 .../ctrl}/xc_devicemodel_compat.c             |  0
 tools/{libxc => libs/ctrl}/xc_domain.c        |  0
 tools/{libxc => libs/ctrl}/xc_evtchn.c        |  0
 tools/{libxc => libs/ctrl}/xc_evtchn_compat.c |  0
 tools/{libxc => libs/ctrl}/xc_flask.c         |  0
 .../{libxc => libs/ctrl}/xc_foreign_memory.c  |  0
 tools/{libxc => libs/ctrl}/xc_freebsd.c       |  0
 tools/{libxc => libs/ctrl}/xc_gnttab.c        |  0
 tools/{libxc => libs/ctrl}/xc_gnttab_compat.c |  0
 tools/{libxc => libs/ctrl}/xc_hcall_buf.c     |  0
 tools/{libxc => libs/ctrl}/xc_kexec.c         |  0
 tools/{libxc => libs/ctrl}/xc_linux.c         |  0
 tools/{libxc => libs/ctrl}/xc_mem_access.c    |  0
 tools/{libxc => libs/ctrl}/xc_mem_paging.c    |  0
 tools/{libxc => libs/ctrl}/xc_memshr.c        |  0
 tools/{libxc => libs/ctrl}/xc_minios.c        |  0
 tools/{libxc => libs/ctrl}/xc_misc.c          |  0
 tools/{libxc => libs/ctrl}/xc_monitor.c       |  0
 tools/{libxc => libs/ctrl}/xc_msr_x86.h       |  0
 tools/{libxc => libs/ctrl}/xc_netbsd.c        |  0
 tools/{libxc => libs/ctrl}/xc_pagetab.c       |  0
 tools/{libxc => libs/ctrl}/xc_physdev.c       |  0
 tools/{libxc => libs/ctrl}/xc_pm.c            |  0
 tools/{libxc => libs/ctrl}/xc_private.c       |  0
 tools/{libxc => libs/ctrl}/xc_private.h       |  0
 tools/{libxc => libs/ctrl}/xc_psr.c           |  0
 tools/{libxc => libs/ctrl}/xc_resource.c      |  0
 tools/{libxc => libs/ctrl}/xc_resume.c        |  0
 tools/{libxc => libs/ctrl}/xc_rt.c            |  0
 tools/{libxc => libs/ctrl}/xc_solaris.c       |  0
 tools/{libxc => libs/ctrl}/xc_tbuf.c          |  0
 tools/{libxc => libs/ctrl}/xc_vm_event.c      |  0
 .../ctrl/xenctrl.pc.in}                       |  0
 tools/libxc/Makefile                          | 99 +++----------------
 tools/libxl/Makefile                          |  2 +-
 tools/misc/Makefile                           |  1 +
 tools/python/Makefile                         |  2 +-
 tools/python/setup.py                         | 10 +-
 63 files changed, 132 insertions(+), 107 deletions(-)
 create mode 100644 tools/libs/ctrl/Makefile
 rename tools/{libxc => libs/ctrl}/include/xenctrl.h (100%)
 rename tools/{libxc => libs/ctrl}/include/xenctrl_compat.h (100%)
 rename tools/{libxc => libs/ctrl}/include/xenctrl_dom.h (100%)
 create mode 100644 tools/libs/ctrl/libxenctrl.map
 rename tools/{libxc => libs/ctrl}/xc_altp2m.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_arinc653.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_bitops.h (100%)
 rename tools/{libxc => libs/ctrl}/xc_core.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_core.h (100%)
 rename tools/{libxc => libs/ctrl}/xc_core_arm.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_core_arm.h (100%)
 rename tools/{libxc => libs/ctrl}/xc_core_x86.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_core_x86.h (100%)
 rename tools/{libxc => libs/ctrl}/xc_cpu_hotplug.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_cpupool.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_csched.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_csched2.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_devicemodel_compat.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_domain.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_evtchn.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_evtchn_compat.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_flask.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_foreign_memory.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_freebsd.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_gnttab.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_gnttab_compat.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_hcall_buf.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_kexec.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_linux.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_mem_access.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_mem_paging.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_memshr.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_minios.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_misc.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_monitor.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_msr_x86.h (100%)
 rename tools/{libxc => libs/ctrl}/xc_netbsd.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_pagetab.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_physdev.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_pm.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_private.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_private.h (100%)
 rename tools/{libxc => libs/ctrl}/xc_psr.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_resource.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_resume.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_rt.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_solaris.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_tbuf.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_vm_event.c (100%)
 rename tools/{libxc/xencontrol.pc.in => libs/ctrl/xenctrl.pc.in} (100%)

diff --git a/.gitignore b/.gitignore
index 5ea48af818..e28c21641c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -114,6 +114,8 @@ tools/libs/hypfs/headers.chk
 tools/libs/hypfs/xenhypfs.pc
 tools/libs/call/headers.chk
 tools/libs/call/xencall.pc
+tools/libs/ctrl/_paths.h
+tools/libs/ctrl/xenctrl.pc
 tools/libs/foreignmemory/headers.chk
 tools/libs/foreignmemory/xenforeignmemory.pc
 tools/libs/devicemodel/headers.chk
@@ -195,6 +197,11 @@ tools/include/xen-foreign/*.(c|h|size)
 tools/include/xen-foreign/checker
 tools/libvchan/xenvchan.pc
 tools/libxc/*.pc
+tools/libxc/xc_bitops.h
+tools/libxc/xc_core.h
+tools/libxc/xc_core_arm.h
+tools/libxc/xc_core_x86.h
+tools/libxc/xc_private.h
 tools/libxl/_libxl.api-for-check
 tools/libxl/*.api-ok
 tools/libxl/*.pc
diff --git a/MAINTAINERS b/MAINTAINERS
index e374816755..7d25ed9c95 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -226,7 +226,7 @@ M:	Stewart Hildebrand <stewart.hildebrand@dornerworks.com>
 S:	Supported
 L:	xen-devel@dornerworks.com
 F:	xen/common/sched/arinc653.c
-F:	tools/libxc/xc_arinc653.c
+F:	tools/libs/ctrl/xc_arinc653.c
 
 ARM (W/ VIRTUALISATION EXTENSIONS) ARCHITECTURE
 M:	Stefano Stabellini <sstabellini@kernel.org>
diff --git a/stubdom/Makefile b/stubdom/Makefile
index af8cde41b9..8147635ad0 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -351,13 +351,16 @@ libs-$(XEN_TARGET_ARCH)/foreignmemory/stamp: $(XEN_ROOT)/tools/libs/foreignmemor
 libs-$(XEN_TARGET_ARCH)/devicemodel/stamp: $(XEN_ROOT)/tools/libs/devicemodel/Makefile
 	$(do_links)
 
+libs-$(XEN_TARGET_ARCH)/ctrl/stamp: $(XEN_ROOT)/tools/libs/ctrl/Makefile
+	$(do_links)
+
 libxc-$(XEN_TARGET_ARCH)/stamp: $(XEN_ROOT)/tools/libxc/Makefile
 	$(do_links)
 
 xenstore/stamp: $(XEN_ROOT)/tools/xenstore/Makefile
 	$(do_links)
 
-LINK_LIBS_DIRS := toolcore toollog evtchn gnttab call foreignmemory devicemodel
+LINK_LIBS_DIRS := toolcore toollog evtchn gnttab call foreignmemory devicemodel ctrl
 LINK_DIRS := libxc-$(XEN_TARGET_ARCH) xenstore $(foreach dir,$(LINK_LIBS_DIRS),libs-$(XEN_TARGET_ARCH)/$(dir))
 LINK_STAMPS := $(foreach dir,$(LINK_DIRS),$(dir)/stamp)
 
@@ -405,6 +408,7 @@ libs-$(XEN_TARGET_ARCH)/toollog/libxentoollog.a: mk-headers-$(XEN_TARGET_ARCH) $
 
 .PHONY: libxenevtchn
 libxenevtchn: libs-$(XEN_TARGET_ARCH)/evtchn/libxenevtchn.a
+libs-$(XEN_TARGET_ARCH)/evtchn/libxenevtchn.a: libxentoolcore
 libs-$(XEN_TARGET_ARCH)/evtchn/libxenevtchn.a: mk-headers-$(XEN_TARGET_ARCH) $(NEWLIB_STAMPFILE)
 	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C libs-$(XEN_TARGET_ARCH)/evtchn
 
@@ -414,6 +418,7 @@ libs-$(XEN_TARGET_ARCH)/evtchn/libxenevtchn.a: mk-headers-$(XEN_TARGET_ARCH) $(N
 
 .PHONY: libxengnttab
 libxengnttab: libs-$(XEN_TARGET_ARCH)/gnttab/libxengnttab.a
+libs-$(XEN_TARGET_ARCH)/gnttab/libxengnttab.a: libxentoolcore libxentoollog
 libs-$(XEN_TARGET_ARCH)/gnttab/libxengnttab.a: mk-headers-$(XEN_TARGET_ARCH) $(NEWLIB_STAMPFILE)
 	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C libs-$(XEN_TARGET_ARCH)/gnttab
 
@@ -423,6 +428,7 @@ libs-$(XEN_TARGET_ARCH)/gnttab/libxengnttab.a: mk-headers-$(XEN_TARGET_ARCH) $(N
 
 .PHONY: libxencall
 libxencall: libs-$(XEN_TARGET_ARCH)/call/libxencall.a
+libs-$(XEN_TARGET_ARCH)/call/libxencall.a: libxentoolcore
 libs-$(XEN_TARGET_ARCH)/call/libxencall.a: mk-headers-$(XEN_TARGET_ARCH) $(NEWLIB_STAMPFILE)
 	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C libs-$(XEN_TARGET_ARCH)/call
 
@@ -432,6 +438,7 @@ libs-$(XEN_TARGET_ARCH)/call/libxencall.a: mk-headers-$(XEN_TARGET_ARCH) $(NEWLI
 
 .PHONY: libxenforeignmemory
 libxenforeignmemory: libs-$(XEN_TARGET_ARCH)/foreignmemory/libxenforeignmemory.a
+libs-$(XEN_TARGET_ARCH)/foreignmemory/libxenforeignmemory.a: libxentoolcore
 libs-$(XEN_TARGET_ARCH)/foreignmemory/libxenforeignmemory.a: mk-headers-$(XEN_TARGET_ARCH) $(NEWLIB_STAMPFILE)
 	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C libs-$(XEN_TARGET_ARCH)/foreignmemory
 
@@ -441,20 +448,31 @@ libs-$(XEN_TARGET_ARCH)/foreignmemory/libxenforeignmemory.a: mk-headers-$(XEN_TA
 
 .PHONY: libxendevicemodel
 libxendevicemodel: libs-$(XEN_TARGET_ARCH)/devicemodel/libxendevicemodel.a
+libs-$(XEN_TARGET_ARCH)/devicemodel/libxendevicemodel.a: libxentoolcore libxentoollog libxencall
 libs-$(XEN_TARGET_ARCH)/devicemodel/libxendevicemodel.a: mk-headers-$(XEN_TARGET_ARCH) $(NEWLIB_STAMPFILE)
 	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C libs-$(XEN_TARGET_ARCH)/devicemodel
 
+#######
+#######
+# libxenctrl
+#######
+
+.PHONY: libxenctrl
+libxenctrl: libs-$(XEN_TARGET_ARCH)/ctrl/libxenctrl.a
+libs-$(XEN_TARGET_ARCH)/ctrl/libxenctrl.a: libxentoollog libxencall libxenevtchn libxengnttab libxenforeignmemory libxendevicemodel
+libs-$(XEN_TARGET_ARCH)/ctrl/libxenctrl.a: mk-headers-$(XEN_TARGET_ARCH) $(NEWLIB_STAMPFILE)
+	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= CONFIG_LIBXC_MINIOS=y -C libs-$(XEN_TARGET_ARCH)/ctrl
+
 #######
 # libxc
 #######
 
 .PHONY: libxc
-libxc: libxc-$(XEN_TARGET_ARCH)/libxenctrl.a libxc-$(XEN_TARGET_ARCH)/libxenguest.a
-libxc-$(XEN_TARGET_ARCH)/libxenctrl.a: mk-headers-$(XEN_TARGET_ARCH) libxentoolcore libxentoollog libxenevtchn libxengnttab libxencall libxenforeignmemory libxendevicemodel cross-zlib
+libxc: libxc-$(XEN_TARGET_ARCH)/libxenguest.a
+libxc-$(XEN_TARGET_ARCH)/libxenguest.a: libxenevtchn libxenctrl cross-zlib
+libxc-$(XEN_TARGET_ARCH)/libxenguest.a: mk-headers-$(XEN_TARGET_ARCH) $(NEWLIB_STAMPFILE)
 	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= CONFIG_LIBXC_MINIOS=y -C libxc-$(XEN_TARGET_ARCH)
 
- libxc-$(XEN_TARGET_ARCH)/libxenguest.a: libxc-$(XEN_TARGET_ARCH)/libxenctrl.a
-
 #######
 # ioemu
 #######
@@ -681,6 +699,7 @@ clean:
 	[ ! -e libs-$(XEN_TARGET_ARCH)/call/Makefile ] || $(MAKE) DESTDIR= -C libs-$(XEN_TARGET_ARCH)/call clean
 	[ ! -e libs-$(XEN_TARGET_ARCH)/foreignmemory/Makefile ] || $(MAKE) DESTDIR= -C libs-$(XEN_TARGET_ARCH)/foreignmemory clean
 	[ ! -e libs-$(XEN_TARGET_ARCH)/devicemodel/Makefile ] || $(MAKE) DESTDIR= -C libs-$(XEN_TARGET_ARCH)/devicemodel clean
+	[ ! -e libs-$(XEN_TARGET_ARCH)/ctrl/Makefile ] || $(MAKE) DESTDIR= -C libs-$(XEN_TARGET_ARCH)/ctrl clean
 	[ ! -e libxc-$(XEN_TARGET_ARCH)/Makefile ] || $(MAKE) DESTDIR= -C libxc-$(XEN_TARGET_ARCH) clean
 	-[ ! -d ioemu ] || $(MAKE) DESTDIR= -C ioemu clean
 	-[ ! -d xenstore ] || $(MAKE) DESTDIR= -C xenstore clean
diff --git a/stubdom/mini-os.mk b/stubdom/mini-os.mk
index 32528bb91f..b1387df3f8 100644
--- a/stubdom/mini-os.mk
+++ b/stubdom/mini-os.mk
@@ -13,5 +13,5 @@ GNTTAB_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/gnttab
 CALL_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/call
 FOREIGNMEMORY_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/foreignmemory
 DEVICEMODEL_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/devicemodel
-CTRL_PATH = $(XEN_ROOT)/stubdom/libxc-$(MINIOS_TARGET_ARCH)
+CTRL_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/ctrl
 GUEST_PATH = $(XEN_ROOT)/stubdom/libxc-$(MINIOS_TARGET_ARCH)
diff --git a/tools/Makefile b/tools/Makefile
index c10946e3b1..7c62c599dd 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -255,6 +255,7 @@ subdir-all-qemu-xen-dir: qemu-xen-dir-find
 		-I$(XEN_ROOT)/tools/libs/gnttab/include \
 		-I$(XEN_ROOT)/tools/libs/foreignmemory/include \
 		-I$(XEN_ROOT)/tools/libs/devicemodel/include \
+		-I$(XEN_ROOT)/tools/libs/ctrl/include \
 		-I$(XEN_ROOT)/tools/libxc/include \
 		-I$(XEN_ROOT)/tools/xenstore/include \
 		-I$(XEN_ROOT)/tools/xenstore/compat/include \
@@ -266,6 +267,7 @@ subdir-all-qemu-xen-dir: qemu-xen-dir-find
 		-L$(XEN_ROOT)/tools/libs/gnttab \
 		-L$(XEN_ROOT)/tools/libs/foreignmemory \
 		-L$(XEN_ROOT)/tools/libs/devicemodel \
+		-L$(XEN_ROOT)/tools/libs/ctrl \
 		-Wl,-rpath-link=$(XEN_ROOT)/tools/libs/toolcore \
 		-Wl,-rpath-link=$(XEN_ROOT)/tools/libs/toollog \
 		-Wl,-rpath-link=$(XEN_ROOT)/tools/libs/evtchn \
@@ -273,6 +275,7 @@ subdir-all-qemu-xen-dir: qemu-xen-dir-find
 		-Wl,-rpath-link=$(XEN_ROOT)/tools/libs/call \
 		-Wl,-rpath-link=$(XEN_ROOT)/tools/libs/foreignmemory \
 		-Wl,-rpath-link=$(XEN_ROOT)/tools/libs/devicemodel \
+		-Wl,-rpath-link=$(XEN_ROOT)/tools/libs/ctrl \
 		$(QEMU_UPSTREAM_RPATH)" \
 		--bindir=$(LIBEXEC_BIN) \
 		--datadir=$(SHAREDIR)/qemu-xen \
diff --git a/tools/Rules.mk b/tools/Rules.mk
index 5d699cfd39..6bc3347a1c 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -20,9 +20,8 @@ XEN_libxencall     = $(XEN_ROOT)/tools/libs/call
 XEN_libxenforeignmemory = $(XEN_ROOT)/tools/libs/foreignmemory
 XEN_libxendevicemodel = $(XEN_ROOT)/tools/libs/devicemodel
 XEN_libxenhypfs    = $(XEN_ROOT)/tools/libs/hypfs
-XEN_libxenctrl     = $(XEN_ROOT)/tools/libxc
-# Currently libxenguest lives in the same directory as libxenctrl
-XEN_libxenguest    = $(XEN_libxenctrl)
+XEN_libxenctrl     = $(XEN_ROOT)/tools/libs/ctrl
+XEN_libxenguest    = $(XEN_ROOT)/tools/libxc
 XEN_libxenlight    = $(XEN_ROOT)/tools/libxl
 # Currently libxlutil lives in the same directory as libxenlight
 XEN_libxlutil      = $(XEN_libxenlight)
@@ -147,7 +146,7 @@ LDLIBS_libxenctrl = $(SHDEPS_libxenctrl) $(XEN_libxenctrl)/libxenctrl$(libextens
 SHLIB_libxenctrl  = $(SHDEPS_libxenctrl) -Wl,-rpath-link=$(XEN_libxenctrl)
 
 CFLAGS_libxenguest = -I$(XEN_libxenguest)/include $(CFLAGS_libxenevtchn) $(CFLAGS_libxenforeignmemory) $(CFLAGS_xeninclude)
-SHDEPS_libxenguest = $(SHLIB_libxenevtchn)
+SHDEPS_libxenguest = $(SHLIB_libxenevtchn) $(SHLIB_libxenctrl)
 LDLIBS_libxenguest = $(SHDEPS_libxenguest) $(XEN_libxenguest)/libxenguest$(libextension)
 SHLIB_libxenguest  = $(SHDEPS_libxenguest) -Wl,-rpath-link=$(XEN_libxenguest)
 
@@ -179,7 +178,7 @@ CFLAGS += -O2 -fomit-frame-pointer
 endif
 
 CFLAGS_libxenlight = -I$(XEN_libxenlight) $(CFLAGS_libxenctrl) $(CFLAGS_xeninclude)
-SHDEPS_libxenlight = $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(SHLIB_libxenhypfs)
+SHDEPS_libxenlight = $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(SHLIB_libxenhypfs) $(SHLIB_libxenguest)
 LDLIBS_libxenlight = $(SHDEPS_libxenlight) $(XEN_libxenlight)/libxenlight$(libextension)
 SHLIB_libxenlight  = $(SHDEPS_libxenlight) -Wl,-rpath-link=$(XEN_libxenlight)
 
diff --git a/tools/libs/Makefile b/tools/libs/Makefile
index 69cdfb5975..7648ea0e4c 100644
--- a/tools/libs/Makefile
+++ b/tools/libs/Makefile
@@ -9,6 +9,7 @@ SUBDIRS-y += gnttab
 SUBDIRS-y += call
 SUBDIRS-y += foreignmemory
 SUBDIRS-y += devicemodel
+SUBDIRS-y += ctrl
 SUBDIRS-y += hypfs
 
 ifeq ($(CONFIG_RUMP),y)
diff --git a/tools/libs/ctrl/Makefile b/tools/libs/ctrl/Makefile
new file mode 100644
index 0000000000..bda0b43dfa
--- /dev/null
+++ b/tools/libs/ctrl/Makefile
@@ -0,0 +1,69 @@
+XEN_ROOT = $(CURDIR)/../../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+MAJOR    = 4.14
+MINOR    = 0
+LIBNAME  := ctrl
+USELIBS  := toollog call evtchn gnttab foreignmemory devicemodel
+
+SRCS-y       += xc_altp2m.c
+SRCS-y       += xc_core.c
+SRCS-$(CONFIG_X86) += xc_core_x86.c
+SRCS-$(CONFIG_ARM) += xc_core_arm.c
+SRCS-y       += xc_cpupool.c
+SRCS-y       += xc_domain.c
+SRCS-y       += xc_evtchn.c
+SRCS-y       += xc_gnttab.c
+SRCS-y       += xc_misc.c
+SRCS-y       += xc_flask.c
+SRCS-y       += xc_physdev.c
+SRCS-y       += xc_private.c
+SRCS-y       += xc_csched.c
+SRCS-y       += xc_csched2.c
+SRCS-y       += xc_arinc653.c
+SRCS-y       += xc_rt.c
+SRCS-y       += xc_tbuf.c
+SRCS-y       += xc_pm.c
+SRCS-y       += xc_cpu_hotplug.c
+SRCS-y       += xc_resume.c
+SRCS-y       += xc_vm_event.c
+SRCS-y       += xc_monitor.c
+SRCS-y       += xc_mem_paging.c
+SRCS-y       += xc_mem_access.c
+SRCS-y       += xc_memshr.c
+SRCS-y       += xc_hcall_buf.c
+SRCS-y       += xc_foreign_memory.c
+SRCS-y       += xc_kexec.c
+SRCS-y       += xc_resource.c
+SRCS-$(CONFIG_X86) += xc_psr.c
+SRCS-$(CONFIG_X86) += xc_pagetab.c
+SRCS-$(CONFIG_Linux) += xc_linux.c
+SRCS-$(CONFIG_FreeBSD) += xc_freebsd.c
+SRCS-$(CONFIG_SunOS) += xc_solaris.c
+SRCS-$(CONFIG_NetBSD) += xc_netbsd.c
+SRCS-$(CONFIG_NetBSDRump) += xc_netbsd.c
+SRCS-$(CONFIG_MiniOS) += xc_minios.c
+SRCS-y       += xc_evtchn_compat.c
+SRCS-y       += xc_gnttab_compat.c
+SRCS-y       += xc_devicemodel_compat.c
+
+CFLAGS   += -D__XEN_TOOLS__
+CFLAGS	+= $(PTHREAD_CFLAGS)
+CFLAGS += -include $(XEN_ROOT)/tools/config.h
+
+# Needed for posix_fadvise64() in xc_linux.c
+CFLAGS-$(CONFIG_Linux) += -D_GNU_SOURCE
+
+LIBHEADER := xenctrl.h xenctrl_compat.h xenctrl_dom.h
+
+NO_HEADERS_CHK := y
+
+include $(XEN_ROOT)/tools/libs/libs.mk
+
+genpath-target = $(call buildmakevars2header,_paths.h)
+$(eval $(genpath-target))
+
+xc_private.h: _paths.h
+
+$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxenctrl)/include
+$(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
diff --git a/tools/libxc/include/xenctrl.h b/tools/libs/ctrl/include/xenctrl.h
similarity index 100%
rename from tools/libxc/include/xenctrl.h
rename to tools/libs/ctrl/include/xenctrl.h
diff --git a/tools/libxc/include/xenctrl_compat.h b/tools/libs/ctrl/include/xenctrl_compat.h
similarity index 100%
rename from tools/libxc/include/xenctrl_compat.h
rename to tools/libs/ctrl/include/xenctrl_compat.h
diff --git a/tools/libxc/include/xenctrl_dom.h b/tools/libs/ctrl/include/xenctrl_dom.h
similarity index 100%
rename from tools/libxc/include/xenctrl_dom.h
rename to tools/libs/ctrl/include/xenctrl_dom.h
diff --git a/tools/libs/ctrl/libxenctrl.map b/tools/libs/ctrl/libxenctrl.map
new file mode 100644
index 0000000000..26f1402d6d
--- /dev/null
+++ b/tools/libs/ctrl/libxenctrl.map
@@ -0,0 +1,3 @@
+VERS_4.14.0 {
+	global: *; /* Expose everything */
+};
diff --git a/tools/libxc/xc_altp2m.c b/tools/libs/ctrl/xc_altp2m.c
similarity index 100%
rename from tools/libxc/xc_altp2m.c
rename to tools/libs/ctrl/xc_altp2m.c
diff --git a/tools/libxc/xc_arinc653.c b/tools/libs/ctrl/xc_arinc653.c
similarity index 100%
rename from tools/libxc/xc_arinc653.c
rename to tools/libs/ctrl/xc_arinc653.c
diff --git a/tools/libxc/xc_bitops.h b/tools/libs/ctrl/xc_bitops.h
similarity index 100%
rename from tools/libxc/xc_bitops.h
rename to tools/libs/ctrl/xc_bitops.h
diff --git a/tools/libxc/xc_core.c b/tools/libs/ctrl/xc_core.c
similarity index 100%
rename from tools/libxc/xc_core.c
rename to tools/libs/ctrl/xc_core.c
diff --git a/tools/libxc/xc_core.h b/tools/libs/ctrl/xc_core.h
similarity index 100%
rename from tools/libxc/xc_core.h
rename to tools/libs/ctrl/xc_core.h
diff --git a/tools/libxc/xc_core_arm.c b/tools/libs/ctrl/xc_core_arm.c
similarity index 100%
rename from tools/libxc/xc_core_arm.c
rename to tools/libs/ctrl/xc_core_arm.c
diff --git a/tools/libxc/xc_core_arm.h b/tools/libs/ctrl/xc_core_arm.h
similarity index 100%
rename from tools/libxc/xc_core_arm.h
rename to tools/libs/ctrl/xc_core_arm.h
diff --git a/tools/libxc/xc_core_x86.c b/tools/libs/ctrl/xc_core_x86.c
similarity index 100%
rename from tools/libxc/xc_core_x86.c
rename to tools/libs/ctrl/xc_core_x86.c
diff --git a/tools/libxc/xc_core_x86.h b/tools/libs/ctrl/xc_core_x86.h
similarity index 100%
rename from tools/libxc/xc_core_x86.h
rename to tools/libs/ctrl/xc_core_x86.h
diff --git a/tools/libxc/xc_cpu_hotplug.c b/tools/libs/ctrl/xc_cpu_hotplug.c
similarity index 100%
rename from tools/libxc/xc_cpu_hotplug.c
rename to tools/libs/ctrl/xc_cpu_hotplug.c
diff --git a/tools/libxc/xc_cpupool.c b/tools/libs/ctrl/xc_cpupool.c
similarity index 100%
rename from tools/libxc/xc_cpupool.c
rename to tools/libs/ctrl/xc_cpupool.c
diff --git a/tools/libxc/xc_csched.c b/tools/libs/ctrl/xc_csched.c
similarity index 100%
rename from tools/libxc/xc_csched.c
rename to tools/libs/ctrl/xc_csched.c
diff --git a/tools/libxc/xc_csched2.c b/tools/libs/ctrl/xc_csched2.c
similarity index 100%
rename from tools/libxc/xc_csched2.c
rename to tools/libs/ctrl/xc_csched2.c
diff --git a/tools/libxc/xc_devicemodel_compat.c b/tools/libs/ctrl/xc_devicemodel_compat.c
similarity index 100%
rename from tools/libxc/xc_devicemodel_compat.c
rename to tools/libs/ctrl/xc_devicemodel_compat.c
diff --git a/tools/libxc/xc_domain.c b/tools/libs/ctrl/xc_domain.c
similarity index 100%
rename from tools/libxc/xc_domain.c
rename to tools/libs/ctrl/xc_domain.c
diff --git a/tools/libxc/xc_evtchn.c b/tools/libs/ctrl/xc_evtchn.c
similarity index 100%
rename from tools/libxc/xc_evtchn.c
rename to tools/libs/ctrl/xc_evtchn.c
diff --git a/tools/libxc/xc_evtchn_compat.c b/tools/libs/ctrl/xc_evtchn_compat.c
similarity index 100%
rename from tools/libxc/xc_evtchn_compat.c
rename to tools/libs/ctrl/xc_evtchn_compat.c
diff --git a/tools/libxc/xc_flask.c b/tools/libs/ctrl/xc_flask.c
similarity index 100%
rename from tools/libxc/xc_flask.c
rename to tools/libs/ctrl/xc_flask.c
diff --git a/tools/libxc/xc_foreign_memory.c b/tools/libs/ctrl/xc_foreign_memory.c
similarity index 100%
rename from tools/libxc/xc_foreign_memory.c
rename to tools/libs/ctrl/xc_foreign_memory.c
diff --git a/tools/libxc/xc_freebsd.c b/tools/libs/ctrl/xc_freebsd.c
similarity index 100%
rename from tools/libxc/xc_freebsd.c
rename to tools/libs/ctrl/xc_freebsd.c
diff --git a/tools/libxc/xc_gnttab.c b/tools/libs/ctrl/xc_gnttab.c
similarity index 100%
rename from tools/libxc/xc_gnttab.c
rename to tools/libs/ctrl/xc_gnttab.c
diff --git a/tools/libxc/xc_gnttab_compat.c b/tools/libs/ctrl/xc_gnttab_compat.c
similarity index 100%
rename from tools/libxc/xc_gnttab_compat.c
rename to tools/libs/ctrl/xc_gnttab_compat.c
diff --git a/tools/libxc/xc_hcall_buf.c b/tools/libs/ctrl/xc_hcall_buf.c
similarity index 100%
rename from tools/libxc/xc_hcall_buf.c
rename to tools/libs/ctrl/xc_hcall_buf.c
diff --git a/tools/libxc/xc_kexec.c b/tools/libs/ctrl/xc_kexec.c
similarity index 100%
rename from tools/libxc/xc_kexec.c
rename to tools/libs/ctrl/xc_kexec.c
diff --git a/tools/libxc/xc_linux.c b/tools/libs/ctrl/xc_linux.c
similarity index 100%
rename from tools/libxc/xc_linux.c
rename to tools/libs/ctrl/xc_linux.c
diff --git a/tools/libxc/xc_mem_access.c b/tools/libs/ctrl/xc_mem_access.c
similarity index 100%
rename from tools/libxc/xc_mem_access.c
rename to tools/libs/ctrl/xc_mem_access.c
diff --git a/tools/libxc/xc_mem_paging.c b/tools/libs/ctrl/xc_mem_paging.c
similarity index 100%
rename from tools/libxc/xc_mem_paging.c
rename to tools/libs/ctrl/xc_mem_paging.c
diff --git a/tools/libxc/xc_memshr.c b/tools/libs/ctrl/xc_memshr.c
similarity index 100%
rename from tools/libxc/xc_memshr.c
rename to tools/libs/ctrl/xc_memshr.c
diff --git a/tools/libxc/xc_minios.c b/tools/libs/ctrl/xc_minios.c
similarity index 100%
rename from tools/libxc/xc_minios.c
rename to tools/libs/ctrl/xc_minios.c
diff --git a/tools/libxc/xc_misc.c b/tools/libs/ctrl/xc_misc.c
similarity index 100%
rename from tools/libxc/xc_misc.c
rename to tools/libs/ctrl/xc_misc.c
diff --git a/tools/libxc/xc_monitor.c b/tools/libs/ctrl/xc_monitor.c
similarity index 100%
rename from tools/libxc/xc_monitor.c
rename to tools/libs/ctrl/xc_monitor.c
diff --git a/tools/libxc/xc_msr_x86.h b/tools/libs/ctrl/xc_msr_x86.h
similarity index 100%
rename from tools/libxc/xc_msr_x86.h
rename to tools/libs/ctrl/xc_msr_x86.h
diff --git a/tools/libxc/xc_netbsd.c b/tools/libs/ctrl/xc_netbsd.c
similarity index 100%
rename from tools/libxc/xc_netbsd.c
rename to tools/libs/ctrl/xc_netbsd.c
diff --git a/tools/libxc/xc_pagetab.c b/tools/libs/ctrl/xc_pagetab.c
similarity index 100%
rename from tools/libxc/xc_pagetab.c
rename to tools/libs/ctrl/xc_pagetab.c
diff --git a/tools/libxc/xc_physdev.c b/tools/libs/ctrl/xc_physdev.c
similarity index 100%
rename from tools/libxc/xc_physdev.c
rename to tools/libs/ctrl/xc_physdev.c
diff --git a/tools/libxc/xc_pm.c b/tools/libs/ctrl/xc_pm.c
similarity index 100%
rename from tools/libxc/xc_pm.c
rename to tools/libs/ctrl/xc_pm.c
diff --git a/tools/libxc/xc_private.c b/tools/libs/ctrl/xc_private.c
similarity index 100%
rename from tools/libxc/xc_private.c
rename to tools/libs/ctrl/xc_private.c
diff --git a/tools/libxc/xc_private.h b/tools/libs/ctrl/xc_private.h
similarity index 100%
rename from tools/libxc/xc_private.h
rename to tools/libs/ctrl/xc_private.h
diff --git a/tools/libxc/xc_psr.c b/tools/libs/ctrl/xc_psr.c
similarity index 100%
rename from tools/libxc/xc_psr.c
rename to tools/libs/ctrl/xc_psr.c
diff --git a/tools/libxc/xc_resource.c b/tools/libs/ctrl/xc_resource.c
similarity index 100%
rename from tools/libxc/xc_resource.c
rename to tools/libs/ctrl/xc_resource.c
diff --git a/tools/libxc/xc_resume.c b/tools/libs/ctrl/xc_resume.c
similarity index 100%
rename from tools/libxc/xc_resume.c
rename to tools/libs/ctrl/xc_resume.c
diff --git a/tools/libxc/xc_rt.c b/tools/libs/ctrl/xc_rt.c
similarity index 100%
rename from tools/libxc/xc_rt.c
rename to tools/libs/ctrl/xc_rt.c
diff --git a/tools/libxc/xc_solaris.c b/tools/libs/ctrl/xc_solaris.c
similarity index 100%
rename from tools/libxc/xc_solaris.c
rename to tools/libs/ctrl/xc_solaris.c
diff --git a/tools/libxc/xc_tbuf.c b/tools/libs/ctrl/xc_tbuf.c
similarity index 100%
rename from tools/libxc/xc_tbuf.c
rename to tools/libs/ctrl/xc_tbuf.c
diff --git a/tools/libxc/xc_vm_event.c b/tools/libs/ctrl/xc_vm_event.c
similarity index 100%
rename from tools/libxc/xc_vm_event.c
rename to tools/libs/ctrl/xc_vm_event.c
diff --git a/tools/libxc/xencontrol.pc.in b/tools/libs/ctrl/xenctrl.pc.in
similarity index 100%
rename from tools/libxc/xencontrol.pc.in
rename to tools/libs/ctrl/xenctrl.pc.in
diff --git a/tools/libxc/Makefile b/tools/libxc/Makefile
index 6f94b5bb4c..1312223093 100644
--- a/tools/libxc/Makefile
+++ b/tools/libxc/Makefile
@@ -9,47 +9,10 @@ ifeq ($(CONFIG_LIBXC_MINIOS),y)
 override CONFIG_MIGRATE := n
 endif
 
-CTRL_SRCS-y       :=
-CTRL_SRCS-y       += xc_altp2m.c
-CTRL_SRCS-y       += xc_core.c
-CTRL_SRCS-$(CONFIG_X86) += xc_core_x86.c
-CTRL_SRCS-$(CONFIG_ARM) += xc_core_arm.c
-CTRL_SRCS-y       += xc_cpupool.c
-CTRL_SRCS-y       += xc_domain.c
-CTRL_SRCS-y       += xc_evtchn.c
-CTRL_SRCS-y       += xc_gnttab.c
-CTRL_SRCS-y       += xc_misc.c
-CTRL_SRCS-y       += xc_flask.c
-CTRL_SRCS-y       += xc_physdev.c
-CTRL_SRCS-y       += xc_private.c
-CTRL_SRCS-y       += xc_csched.c
-CTRL_SRCS-y       += xc_csched2.c
-CTRL_SRCS-y       += xc_arinc653.c
-CTRL_SRCS-y       += xc_rt.c
-CTRL_SRCS-y       += xc_tbuf.c
-CTRL_SRCS-y       += xc_pm.c
-CTRL_SRCS-y       += xc_cpu_hotplug.c
-CTRL_SRCS-y       += xc_resume.c
-CTRL_SRCS-y       += xc_vm_event.c
-CTRL_SRCS-y       += xc_monitor.c
-CTRL_SRCS-y       += xc_mem_paging.c
-CTRL_SRCS-y       += xc_mem_access.c
-CTRL_SRCS-y       += xc_memshr.c
-CTRL_SRCS-y       += xc_hcall_buf.c
-CTRL_SRCS-y       += xc_foreign_memory.c
-CTRL_SRCS-y       += xc_kexec.c
-CTRL_SRCS-y       += xc_resource.c
-CTRL_SRCS-$(CONFIG_X86) += xc_psr.c
-CTRL_SRCS-$(CONFIG_X86) += xc_pagetab.c
-CTRL_SRCS-$(CONFIG_Linux) += xc_linux.c
-CTRL_SRCS-$(CONFIG_FreeBSD) += xc_freebsd.c
-CTRL_SRCS-$(CONFIG_SunOS) += xc_solaris.c
-CTRL_SRCS-$(CONFIG_NetBSD) += xc_netbsd.c
-CTRL_SRCS-$(CONFIG_NetBSDRump) += xc_netbsd.c
-CTRL_SRCS-$(CONFIG_MiniOS) += xc_minios.c
-CTRL_SRCS-y       += xc_evtchn_compat.c
-CTRL_SRCS-y       += xc_gnttab_compat.c
-CTRL_SRCS-y       += xc_devicemodel_compat.c
+LINK_FILES := xc_private.h xc_core.h xc_core_x86.h xc_core_arm.h xc_bitops.h
+
+$(LINK_FILES):
+	ln -sf $(XEN_ROOT)/tools/libs/ctrl/$(notdir $@) $@
 
 GUEST_SRCS-y :=
 GUEST_SRCS-y += xg_private.c
@@ -124,26 +87,14 @@ CFLAGS	+= $(CFLAGS_libxentoollog)
 CFLAGS	+= $(CFLAGS_libxenevtchn)
 CFLAGS	+= $(CFLAGS_libxendevicemodel)
 
-CTRL_LIB_OBJS := $(patsubst %.c,%.o,$(CTRL_SRCS-y))
-CTRL_PIC_OBJS := $(patsubst %.c,%.opic,$(CTRL_SRCS-y))
-
 GUEST_LIB_OBJS := $(patsubst %.c,%.o,$(GUEST_SRCS-y))
 GUEST_PIC_OBJS := $(patsubst %.c,%.opic,$(GUEST_SRCS-y))
 
-$(CTRL_LIB_OBJS) $(GUEST_LIB_OBJS) \
-$(CTRL_PIC_OBJS) $(GUEST_PIC_OBJS): CFLAGS += -include $(XEN_ROOT)/tools/config.h
+$(GUEST_LIB_OBJS) $(GUEST_PIC_OBJS): CFLAGS += -include $(XEN_ROOT)/tools/config.h
 
 # libxenguest includes xc_private.h, so needs this despite not using
 # this functionality directly.
-$(CTRL_LIB_OBJS) $(GUEST_LIB_OBJS) \
-$(CTRL_PIC_OBJS) $(GUEST_PIC_OBJS): CFLAGS += $(CFLAGS_libxencall) $(CFLAGS_libxenforeignmemory)
-
-$(CTRL_LIB_OBJS) $(CTRL_PIC_OBJS): CFLAGS += $(CFLAGS_libxengnttab)
-
-LIB := libxenctrl.a
-ifneq ($(nosharedlibs),y)
-LIB += libxenctrl.so libxenctrl.so.$(MAJOR) libxenctrl.so.$(MAJOR).$(MINOR)
-endif
+$(GUEST_LIB_OBJS) $(GUEST_PIC_OBJS): CFLAGS += $(CFLAGS_libxencall) $(CFLAGS_libxenforeignmemory)
 
 LIB += libxenguest.a
 ifneq ($(nosharedlibs),y)
@@ -155,10 +106,9 @@ $(eval $(genpath-target))
 
 xc_private.h: _paths.h
 
-$(CTRL_LIB_OBJS) $(GUEST_LIB_OBJS) \
-$(CTRL_PIC_OBJS) $(GUEST_PIC_OBJS): xc_private.h
+$(GUEST_LIB_OBJS) $(GUEST_PIC_OBJS): $(LINK_FILES)
 
-PKG_CONFIG := xencontrol.pc xenguest.pc
+PKG_CONFIG := xenguest.pc
 PKG_CONFIG_VERSION := $(MAJOR).$(MINOR)
 
 ifneq ($(CONFIG_LIBXC_MINIOS),y)
@@ -189,17 +139,11 @@ libs: $(LIB) $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL)
 install: build
 	$(INSTALL_DIR) $(DESTDIR)$(libdir)
 	$(INSTALL_DIR) $(DESTDIR)$(includedir)
-	$(INSTALL_SHLIB) libxenctrl.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)
-	$(INSTALL_DATA) libxenctrl.a $(DESTDIR)$(libdir)
-	$(SYMLINK_SHLIB) libxenctrl.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)/libxenctrl.so.$(MAJOR)
-	$(SYMLINK_SHLIB) libxenctrl.so.$(MAJOR) $(DESTDIR)$(libdir)/libxenctrl.so
-	$(INSTALL_DATA) include/xenctrl.h include/xenctrl_compat.h include/xenctrl_dom.h $(DESTDIR)$(includedir)
 	$(INSTALL_SHLIB) libxenguest.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)
 	$(INSTALL_DATA) libxenguest.a $(DESTDIR)$(libdir)
 	$(SYMLINK_SHLIB) libxenguest.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)/libxenguest.so.$(MAJOR)
 	$(SYMLINK_SHLIB) libxenguest.so.$(MAJOR) $(DESTDIR)$(libdir)/libxenguest.so
 	$(INSTALL_DATA) include/xenguest.h $(DESTDIR)$(includedir)
-	$(INSTALL_DATA) xencontrol.pc $(DESTDIR)$(PKG_INSTALLDIR)
 	$(INSTALL_DATA) xenguest.pc $(DESTDIR)$(PKG_INSTALLDIR)
 
 .PHONY: uninstall
@@ -210,14 +154,6 @@ uninstall:
 	rm -f $(DESTDIR)$(libdir)/libxenguest.so.$(MAJOR)
 	rm -f $(DESTDIR)$(libdir)/libxenguest.so.$(MAJOR).$(MINOR)
 	rm -f $(DESTDIR)$(libdir)/libxenguest.a
-	rm -f $(DESTDIR)$(PKG_INSTALLDIR)/xencontrol.pc
-	rm -f $(DESTDIR)$(includedir)/xenctrl.h
-	rm -f $(DESTDIR)$(includedir)/xenctrl_compat.h
-	rm -f $(DESTDIR)$(includedir)/xenctrl_dom.h
-	rm -f $(DESTDIR)$(libdir)/libxenctrl.so
-	rm -f $(DESTDIR)$(libdir)/libxenctrl.so.$(MAJOR)
-	rm -f $(DESTDIR)$(libdir)/libxenctrl.so.$(MAJOR).$(MINOR)
-	rm -f $(DESTDIR)$(libdir)/libxenctrl.a
 
 .PHONY: TAGS
 TAGS:
@@ -227,8 +163,8 @@ TAGS:
 clean:
 	rm -rf *.rpm $(LIB) *~ $(DEPS_RM) \
             _paths.h \
-	    xencontrol.pc xenguest.pc \
-            $(CTRL_LIB_OBJS) $(CTRL_PIC_OBJS) \
+	    $(LINK_FILES) \
+	    xenguest.pc \
             $(GUEST_LIB_OBJS) $(GUEST_PIC_OBJS)
 
 .PHONY: distclean
@@ -244,19 +180,6 @@ rpm: build
 	mv staging/i386/*.rpm .
 	rm -rf staging
 
-# libxenctrl
-
-libxenctrl.a: $(CTRL_LIB_OBJS)
-	$(AR) rc $@ $^
-
-libxenctrl.so: libxenctrl.so.$(MAJOR)
-	$(SYMLINK_SHLIB) $< $@
-libxenctrl.so.$(MAJOR): libxenctrl.so.$(MAJOR).$(MINOR)
-	$(SYMLINK_SHLIB) $< $@
-
-libxenctrl.so.$(MAJOR).$(MINOR): $(CTRL_PIC_OBJS)
-	$(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenctrl.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(LDLIBS_libxentoollog) $(LDLIBS_libxenevtchn) $(LDLIBS_libxengnttab) $(LDLIBS_libxencall) $(LDLIBS_libxenforeignmemory) $(LDLIBS_libxendevicemodel) $(PTHREAD_LIBS) $(APPEND_LDFLAGS)
-
 # libxenguest
 
 libxenguest.a: $(GUEST_LIB_OBJS)
@@ -277,7 +200,7 @@ xc_dom_bzimageloader.o: CFLAGS += $(filter -D%,$(zlib-options))
 xc_dom_bzimageloader.opic: CFLAGS += $(filter -D%,$(zlib-options))
 
 libxenguest.so.$(MAJOR).$(MINOR): COMPRESSION_LIBS = $(filter -l%,$(zlib-options))
-libxenguest.so.$(MAJOR).$(MINOR): $(GUEST_PIC_OBJS) libxenctrl.so
+libxenguest.so.$(MAJOR).$(MINOR): $(GUEST_PIC_OBJS)
 	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenguest.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(GUEST_PIC_OBJS) $(COMPRESSION_LIBS) -lz $(LDLIBS_libxenevtchn) $(LDLIBS_libxenctrl) $(PTHREAD_LIBS) $(APPEND_LDFLAGS)
 
 -include $(DEPS_INCLUDE)
diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile
index 38cd43abae..b1cd5d8ef2 100644
--- a/tools/libxl/Makefile
+++ b/tools/libxl/Makefile
@@ -188,7 +188,7 @@ libxl_dom.o: CFLAGS += -I$(XEN_ROOT)/tools  # include libacpi/x86.h
 libxl_x86_acpi.o: CFLAGS += -I$(XEN_ROOT)/tools
 
 SAVE_HELPER_OBJS = libxl_save_helper.o _libxl_save_msgs_helper.o
-$(SAVE_HELPER_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenevtchn)
+$(SAVE_HELPER_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenevtchn) $(CFLAGS_libxenguest)
 
 PKG_CONFIG = xenlight.pc xlutil.pc
 PKG_CONFIG_VERSION := $(MAJOR).$(MINOR)
diff --git a/tools/misc/Makefile b/tools/misc/Makefile
index 4e2e8f3b17..7d37f297a9 100644
--- a/tools/misc/Makefile
+++ b/tools/misc/Makefile
@@ -6,6 +6,7 @@ CFLAGS += -Werror
 CFLAGS += -include $(XEN_ROOT)/tools/config.h
 CFLAGS += $(CFLAGS_libxenevtchn)
 CFLAGS += $(CFLAGS_libxenctrl)
+CFLAGS += $(CFLAGS_libxenguest)
 CFLAGS += $(CFLAGS_xeninclude)
 CFLAGS += $(CFLAGS_libxenstore)
 
diff --git a/tools/python/Makefile b/tools/python/Makefile
index 8d22c03676..bd3d62a36c 100644
--- a/tools/python/Makefile
+++ b/tools/python/Makefile
@@ -33,7 +33,7 @@ uninstall:
 
 .PHONY: test
 test:
-	LD_LIBRARY_PATH=$$(readlink -f ../libxc):$$(readlink -f ../xenstore) $(PYTHON) -m unittest discover
+	LD_LIBRARY_PATH=$$(readlink -f ../libs/ctrl):$$(readlink -f ../libxc):$$(readlink -f ../xenstore) $(PYTHON) -m unittest discover
 
 .PHONY: clean
 clean:
diff --git a/tools/python/setup.py b/tools/python/setup.py
index 8faf1c0ddc..24b284af39 100644
--- a/tools/python/setup.py
+++ b/tools/python/setup.py
@@ -9,7 +9,7 @@ extra_compile_args  = [ "-fno-strict-aliasing", "-Werror" ]
 PATH_XEN      = XEN_ROOT + "/tools/include"
 PATH_LIBXENTOOLLOG = XEN_ROOT + "/tools/libs/toollog"
 PATH_LIBXENEVTCHN = XEN_ROOT + "/tools/libs/evtchn"
-PATH_LIBXC    = XEN_ROOT + "/tools/libxc"
+PATH_LIBXENCTRL = XEN_ROOT + "/tools/libs/ctrl"
 PATH_LIBXL    = XEN_ROOT + "/tools/libxl"
 PATH_XENSTORE = XEN_ROOT + "/tools/xenstore"
 
@@ -18,11 +18,11 @@ xc = Extension("xc",
                include_dirs       = [ PATH_XEN,
                                       PATH_LIBXENTOOLLOG + "/include",
                                       PATH_LIBXENEVTCHN + "/include",
-                                      PATH_LIBXC + "/include",
+                                      PATH_LIBXENCTRL + "/include",
                                       "xen/lowlevel/xc" ],
-               library_dirs       = [ PATH_LIBXC ],
-               libraries          = [ "xenctrl", "xenguest" ],
-               depends            = [ PATH_LIBXC + "/libxenctrl.so", PATH_LIBXC + "/libxenguest.so" ],
+               library_dirs       = [ PATH_LIBXENCTRL ],
+               libraries          = [ "xenctrl" ],
+               depends            = [ PATH_LIBXENCTRL + "/libxenctrl.so" ],
                extra_link_args    = [ "-Wl,-rpath-link="+PATH_LIBXENTOOLLOG ],
                sources            = [ "xen/lowlevel/xc/xc.c" ])
 
-- 
2.20.1



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

* [PATCH 09/12] tools: split libxenstore into new tools/libs/store directory
  2020-07-15 16:24 [PATCH 00/12] tools: move more libraries into tools/libs Ian Jackson
                   ` (8 preceding siblings ...)
  2020-07-15 16:25 ` [PATCH 08/12] tools: move libxenctrl below tools/libs Ian Jackson
@ 2020-07-15 16:25 ` Ian Jackson
  2020-07-15 16:25 ` [PATCH 10/12] tools: split libxenvchan into new tools/libs/vchan directory Ian Jackson
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 27+ messages in thread
From: Ian Jackson @ 2020-07-15 16:25 UTC (permalink / raw)
  To: xen-devel
  Cc: Juergen Gross, Stefano Stabellini, Julien Grall, Wei Liu,
	Andrew Cooper, ian.jackson, George Dunlap,
	Marek Marczykowski-Górecki, Jan Beulich, Samuel Thibault

From: Juergen Gross <jgross@suse.com>

There is no reason why libxenstore is not placed in the tools/libs
directory.

The common files between libxenstore and xenstored are kept in the
tools/xenstore directory to be easily accessible by xenstore-stubdom
which needs the xenstored files to be built.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 .gitignore                                    |  7 +-
 stubdom/mini-os.mk                            |  2 +-
 tools/Makefile                                |  8 +-
 tools/Rules.mk                                |  2 +-
 tools/libs/Makefile                           |  1 +
 tools/libs/store/Makefile                     | 66 +++++++++++++++
 .../store}/include/compat/xs.h                |  0
 .../store}/include/compat/xs_lib.h            |  0
 .../store}/include/xenstore.h                 |  0
 tools/libs/store/libxenstore.map              | 49 +++++++++++
 tools/{xenstore => libs/store}/xenstore.pc.in |  0
 tools/{xenstore => libs/store}/xs.c           |  0
 tools/python/setup.py                         |  2 +-
 tools/xenstore/Makefile                       | 82 +------------------
 tools/xenstore/{include => }/xenstore_lib.h   |  0
 15 files changed, 133 insertions(+), 86 deletions(-)
 create mode 100644 tools/libs/store/Makefile
 rename tools/{xenstore => libs/store}/include/compat/xs.h (100%)
 rename tools/{xenstore => libs/store}/include/compat/xs_lib.h (100%)
 rename tools/{xenstore => libs/store}/include/xenstore.h (100%)
 create mode 100644 tools/libs/store/libxenstore.map
 rename tools/{xenstore => libs/store}/xenstore.pc.in (100%)
 rename tools/{xenstore => libs/store}/xs.c (100%)
 rename tools/xenstore/{include => }/xenstore_lib.h (100%)

diff --git a/.gitignore b/.gitignore
index e28c21641c..dad694a979 100644
--- a/.gitignore
+++ b/.gitignore
@@ -120,6 +120,12 @@ tools/libs/foreignmemory/headers.chk
 tools/libs/foreignmemory/xenforeignmemory.pc
 tools/libs/devicemodel/headers.chk
 tools/libs/devicemodel/xendevicemodel.pc
+tools/libs/store/headers.chk
+tools/libs/store/list.h
+tools/libs/store/utils.h
+tools/libs/store/xenstore.pc
+tools/libs/store/xs_lib.c
+tools/libs/store/include/xenstore_lib.h
 tools/console/xenconsole
 tools/console/xenconsoled
 tools/console/client/_paths.h
@@ -280,7 +286,6 @@ tools/xenstore/xenstore-control
 tools/xenstore/xenstore-ls
 tools/xenstore/xenstored
 tools/xenstore/xenstored_test
-tools/xenstore/xenstore.pc
 tools/xenstore/xs_tdb_dump
 tools/xentrace/xentrace_setsize
 tools/xentrace/tbctl
diff --git a/stubdom/mini-os.mk b/stubdom/mini-os.mk
index b1387df3f8..55b26c9517 100644
--- a/stubdom/mini-os.mk
+++ b/stubdom/mini-os.mk
@@ -5,7 +5,7 @@
 # XEN_ROOT
 # MINIOS_TARGET_ARCH
 
-XENSTORE_CPPFLAGS = -isystem $(XEN_ROOT)/tools/xenstore/include
+XENSTORE_CPPFLAGS = -isystem $(XEN_ROOT)/tools/libs/store/include
 TOOLCORE_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/toolcore
 TOOLLOG_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/toollog
 EVTCHN_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/evtchn
diff --git a/tools/Makefile b/tools/Makefile
index 7c62c599dd..88231856d7 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -47,7 +47,7 @@ SUBDIRS-$(OCAML_TOOLS) += ocaml
 endif
 
 ifeq ($(CONFIG_RUMP),y)
-SUBDIRS-y := libs libxc xenstore
+SUBDIRS-y := libs libxc
 endif
 
 # For the sake of linking, set the sys-root
@@ -256,12 +256,12 @@ subdir-all-qemu-xen-dir: qemu-xen-dir-find
 		-I$(XEN_ROOT)/tools/libs/foreignmemory/include \
 		-I$(XEN_ROOT)/tools/libs/devicemodel/include \
 		-I$(XEN_ROOT)/tools/libs/ctrl/include \
+		-I$(XEN_ROOT)/tools/libs/store/include \
+		-I$(XEN_ROOT)/tools/libs/store/compat/include \
 		-I$(XEN_ROOT)/tools/libxc/include \
-		-I$(XEN_ROOT)/tools/xenstore/include \
-		-I$(XEN_ROOT)/tools/xenstore/compat/include \
 		$(EXTRA_CFLAGS_QEMU_XEN)" \
 		--extra-ldflags="-L$(XEN_ROOT)/tools/libxc \
-		-L$(XEN_ROOT)/tools/xenstore \
+		-L$(XEN_ROOT)/tools/libs/store \
 		-L$(XEN_ROOT)/tools/libs/toolcore \
 		-L$(XEN_ROOT)/tools/libs/evtchn \
 		-L$(XEN_ROOT)/tools/libs/gnttab \
diff --git a/tools/Rules.mk b/tools/Rules.mk
index 6bc3347a1c..cd1b49bca8 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -21,11 +21,11 @@ XEN_libxenforeignmemory = $(XEN_ROOT)/tools/libs/foreignmemory
 XEN_libxendevicemodel = $(XEN_ROOT)/tools/libs/devicemodel
 XEN_libxenhypfs    = $(XEN_ROOT)/tools/libs/hypfs
 XEN_libxenctrl     = $(XEN_ROOT)/tools/libs/ctrl
+XEN_libxenstore    = $(XEN_ROOT)/tools/libs/store
 XEN_libxenguest    = $(XEN_ROOT)/tools/libxc
 XEN_libxenlight    = $(XEN_ROOT)/tools/libxl
 # Currently libxlutil lives in the same directory as libxenlight
 XEN_libxlutil      = $(XEN_libxenlight)
-XEN_libxenstore    = $(XEN_ROOT)/tools/xenstore
 XEN_libxenstat     = $(XEN_ROOT)/tools/xenstat/libxenstat/src
 XEN_libxenvchan    = $(XEN_ROOT)/tools/libvchan
 
diff --git a/tools/libs/Makefile b/tools/libs/Makefile
index 7648ea0e4c..27a7df9b31 100644
--- a/tools/libs/Makefile
+++ b/tools/libs/Makefile
@@ -11,6 +11,7 @@ SUBDIRS-y += foreignmemory
 SUBDIRS-y += devicemodel
 SUBDIRS-y += ctrl
 SUBDIRS-y += hypfs
+SUBDIRS-y += store
 
 ifeq ($(CONFIG_RUMP),y)
 SUBDIRS-y := toolcore
diff --git a/tools/libs/store/Makefile b/tools/libs/store/Makefile
new file mode 100644
index 0000000000..76b30145cf
--- /dev/null
+++ b/tools/libs/store/Makefile
@@ -0,0 +1,66 @@
+XEN_ROOT=$(CURDIR)/../../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+MAJOR = 3.0
+MINOR = 3
+LIBNAME  := store
+USELIBS  := toolcore
+
+ifeq ($(CONFIG_Linux),y)
+APPEND_LDFLAGS += -ldl
+endif
+
+SRCS-y   += xs_lib.c
+SRCS-y   += xs.c
+
+LIBHEADER = xenstore.h xenstore_lib.h
+
+include ../libs.mk
+
+# Include configure output (config.h)
+CFLAGS += -include $(XEN_ROOT)/tools/config.h
+CFLAGS += $(CFLAGS_libxentoolcore)
+CFLAGS += -DXEN_LIB_STORED="\"$(XEN_LIB_STORED)\""
+CFLAGS += -DXEN_RUN_STORED="\"$(XEN_RUN_STORED)\""
+
+LINK_FILES = xs_lib.c include/xenstore_lib.h list.h utils.h
+
+$(LIB_OBJS): $(LINK_FILES)
+
+$(LINK_FILES):
+	ln -sf $(XEN_ROOT)/tools/xenstore/$(notdir $@) $@
+
+xs.opic: CFLAGS += -DUSE_PTHREAD
+ifeq ($(CONFIG_Linux),y)
+xs.opic: CFLAGS += -DUSE_DLSYM
+else
+PKG_CONFIG_REMOVE += -ldl
+endif
+
+$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxenstore)/include
+$(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
+
+.PHONY: install
+install: install-headers
+
+.PHONY: install-headers
+install-headers:
+	$(INSTALL_DIR) $(DESTDIR)$(includedir)
+	$(INSTALL_DIR) $(DESTDIR)$(includedir)/xenstore-compat
+	$(INSTALL_DATA) include/compat/xs.h $(DESTDIR)$(includedir)/xenstore-compat/xs.h
+	$(INSTALL_DATA) include/compat/xs_lib.h $(DESTDIR)$(includedir)/xenstore-compat/xs_lib.h
+	ln -sf xenstore-compat/xs.h  $(DESTDIR)$(includedir)/xs.h
+	ln -sf xenstore-compat/xs_lib.h $(DESTDIR)$(includedir)/xs_lib.h
+
+.PHONY: uninstall
+uninstall: uninstall-headers
+
+.PHONY: uninstall-headers
+uninstall-headers:
+	rm -f $(DESTDIR)$(includedir)/xs_lib.h
+	rm -f $(DESTDIR)$(includedir)/xs.h
+	rm -f $(DESTDIR)$(includedir)/xenstore-compat/xs_lib.h
+	rm -f $(DESTDIR)$(includedir)/xenstore-compat/xs.h
+	if [ -d $(DESTDIR)$(includedir)/xenstore-compat ]; then \
+		rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/xenstore-compat; \
+	fi
diff --git a/tools/xenstore/include/compat/xs.h b/tools/libs/store/include/compat/xs.h
similarity index 100%
rename from tools/xenstore/include/compat/xs.h
rename to tools/libs/store/include/compat/xs.h
diff --git a/tools/xenstore/include/compat/xs_lib.h b/tools/libs/store/include/compat/xs_lib.h
similarity index 100%
rename from tools/xenstore/include/compat/xs_lib.h
rename to tools/libs/store/include/compat/xs_lib.h
diff --git a/tools/xenstore/include/xenstore.h b/tools/libs/store/include/xenstore.h
similarity index 100%
rename from tools/xenstore/include/xenstore.h
rename to tools/libs/store/include/xenstore.h
diff --git a/tools/libs/store/libxenstore.map b/tools/libs/store/libxenstore.map
new file mode 100644
index 0000000000..9854305a2c
--- /dev/null
+++ b/tools/libs/store/libxenstore.map
@@ -0,0 +1,49 @@
+VERS_3.0.3 {
+	global:
+		xs_open;
+		xs_close;
+		xs_daemon_open;
+		xs_domain_open;
+		xs_daemon_open_readonly;
+		xs_daemon_close;
+		xs_daemon_destroy_postfork;
+		xs_directory;
+		xs_read;
+		xs_write;
+		xs_mkdir;
+		xs_rm;
+		xs_restrict;
+		xs_get_permissions;
+		xs_set_permissions;
+		xs_watch;
+		xs_fileno;
+		xs_check_watch;
+		xs_read_watch;
+		xs_unwatch;
+		xs_transaction_start;
+		xs_transaction_end;
+		xs_introduce_domain;
+		xs_set_target;
+		xs_resume_domain;
+		xs_release_domain;
+		xs_get_domain_path;
+		xs_path_is_subpath;
+		xs_is_domain_introduced;
+		xs_control_command;
+		xs_debug_command;
+		xs_suspend_evtchn_port;
+		xs_daemon_rootdir;
+		xs_daemon_rundir;
+		xs_daemon_socket;
+		xs_daemon_socket_ro;
+		xs_domain_dev;
+		xs_daemon_tdb;
+		xs_write_all;
+		xs_strings_to_perms;
+		xs_perm_to_string;
+		xs_count_strings;
+		expanding_buffer_ensure;
+		sanitise_value;
+		unsanitise_value;
+	local: *; /* Do not expose anything by default */
+};
diff --git a/tools/xenstore/xenstore.pc.in b/tools/libs/store/xenstore.pc.in
similarity index 100%
rename from tools/xenstore/xenstore.pc.in
rename to tools/libs/store/xenstore.pc.in
diff --git a/tools/xenstore/xs.c b/tools/libs/store/xs.c
similarity index 100%
rename from tools/xenstore/xs.c
rename to tools/libs/store/xs.c
diff --git a/tools/python/setup.py b/tools/python/setup.py
index 24b284af39..8254464aff 100644
--- a/tools/python/setup.py
+++ b/tools/python/setup.py
@@ -11,7 +11,7 @@ PATH_LIBXENTOOLLOG = XEN_ROOT + "/tools/libs/toollog"
 PATH_LIBXENEVTCHN = XEN_ROOT + "/tools/libs/evtchn"
 PATH_LIBXENCTRL = XEN_ROOT + "/tools/libs/ctrl"
 PATH_LIBXL    = XEN_ROOT + "/tools/libxl"
-PATH_XENSTORE = XEN_ROOT + "/tools/xenstore"
+PATH_XENSTORE = XEN_ROOT + "/tools/libs/store"
 
 xc = Extension("xc",
                extra_compile_args = extra_compile_args,
diff --git a/tools/xenstore/Makefile b/tools/xenstore/Makefile
index 0a64ac1571..9a0f0d012d 100644
--- a/tools/xenstore/Makefile
+++ b/tools/xenstore/Makefile
@@ -34,17 +34,7 @@ XENSTORED_OBJS_$(CONFIG_MiniOS) = xenstored_minios.o
 XENSTORED_OBJS += $(XENSTORED_OBJS_y)
 LDLIBS_xenstored += -lrt
 
-ifneq ($(XENSTORE_STATIC_CLIENTS),y)
-LIBXENSTORE := libxenstore.so
-else
-LIBXENSTORE := libxenstore.a
-xenstore xenstore-control: CFLAGS += -static
-endif
-
-ALL_TARGETS = libxenstore.a clients
-ifneq ($(nosharedlibs),y)
-ALL_TARGETS += libxenstore.so
-endif
+ALL_TARGETS = clients
 ifeq ($(XENSTORE_XENSTORED),y)
 ALL_TARGETS += xs_tdb_dump xenstored
 endif
@@ -87,60 +77,21 @@ xenstored.a: $(XENSTORED_OBJS)
 $(CLIENTS): xenstore
 	ln -f xenstore $@
 
-xenstore: xenstore_client.o $(LIBXENSTORE)
+xenstore: xenstore_client.o
 	$(CC) $< $(LDFLAGS) $(LDLIBS_libxenstore) $(LDLIBS_libxentoolcore) $(SOCKET_LIBS) -o $@ $(APPEND_LDFLAGS)
 
-xenstore-control: xenstore_control.o $(LIBXENSTORE)
+xenstore-control: xenstore_control.o
 	$(CC) $< $(LDFLAGS) $(LDLIBS_libxenstore) $(LDLIBS_libxentoolcore) $(SOCKET_LIBS) -o $@ $(APPEND_LDFLAGS)
 
 xs_tdb_dump: xs_tdb_dump.o utils.o tdb.o talloc.o
 	$(CC) $^ $(LDFLAGS) -o $@ $(APPEND_LDFLAGS)
 
-libxenstore.so: libxenstore.so.$(MAJOR)
-	ln -sf $< $@
-libxenstore.so.$(MAJOR): libxenstore.so.$(MAJOR).$(MINOR)
-	ln -sf $< $@
-
-xs.opic: CFLAGS += -DUSE_PTHREAD
-ifeq ($(CONFIG_Linux),y)
-xs.opic: CFLAGS += -DUSE_DLSYM
-libxenstore.so.$(MAJOR).$(MINOR): APPEND_LDFLAGS += -ldl
-else
-PKG_CONFIG_REMOVE += -ldl
-endif
-
-libxenstore.so.$(MAJOR).$(MINOR): xs.opic xs_lib.opic
-	$(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenstore.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(LDLIBS_libxentoolcore) $(SOCKET_LIBS) $(PTHREAD_LIBS) $(APPEND_LDFLAGS)
-
-libxenstore.a: xs.o xs_lib.o
-	$(AR) rcs $@ $^
-
-PKG_CONFIG := xenstore.pc
-PKG_CONFIG_VERSION := $(MAJOR).$(MINOR)
-
-ifneq ($(CONFIG_LIBXC_MINIOS),y)
-PKG_CONFIG_INST := $(PKG_CONFIG)
-$(PKG_CONFIG_INST): PKG_CONFIG_PREFIX = $(prefix)
-$(PKG_CONFIG_INST): PKG_CONFIG_INCDIR = $(includedir)
-$(PKG_CONFIG_INST): PKG_CONFIG_LIBDIR = $(libdir)
-endif
-
-PKG_CONFIG_LOCAL := $(foreach pc,$(PKG_CONFIG),$(PKG_CONFIG_DIR)/$(pc))
-
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_PREFIX = $(XEN_ROOT)
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxenstore)/include
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
-
-$(LIBXENSTORE): $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL)
-
 .PHONY: clean
 clean:
-	rm -f *.a *.o *.opic *.so* xenstored_probes.h
+	rm -f *.a *.o xenstored_probes.h
 	rm -f xenstored xs_random xs_stress xs_crashme
 	rm -f xs_tdb_dump xenstore-control init-xenstore-domain
 	rm -f xenstore $(CLIENTS)
-	rm -f xenstore.pc
 	$(RM) $(DEPS_RM)
 
 .PHONY: distclean
@@ -157,8 +108,6 @@ tarball: clean
 .PHONY: install
 install: all
 	$(INSTALL_DIR) $(DESTDIR)$(bindir)
-	$(INSTALL_DIR) $(DESTDIR)$(includedir)
-	$(INSTALL_DIR) $(DESTDIR)$(includedir)/xenstore-compat
 ifeq ($(XENSTORE_XENSTORED),y)
 	$(INSTALL_DIR) $(DESTDIR)$(sbindir)
 	$(INSTALL_DIR) $(DESTDIR)$(XEN_LIB_STORED)
@@ -169,32 +118,9 @@ endif
 	set -e ; for c in $(CLIENTS) ; do \
 		ln -f $(DESTDIR)$(bindir)/xenstore $(DESTDIR)$(bindir)/$${c} ; \
 	done
-	$(INSTALL_DIR) $(DESTDIR)$(libdir)
-	$(INSTALL_SHLIB) libxenstore.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)
-	ln -sf libxenstore.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)/libxenstore.so.$(MAJOR)
-	ln -sf libxenstore.so.$(MAJOR) $(DESTDIR)$(libdir)/libxenstore.so
-	$(INSTALL_DATA) libxenstore.a $(DESTDIR)$(libdir)
-	$(INSTALL_DATA) include/xenstore.h $(DESTDIR)$(includedir)
-	$(INSTALL_DATA) include/xenstore_lib.h $(DESTDIR)$(includedir)
-	$(INSTALL_DATA) include/compat/xs.h $(DESTDIR)$(includedir)/xenstore-compat/xs.h
-	$(INSTALL_DATA) include/compat/xs_lib.h $(DESTDIR)$(includedir)/xenstore-compat/xs_lib.h
-	ln -sf xenstore-compat/xs.h  $(DESTDIR)$(includedir)/xs.h
-	ln -sf xenstore-compat/xs_lib.h $(DESTDIR)$(includedir)/xs_lib.h
-	$(INSTALL_DATA) xenstore.pc $(DESTDIR)$(PKG_INSTALLDIR)
 
 .PHONY: uninstall
 uninstall:
-	rm -f $(DESTDIR)$(PKG_INSTALLDIR)/xenstore.pc
-	rm -f $(DESTDIR)$(includedir)/xs_lib.h
-	rm -f $(DESTDIR)$(includedir)/xs.h
-	rm -f $(DESTDIR)$(includedir)/xenstore-compat/xs_lib.h
-	rm -f $(DESTDIR)$(includedir)/xenstore-compat/xs.h
-	rm -f $(DESTDIR)$(includedir)/xenstore_lib.h
-	rm -f $(DESTDIR)$(includedir)/xenstore.h
-	rm -f $(DESTDIR)$(libdir)/libxenstore.a
-	rm -f $(DESTDIR)$(libdir)/libxenstore.so
-	rm -f $(DESTDIR)$(libdir)/libxenstore.so.$(MAJOR)
-	rm -f $(DESTDIR)$(libdir)/libxenstore.so.$(MAJOR).$(MINOR)
 	rm -f $(addprefix $(DESTDIR)$(bindir)/, $(CLIENTS))
 	rm -f $(DESTDIR)$(bindir)/xenstore
 	rm -f $(DESTDIR)$(bindir)/xenstore-control
diff --git a/tools/xenstore/include/xenstore_lib.h b/tools/xenstore/xenstore_lib.h
similarity index 100%
rename from tools/xenstore/include/xenstore_lib.h
rename to tools/xenstore/xenstore_lib.h
-- 
2.20.1



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

* [PATCH 10/12] tools: split libxenvchan into new tools/libs/vchan directory
  2020-07-15 16:24 [PATCH 00/12] tools: move more libraries into tools/libs Ian Jackson
                   ` (9 preceding siblings ...)
  2020-07-15 16:25 ` [PATCH 09/12] tools: split libxenstore into new tools/libs/store directory Ian Jackson
@ 2020-07-15 16:25 ` Ian Jackson
  2020-07-15 16:25 ` [PATCH 11/12] tools: split libxenstat into new tools/libs/stat directory Ian Jackson
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 27+ messages in thread
From: Ian Jackson @ 2020-07-15 16:25 UTC (permalink / raw)
  To: xen-devel
  Cc: Juergen Gross, Stefano Stabellini, Julien Grall, Wei Liu,
	Andrew Cooper, ian.jackson, George Dunlap, Jan Beulich

From: Juergen Gross <jgross@suse.com>

There is no reason why libvchan is not placed in the tools/libs
directory.

At the same time move libxenvchan.h to a dedicated include directory
in tools/libs/vchan in order to follow the same pattern as the other
libraries in tools/libs.

As tools/libvchan now contains no library any longer rename it to
tools/vchan.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 .gitignore                                    |  7 +-
 tools/Makefile                                |  2 +-
 tools/Rules.mk                                |  4 +-
 tools/libs/Makefile                           |  1 +
 tools/libs/vchan/Makefile                     | 19 ++++
 .../vchan/include}/libxenvchan.h              |  0
 tools/{libvchan => libs/vchan}/init.c         |  0
 tools/{libvchan => libs/vchan}/io.c           |  0
 tools/libs/vchan/libxenvchan.map              | 16 ++++
 tools/{libvchan => libs/vchan}/xenvchan.pc.in |  0
 tools/libvchan/Makefile                       | 95 -------------------
 tools/vchan/Makefile                          | 37 ++++++++
 tools/{libvchan => vchan}/node-select.c       |  0
 tools/{libvchan => vchan}/node.c              |  0
 .../{libvchan => vchan}/vchan-socket-proxy.c  |  0
 15 files changed, 80 insertions(+), 101 deletions(-)
 create mode 100644 tools/libs/vchan/Makefile
 rename tools/{libvchan => libs/vchan/include}/libxenvchan.h (100%)
 rename tools/{libvchan => libs/vchan}/init.c (100%)
 rename tools/{libvchan => libs/vchan}/io.c (100%)
 create mode 100644 tools/libs/vchan/libxenvchan.map
 rename tools/{libvchan => libs/vchan}/xenvchan.pc.in (100%)
 delete mode 100644 tools/libvchan/Makefile
 create mode 100644 tools/vchan/Makefile
 rename tools/{libvchan => vchan}/node-select.c (100%)
 rename tools/{libvchan => vchan}/node.c (100%)
 rename tools/{libvchan => vchan}/vchan-socket-proxy.c (100%)

diff --git a/.gitignore b/.gitignore
index dad694a979..3e130b0596 100644
--- a/.gitignore
+++ b/.gitignore
@@ -126,6 +126,8 @@ tools/libs/store/utils.h
 tools/libs/store/xenstore.pc
 tools/libs/store/xs_lib.c
 tools/libs/store/include/xenstore_lib.h
+tools/libs/vchan/headers.chk
+tools/libs/vchan/xenvchan.pc
 tools/console/xenconsole
 tools/console/xenconsoled
 tools/console/client/_paths.h
@@ -201,7 +203,6 @@ tools/include/xen/*
 tools/include/xen-xsm/*
 tools/include/xen-foreign/*.(c|h|size)
 tools/include/xen-foreign/checker
-tools/libvchan/xenvchan.pc
 tools/libxc/*.pc
 tools/libxc/xc_bitops.h
 tools/libxc/xc_core.h
@@ -387,8 +388,8 @@ tools/misc/xenhypfs
 tools/misc/xenwatchdogd
 tools/misc/xen-hvmcrash
 tools/misc/xen-lowmemd
-tools/libvchan/vchan-node[12]
-tools/libvchan/vchan-socket-proxy
+tools/vchan/vchan-node[12]
+tools/vchan/vchan-socket-proxy
 tools/ocaml/*/.ocamldep.make
 tools/ocaml/*/*.cm[ixao]
 tools/ocaml/*/*.cmxa
diff --git a/tools/Makefile b/tools/Makefile
index 88231856d7..ed119fffd7 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -21,7 +21,7 @@ SUBDIRS-y += xenmon
 SUBDIRS-y += xenstat
 SUBDIRS-$(CONFIG_NetBSD) += xenbackendd
 SUBDIRS-y += libfsimage
-SUBDIRS-$(CONFIG_Linux) += libvchan
+SUBDIRS-$(CONFIG_Linux) += vchan
 
 # do not recurse in to a dir we are about to delete
 ifneq "$(MAKECMDGOALS)" "distclean"
diff --git a/tools/Rules.mk b/tools/Rules.mk
index cd1b49bca8..30ee379484 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -22,12 +22,12 @@ XEN_libxendevicemodel = $(XEN_ROOT)/tools/libs/devicemodel
 XEN_libxenhypfs    = $(XEN_ROOT)/tools/libs/hypfs
 XEN_libxenctrl     = $(XEN_ROOT)/tools/libs/ctrl
 XEN_libxenstore    = $(XEN_ROOT)/tools/libs/store
+XEN_libxenvchan    = $(XEN_ROOT)/tools/libs/vchan
 XEN_libxenguest    = $(XEN_ROOT)/tools/libxc
 XEN_libxenlight    = $(XEN_ROOT)/tools/libxl
 # Currently libxlutil lives in the same directory as libxenlight
 XEN_libxlutil      = $(XEN_libxenlight)
 XEN_libxenstat     = $(XEN_ROOT)/tools/xenstat/libxenstat/src
-XEN_libxenvchan    = $(XEN_ROOT)/tools/libvchan
 
 CFLAGS_xeninclude = -I$(XEN_INCLUDE)
 
@@ -163,7 +163,7 @@ SHDEPS_libxenstat  = $(SHLIB_libxenctrl) $(SHLIB_libxenstore)
 LDLIBS_libxenstat  = $(SHDEPS_libxenstat) $(XEN_libxenstat)/libxenstat$(libextension)
 SHLIB_libxenstat   = $(SHDEPS_libxenstat) -Wl,-rpath-link=$(XEN_libxenstat)
 
-CFLAGS_libxenvchan = -I$(XEN_libxenvchan) $(CFLAGS_libxengnttab) $(CFLAGS_libxenevtchn)
+CFLAGS_libxenvchan = -I$(XEN_libxenvchan)/include $(CFLAGS_libxengnttab) $(CFLAGS_libxenevtchn)
 SHDEPS_libxenvchan = $(SHLIB_libxentoollog) $(SHLIB_libxenstore) $(SHLIB_libxenevtchn) $(SHLIB_libxengnttab)
 LDLIBS_libxenvchan = $(SHDEPS_libxenvchan) $(XEN_libxenvchan)/libxenvchan$(libextension)
 SHLIB_libxenvchan  = $(SHDEPS_libxenvchan) -Wl,-rpath-link=$(XEN_libxenvchan)
diff --git a/tools/libs/Makefile b/tools/libs/Makefile
index 27a7df9b31..396116b0b3 100644
--- a/tools/libs/Makefile
+++ b/tools/libs/Makefile
@@ -12,6 +12,7 @@ SUBDIRS-y += devicemodel
 SUBDIRS-y += ctrl
 SUBDIRS-y += hypfs
 SUBDIRS-y += store
+SUBDIRS-$(CONFIG_Linux) += vchan
 
 ifeq ($(CONFIG_RUMP),y)
 SUBDIRS-y := toolcore
diff --git a/tools/libs/vchan/Makefile b/tools/libs/vchan/Makefile
new file mode 100644
index 0000000000..bf944d251c
--- /dev/null
+++ b/tools/libs/vchan/Makefile
@@ -0,0 +1,19 @@
+XEN_ROOT = $(CURDIR)/../../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+MAJOR = 4.14
+MINOR = 0
+LIBNAME  := vchan
+USELIBS  := toollog store evtchn gnttab
+
+CFLAGS += $(CFLAGS_libxenctrl)
+
+LIBHEADER := libxenvchan.h
+
+SRCS-y += init.c
+SRCS-y += io.c
+
+include $(XEN_ROOT)/tools/libs/libs.mk
+
+$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxenvchan)/include
+$(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
diff --git a/tools/libvchan/libxenvchan.h b/tools/libs/vchan/include/libxenvchan.h
similarity index 100%
rename from tools/libvchan/libxenvchan.h
rename to tools/libs/vchan/include/libxenvchan.h
diff --git a/tools/libvchan/init.c b/tools/libs/vchan/init.c
similarity index 100%
rename from tools/libvchan/init.c
rename to tools/libs/vchan/init.c
diff --git a/tools/libvchan/io.c b/tools/libs/vchan/io.c
similarity index 100%
rename from tools/libvchan/io.c
rename to tools/libs/vchan/io.c
diff --git a/tools/libs/vchan/libxenvchan.map b/tools/libs/vchan/libxenvchan.map
new file mode 100644
index 0000000000..9ac00c5b45
--- /dev/null
+++ b/tools/libs/vchan/libxenvchan.map
@@ -0,0 +1,16 @@
+VERS_4.14.0 {
+	global:
+		libxenvchan_server_init;
+		libxenvchan_client_init;
+		libxenvchan_close;
+		libxenvchan_recv;
+		libxenvchan_read;
+		libxenvchan_send;
+		libxenvchan_write;
+		libxenvchan_wait;
+		libxenvchan_fd_for_select;
+		libxenvchan_is_open;
+		libxenvchan_data_ready;
+		libxenvchan_buffer_space;
+	local: *; /* Do not expose anything by default */
+};
diff --git a/tools/libvchan/xenvchan.pc.in b/tools/libs/vchan/xenvchan.pc.in
similarity index 100%
rename from tools/libvchan/xenvchan.pc.in
rename to tools/libs/vchan/xenvchan.pc.in
diff --git a/tools/libvchan/Makefile b/tools/libvchan/Makefile
deleted file mode 100644
index 025a935cb7..0000000000
--- a/tools/libvchan/Makefile
+++ /dev/null
@@ -1,95 +0,0 @@
-#
-# tools/libvchan/Makefile
-#
-
-XEN_ROOT = $(CURDIR)/../..
-include $(XEN_ROOT)/tools/Rules.mk
-
-LIBVCHAN_OBJS = init.o io.o
-NODE_OBJS = node.o
-NODE2_OBJS = node-select.o
-
-LIBVCHAN_PIC_OBJS = $(patsubst %.o,%.opic,$(LIBVCHAN_OBJS))
-LIBVCHAN_LIBS = $(LDLIBS_libxenstore) $(LDLIBS_libxengnttab) $(LDLIBS_libxenevtchn)
-$(LIBVCHAN_OBJS) $(LIBVCHAN_PIC_OBJS): CFLAGS += $(CFLAGS_libxenstore) $(CFLAGS_libxengnttab) $(CFLAGS_libxenevtchn)
-$(NODE_OBJS) $(NODE2_OBJS): CFLAGS += $(CFLAGS_libxengnttab) $(CFLAGS_libxenevtchn)
-vchan-socket-proxy.o: CFLAGS += $(CFLAGS_libxenstore) $(CFLAGS_libxenctrl) $(CFLAGS_libxengnttab) $(CFLAGS_libxenevtchn)
-
-MAJOR = 4.14
-MINOR = 0
-
-CFLAGS += -I../include -I.
-
-io.o io.opic: CFLAGS += $(CFLAGS_libxenctrl) # for xen_mb et al
-
-PKG_CONFIG := xenvchan.pc
-PKG_CONFIG_VERSION := $(MAJOR).$(MINOR)
-
-ifneq ($(CONFIG_LIBXC_MINIOS),y)
-PKG_CONFIG_INST := $(PKG_CONFIG)
-$(PKG_CONFIG_INST): PKG_CONFIG_PREFIX = $(prefix)
-$(PKG_CONFIG_INST): PKG_CONFIG_INCDIR = $(includedir)
-$(PKG_CONFIG_INST): PKG_CONFIG_LIBDIR = $(libdir)
-endif
-
-PKG_CONFIG_LOCAL := $(foreach pc,$(PKG_CONFIG),$(PKG_CONFIG_DIR)/$(pc))
-
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_PREFIX = $(XEN_ROOT)
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxenvchan)
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
-
-.PHONY: all
-all: libxenvchan.so vchan-node1 vchan-node2 vchan-socket-proxy libxenvchan.a $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL)
-
-libxenvchan.so: libxenvchan.so.$(MAJOR)
-	ln -sf $< $@
-
-libxenvchan.so.$(MAJOR): libxenvchan.so.$(MAJOR).$(MINOR)
-	ln -sf $< $@
-
-libxenvchan.so.$(MAJOR).$(MINOR): $(LIBVCHAN_PIC_OBJS)
-	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenvchan.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(LIBVCHAN_LIBS) $(APPEND_LDFLAGS)
-
-libxenvchan.a: $(LIBVCHAN_OBJS)
-	$(AR) rcs libxenvchan.a $^
-
-vchan-node1: $(NODE_OBJS) libxenvchan.so
-	$(CC) $(LDFLAGS) -o $@ $(NODE_OBJS) $(LDLIBS_libxenvchan) $(APPEND_LDFLAGS)
-
-vchan-node2: $(NODE2_OBJS) libxenvchan.so
-	$(CC) $(LDFLAGS) -o $@ $(NODE2_OBJS) $(LDLIBS_libxenvchan) $(APPEND_LDFLAGS)
-
-vchan-socket-proxy: vchan-socket-proxy.o libxenvchan.so
-	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenvchan) $(LDLIBS_libxenstore) $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
-
-.PHONY: install
-install: all
-	$(INSTALL_DIR) $(DESTDIR)$(libdir)
-	$(INSTALL_DIR) $(DESTDIR)$(includedir)
-	$(INSTALL_DIR) $(DESTDIR)$(bindir)
-	$(INSTALL_PROG) libxenvchan.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)
-	ln -sf libxenvchan.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)/libxenvchan.so.$(MAJOR)
-	ln -sf libxenvchan.so.$(MAJOR) $(DESTDIR)$(libdir)/libxenvchan.so
-	$(INSTALL_PROG) vchan-socket-proxy $(DESTDIR)$(bindir)
-	$(INSTALL_DATA) libxenvchan.h $(DESTDIR)$(includedir)
-	$(INSTALL_DATA) libxenvchan.a $(DESTDIR)$(libdir)
-	$(INSTALL_DATA) xenvchan.pc $(DESTDIR)$(PKG_INSTALLDIR)
-
-.PHONY: uninstall
-uninstall:
-	rm -f $(DESTDIR)$(PKG_INSTALLDIR)/xenvchan.pc
-	rm -f $(DESTDIR)$(libdir)/libxenvchan.a
-	rm -f $(DESTDIR)$(includedir)/libxenvchan.h
-	rm -f $(DESTDIR)$(libdir)/libxenvchan.so
-	rm -f $(DESTDIR)$(libdir)/libxenvchan.so.$(MAJOR)
-	rm -f $(DESTDIR)$(libdir)/libxenvchan.so.$(MAJOR).$(MINOR)
-
-.PHONY: clean
-clean:
-	$(RM) -f *.o *.opic *.so* *.a vchan-node1 vchan-node2 $(DEPS_RM)
-	$(RM) -f xenvchan.pc
-
-distclean: clean
-
--include $(DEPS_INCLUDE)
diff --git a/tools/vchan/Makefile b/tools/vchan/Makefile
new file mode 100644
index 0000000000..a731e0e073
--- /dev/null
+++ b/tools/vchan/Makefile
@@ -0,0 +1,37 @@
+#
+# tools/vchan/Makefile
+#
+
+XEN_ROOT = $(CURDIR)/../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+NODE_OBJS = node.o
+NODE2_OBJS = node-select.o
+
+$(NODE_OBJS) $(NODE2_OBJS): CFLAGS += $(CFLAGS_libxenvchan) $(CFLAGS_libxengnttab) $(CFLAGS_libxenevtchn)
+vchan-socket-proxy.o: CFLAGS += $(CFLAGS_libxenvchan) $(CFLAGS_libxenstore) $(CFLAGS_libxenctrl) $(CFLAGS_libxengnttab) $(CFLAGS_libxenevtchn)
+
+.PHONY: all
+all: vchan-node1 vchan-node2 vchan-socket-proxy
+
+vchan-node1: $(NODE_OBJS)
+	$(CC) $(LDFLAGS) -o $@ $(NODE_OBJS) $(LDLIBS_libxenvchan) $(APPEND_LDFLAGS)
+
+vchan-node2: $(NODE2_OBJS)
+	$(CC) $(LDFLAGS) -o $@ $(NODE2_OBJS) $(LDLIBS_libxenvchan) $(APPEND_LDFLAGS)
+
+vchan-socket-proxy: vchan-socket-proxy.o
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenvchan) $(LDLIBS_libxenstore) $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
+
+.PHONY: install
+install: all
+	$(INSTALL_DIR) $(DESTDIR)$(bindir)
+	$(INSTALL_PROG) vchan-socket-proxy $(DESTDIR)$(bindir)
+
+.PHONY: clean
+clean:
+	$(RM) -f *.o vchan-node1 vchan-node2 $(DEPS_RM)
+
+distclean: clean
+
+-include $(DEPS_INCLUDE)
diff --git a/tools/libvchan/node-select.c b/tools/vchan/node-select.c
similarity index 100%
rename from tools/libvchan/node-select.c
rename to tools/vchan/node-select.c
diff --git a/tools/libvchan/node.c b/tools/vchan/node.c
similarity index 100%
rename from tools/libvchan/node.c
rename to tools/vchan/node.c
diff --git a/tools/libvchan/vchan-socket-proxy.c b/tools/vchan/vchan-socket-proxy.c
similarity index 100%
rename from tools/libvchan/vchan-socket-proxy.c
rename to tools/vchan/vchan-socket-proxy.c
-- 
2.20.1



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

* [PATCH 11/12] tools: split libxenstat into new tools/libs/stat directory
  2020-07-15 16:24 [PATCH 00/12] tools: move more libraries into tools/libs Ian Jackson
                   ` (10 preceding siblings ...)
  2020-07-15 16:25 ` [PATCH 10/12] tools: split libxenvchan into new tools/libs/vchan directory Ian Jackson
@ 2020-07-15 16:25 ` Ian Jackson
  2020-07-15 16:25 ` [PATCH 12/12] tools: generate most contents of library make variables Ian Jackson
  2020-07-15 16:50 ` [PATCH 00/12] tools: move more libraries into tools/libs Stefano Stabellini
  13 siblings, 0 replies; 27+ messages in thread
From: Ian Jackson @ 2020-07-15 16:25 UTC (permalink / raw)
  To: xen-devel
  Cc: Juergen Gross, Stefano Stabellini, Julien Grall, Wei Liu,
	Andrew Cooper, ian.jackson, George Dunlap, Jan Beulich

From: Juergen Gross <jgross@suse.com>

There is no reason why libxenstat is not placed in the tools/libs
directory.

At the same time move xenstat.h to a dedicated include directory
in tools/libs/stat in order to follow the same pattern as the other
libraries in tools/libs.

As now xentop is the only left directory in xenstat move it directly
under tools and get rid of tools/xenstat.

Fix some missing prototype errors (add one prototype and make two
functions static).

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 .gitignore                                    |  7 +-
 tools/Makefile                                |  2 +-
 tools/Rules.mk                                |  4 +-
 tools/libs/Makefile                           |  1 +
 .../{xenstat/libxenstat => libs/stat}/COPYING |  0
 .../libxenstat => libs/stat}/Makefile         | 98 ++++---------------
 .../stat}/bindings/swig/perl/.empty           |  0
 .../stat}/bindings/swig/python/.empty         |  0
 .../stat}/bindings/swig/xenstat.i             |  0
 .../src => libs/stat/include}/xenstat.h       |  3 +
 tools/libs/stat/libxenstat.map                | 54 ++++++++++
 .../libxenstat/src => libs/stat}/xenstat.c    |  0
 .../libxenstat => libs/stat}/xenstat.pc.in    |  2 +-
 .../src => libs/stat}/xenstat_freebsd.c       |  0
 .../src => libs/stat}/xenstat_linux.c         |  4 +-
 .../src => libs/stat}/xenstat_netbsd.c        |  0
 .../src => libs/stat}/xenstat_priv.h          |  0
 .../src => libs/stat}/xenstat_qmp.c           |  0
 .../src => libs/stat}/xenstat_solaris.c       |  0
 tools/xenstat/Makefile                        | 10 --
 tools/{xenstat => }/xentop/Makefile           |  2 +-
 tools/{xenstat => }/xentop/TODO               |  0
 tools/{xenstat => }/xentop/xentop.c           |  0
 23 files changed, 90 insertions(+), 97 deletions(-)
 rename tools/{xenstat/libxenstat => libs/stat}/COPYING (100%)
 rename tools/{xenstat/libxenstat => libs/stat}/Makefile (56%)
 rename tools/{xenstat/libxenstat => libs/stat}/bindings/swig/perl/.empty (100%)
 rename tools/{xenstat/libxenstat => libs/stat}/bindings/swig/python/.empty (100%)
 rename tools/{xenstat/libxenstat => libs/stat}/bindings/swig/xenstat.i (100%)
 rename tools/{xenstat/libxenstat/src => libs/stat/include}/xenstat.h (98%)
 create mode 100644 tools/libs/stat/libxenstat.map
 rename tools/{xenstat/libxenstat/src => libs/stat}/xenstat.c (100%)
 rename tools/{xenstat/libxenstat => libs/stat}/xenstat.pc.in (82%)
 rename tools/{xenstat/libxenstat/src => libs/stat}/xenstat_freebsd.c (100%)
 rename tools/{xenstat/libxenstat/src => libs/stat}/xenstat_linux.c (98%)
 rename tools/{xenstat/libxenstat/src => libs/stat}/xenstat_netbsd.c (100%)
 rename tools/{xenstat/libxenstat/src => libs/stat}/xenstat_priv.h (100%)
 rename tools/{xenstat/libxenstat/src => libs/stat}/xenstat_qmp.c (100%)
 rename tools/{xenstat/libxenstat/src => libs/stat}/xenstat_solaris.c (100%)
 delete mode 100644 tools/xenstat/Makefile
 rename tools/{xenstat => }/xentop/Makefile (97%)
 rename tools/{xenstat => }/xentop/TODO (100%)
 rename tools/{xenstat => }/xentop/xentop.c (100%)

diff --git a/.gitignore b/.gitignore
index 3e130b0596..5c240c25db 100644
--- a/.gitignore
+++ b/.gitignore
@@ -120,6 +120,9 @@ tools/libs/foreignmemory/headers.chk
 tools/libs/foreignmemory/xenforeignmemory.pc
 tools/libs/devicemodel/headers.chk
 tools/libs/devicemodel/xendevicemodel.pc
+tools/libs/stat/_paths.h
+tools/libs/stat/headers.chk
+tools/libs/stat/xenstat.pc
 tools/libs/store/headers.chk
 tools/libs/store/list.h
 tools/libs/store/utils.h
@@ -273,9 +276,6 @@ tools/xenmon/xentrace_setmask
 tools/xenmon/xenbaked
 tools/xenpaging/xenpaging
 tools/xenpmd/xenpmd
-tools/xenstat/libxenstat/src/_paths.h
-tools/xenstat/libxenstat/xenstat.pc
-tools/xenstat/xentop/xentop
 tools/xenstore/xenstore
 tools/xenstore/xenstore-chmod
 tools/xenstore/xenstore-exists
@@ -288,6 +288,7 @@ tools/xenstore/xenstore-ls
 tools/xenstore/xenstored
 tools/xenstore/xenstored_test
 tools/xenstore/xs_tdb_dump
+tools/xentop/xentop
 tools/xentrace/xentrace_setsize
 tools/xentrace/tbctl
 tools/xentrace/xenctx
diff --git a/tools/Makefile b/tools/Makefile
index ed119fffd7..e37b4c0f12 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -18,7 +18,7 @@ SUBDIRS-$(CONFIG_XCUTILS) += xcutils
 SUBDIRS-$(CONFIG_X86) += firmware
 SUBDIRS-y += console
 SUBDIRS-y += xenmon
-SUBDIRS-y += xenstat
+SUBDIRS-y += xentop
 SUBDIRS-$(CONFIG_NetBSD) += xenbackendd
 SUBDIRS-y += libfsimage
 SUBDIRS-$(CONFIG_Linux) += vchan
diff --git a/tools/Rules.mk b/tools/Rules.mk
index 30ee379484..279df14152 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -22,12 +22,12 @@ XEN_libxendevicemodel = $(XEN_ROOT)/tools/libs/devicemodel
 XEN_libxenhypfs    = $(XEN_ROOT)/tools/libs/hypfs
 XEN_libxenctrl     = $(XEN_ROOT)/tools/libs/ctrl
 XEN_libxenstore    = $(XEN_ROOT)/tools/libs/store
+XEN_libxenstat     = $(XEN_ROOT)/tools/libs/stat
 XEN_libxenvchan    = $(XEN_ROOT)/tools/libs/vchan
 XEN_libxenguest    = $(XEN_ROOT)/tools/libxc
 XEN_libxenlight    = $(XEN_ROOT)/tools/libxl
 # Currently libxlutil lives in the same directory as libxenlight
 XEN_libxlutil      = $(XEN_libxenlight)
-XEN_libxenstat     = $(XEN_ROOT)/tools/xenstat/libxenstat/src
 
 CFLAGS_xeninclude = -I$(XEN_INCLUDE)
 
@@ -158,7 +158,7 @@ ifeq ($(CONFIG_Linux),y)
 LDLIBS_libxenstore += -ldl
 endif
 
-CFLAGS_libxenstat  = -I$(XEN_libxenstat)
+CFLAGS_libxenstat  = -I$(XEN_libxenstat)/include
 SHDEPS_libxenstat  = $(SHLIB_libxenctrl) $(SHLIB_libxenstore)
 LDLIBS_libxenstat  = $(SHDEPS_libxenstat) $(XEN_libxenstat)/libxenstat$(libextension)
 SHLIB_libxenstat   = $(SHDEPS_libxenstat) -Wl,-rpath-link=$(XEN_libxenstat)
diff --git a/tools/libs/Makefile b/tools/libs/Makefile
index 396116b0b3..a1985cf7a7 100644
--- a/tools/libs/Makefile
+++ b/tools/libs/Makefile
@@ -12,6 +12,7 @@ SUBDIRS-y += devicemodel
 SUBDIRS-y += ctrl
 SUBDIRS-y += hypfs
 SUBDIRS-y += store
+SUBDIRS-y += stat
 SUBDIRS-$(CONFIG_Linux) += vchan
 
 ifeq ($(CONFIG_RUMP),y)
diff --git a/tools/xenstat/libxenstat/COPYING b/tools/libs/stat/COPYING
similarity index 100%
rename from tools/xenstat/libxenstat/COPYING
rename to tools/libs/stat/COPYING
diff --git a/tools/xenstat/libxenstat/Makefile b/tools/libs/stat/Makefile
similarity index 56%
rename from tools/xenstat/libxenstat/Makefile
rename to tools/libs/stat/Makefile
index 3d05ecdd9f..6162395a9a 100644
--- a/tools/xenstat/libxenstat/Makefile
+++ b/tools/libs/stat/Makefile
@@ -15,80 +15,29 @@
 XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-LDCONFIG=ldconfig
-MAKE_LINK=ln -sf
-
-MAJOR=4.14
-MINOR=0
-
-LIB=src/libxenstat.a
-SHLIB=src/libxenstat.so.$(MAJOR).$(MINOR)
-SHLIB_LINKS=src/libxenstat.so.$(MAJOR) src/libxenstat.so
-OBJECTS-y=src/xenstat.o src/xenstat_qmp.o
-OBJECTS-$(CONFIG_Linux) += src/xenstat_linux.o
-OBJECTS-$(CONFIG_SunOS) += src/xenstat_solaris.o
-OBJECTS-$(CONFIG_NetBSD) += src/xenstat_netbsd.o
-OBJECTS-$(CONFIG_FreeBSD) += src/xenstat_freebsd.o
-SONAME_FLAGS=-Wl,$(SONAME_LDFLAG) -Wl,libxenstat.so.$(MAJOR)
-
-CFLAGS+=-fPIC -Werror
-CFLAGS+=-Isrc $(CFLAGS_libxenctrl) $(CFLAGS_libxenstore) $(CFLAGS_xeninclude) -include $(XEN_ROOT)/tools/config.h
-
-LDLIBS-y = $(LDLIBS_libxenstore) $(LDLIBS_libxenctrl) -lyajl
-LDLIBS-$(CONFIG_SunOS) += -lkstat
-
-PKG_CONFIG := xenstat.pc
-PKG_CONFIG_VERSION := $(MAJOR).$(MINOR)
-
-ifneq ($(CONFIG_LIBXC_MINIOS),y)
-PKG_CONFIG_INST := $(PKG_CONFIG)
-$(PKG_CONFIG_INST): PKG_CONFIG_PREFIX = $(prefix)
-$(PKG_CONFIG_INST): PKG_CONFIG_INCDIR = $(includedir)
-$(PKG_CONFIG_INST): PKG_CONFIG_LIBDIR = $(libdir)
-endif
-
-PKG_CONFIG_LOCAL := $(foreach pc,$(PKG_CONFIG),$(PKG_CONFIG_DIR)/$(pc))
+MAJOR = 4.14
+MINOR = 0
+LIBNAME  := stat
+USELIBS  := ctrl store
 
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_PREFIX = $(XEN_ROOT)
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxenstat)
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
+CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenstore) $(CFLAGS_xeninclude) -include $(XEN_ROOT)/tools/config.h
 
-.PHONY: all
-all: $(LIB) $(SHLIB) $(SHLIB_LINKS) $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL)
+SRCS-y += xenstat.c
+SRCS-y += xenstat_qmp.c
+SRCS-$(CONFIG_Linux) += xenstat_linux.c
+SRCS-$(CONFIG_SunOS) += xenstat_solaris.c
+SRCS-$(CONFIG_NetBSD) += xenstat_netbsd.c
+SRCS-$(CONFIG_FreeBSD) += xenstat_freebsd.c
 
-$(OBJECTS-y): src/_paths.h
-
-$(LIB): $(OBJECTS-y)
-	$(AR) rc $@ $^
-	$(RANLIB) $@
+LDLIBS-y += -lyajl
+LDLIBS-$(CONFIG_SunOS) += -lkstat
+APPEND_LDFLAGS += $(LDLIBS-y)
 
-$(SHLIB): $(OBJECTS-y)
-	$(CC) $(LDFLAGS) $(SONAME_FLAGS) $(SHLIB_LDFLAGS) -o $@ \
-	    $(OBJECTS-y) $(LDLIBS-y) $(APPEND_LDFLAGS)
+include $(XEN_ROOT)/tools/libs/libs.mk
 
-src/libxenstat.so.$(MAJOR): $(SHLIB)
-	$(MAKE_LINK) $(<F) $@
+$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxenstat)/include
 
-src/libxenstat.so: src/libxenstat.so.$(MAJOR)
-	$(MAKE_LINK) $(<F) $@
-
-.PHONY: install
-install: all
-	$(INSTALL_DATA) src/xenstat.h $(DESTDIR)$(includedir)
-	$(INSTALL_DATA) $(LIB) $(DESTDIR)$(libdir)/libxenstat.a
-	$(INSTALL_PROG) src/libxenstat.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)
-	ln -sf libxenstat.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)/libxenstat.so.$(MAJOR)
-	ln -sf libxenstat.so.$(MAJOR) $(DESTDIR)$(libdir)/libxenstat.so
-	$(INSTALL_DATA) xenstat.pc $(DESTDIR)$(PKG_INSTALLDIR)
-
-.PHONY: uninstall
-uninstall:
-	rm -f $(DESTDIR)$(PKG_INSTALLDIR)/xenstat.pc
-	rm -f $(DESTDIR)$(libdir)/libxenstat.so
-	rm -f $(DESTDIR)$(libdir)/libxenstat.so.$(MAJOR)
-	rm -f $(DESTDIR)$(libdir)/libxenstat.so.$(MAJOR).$(MINOR)
-	rm -f $(DESTDIR)$(libdir)/libxenstat.a
-	rm -f $(DESTDIR)$(includedir)/xenstat.h
+$(LIB_OBJS): _paths.h
 
 PYLIB=bindings/swig/python/_xenstat.so
 PYMOD=bindings/swig/python/xenstat.py
@@ -109,9 +58,9 @@ install-bindings: install-perl-bindings install-python-bindings
 .PHONY: uninstall-bindings
 uninstall-bindings: uninstall-perl-bindings uninstall-python-bindings
 
-$(BINDINGS): $(SHLIB) $(SHLIB_LINKS) src/xenstat.h
+$(BINDINGS): $(SHLIB) $(SHLIB_LINKS) include/xenstat.h
 
-SWIG_FLAGS=-module xenstat -Isrc
+SWIG_FLAGS=-module xenstat -Iinclude -I.
 
 # Python bindings
 PYTHON_VERSION=$(PYTHON:python%=%)
@@ -177,14 +126,9 @@ endif
 
 .PHONY: clean
 clean:
-	rm -f $(LIB) $(SHLIB) $(SHLIB_LINKS) $(OBJECTS-y) \
-	      $(BINDINGS) $(BINDINGSRC) $(DEPS_RM) src/_paths.h
-	rm -f xenstat.pc
-
-.PHONY: distclean
-distclean: clean
+	rm -f $(BINDINGS) $(BINDINGSRC) $(DEPS_RM) _paths.h
 
 -include $(DEPS_INCLUDE)
 
-genpath-target = $(call buildmakevars2header,src/_paths.h)
+genpath-target = $(call buildmakevars2header,_paths.h)
 $(eval $(genpath-target))
diff --git a/tools/xenstat/libxenstat/bindings/swig/perl/.empty b/tools/libs/stat/bindings/swig/perl/.empty
similarity index 100%
rename from tools/xenstat/libxenstat/bindings/swig/perl/.empty
rename to tools/libs/stat/bindings/swig/perl/.empty
diff --git a/tools/xenstat/libxenstat/bindings/swig/python/.empty b/tools/libs/stat/bindings/swig/python/.empty
similarity index 100%
rename from tools/xenstat/libxenstat/bindings/swig/python/.empty
rename to tools/libs/stat/bindings/swig/python/.empty
diff --git a/tools/xenstat/libxenstat/bindings/swig/xenstat.i b/tools/libs/stat/bindings/swig/xenstat.i
similarity index 100%
rename from tools/xenstat/libxenstat/bindings/swig/xenstat.i
rename to tools/libs/stat/bindings/swig/xenstat.i
diff --git a/tools/xenstat/libxenstat/src/xenstat.h b/tools/libs/stat/include/xenstat.h
similarity index 98%
rename from tools/xenstat/libxenstat/src/xenstat.h
rename to tools/libs/stat/include/xenstat.h
index 76a660f321..c3b98909dd 100644
--- a/tools/xenstat/libxenstat/src/xenstat.h
+++ b/tools/libs/stat/include/xenstat.h
@@ -71,6 +71,9 @@ unsigned long long xenstat_node_tot_mem(xenstat_node * node);
 /* Get amount of free memory on a node */
 unsigned long long xenstat_node_free_mem(xenstat_node * node);
 
+/* Get amount of freeable memory on a node */
+long xenstat_node_freeable_mb(xenstat_node * node);
+
 /* Find the number of domains existing on a node */
 unsigned int xenstat_node_num_domains(xenstat_node * node);
 
diff --git a/tools/libs/stat/libxenstat.map b/tools/libs/stat/libxenstat.map
new file mode 100644
index 0000000000..b736d8e94c
--- /dev/null
+++ b/tools/libs/stat/libxenstat.map
@@ -0,0 +1,54 @@
+VERS_4.14.0 {
+	global:
+		xenstat_init;
+		xenstat_uninit;
+		xenstat_get_node;
+		xenstat_free_node;
+		xenstat_node_domain;
+		xenstat_node_domain_by_index;
+		xenstat_node_xen_version;
+		xenstat_node_tot_mem;
+		xenstat_node_free_mem;
+		xenstat_node_freeable_mb;
+		xenstat_node_num_domains;
+		xenstat_node_num_cpus;
+		xenstat_node_cpu_hz;
+		xenstat_domain_id;
+		xenstat_domain_name;
+		xenstat_domain_cpu_ns;
+		xenstat_domain_num_vcpus;
+		xenstat_domain_vcpu;
+		xenstat_domain_cur_mem;
+		xenstat_domain_max_mem;
+		xenstat_domain_ssid;
+		xenstat_domain_dying;
+		xenstat_domain_crashed;
+		xenstat_domain_shutdown;
+		xenstat_domain_paused;
+		xenstat_domain_blocked;
+		xenstat_domain_running;
+		xenstat_domain_num_networks;
+		xenstat_domain_network;
+		xenstat_domain_num_vbds;
+		xenstat_domain_vbd;
+		xenstat_vcpu_online;
+		xenstat_vcpu_ns;
+		xenstat_network_id;
+		xenstat_network_rbytes;
+		xenstat_network_rpackets;
+		xenstat_network_rerrs;
+		xenstat_network_rdrop;
+		xenstat_network_tbytes;
+		xenstat_network_tpackets;
+		xenstat_network_terrs;
+		xenstat_network_tdrop;
+		xenstat_vbd_type;
+		xenstat_vbd_dev;
+		xenstat_vbd_oo_reqs;
+		xenstat_vbd_rd_reqs;
+		xenstat_vbd_wr_reqs;
+		xenstat_vbd_rd_sects;
+		xenstat_vbd_wr_sects;
+		xenstat_vbd_error;
+	local: *; /* Do not expose anything by default */
+};
diff --git a/tools/xenstat/libxenstat/src/xenstat.c b/tools/libs/stat/xenstat.c
similarity index 100%
rename from tools/xenstat/libxenstat/src/xenstat.c
rename to tools/libs/stat/xenstat.c
diff --git a/tools/xenstat/libxenstat/xenstat.pc.in b/tools/libs/stat/xenstat.pc.in
similarity index 82%
rename from tools/xenstat/libxenstat/xenstat.pc.in
rename to tools/libs/stat/xenstat.pc.in
index ad00577c89..6005593ba1 100644
--- a/tools/xenstat/libxenstat/xenstat.pc.in
+++ b/tools/libs/stat/xenstat.pc.in
@@ -7,4 +7,4 @@ Description: The Xenstat library for Xen hypervisor
 Version: @@version@@
 Cflags: -I${includedir}
 Libs: @@libsflag@@${libdir} -lxenstat
-Requires.private: xencontrol,xenstore
+Requires.private: xencontrol,xenstore,yajl
diff --git a/tools/xenstat/libxenstat/src/xenstat_freebsd.c b/tools/libs/stat/xenstat_freebsd.c
similarity index 100%
rename from tools/xenstat/libxenstat/src/xenstat_freebsd.c
rename to tools/libs/stat/xenstat_freebsd.c
diff --git a/tools/xenstat/libxenstat/src/xenstat_linux.c b/tools/libs/stat/xenstat_linux.c
similarity index 98%
rename from tools/xenstat/libxenstat/src/xenstat_linux.c
rename to tools/libs/stat/xenstat_linux.c
index 7530349eee..793263f2b6 100644
--- a/tools/xenstat/libxenstat/src/xenstat_linux.c
+++ b/tools/libs/stat/xenstat_linux.c
@@ -64,7 +64,7 @@ static const char PROCNETDEV_HEADER[] =
 
 /* We need to get the name of the bridge interface for use with bonding interfaces */
 /* Use excludeName parameter to avoid adding bridges we don't care about, eg. virbr0 */
-void getBridge(char *excludeName, char *result, size_t resultLen)
+static void getBridge(char *excludeName, char *result, size_t resultLen)
 {
 	struct dirent *de;
 	DIR *d;
@@ -89,7 +89,7 @@ void getBridge(char *excludeName, char *result, size_t resultLen)
 
 /* parseNetLine provides regular expression based parsing for lines from /proc/net/dev, all the */
 /* information are parsed but not all are used in our case, ie. for xenstat */
-int parseNetDevLine(char *line, char *iface, unsigned long long *rxBytes, unsigned long long *rxPackets,
+static int parseNetDevLine(char *line, char *iface, unsigned long long *rxBytes, unsigned long long *rxPackets,
 		unsigned long long *rxErrs, unsigned long long *rxDrops, unsigned long long *rxFifo,
 		unsigned long long *rxFrames, unsigned long long *rxComp, unsigned long long *rxMcast,
 		unsigned long long *txBytes, unsigned long long *txPackets, unsigned long long *txErrs,
diff --git a/tools/xenstat/libxenstat/src/xenstat_netbsd.c b/tools/libs/stat/xenstat_netbsd.c
similarity index 100%
rename from tools/xenstat/libxenstat/src/xenstat_netbsd.c
rename to tools/libs/stat/xenstat_netbsd.c
diff --git a/tools/xenstat/libxenstat/src/xenstat_priv.h b/tools/libs/stat/xenstat_priv.h
similarity index 100%
rename from tools/xenstat/libxenstat/src/xenstat_priv.h
rename to tools/libs/stat/xenstat_priv.h
diff --git a/tools/xenstat/libxenstat/src/xenstat_qmp.c b/tools/libs/stat/xenstat_qmp.c
similarity index 100%
rename from tools/xenstat/libxenstat/src/xenstat_qmp.c
rename to tools/libs/stat/xenstat_qmp.c
diff --git a/tools/xenstat/libxenstat/src/xenstat_solaris.c b/tools/libs/stat/xenstat_solaris.c
similarity index 100%
rename from tools/xenstat/libxenstat/src/xenstat_solaris.c
rename to tools/libs/stat/xenstat_solaris.c
diff --git a/tools/xenstat/Makefile b/tools/xenstat/Makefile
deleted file mode 100644
index b300f31289..0000000000
--- a/tools/xenstat/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-XEN_ROOT = $(CURDIR)/../..
-include $(XEN_ROOT)/tools/Rules.mk
-
-SUBDIRS :=
-SUBDIRS += libxenstat
-SUBDIRS += xentop
-
-.PHONY: all install clean distclean uninstall
-
-all install clean distclean uninstall: %: subdirs-%
diff --git a/tools/xenstat/xentop/Makefile b/tools/xentop/Makefile
similarity index 97%
rename from tools/xenstat/xentop/Makefile
rename to tools/xentop/Makefile
index ec612db2a2..0034114684 100644
--- a/tools/xenstat/xentop/Makefile
+++ b/tools/xentop/Makefile
@@ -10,7 +10,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-XEN_ROOT=$(CURDIR)/../../..
+XEN_ROOT=$(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 ifneq ($(XENSTAT_XENTOP),y)
diff --git a/tools/xenstat/xentop/TODO b/tools/xentop/TODO
similarity index 100%
rename from tools/xenstat/xentop/TODO
rename to tools/xentop/TODO
diff --git a/tools/xenstat/xentop/xentop.c b/tools/xentop/xentop.c
similarity index 100%
rename from tools/xenstat/xentop/xentop.c
rename to tools/xentop/xentop.c
-- 
2.20.1



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

* [PATCH 12/12] tools: generate most contents of library make variables
  2020-07-15 16:24 [PATCH 00/12] tools: move more libraries into tools/libs Ian Jackson
                   ` (11 preceding siblings ...)
  2020-07-15 16:25 ` [PATCH 11/12] tools: split libxenstat into new tools/libs/stat directory Ian Jackson
@ 2020-07-15 16:25 ` Ian Jackson
  2020-07-15 16:50 ` [PATCH 00/12] tools: move more libraries into tools/libs Stefano Stabellini
  13 siblings, 0 replies; 27+ messages in thread
From: Ian Jackson @ 2020-07-15 16:25 UTC (permalink / raw)
  To: xen-devel; +Cc: Juergen Gross, ian.jackson, Wei Liu

From: Juergen Gross <jgross@suse.com>

Library related make variables (CFLAGS_lib*, SHDEPS_lib*, LDLIBS_lib*
and SHLIB_lib*) mostly have a common pattern for their values. Generate
most of this content automatically by adding a new per-library variable
defining on which other libraries a lib is depending. This in turn
makes it possible to drop the USELIB variable from each library
Makefile.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 tools/Rules.mk                    | 103 ++++++++++--------------------
 tools/libs/call/Makefile          |   1 -
 tools/libs/ctrl/Makefile          |   1 -
 tools/libs/devicemodel/Makefile   |   1 -
 tools/libs/evtchn/Makefile        |   1 -
 tools/libs/foreignmemory/Makefile |   1 -
 tools/libs/gnttab/Makefile        |   1 -
 tools/libs/hypfs/Makefile         |   1 -
 tools/libs/libs.mk                |   5 +-
 tools/libs/stat/Makefile          |   1 -
 tools/libs/store/Makefile         |   1 -
 tools/libs/vchan/Makefile         |   1 -
 12 files changed, 35 insertions(+), 83 deletions(-)

diff --git a/tools/Rules.mk b/tools/Rules.mk
index 279df14152..89b28e3fad 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -12,18 +12,38 @@ INSTALL = $(XEN_ROOT)/tools/cross-install
 LDFLAGS += $(PREPEND_LDFLAGS_XEN_TOOLS)
 
 XEN_INCLUDE        = $(XEN_ROOT)/tools/include
-XEN_libxentoolcore = $(XEN_ROOT)/tools/libs/toolcore
-XEN_libxentoollog  = $(XEN_ROOT)/tools/libs/toollog
-XEN_libxenevtchn   = $(XEN_ROOT)/tools/libs/evtchn
-XEN_libxengnttab   = $(XEN_ROOT)/tools/libs/gnttab
-XEN_libxencall     = $(XEN_ROOT)/tools/libs/call
-XEN_libxenforeignmemory = $(XEN_ROOT)/tools/libs/foreignmemory
-XEN_libxendevicemodel = $(XEN_ROOT)/tools/libs/devicemodel
-XEN_libxenhypfs    = $(XEN_ROOT)/tools/libs/hypfs
-XEN_libxenctrl     = $(XEN_ROOT)/tools/libs/ctrl
-XEN_libxenstore    = $(XEN_ROOT)/tools/libs/store
-XEN_libxenstat     = $(XEN_ROOT)/tools/libs/stat
-XEN_libxenvchan    = $(XEN_ROOT)/tools/libs/vchan
+
+LIBS_LIBS += toolcore
+USELIBS_toolcore :=
+LIBS_LIBS += toollog
+USELIBS_toollog :=
+LIBS_LIBS += evtchn
+USELIBS_evtchn := toollog toolcore
+LIBS_LIBS += gnttab
+USELIBS_gnttab := toollog toolcore
+LIBS_LIBS += call
+USELIBS_call := toollog toolcore
+LIBS_LIBS += foreignmemory
+USELIBS_foreignmemory := toollog toolcore
+LIBS_LIBS += devicemodel
+USELIBS_devicemodel := toollog toolcore call
+LIBS_LIBS += hypfs
+USELIBS_hypfs := toollog toolcore call
+LIBS_LIBS += ctrl
+USELIBS_ctrl := toollog call evtchn gnttab foreignmemory devicemodel
+LIBS_LIBS += store
+USELIBS_store := toolcore
+LIBS_LIBS += stat
+USELIBS_stat := ctrl store
+LIBS_LIBS += vchan
+USELIBS_vchan := toollog store gnttab evtchn
+
+$(foreach lib,$(LIBS_LIBS),$(eval XEN_libxen$(lib) = $(XEN_ROOT)/tools/libs/$(lib)))
+$(foreach lib,$(LIBS_LIBS),$(eval CFLAGS_libxen$(lib) = -I$(XEN_libxen$(lib))/include $(CFLAGS_xeninclude)))
+$(foreach lib,$(LIBS_LIBS),$(eval SHDEPS_libxen$(lib) = $(foreach use,$(USELIBS_$(lib)),$(SHLIB_libxen$(use)))))
+$(foreach lib,$(LIBS_LIBS),$(eval LDLIBS_libxen$(lib) = $(SHDEPS_libxen$(lib)) $(XEN_libxen$(lib))/libxen$(lib)$(libextension)))
+$(foreach lib,$(LIBS_LIBS),$(eval SHLIB_libxen$(lib) = $(SHDEPS_libxen$(lib)) -Wl,-rpath-link=$(XEN_libxen$(lib))))
+
 XEN_libxenguest    = $(XEN_ROOT)/tools/libxc
 XEN_libxenlight    = $(XEN_ROOT)/tools/libxl
 # Currently libxlutil lives in the same directory as libxenlight
@@ -98,76 +118,19 @@ endif
 # Consumers of libfoo should not directly use $(SHDEPS_libfoo) or
 # $(SHLIB_libfoo)
 
-CFLAGS_libxentoollog = -I$(XEN_libxentoollog)/include $(CFLAGS_xeninclude)
-SHDEPS_libxentoollog =
-LDLIBS_libxentoollog = $(SHDEPS_libxentoollog) $(XEN_libxentoollog)/libxentoollog$(libextension)
-SHLIB_libxentoollog  = $(SHDEPS_libxentoollog) -Wl,-rpath-link=$(XEN_libxentoollog)
-
-CFLAGS_libxentoolcore = -I$(XEN_libxentoolcore)/include $(CFLAGS_xeninclude)
-SHDEPS_libxentoolcore =
-LDLIBS_libxentoolcore = $(SHDEPS_libxentoolcore) $(XEN_libxentoolcore)/libxentoolcore$(libextension)
-SHLIB_libxentoolcore  = $(SHDEPS_libxentoolcore) -Wl,-rpath-link=$(XEN_libxentoolcore)
-
-CFLAGS_libxenevtchn = -I$(XEN_libxenevtchn)/include $(CFLAGS_xeninclude)
-SHDEPS_libxenevtchn = $(SHLIB_libxentoolcore)
-LDLIBS_libxenevtchn = $(SHDEPS_libxenevtchn) $(XEN_libxenevtchn)/libxenevtchn$(libextension)
-SHLIB_libxenevtchn  = $(SHDEPS_libxenevtchn) -Wl,-rpath-link=$(XEN_libxenevtchn)
-
-CFLAGS_libxengnttab = -I$(XEN_libxengnttab)/include $(CFLAGS_xeninclude)
-SHDEPS_libxengnttab = $(SHLIB_libxentoollog) $(SHLIB_libxentoolcore)
-LDLIBS_libxengnttab = $(SHDEPS_libxengnttab) $(XEN_libxengnttab)/libxengnttab$(libextension)
-SHLIB_libxengnttab  = $(SHDEPS_libxengnttab) -Wl,-rpath-link=$(XEN_libxengnttab)
-
-CFLAGS_libxencall = -I$(XEN_libxencall)/include $(CFLAGS_xeninclude)
-SHDEPS_libxencall = $(SHLIB_libxentoolcore)
-LDLIBS_libxencall = $(SHDEPS_libxencall) $(XEN_libxencall)/libxencall$(libextension)
-SHLIB_libxencall  = $(SHDEPS_libxencall) -Wl,-rpath-link=$(XEN_libxencall)
-
-CFLAGS_libxenforeignmemory = -I$(XEN_libxenforeignmemory)/include $(CFLAGS_xeninclude)
-SHDEPS_libxenforeignmemory = $(SHLIB_libxentoolcore)
-LDLIBS_libxenforeignmemory = $(SHDEPS_libxenforeignmemory) $(XEN_libxenforeignmemory)/libxenforeignmemory$(libextension)
-SHLIB_libxenforeignmemory  = $(SHDEPS_libxenforeignmemory) -Wl,-rpath-link=$(XEN_libxenforeignmemory)
-
-CFLAGS_libxendevicemodel = -I$(XEN_libxendevicemodel)/include $(CFLAGS_xeninclude)
-SHDEPS_libxendevicemodel = $(SHLIB_libxentoollog) $(SHLIB_libxentoolcore) $(SHLIB_libxencall)
-LDLIBS_libxendevicemodel = $(SHDEPS_libxendevicemodel) $(XEN_libxendevicemodel)/libxendevicemodel$(libextension)
-SHLIB_libxendevicemodel  = $(SHDEPS_libxendevicemodel) -Wl,-rpath-link=$(XEN_libxendevicemodel)
-
-CFLAGS_libxenhypfs = -I$(XEN_libxenhypfs)/include $(CFLAGS_xeninclude)
-SHDEPS_libxenhypfs = $(SHLIB_libxentoollog) $(SHLIB_libxentoolcore) $(SHLIB_libxencall)
-LDLIBS_libxenhypfs = $(SHDEPS_libxenhypfs) $(XEN_libxenhypfs)/libxenhypfs$(libextension)
-SHLIB_libxenhypfs  = $(SHDEPS_libxenhypfs) -Wl,-rpath-link=$(XEN_libxenhypfs)
-
 # code which compiles against libxenctrl get __XEN_TOOLS__ and
 # therefore sees the unstable hypercall interfaces.
-CFLAGS_libxenctrl = -I$(XEN_libxenctrl)/include $(CFLAGS_libxentoollog) $(CFLAGS_libxenforeignmemory) $(CFLAGS_libxendevicemodel) $(CFLAGS_xeninclude) -D__XEN_TOOLS__
-SHDEPS_libxenctrl = $(SHLIB_libxentoollog) $(SHLIB_libxenevtchn) $(SHLIB_libxengnttab) $(SHLIB_libxencall) $(SHLIB_libxenforeignmemory) $(SHLIB_libxendevicemodel)
-LDLIBS_libxenctrl = $(SHDEPS_libxenctrl) $(XEN_libxenctrl)/libxenctrl$(libextension)
-SHLIB_libxenctrl  = $(SHDEPS_libxenctrl) -Wl,-rpath-link=$(XEN_libxenctrl)
+CFLAGS_libxenctrl += (CFLAGS_libxentoollog) $(CFLAGS_libxenforeignmemory) $(CFLAGS_libxendevicemodel) -D__XEN_TOOLS__
 
 CFLAGS_libxenguest = -I$(XEN_libxenguest)/include $(CFLAGS_libxenevtchn) $(CFLAGS_libxenforeignmemory) $(CFLAGS_xeninclude)
 SHDEPS_libxenguest = $(SHLIB_libxenevtchn) $(SHLIB_libxenctrl)
 LDLIBS_libxenguest = $(SHDEPS_libxenguest) $(XEN_libxenguest)/libxenguest$(libextension)
 SHLIB_libxenguest  = $(SHDEPS_libxenguest) -Wl,-rpath-link=$(XEN_libxenguest)
 
-CFLAGS_libxenstore = -I$(XEN_libxenstore)/include $(CFLAGS_xeninclude)
-SHDEPS_libxenstore = $(SHLIB_libxentoolcore)
-LDLIBS_libxenstore = $(SHDEPS_libxenstore) $(XEN_libxenstore)/libxenstore$(libextension)
-SHLIB_libxenstore  = $(SHDEPS_libxenstore) -Wl,-rpath-link=$(XEN_libxenstore)
 ifeq ($(CONFIG_Linux),y)
 LDLIBS_libxenstore += -ldl
 endif
 
-CFLAGS_libxenstat  = -I$(XEN_libxenstat)/include
-SHDEPS_libxenstat  = $(SHLIB_libxenctrl) $(SHLIB_libxenstore)
-LDLIBS_libxenstat  = $(SHDEPS_libxenstat) $(XEN_libxenstat)/libxenstat$(libextension)
-SHLIB_libxenstat   = $(SHDEPS_libxenstat) -Wl,-rpath-link=$(XEN_libxenstat)
-
-CFLAGS_libxenvchan = -I$(XEN_libxenvchan)/include $(CFLAGS_libxengnttab) $(CFLAGS_libxenevtchn)
-SHDEPS_libxenvchan = $(SHLIB_libxentoollog) $(SHLIB_libxenstore) $(SHLIB_libxenevtchn) $(SHLIB_libxengnttab)
-LDLIBS_libxenvchan = $(SHDEPS_libxenvchan) $(XEN_libxenvchan)/libxenvchan$(libextension)
-SHLIB_libxenvchan  = $(SHDEPS_libxenvchan) -Wl,-rpath-link=$(XEN_libxenvchan)
-
 ifeq ($(debug),y)
 # Disable optimizations
 CFLAGS += -O0 -fno-omit-frame-pointer
diff --git a/tools/libs/call/Makefile b/tools/libs/call/Makefile
index 7994b411fa..acddc41928 100644
--- a/tools/libs/call/Makefile
+++ b/tools/libs/call/Makefile
@@ -4,7 +4,6 @@ include $(XEN_ROOT)/tools/Rules.mk
 MAJOR    = 1
 MINOR    = 2
 LIBNAME  := call
-USELIBS  := toollog toolcore
 
 SRCS-y                 += core.c buffer.c
 SRCS-$(CONFIG_Linux)   += linux.c
diff --git a/tools/libs/ctrl/Makefile b/tools/libs/ctrl/Makefile
index bda0b43dfa..9d9b32cd2b 100644
--- a/tools/libs/ctrl/Makefile
+++ b/tools/libs/ctrl/Makefile
@@ -4,7 +4,6 @@ include $(XEN_ROOT)/tools/Rules.mk
 MAJOR    = 4.14
 MINOR    = 0
 LIBNAME  := ctrl
-USELIBS  := toollog call evtchn gnttab foreignmemory devicemodel
 
 SRCS-y       += xc_altp2m.c
 SRCS-y       += xc_core.c
diff --git a/tools/libs/devicemodel/Makefile b/tools/libs/devicemodel/Makefile
index d9d1d1b850..0c0d9114cb 100644
--- a/tools/libs/devicemodel/Makefile
+++ b/tools/libs/devicemodel/Makefile
@@ -4,7 +4,6 @@ include $(XEN_ROOT)/tools/Rules.mk
 MAJOR    = 1
 MINOR    = 3
 LIBNAME  := devicemodel
-USELIBS  := toollog toolcore call
 
 SRCS-y                 += core.c
 SRCS-$(CONFIG_Linux)   += linux.c
diff --git a/tools/libs/evtchn/Makefile b/tools/libs/evtchn/Makefile
index d7aa4d402f..ea529e5fb7 100644
--- a/tools/libs/evtchn/Makefile
+++ b/tools/libs/evtchn/Makefile
@@ -4,7 +4,6 @@ include $(XEN_ROOT)/tools/Rules.mk
 MAJOR    = 1
 MINOR    = 1
 LIBNAME  := evtchn
-USELIBS  := toollog toolcore
 
 SRCS-y                 += core.c
 SRCS-$(CONFIG_Linux)   += linux.c
diff --git a/tools/libs/foreignmemory/Makefile b/tools/libs/foreignmemory/Makefile
index 823989681d..17057fc1e1 100644
--- a/tools/libs/foreignmemory/Makefile
+++ b/tools/libs/foreignmemory/Makefile
@@ -4,7 +4,6 @@ include $(XEN_ROOT)/tools/Rules.mk
 MAJOR    = 1
 MINOR    = 3
 LIBNAME  := foreignmemory
-USELIBS  := toollog toolcore
 
 SRCS-y                 += core.c
 SRCS-$(CONFIG_Linux)   += linux.c
diff --git a/tools/libs/gnttab/Makefile b/tools/libs/gnttab/Makefile
index c0fffdac71..2467330d1a 100644
--- a/tools/libs/gnttab/Makefile
+++ b/tools/libs/gnttab/Makefile
@@ -4,7 +4,6 @@ include $(XEN_ROOT)/tools/Rules.mk
 MAJOR    = 1
 MINOR    = 2
 LIBNAME  := gnttab
-USELIBS  := toollog toolcore
 
 SRCS-GNTTAB            += gnttab_core.c
 SRCS-GNTSHR            += gntshr_core.c
diff --git a/tools/libs/hypfs/Makefile b/tools/libs/hypfs/Makefile
index b4c41f6189..af358547f2 100644
--- a/tools/libs/hypfs/Makefile
+++ b/tools/libs/hypfs/Makefile
@@ -4,7 +4,6 @@ include $(XEN_ROOT)/tools/Rules.mk
 MAJOR    = 1
 MINOR    = 0
 LIBNAME  := hypfs
-USELIBS  := toollog toolcore call
 
 APPEND_LDFLAGS += -lz
 
diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index 764f5441e2..dde0360b1e 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -4,15 +4,14 @@
 #   LIBNAME: name of lib to build, will be prepended with "libxen"
 #   MAJOR:   major version of lib
 #   MINOR:   minor version of lib
-#   USELIBS: xen libs to use (e.g. "toolcore toollog")
 
 SHLIB_LDFLAGS += -Wl,--version-script=libxen$(LIBNAME).map
 
 CFLAGS   += -Werror -Wmissing-prototypes
 CFLAGS   += -I./include $(CFLAGS_xeninclude)
-CFLAGS   += $(foreach lib, $(USELIBS), $(CFLAGS_libxen$(lib)))
+CFLAGS   += $(foreach lib, $(USELIBS_$(LIBNAME)), $(CFLAGS_libxen$(lib)))
 
-LDUSELIBS = $(foreach lib, $(USELIBS), $(LDLIBS_libxen$(lib)))
+LDUSELIBS = $(foreach lib, $(USELIBS_$(LIBNAME)), $(LDLIBS_libxen$(lib)))
 
 LIB_OBJS := $(SRCS-y:.c=.o)
 PIC_OBJS := $(SRCS-y:.c=.opic)
diff --git a/tools/libs/stat/Makefile b/tools/libs/stat/Makefile
index 6162395a9a..87bfa1b91c 100644
--- a/tools/libs/stat/Makefile
+++ b/tools/libs/stat/Makefile
@@ -18,7 +18,6 @@ include $(XEN_ROOT)/tools/Rules.mk
 MAJOR = 4.14
 MINOR = 0
 LIBNAME  := stat
-USELIBS  := ctrl store
 
 CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenstore) $(CFLAGS_xeninclude) -include $(XEN_ROOT)/tools/config.h
 
diff --git a/tools/libs/store/Makefile b/tools/libs/store/Makefile
index 76b30145cf..2aa8add521 100644
--- a/tools/libs/store/Makefile
+++ b/tools/libs/store/Makefile
@@ -4,7 +4,6 @@ include $(XEN_ROOT)/tools/Rules.mk
 MAJOR = 3.0
 MINOR = 3
 LIBNAME  := store
-USELIBS  := toolcore
 
 ifeq ($(CONFIG_Linux),y)
 APPEND_LDFLAGS += -ldl
diff --git a/tools/libs/vchan/Makefile b/tools/libs/vchan/Makefile
index bf944d251c..5b59ff5265 100644
--- a/tools/libs/vchan/Makefile
+++ b/tools/libs/vchan/Makefile
@@ -4,7 +4,6 @@ include $(XEN_ROOT)/tools/Rules.mk
 MAJOR = 4.14
 MINOR = 0
 LIBNAME  := vchan
-USELIBS  := toollog store evtchn gnttab
 
 CFLAGS += $(CFLAGS_libxenctrl)
 
-- 
2.20.1



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

* Re: [PATCH 00/12] tools: move more libraries into tools/libs
  2020-07-15 16:24 [PATCH 00/12] tools: move more libraries into tools/libs Ian Jackson
                   ` (12 preceding siblings ...)
  2020-07-15 16:25 ` [PATCH 12/12] tools: generate most contents of library make variables Ian Jackson
@ 2020-07-15 16:50 ` Stefano Stabellini
  2020-07-15 17:03   ` Ian Jackson
  13 siblings, 1 reply; 27+ messages in thread
From: Stefano Stabellini @ 2020-07-15 16:50 UTC (permalink / raw)
  To: incoming+61544a64d0c2dc4555813e58f3810dd7, xen-devel
  Cc: xen-devel, Stefano Stabellini, Julien Grall, Wei Liu,
	Andrew Cooper, ian.jackson, George Dunlap,
	Marek Marczykowski-Górecki, Stewart Hildebrand,
	Josh Whitehead, Jan Beulich, Anthony PERARD, Samuel Thibault

On Wed, 15 Jul 2020, Ian Jackson wrote:
> [ NB: this patch series is actually from Juergen Gross.
> 
>   It is being experiemntally handled as a Merge Reqeust in gitlab, in
>   part to see what problems there are with that workflow that will
>   need extra tooling or whatever.
> 
>   I have manually generated this series using git-format-patch,
>   scripts/add_maintainers.pl, and git-send-email.  I expect that if we
>   adopt this as a real workflow, we will want to make a robot do some
>   of that.
> 
>   I have set replies to go to the Gitlab comment thread and to
>   xen-devel.  Again this is experimental.  We are likely to need
>   something to automatically collect acks, at the very least.
> 
>   Reviewers: for now, please review this series as normal.  You may
>   reply to the messages by email.  Please, for now, send your replies
>   to gitlab and to the mailing list.  I think I have set the reply-to
>   appropriately.
> 
>   Alternatively you may review the code in the gitlab web UI.  But
>   please do not use the line-by-line comment system: write only to the
>   main MR discussion thread.

Thanks for doing this Ian.

I am curious about this: why not the line-by-line comment system? It
looks like it would be the most similar to emails comments. Is it
because comments done that way cannot be sent via email while the main
MR discussion thread can?


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

* Re: [PATCH 04/12] tools: don't call make recursively from libs.mk
  2020-07-15 16:25 ` [PATCH 04/12] tools: don't call make recursively from libs.mk Ian Jackson
@ 2020-07-15 16:54   ` Ian Jackson
  0 siblings, 0 replies; 27+ messages in thread
From: Ian Jackson @ 2020-07-15 16:54 UTC (permalink / raw)
  To: incoming+61544a64d0c2dc4555813e58f3810dd7, xen-devel
  Cc: Juergen Gross, Wei Liu

Ian Jackson writes ("[PATCH 04/12] tools: don't call make recursively from libs.mk"):
> From: Juergen Gross <jgross@suse.com>
> 
> During build of a xen library make is called again via libs.mk. This is
> not necessary as the same can be achieved by a simple dependency.

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


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

* Re: [PATCH 06/12] tools/misc: don't use libxenctrl internals from misc tools
  2020-07-15 16:25 ` [PATCH 06/12] tools/misc: don't use libxenctrl internals from misc tools Ian Jackson
@ 2020-07-15 17:00   ` Ian Jackson
  0 siblings, 0 replies; 27+ messages in thread
From: Ian Jackson @ 2020-07-15 17:00 UTC (permalink / raw)
  To: incoming+61544a64d0c2dc4555813e58f3810dd7, xen-devel
  Cc: Juergen Gross, Wei Liu

Ian Jackson writes ("[PATCH 06/12] tools/misc: don't use libxenctrl internals from misc tools"):
> From: Juergen Gross <jgross@suse.com>
> 
> xen-hptool and xen-mfndump are using internals from libxenctrl e.g. by
> including private headers. Fix that by using either the correct
> official headers or use other means.
...
> -        ERROR("Failed to get the maximum mfn");
> +        fprintf(stderr, "Failed to get the maximum mfn");
>          return -1;

I think this is definitely worse than providing a duplicate definition of
ERROR.

Also patches like this are much easier to read if the different kinds
of change are split up.  Do you think you can break it up further ?

Thanks,
Ian.


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

* Re: [PATCH 00/12] tools: move more libraries into tools/libs
  2020-07-15 16:50 ` [PATCH 00/12] tools: move more libraries into tools/libs Stefano Stabellini
@ 2020-07-15 17:03   ` Ian Jackson
  0 siblings, 0 replies; 27+ messages in thread
From: Ian Jackson @ 2020-07-15 17:03 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: xen-devel, Julien Grall,
	incoming+61544a64d0c2dc4555813e58f3810dd7, Wei Liu,
	Andrew Cooper, George Dunlap, Marek Marczykowski-Górecki,
	Stewart Hildebrand, Josh Whitehead, Jan Beulich, Samuel Thibault,
	Anthony Perard, xen-devel

Stefano Stabellini writes ("Re: [PATCH 00/12] tools: move more libraries into tools/libs"):
> On Wed, 15 Jul 2020, Ian Jackson wrote:
> > [ NB: this patch series is actually from Juergen Gross.
> > 
> >   It is being experiemntally handled as a Merge Reqeust in gitlab, in
> >   part to see what problems there are with that workflow that will
> >   need extra tooling or whatever.
> > 
> >   I have manually generated this series using git-format-patch,
> >   scripts/add_maintainers.pl, and git-send-email.  I expect that if we
> >   adopt this as a real workflow, we will want to make a robot do some
> >   of that.
> > 
> >   I have set replies to go to the Gitlab comment thread and to
> >   xen-devel.  Again this is experimental.  We are likely to need
> >   something to automatically collect acks, at the very least.
> > 
> >   Reviewers: for now, please review this series as normal.  You may
> >   reply to the messages by email.  Please, for now, send your replies
> >   to gitlab and to the mailing list.  I think I have set the reply-to
> >   appropriately.
> > 
> >   Alternatively you may review the code in the gitlab web UI.  But
> >   please do not use the line-by-line comment system: write only to the
> >   main MR discussion thread.
> 
> Thanks for doing this Ian.
> 
> I am curious about this: why not the line-by-line comment system? It
> looks like it would be the most similar to emails comments. Is it
> because comments done that way cannot be sent via email while the main
> MR discussion thread can?

Well, they can sort of go by email but they can't be created by email
and the webpage mouse UI is clearly primary for them.

Also they are difficult to archive, so difficult to look at later.

I guess this is an experiemnt, so feel free to try it but be prepared
to c&p many messages manually to the list...

Ian.


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

* Re: [PATCH 07/12] tools/libxc: untangle libxenctrl from libxenguest
  2020-07-15 16:25 ` [PATCH 07/12] tools/libxc: untangle libxenctrl from libxenguest Ian Jackson
@ 2020-07-15 17:07   ` Ian Jackson
  0 siblings, 0 replies; 27+ messages in thread
From: Ian Jackson @ 2020-07-15 17:07 UTC (permalink / raw)
  To: incoming+61544a64d0c2dc4555813e58f3810dd7, xen-devel
  Cc: Juergen Gross, Samuel Thibault, Marek Marczykowski-Górecki,
	Wei Liu, Anthony Perard

Ian Jackson writes ("[PATCH 07/12] tools/libxc: untangle libxenctrl from libxenguest"):
> From: Juergen Gross <jgross@suse.com>
> 
> Sources of libxenctrl and libxenguest are completely entangled. In
> practice libxenguest is a user of libxenctrl, so don't let any source
> libxenctrl include xg_private.h.
> 
> This can be achieved by moving all definitions used by libxenctrl from
> xg_private.h to xc_private.h. Additionally xc_dom.h needs to be
> exported, so rename it to xenctrl_dom.h.
> 
> Rename all libxenguest sources from xc_* to xg_*.
> 
> Move xc_[un]map_domain_meminfo() fnctions to new source xg_domain.c as
> they are defined in include/xenguest.h and should be in libxenguest.
> 
> Remove xc_efi.h and xc_elf.h as they aren't used anywhere.

Reviewing this is quite difficult.  Is there any way it could be split
up ?  Perhaps some of it could be generated automatically ?  (Eg you
could send a patch whose commit message had the perl rune you used to
generate it, which would enable a reviewer to see what was supposed to
be going on.)

Thanks,
Ian.


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

* Re: [PATCH 08/12] tools: move libxenctrl below tools/libs
  2020-07-15 16:25 ` [PATCH 08/12] tools: move libxenctrl below tools/libs Ian Jackson
@ 2020-07-15 17:08   ` Ian Jackson
  2020-07-18 18:21   ` Samuel Thibault
  1 sibling, 0 replies; 27+ messages in thread
From: Ian Jackson @ 2020-07-15 17:08 UTC (permalink / raw)
  To: incoming+61544a64d0c2dc4555813e58f3810dd7, xen-devel
  Cc: xen-devel, Juergen Gross, Stefano Stabellini, Julien Grall,
	Wei Liu, Andrew Cooper, George Dunlap,
	Marek Marczykowski-Górecki, Anthony Perard, Josh Whitehead,
	Jan Beulich, Stewart Hildebrand, Samuel Thibault

Ian Jackson writes ("[PATCH 08/12] tools: move libxenctrl below tools/libs"):
> From: Juergen Gross <jgross@suse.com>
> 
> Today tools/libxc needs to be built after tools/libs as libxenctrl is
> depending on some libraries in tools/libs. This in turn blocks moving
> other libraries depending on libxenctrl below tools/libs.
> 
> So carve out libxenctrl from tools/libxc and move it into
> tools/libs/ctrl.

Again, maybe this could be 1. split the library, 2. move it ?  Maybe ?

Ian.


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

* Re: [PATCH 01/12] stubdom: add stubdom/mini-os.mk for Xen paths used by Mini-OS
  2020-07-15 16:25 ` [PATCH 01/12] stubdom: add stubdom/mini-os.mk for Xen paths used by Mini-OS Ian Jackson
@ 2020-07-18 18:18   ` Samuel Thibault
  0 siblings, 0 replies; 27+ messages in thread
From: Samuel Thibault @ 2020-07-18 18:18 UTC (permalink / raw)
  To: incoming+61544a64d0c2dc4555813e58f3810dd7, xen-devel
  Cc: Juergen Gross, ian.jackson

Ian Jackson, le mer. 15 juil. 2020 17:25:00 +0100, a ecrit:
> From: Juergen Gross <jgross@suse.com>
> 
> stubdom/mini-os.mk should contain paths used by Mini-OS when built as
> stubdom.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

> ---
>  stubdom/mini-os.mk | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
>  create mode 100644 stubdom/mini-os.mk
> 
> diff --git a/stubdom/mini-os.mk b/stubdom/mini-os.mk
> new file mode 100644
> index 0000000000..32528bb91f
> --- /dev/null
> +++ b/stubdom/mini-os.mk
> @@ -0,0 +1,17 @@
> +# Included by Mini-OS stubdom builds to set variables depending on Xen
> +# internal paths.
> +#
> +# Input variables are:
> +# XEN_ROOT
> +# MINIOS_TARGET_ARCH
> +
> +XENSTORE_CPPFLAGS = -isystem $(XEN_ROOT)/tools/xenstore/include
> +TOOLCORE_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/toolcore
> +TOOLLOG_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/toollog
> +EVTCHN_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/evtchn
> +GNTTAB_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/gnttab
> +CALL_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/call
> +FOREIGNMEMORY_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/foreignmemory
> +DEVICEMODEL_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/devicemodel
> +CTRL_PATH = $(XEN_ROOT)/stubdom/libxc-$(MINIOS_TARGET_ARCH)
> +GUEST_PATH = $(XEN_ROOT)/stubdom/libxc-$(MINIOS_TARGET_ARCH)
> -- 
> 2.20.1
> 

-- 
Samuel
 Créer une hiérarchie supplementaire pour remedier à un problème (?) de
 dispersion est d'une logique digne des Shadocks.
 * BT in: Guide du Cabaliste Usenet - La Cabale vote oui (les Shadocks aussi) *


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

* Re: [PATCH 08/12] tools: move libxenctrl below tools/libs
  2020-07-15 16:25 ` [PATCH 08/12] tools: move libxenctrl below tools/libs Ian Jackson
  2020-07-15 17:08   ` Ian Jackson
@ 2020-07-18 18:21   ` Samuel Thibault
  1 sibling, 0 replies; 27+ messages in thread
From: Samuel Thibault @ 2020-07-18 18:21 UTC (permalink / raw)
  To: incoming+61544a64d0c2dc4555813e58f3810dd7, xen-devel
  Cc: xen-devel, Juergen Gross, Stefano Stabellini, Julien Grall,
	Wei Liu, Andrew Cooper, ian.jackson, George Dunlap,
	Marek Marczykowski-Górecki, Anthony PERARD, Josh Whitehead,
	Jan Beulich, Stewart Hildebrand

Ian Jackson, le mer. 15 juil. 2020 17:25:07 +0100, a ecrit:
> From: Juergen Gross <jgross@suse.com>
> 
> Today tools/libxc needs to be built after tools/libs as libxenctrl is
> depending on some libraries in tools/libs. This in turn blocks moving
> other libraries depending on libxenctrl below tools/libs.
> 
> So carve out libxenctrl from tools/libxc and move it into
> tools/libs/ctrl.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

>  stubdom/Makefile                              | 29 +++++-
>  stubdom/mini-os.mk                            |  2 +-

For that part,

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>


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

* Re: [PATCH 02/12] tools: switch XEN_LIBXEN* make variables to lower case (XEN_libxen*)
  2020-07-15 16:25 ` [PATCH 02/12] tools: switch XEN_LIBXEN* make variables to lower case (XEN_libxen*) Ian Jackson
@ 2020-07-21 13:30   ` Wei Liu
  0 siblings, 0 replies; 27+ messages in thread
From: Wei Liu @ 2020-07-21 13:30 UTC (permalink / raw)
  To: incoming+61544a64d0c2dc4555813e58f3810dd7, xen-devel
  Cc: Juergen Gross, ian.jackson, George Dunlap, Wei Liu

On Wed, Jul 15, 2020 at 05:25:01PM +0100, Ian Jackson wrote:
> From: Juergen Gross <jgross@suse.com>
> 
> In order to harmonize names of library related make variables switch
> XEN_LIBXEN* names to XEN_libxen*, as all other related variables (e.g.
> CFLAGS_libxen*, SHDEPS_libxen*, ...) already use this pattern.
> 
> Rename XEN_LIBXC to XEN_libxenctrl, XEN_XENSTORE to XEN_libxenstore,
> XEN_XENLIGHT to XEN_libxenlight, XEN_XLUTIL to XEN_libxlutil, and
> XEN_LIBVCHAN to XEN_libxenvchan for the same reason.
> 
> Introduce XEN_libxenguest with the same value as XEN_libxenctrl.
> 
> No functional change.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

Looks fine to me.

(Experiment to see how this mail shows up in Gitlab)

Wei.


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

* Re: [PATCH 1/1] docs/process/branching-checklist: Get osstest branch right
  2020-07-15 16:24 ` [PATCH 1/1] docs/process/branching-checklist: Get osstest branch right Ian Jackson
@ 2020-08-18 12:41   ` Ian Jackson
  0 siblings, 0 replies; 27+ messages in thread
From: Ian Jackson @ 2020-08-18 12:41 UTC (permalink / raw)
  To: xen-devel
  Cc: Andrew Cooper, George Dunlap, Jan Beulich, Julien Grall,
	Stefano Stabellini, Wei Liu

Ian Jackson writes ("[PATCH 1/1] docs/process/branching-checklist: Get osstest branch right"):
> The runes for this manual osstest were wrong.  It needs to run as
> osstest, and cr-for-branches should be run from testing.git.
> 
> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>

Not sure if I need an ack for this but one hasn't been forthcoming and
there have been no naks, so I have pushed it.

Ian.


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

* Re: [PATCH 00/12] tools: move more libraries into tools/libs
  2020-07-15 13:01 ` Jan Beulich
@ 2020-07-15 13:10   ` Jürgen Groß
  0 siblings, 0 replies; 27+ messages in thread
From: Jürgen Groß @ 2020-07-15 13:10 UTC (permalink / raw)
  To: Jan Beulich, George Dunlap
  Cc: Stefano Stabellini, Julien Grall, Wei Liu, Andrew Cooper,
	Ian Jackson, Marek Marczykowski-Górecki, Stewart Hildebrand,
	Josh Whitehead, Samuel Thibault, Anthony PERARD, xen-devel

On 15.07.20 15:01, Jan Beulich wrote:
> On 15.07.2020 14:51, Juergen Gross wrote:
>> Move some more libraries under tools/libs, including libxenctrl. This
>> is resulting in a lot of cleanup work regarding building libs and
>> restructuring of the tools directory.
>>
>> I have (for now) left out some more libraries like libxenguest and
>> libxl, but I can have a try moving those, too, if wanted.
>>
>> Please note that patch 8 ("tools: move libxenctrl below tools/libs")
>> needs the related mini-os and qemu-trad patches applied in order not
>> to break the build:
>>
>> https://lists.xen.org/archives/html/xen-devel/2020-07/msg00548.html
>> https://lists.xen.org/archives/html/xen-devel/2020-07/msg00617.html
>>
>> As discussed at the Xen developers summit this series has been
>> selected to act as a test case for sending pull requests via gitlab.
>> This is the reason the patches are _not_ sent individually to
>> xen-devel, but only the cover letter.
> 
> I don't think I've seen any summary of that discussion, and hence I
> also can't judge or know whether this is meant just for huge and
> presumably very mechanical series, or as a general form of patch
> submission. The immediate point that strikes me is - how would I
> comment on such series without having to go to gitlab? (There are
> likely other issues I'd want to see addressed before this becomes
> a common process.)

Those are basically the reasons we decided to have a try.

There is certainly a how-to needed for a submitter and some scripting
to at least ping the maintainers. I have volunteered to send a series
via gitlab as I had already this one in the works and the main
maintainers of the modified files agreed to try the gitlab workflow.

We need to learn whether this is something to consider or not, and for
this purpose we need a practical example.

TBH I had some reservations as I like to be able to review patches while
being offline, so I want to make sure this is still possible somehow.
And being part of the experiment ensures I'm not missing anything. :-)


Juergen


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

* Re: [PATCH 00/12] tools: move more libraries into tools/libs
  2020-07-15 12:51 Juergen Gross
@ 2020-07-15 13:01 ` Jan Beulich
  2020-07-15 13:10   ` Jürgen Groß
  0 siblings, 1 reply; 27+ messages in thread
From: Jan Beulich @ 2020-07-15 13:01 UTC (permalink / raw)
  To: Juergen Gross, George Dunlap
  Cc: Stefano Stabellini, Julien Grall, Wei Liu, Andrew Cooper,
	Ian Jackson, Marek Marczykowski-Górecki, Stewart Hildebrand,
	Josh Whitehead, Samuel Thibault, Anthony PERARD, xen-devel

On 15.07.2020 14:51, Juergen Gross wrote:
> Move some more libraries under tools/libs, including libxenctrl. This
> is resulting in a lot of cleanup work regarding building libs and
> restructuring of the tools directory.
> 
> I have (for now) left out some more libraries like libxenguest and
> libxl, but I can have a try moving those, too, if wanted.
> 
> Please note that patch 8 ("tools: move libxenctrl below tools/libs")
> needs the related mini-os and qemu-trad patches applied in order not
> to break the build:
> 
> https://lists.xen.org/archives/html/xen-devel/2020-07/msg00548.html
> https://lists.xen.org/archives/html/xen-devel/2020-07/msg00617.html
> 
> As discussed at the Xen developers summit this series has been
> selected to act as a test case for sending pull requests via gitlab.
> This is the reason the patches are _not_ sent individually to
> xen-devel, but only the cover letter.

I don't think I've seen any summary of that discussion, and hence I
also can't judge or know whether this is meant just for huge and
presumably very mechanical series, or as a general form of patch
submission. The immediate point that strikes me is - how would I
comment on such series without having to go to gitlab? (There are
likely other issues I'd want to see addressed before this becomes
a common process.)

Jan


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

* [PATCH 00/12] tools: move more libraries into tools/libs
@ 2020-07-15 12:51 Juergen Gross
  2020-07-15 13:01 ` Jan Beulich
  0 siblings, 1 reply; 27+ messages in thread
From: Juergen Gross @ 2020-07-15 12:51 UTC (permalink / raw)
  To: xen-devel, xen-devel
  Cc: Juergen Gross, Stefano Stabellini, Julien Grall, Wei Liu,
	Andrew Cooper, Ian Jackson, George Dunlap,
	Marek Marczykowski-Górecki, Stewart Hildebrand,
	Josh Whitehead, Jan Beulich, Anthony PERARD, Samuel Thibault

Move some more libraries under tools/libs, including libxenctrl. This
is resulting in a lot of cleanup work regarding building libs and
restructuring of the tools directory.

I have (for now) left out some more libraries like libxenguest and
libxl, but I can have a try moving those, too, if wanted.

Please note that patch 8 ("tools: move libxenctrl below tools/libs")
needs the related mini-os and qemu-trad patches applied in order not
to break the build:

https://lists.xen.org/archives/html/xen-devel/2020-07/msg00548.html
https://lists.xen.org/archives/html/xen-devel/2020-07/msg00617.html

As discussed at the Xen developers summit this series has been
selected to act as a test case for sending pull requests via gitlab.
This is the reason the patches are _not_ sent individually to
xen-devel, but only the cover letter.

The full series is available at:

git@gitlab.com:jgross1/xen.git libbuild/v1


Juergen Gross (12):
  stubdom: add stubdom/mini-os.mk for Xen paths used by Mini-OS
  tools: switch XEN_LIBXEN* make variables to lower case (XEN_libxen*)
  tools: add a copy of library headers in tools/include
  tools: don't call make recursively from libs.mk
  tools: define ROUNDUP() in tools/include/xen-tools/libs.h
  tools/misc: don't use libxenctrl internals from misc tools
  tools/libxc: untangle libxenctrl from libxenguest
  tools: move libxenctrl below tools/libs
  tools: split libxenstore into new tools/libs/store directory
  tools: split libxenvchan into new tools/libs/vchan directory
  tools: split libxenstat into new tools/libs/stat directory
  tools: generate most contents of library make variables

 .gitignore                                    |  29 +++-
 MAINTAINERS                                   |   2 +-
 stubdom/Makefile                              |  29 +++-
 stubdom/grub/kexec.c                          |   2 +-
 stubdom/mini-os.mk                            |  17 ++
 tools/Makefile                                |  15 +-
 tools/Rules.mk                                | 142 ++++++---------
 tools/console/daemon/io.c                     |   6 +-
 tools/golang/xenlight/Makefile                |   4 +-
 tools/helpers/init-xenstore-domain.c          |   2 +-
 tools/include/xen-tools/libs.h                |   4 +
 tools/libs/Makefile                           |   4 +
 tools/libs/call/Makefile                      |   3 +-
 tools/libs/call/buffer.c                      |   3 +-
 tools/libs/ctrl/Makefile                      |  68 ++++++++
 tools/{libxc => libs/ctrl}/include/xenctrl.h  |   0
 .../ctrl}/include/xenctrl_compat.h            |   0
 .../ctrl/include/xenctrl_dom.h}               |  10 +-
 tools/libs/ctrl/libxenctrl.map                |   3 +
 tools/{libxc => libs/ctrl}/xc_altp2m.c        |   0
 tools/{libxc => libs/ctrl}/xc_arinc653.c      |   0
 tools/{libxc => libs/ctrl}/xc_bitops.h        |   0
 tools/{libxc => libs/ctrl}/xc_core.c          |   5 +-
 tools/{libxc => libs/ctrl}/xc_core.h          |   2 +-
 tools/{libxc => libs/ctrl}/xc_core_arm.c      |   2 +-
 tools/{libxc => libs/ctrl}/xc_core_arm.h      |   0
 tools/{libxc => libs/ctrl}/xc_core_x86.c      |   6 +-
 tools/{libxc => libs/ctrl}/xc_core_x86.h      |   0
 tools/{libxc => libs/ctrl}/xc_cpu_hotplug.c   |   0
 tools/{libxc => libs/ctrl}/xc_cpupool.c       |   0
 tools/{libxc => libs/ctrl}/xc_csched.c        |   0
 tools/{libxc => libs/ctrl}/xc_csched2.c       |   0
 .../ctrl}/xc_devicemodel_compat.c             |   0
 tools/{libxc => libs/ctrl}/xc_domain.c        | 129 +-------------
 tools/{libxc => libs/ctrl}/xc_evtchn.c        |   0
 tools/{libxc => libs/ctrl}/xc_evtchn_compat.c |   0
 tools/{libxc => libs/ctrl}/xc_flask.c         |   0
 .../{libxc => libs/ctrl}/xc_foreign_memory.c  |   0
 tools/{libxc => libs/ctrl}/xc_freebsd.c       |   0
 tools/{libxc => libs/ctrl}/xc_gnttab.c        |   0
 tools/{libxc => libs/ctrl}/xc_gnttab_compat.c |   0
 tools/{libxc => libs/ctrl}/xc_hcall_buf.c     |   1 -
 tools/{libxc => libs/ctrl}/xc_kexec.c         |   0
 tools/{libxc => libs/ctrl}/xc_linux.c         |   0
 tools/{libxc => libs/ctrl}/xc_mem_access.c    |   0
 tools/{libxc => libs/ctrl}/xc_mem_paging.c    |   0
 tools/{libxc => libs/ctrl}/xc_memshr.c        |   0
 tools/{libxc => libs/ctrl}/xc_minios.c        |   0
 tools/{libxc => libs/ctrl}/xc_misc.c          |   0
 tools/{libxc => libs/ctrl}/xc_monitor.c       |   0
 tools/{libxc => libs/ctrl}/xc_msr_x86.h       |   0
 tools/{libxc => libs/ctrl}/xc_netbsd.c        |   0
 tools/{libxc => libs/ctrl}/xc_pagetab.c       |   0
 tools/{libxc => libs/ctrl}/xc_physdev.c       |   0
 tools/{libxc => libs/ctrl}/xc_pm.c            |   0
 tools/{libxc => libs/ctrl}/xc_private.c       |   3 +-
 tools/{libxc => libs/ctrl}/xc_private.h       |  36 ++++
 tools/{libxc => libs/ctrl}/xc_psr.c           |   0
 tools/{libxc => libs/ctrl}/xc_resource.c      |   0
 tools/{libxc => libs/ctrl}/xc_resume.c        |   2 -
 tools/{libxc => libs/ctrl}/xc_rt.c            |   0
 tools/{libxc => libs/ctrl}/xc_solaris.c       |   0
 tools/{libxc => libs/ctrl}/xc_tbuf.c          |   0
 tools/{libxc => libs/ctrl}/xc_vm_event.c      |   0
 .../ctrl/xenctrl.pc.in}                       |   0
 tools/libs/devicemodel/Makefile               |   3 +-
 tools/libs/evtchn/Makefile                    |   3 +-
 tools/libs/foreignmemory/Makefile             |   3 +-
 tools/libs/foreignmemory/linux.c              |   3 +-
 tools/libs/gnttab/Makefile                    |   3 +-
 tools/libs/gnttab/private.h                   |   3 -
 tools/libs/hypfs/Makefile                     |   3 +-
 tools/libs/libs.mk                            |  34 +++-
 .../{xenstat/libxenstat => libs/stat}/COPYING |   0
 .../libxenstat => libs/stat}/Makefile         |  97 +++--------
 .../stat}/bindings/swig/perl/.empty           |   0
 .../stat}/bindings/swig/python/.empty         |   0
 .../stat}/bindings/swig/xenstat.i             |   0
 .../src => libs/stat/include}/xenstat.h       |   3 +
 tools/libs/stat/libxenstat.map                |  54 ++++++
 .../libxenstat/src => libs/stat}/xenstat.c    |   0
 .../libxenstat => libs/stat}/xenstat.pc.in    |   2 +-
 .../src => libs/stat}/xenstat_freebsd.c       |   0
 .../src => libs/stat}/xenstat_linux.c         |   4 +-
 .../src => libs/stat}/xenstat_netbsd.c        |   0
 .../src => libs/stat}/xenstat_priv.h          |   0
 .../src => libs/stat}/xenstat_qmp.c           |   0
 .../src => libs/stat}/xenstat_solaris.c       |   0
 tools/libs/store/Makefile                     |  65 +++++++
 .../store}/include/compat/xs.h                |   0
 .../store}/include/compat/xs_lib.h            |   0
 .../store}/include/xenstore.h                 |   0
 tools/libs/store/libxenstore.map              |  49 ++++++
 tools/{xenstore => libs/store}/xenstore.pc.in |   0
 tools/{xenstore => libs/store}/xs.c           |   0
 tools/libs/toolcore/Makefile                  |   2 +-
 tools/libs/toollog/Makefile                   |   2 +-
 tools/libs/vchan/Makefile                     |  18 ++
 .../vchan/include}/libxenvchan.h              |   0
 tools/{libvchan => libs/vchan}/init.c         |   0
 tools/{libvchan => libs/vchan}/io.c           |   0
 tools/libs/vchan/libxenvchan.map              |  16 ++
 tools/{libvchan => libs/vchan}/xenvchan.pc.in |   0
 tools/libvchan/Makefile                       |  95 -----------
 tools/libxc/Makefile                          | 161 +++++-------------
 tools/libxc/include/xenguest.h                |   8 +-
 tools/libxc/xc_efi.h                          | 158 -----------------
 tools/libxc/xc_elf.h                          |  16 --
 .../libxc/{xc_cpuid_x86.c => xg_cpuid_x86.c}  |   0
 tools/libxc/{xc_dom_arm.c => xg_dom_arm.c}    |   2 +-
 ...imageloader.c => xg_dom_armzimageloader.c} |   2 +-
 ...{xc_dom_binloader.c => xg_dom_binloader.c} |   2 +-
 tools/libxc/{xc_dom_boot.c => xg_dom_boot.c}  |   2 +-
 ...bzimageloader.c => xg_dom_bzimageloader.c} |   2 +-
 ...m_compat_linux.c => xg_dom_compat_linux.c} |   2 +-
 tools/libxc/{xc_dom_core.c => xg_dom_core.c}  |   2 +-
 ...c_dom_decompress.h => xg_dom_decompress.h} |   4 +-
 ...compress_lz4.c => xg_dom_decompress_lz4.c} |   2 +-
 ...ss_unsafe.c => xg_dom_decompress_unsafe.c} |   2 +-
 ...ss_unsafe.h => xg_dom_decompress_unsafe.h} |   2 +-
 ...ip2.c => xg_dom_decompress_unsafe_bzip2.c} |   2 +-
 ...lzma.c => xg_dom_decompress_unsafe_lzma.c} |   2 +-
 ...o1x.c => xg_dom_decompress_unsafe_lzo1x.c} |   2 +-
 ...afe_xz.c => xg_dom_decompress_unsafe_xz.c} |   2 +-
 ...{xc_dom_elfloader.c => xg_dom_elfloader.c} |   2 +-
 ...{xc_dom_hvmloader.c => xg_dom_hvmloader.c} |   2 +-
 tools/libxc/{xc_dom_x86.c => xg_dom_x86.c}    |   2 +-
 tools/libxc/xg_domain.c                       | 149 ++++++++++++++++
 .../libxc/{xc_nomigrate.c => xg_nomigrate.c}  |   0
 .../{xc_offline_page.c => xg_offline_page.c}  |   2 +-
 tools/libxc/xg_private.h                      |  23 ---
 tools/libxc/xg_save_restore.h                 |  13 --
 .../libxc/{xc_sr_common.c => xg_sr_common.c}  |   2 +-
 .../libxc/{xc_sr_common.h => xg_sr_common.h}  |   4 +-
 ...{xc_sr_common_x86.c => xg_sr_common_x86.c} |   2 +-
 ...{xc_sr_common_x86.h => xg_sr_common_x86.h} |   2 +-
 ..._common_x86_pv.c => xg_sr_common_x86_pv.c} |   2 +-
 ..._common_x86_pv.h => xg_sr_common_x86_pv.h} |   2 +-
 .../{xc_sr_restore.c => xg_sr_restore.c}      |   2 +-
 ...tore_x86_hvm.c => xg_sr_restore_x86_hvm.c} |   2 +-
 ...estore_x86_pv.c => xg_sr_restore_x86_pv.c} |   2 +-
 tools/libxc/{xc_sr_save.c => xg_sr_save.c}    |   2 +-
 ...sr_save_x86_hvm.c => xg_sr_save_x86_hvm.c} |   2 +-
 ...c_sr_save_x86_pv.c => xg_sr_save_x86_pv.c} |   2 +-
 ..._stream_format.h => xg_sr_stream_format.h} |   0
 tools/libxc/{xc_suspend.c => xg_suspend.c}    |   0
 tools/libxl/Makefile                          |   2 +-
 tools/libxl/libxl_arm.c                       |   2 +-
 tools/libxl/libxl_arm.h                       |   2 +-
 tools/libxl/libxl_create.c                    |   2 +-
 tools/libxl/libxl_dm.c                        |   2 +-
 tools/libxl/libxl_dom.c                       |   2 +-
 tools/libxl/libxl_internal.h                  |   5 +-
 tools/libxl/libxl_vnuma.c                     |   2 +-
 tools/libxl/libxl_x86.c                       |   2 +-
 tools/libxl/libxl_x86_acpi.c                  |   2 +-
 tools/misc/Makefile                           |   5 +-
 tools/misc/xen-hptool.c                       |   8 +-
 tools/misc/xen-mfndump.c                      |  70 ++++----
 tools/python/Makefile                         |   2 +-
 tools/python/setup.py                         |  12 +-
 tools/python/xen/lowlevel/xc/xc.c             |   2 +-
 tools/vchan/Makefile                          |  37 ++++
 tools/{libvchan => vchan}/node-select.c       |   0
 tools/{libvchan => vchan}/node.c              |   0
 .../{libvchan => vchan}/vchan-socket-proxy.c  |   0
 tools/xcutils/readnotes.c                     |   2 +-
 tools/xenstat/Makefile                        |  10 --
 tools/xenstore/Makefile                       |  82 +--------
 tools/xenstore/{include => }/xenstore_lib.h   |   0
 tools/xenstore/xenstored_core.c               |   2 -
 tools/{xenstat => }/xentop/Makefile           |   2 +-
 tools/{xenstat => }/xentop/TODO               |   0
 tools/{xenstat => }/xentop/xentop.c           |   0
 174 files changed, 856 insertions(+), 986 deletions(-)
 create mode 100644 stubdom/mini-os.mk
 create mode 100644 tools/libs/ctrl/Makefile
 rename tools/{libxc => libs/ctrl}/include/xenctrl.h (100%)
 rename tools/{libxc => libs/ctrl}/include/xenctrl_compat.h (100%)
 rename tools/{libxc/include/xc_dom.h => libs/ctrl/include/xenctrl_dom.h} (98%)
 create mode 100644 tools/libs/ctrl/libxenctrl.map
 rename tools/{libxc => libs/ctrl}/xc_altp2m.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_arinc653.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_bitops.h (100%)
 rename tools/{libxc => libs/ctrl}/xc_core.c (99%)
 rename tools/{libxc => libs/ctrl}/xc_core.h (99%)
 rename tools/{libxc => libs/ctrl}/xc_core_arm.c (99%)
 rename tools/{libxc => libs/ctrl}/xc_core_arm.h (100%)
 rename tools/{libxc => libs/ctrl}/xc_core_x86.c (98%)
 rename tools/{libxc => libs/ctrl}/xc_core_x86.h (100%)
 rename tools/{libxc => libs/ctrl}/xc_cpu_hotplug.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_cpupool.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_csched.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_csched2.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_devicemodel_compat.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_domain.c (94%)
 rename tools/{libxc => libs/ctrl}/xc_evtchn.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_evtchn_compat.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_flask.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_foreign_memory.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_freebsd.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_gnttab.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_gnttab_compat.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_hcall_buf.c (99%)
 rename tools/{libxc => libs/ctrl}/xc_kexec.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_linux.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_mem_access.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_mem_paging.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_memshr.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_minios.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_misc.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_monitor.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_msr_x86.h (100%)
 rename tools/{libxc => libs/ctrl}/xc_netbsd.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_pagetab.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_physdev.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_pm.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_private.c (99%)
 rename tools/{libxc => libs/ctrl}/xc_private.h (91%)
 rename tools/{libxc => libs/ctrl}/xc_psr.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_resource.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_resume.c (99%)
 rename tools/{libxc => libs/ctrl}/xc_rt.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_solaris.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_tbuf.c (100%)
 rename tools/{libxc => libs/ctrl}/xc_vm_event.c (100%)
 rename tools/{libxc/xencontrol.pc.in => libs/ctrl/xenctrl.pc.in} (100%)
 rename tools/{xenstat/libxenstat => libs/stat}/COPYING (100%)
 rename tools/{xenstat/libxenstat => libs/stat}/Makefile (56%)
 rename tools/{xenstat/libxenstat => libs/stat}/bindings/swig/perl/.empty (100%)
 rename tools/{xenstat/libxenstat => libs/stat}/bindings/swig/python/.empty (100%)
 rename tools/{xenstat/libxenstat => libs/stat}/bindings/swig/xenstat.i (100%)
 rename tools/{xenstat/libxenstat/src => libs/stat/include}/xenstat.h (98%)
 create mode 100644 tools/libs/stat/libxenstat.map
 rename tools/{xenstat/libxenstat/src => libs/stat}/xenstat.c (100%)
 rename tools/{xenstat/libxenstat => libs/stat}/xenstat.pc.in (82%)
 rename tools/{xenstat/libxenstat/src => libs/stat}/xenstat_freebsd.c (100%)
 rename tools/{xenstat/libxenstat/src => libs/stat}/xenstat_linux.c (98%)
 rename tools/{xenstat/libxenstat/src => libs/stat}/xenstat_netbsd.c (100%)
 rename tools/{xenstat/libxenstat/src => libs/stat}/xenstat_priv.h (100%)
 rename tools/{xenstat/libxenstat/src => libs/stat}/xenstat_qmp.c (100%)
 rename tools/{xenstat/libxenstat/src => libs/stat}/xenstat_solaris.c (100%)
 create mode 100644 tools/libs/store/Makefile
 rename tools/{xenstore => libs/store}/include/compat/xs.h (100%)
 rename tools/{xenstore => libs/store}/include/compat/xs_lib.h (100%)
 rename tools/{xenstore => libs/store}/include/xenstore.h (100%)
 create mode 100644 tools/libs/store/libxenstore.map
 rename tools/{xenstore => libs/store}/xenstore.pc.in (100%)
 rename tools/{xenstore => libs/store}/xs.c (100%)
 create mode 100644 tools/libs/vchan/Makefile
 rename tools/{libvchan => libs/vchan/include}/libxenvchan.h (100%)
 rename tools/{libvchan => libs/vchan}/init.c (100%)
 rename tools/{libvchan => libs/vchan}/io.c (100%)
 create mode 100644 tools/libs/vchan/libxenvchan.map
 rename tools/{libvchan => libs/vchan}/xenvchan.pc.in (100%)
 delete mode 100644 tools/libvchan/Makefile
 delete mode 100644 tools/libxc/xc_efi.h
 delete mode 100644 tools/libxc/xc_elf.h
 rename tools/libxc/{xc_cpuid_x86.c => xg_cpuid_x86.c} (100%)
 rename tools/libxc/{xc_dom_arm.c => xg_dom_arm.c} (99%)
 rename tools/libxc/{xc_dom_armzimageloader.c => xg_dom_armzimageloader.c} (99%)
 rename tools/libxc/{xc_dom_binloader.c => xg_dom_binloader.c} (99%)
 rename tools/libxc/{xc_dom_boot.c => xg_dom_boot.c} (99%)
 rename tools/libxc/{xc_dom_bzimageloader.c => xg_dom_bzimageloader.c} (99%)
 rename tools/libxc/{xc_dom_compat_linux.c => xg_dom_compat_linux.c} (99%)
 rename tools/libxc/{xc_dom_core.c => xg_dom_core.c} (99%)
 rename tools/libxc/{xc_dom_decompress.h => xg_dom_decompress.h} (62%)
 rename tools/libxc/{xc_dom_decompress_lz4.c => xg_dom_decompress_lz4.c} (98%)
 rename tools/libxc/{xc_dom_decompress_unsafe.c => xg_dom_decompress_unsafe.c} (96%)
 rename tools/libxc/{xc_dom_decompress_unsafe.h => xg_dom_decompress_unsafe.h} (97%)
 rename tools/libxc/{xc_dom_decompress_unsafe_bzip2.c => xg_dom_decompress_unsafe_bzip2.c} (87%)
 rename tools/libxc/{xc_dom_decompress_unsafe_lzma.c => xg_dom_decompress_unsafe_lzma.c} (87%)
 rename tools/libxc/{xc_dom_decompress_unsafe_lzo1x.c => xg_dom_decompress_unsafe_lzo1x.c} (96%)
 rename tools/libxc/{xc_dom_decompress_unsafe_xz.c => xg_dom_decompress_unsafe_xz.c} (95%)
 rename tools/libxc/{xc_dom_elfloader.c => xg_dom_elfloader.c} (99%)
 rename tools/libxc/{xc_dom_hvmloader.c => xg_dom_hvmloader.c} (99%)
 rename tools/libxc/{xc_dom_x86.c => xg_dom_x86.c} (99%)
 create mode 100644 tools/libxc/xg_domain.c
 rename tools/libxc/{xc_nomigrate.c => xg_nomigrate.c} (100%)
 rename tools/libxc/{xc_offline_page.c => xg_offline_page.c} (99%)
 rename tools/libxc/{xc_sr_common.c => xg_sr_common.c} (99%)
 rename tools/libxc/{xc_sr_common.h => xg_sr_common.h} (99%)
 rename tools/libxc/{xc_sr_common_x86.c => xg_sr_common_x86.c} (99%)
 rename tools/libxc/{xc_sr_common_x86.h => xg_sr_common_x86.h} (98%)
 rename tools/libxc/{xc_sr_common_x86_pv.c => xg_sr_common_x86_pv.c} (99%)
 rename tools/libxc/{xc_sr_common_x86_pv.h => xg_sr_common_x86_pv.h} (98%)
 rename tools/libxc/{xc_sr_restore.c => xg_sr_restore.c} (99%)
 rename tools/libxc/{xc_sr_restore_x86_hvm.c => xg_sr_restore_x86_hvm.c} (99%)
 rename tools/libxc/{xc_sr_restore_x86_pv.c => xg_sr_restore_x86_pv.c} (99%)
 rename tools/libxc/{xc_sr_save.c => xg_sr_save.c} (99%)
 rename tools/libxc/{xc_sr_save_x86_hvm.c => xg_sr_save_x86_hvm.c} (99%)
 rename tools/libxc/{xc_sr_save_x86_pv.c => xg_sr_save_x86_pv.c} (99%)
 rename tools/libxc/{xc_sr_stream_format.h => xg_sr_stream_format.h} (100%)
 rename tools/libxc/{xc_suspend.c => xg_suspend.c} (100%)
 create mode 100644 tools/vchan/Makefile
 rename tools/{libvchan => vchan}/node-select.c (100%)
 rename tools/{libvchan => vchan}/node.c (100%)
 rename tools/{libvchan => vchan}/vchan-socket-proxy.c (100%)
 delete mode 100644 tools/xenstat/Makefile
 rename tools/xenstore/{include => }/xenstore_lib.h (100%)
 rename tools/{xenstat => }/xentop/Makefile (97%)
 rename tools/{xenstat => }/xentop/TODO (100%)
 rename tools/{xenstat => }/xentop/xentop.c (100%)

-- 
2.26.2



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

end of thread, other threads:[~2020-08-18 12:41 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-15 16:24 [PATCH 00/12] tools: move more libraries into tools/libs Ian Jackson
2020-07-15 16:24 ` [PATCH 1/1] docs/process/branching-checklist: Get osstest branch right Ian Jackson
2020-08-18 12:41   ` Ian Jackson
2020-07-15 16:25 ` [PATCH 01/12] stubdom: add stubdom/mini-os.mk for Xen paths used by Mini-OS Ian Jackson
2020-07-18 18:18   ` Samuel Thibault
2020-07-15 16:25 ` [PATCH 02/12] tools: switch XEN_LIBXEN* make variables to lower case (XEN_libxen*) Ian Jackson
2020-07-21 13:30   ` Wei Liu
2020-07-15 16:25 ` [PATCH 03/12] tools: add a copy of library headers in tools/include Ian Jackson
2020-07-15 16:25 ` [PATCH 04/12] tools: don't call make recursively from libs.mk Ian Jackson
2020-07-15 16:54   ` Ian Jackson
2020-07-15 16:25 ` [PATCH 05/12] tools: define ROUNDUP() in tools/include/xen-tools/libs.h Ian Jackson
2020-07-15 16:25 ` [PATCH 06/12] tools/misc: don't use libxenctrl internals from misc tools Ian Jackson
2020-07-15 17:00   ` Ian Jackson
2020-07-15 16:25 ` [PATCH 07/12] tools/libxc: untangle libxenctrl from libxenguest Ian Jackson
2020-07-15 17:07   ` Ian Jackson
2020-07-15 16:25 ` [PATCH 08/12] tools: move libxenctrl below tools/libs Ian Jackson
2020-07-15 17:08   ` Ian Jackson
2020-07-18 18:21   ` Samuel Thibault
2020-07-15 16:25 ` [PATCH 09/12] tools: split libxenstore into new tools/libs/store directory Ian Jackson
2020-07-15 16:25 ` [PATCH 10/12] tools: split libxenvchan into new tools/libs/vchan directory Ian Jackson
2020-07-15 16:25 ` [PATCH 11/12] tools: split libxenstat into new tools/libs/stat directory Ian Jackson
2020-07-15 16:25 ` [PATCH 12/12] tools: generate most contents of library make variables Ian Jackson
2020-07-15 16:50 ` [PATCH 00/12] tools: move more libraries into tools/libs Stefano Stabellini
2020-07-15 17:03   ` Ian Jackson
  -- strict thread matches above, loose matches on Subject: below --
2020-07-15 12:51 Juergen Gross
2020-07-15 13:01 ` Jan Beulich
2020-07-15 13:10   ` Jürgen Groß

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).