@@ -128,6 +128,10 @@ tools/libs/guest/xc_core.h
tools/libs/guest/xc_core_arm.h
tools/libs/guest/xc_core_x86.h
tools/libs/guest/xc_private.h
+tools/libs/stat/_paths.h
+tools/libs/stat/headers.chk
+tools/libs/stat/libxenstat.map
+tools/libs/stat/xenstat.pc
tools/libs/store/headers.chk
tools/libs/store/list.h
tools/libs/store/utils.h
@@ -276,9 +280,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
@@ -291,6 +292,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
@@ -17,7 +17,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
@@ -18,7 +18,6 @@ include $(XEN_ROOT)/tools/libs/uselibs.mk
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)
@@ -108,11 +107,6 @@ ifeq ($(CONFIG_Linux),y)
LDLIBS_libxenstore += -ldl
endif
-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)
-
ifeq ($(debug),y)
# Disable optimizations
CFLAGS += -O0 -fno-omit-frame-pointer
@@ -13,6 +13,7 @@ SUBDIRS-y += ctrl
SUBDIRS-y += guest
SUBDIRS-y += hypfs
SUBDIRS-y += store
+SUBDIRS-y += stat
SUBDIRS-$(CONFIG_Linux) += vchan
ifeq ($(CONFIG_RUMP),y)
similarity index 100%
rename from tools/xenstat/libxenstat/COPYING
rename to tools/libs/stat/COPYING
similarity index 55%
rename from tools/xenstat/libxenstat/Makefile
rename to tools/libs/stat/Makefile
@@ -15,80 +15,24 @@
XEN_ROOT=$(CURDIR)/../../..
include $(XEN_ROOT)/tools/Rules.mk
-LDCONFIG=ldconfig
-MAKE_LINK=ln -sf
-
-MAJOR=4.15
-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))
+CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenstore) $(CFLAGS_xeninclude) -include $(XEN_ROOT)/tools/config.h
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_PREFIX = $(XEN_ROOT)
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxenstat)
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
+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
-.PHONY: all
-all: $(LIB) $(SHLIB) $(SHLIB_LINKS) $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL)
-
-$(OBJECTS-y): src/_paths.h
-
-$(LIB): $(OBJECTS-y)
- $(AR) rc $@ $^
- $(RANLIB) $@
-
-$(SHLIB): $(OBJECTS-y)
- $(CC) $(LDFLAGS) $(SONAME_FLAGS) $(SHLIB_LDFLAGS) -o $@ \
- $(OBJECTS-y) $(LDLIBS-y) $(APPEND_LDFLAGS)
+LDLIBS-y += -lyajl
+LDLIBS-$(CONFIG_SunOS) += -lkstat
+APPEND_LDFLAGS += $(LDLIBS-y)
-src/libxenstat.so.$(MAJOR): $(SHLIB)
- $(MAKE_LINK) $(<F) $@
+include $(XEN_ROOT)/tools/libs/libs.mk
-src/libxenstat.so: src/libxenstat.so.$(MAJOR)
- $(MAKE_LINK) $(<F) $@
+$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxenstat)/include
-.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 +53,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%=%)
@@ -175,16 +119,14 @@ install: install-perl-bindings
uninstall: uninstall-perl-bindings
endif
-.PHONY: clean
-clean:
- rm -f $(LIB) $(SHLIB) $(SHLIB_LINKS) $(OBJECTS-y) \
- $(BINDINGS) $(BINDINGSRC) $(DEPS_RM) src/_paths.h
- rm -f xenstat.pc
+clean: cleanlocal
-.PHONY: distclean
-distclean: clean
+.PHONY: cleanlocal
+cleanlocal:
+ rm -f $(BINDINGS) $(BINDINGSRC) $(DEPS_RM) _paths.h
+ rm -f libxenstat.map
-include $(DEPS_INCLUDE)
-genpath-target = $(call buildmakevars2header,src/_paths.h)
+genpath-target = $(call buildmakevars2header,_paths.h)
$(eval $(genpath-target))
similarity index 100%
rename from tools/xenstat/libxenstat/bindings/swig/perl/.empty
rename to tools/libs/stat/bindings/swig/perl/.empty
similarity index 100%
rename from tools/xenstat/libxenstat/bindings/swig/python/.empty
rename to tools/libs/stat/bindings/swig/python/.empty
similarity index 100%
rename from tools/xenstat/libxenstat/bindings/swig/xenstat.i
rename to tools/libs/stat/bindings/swig/xenstat.i
similarity index 98%
rename from tools/xenstat/libxenstat/src/xenstat.h
rename to 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);
similarity index 100%
rename from tools/xenstat/libxenstat/src/xenstat.c
rename to tools/libs/stat/xenstat.c
similarity index 82%
rename from tools/xenstat/libxenstat/xenstat.pc.in
rename to 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
similarity index 100%
rename from tools/xenstat/libxenstat/src/xenstat_freebsd.c
rename to tools/libs/stat/xenstat_freebsd.c
similarity index 98%
rename from tools/xenstat/libxenstat/src/xenstat_linux.c
rename to 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,
similarity index 100%
rename from tools/xenstat/libxenstat/src/xenstat_netbsd.c
rename to tools/libs/stat/xenstat_netbsd.c
similarity index 100%
rename from tools/xenstat/libxenstat/src/xenstat_priv.h
rename to tools/libs/stat/xenstat_priv.h
similarity index 100%
rename from tools/xenstat/libxenstat/src/xenstat_qmp.c
rename to tools/libs/stat/xenstat_qmp.c
similarity index 100%
rename from tools/xenstat/libxenstat/src/xenstat_solaris.c
rename to tools/libs/stat/xenstat_solaris.c
@@ -24,3 +24,5 @@ LIBS_LIBS += store
USELIBS_store := toolcore
LIBS_LIBS += vchan
USELIBS_vchan := toollog store gnttab evtchn
+LIBS_LIBS += stat
+USELIBS_stat := ctrl store
deleted file mode 100644
@@ -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-%
similarity index 97%
rename from tools/xenstat/xentop/Makefile
rename to 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)
similarity index 100%
rename from tools/xenstat/xentop/TODO
rename to tools/xentop/TODO
similarity index 100%
rename from tools/xenstat/xentop/xentop.c
rename to tools/xentop/xentop.c
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 | 8 +- tools/Makefile | 2 +- tools/Rules.mk | 6 -- tools/libs/Makefile | 1 + .../{xenstat/libxenstat => libs/stat}/COPYING | 0 .../libxenstat => libs/stat}/Makefile | 100 ++++-------------- .../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 + .../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/uselibs.mk | 2 + tools/xenstat/Makefile | 10 -- tools/{xenstat => }/xentop/Makefile | 2 +- tools/{xenstat => }/xentop/TODO | 0 tools/{xenstat => }/xentop/xentop.c | 0 23 files changed, 37 insertions(+), 103 deletions(-) rename tools/{xenstat/libxenstat => libs/stat}/COPYING (100%) rename tools/{xenstat/libxenstat => libs/stat}/Makefile (55%) 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%) 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%)