Hello community, here is the log from the commit of package qclib for openSUSE:Factory checked in at 2020-10-23 12:21:03 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/qclib (Old) and /work/SRC/openSUSE:Factory/.qclib.new.3463 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "qclib" Fri Oct 23 12:21:03 2020 rev:11 rq:843547 version:2.2.1 Changes: -------- --- /work/SRC/openSUSE:Factory/qclib/qclib.changes 2020-09-24 16:14:14.564898541 +0200 +++ /work/SRC/openSUSE:Factory/.qclib.new.3463/qclib.changes 2020-10-23 12:22:17.904680679 +0200 @@ -1,0 +2,11 @@ +Mon Oct 19 17:58:26 UTC 2020 - Mark Post <mp...@suse.com> + +- Upgraded to version 2.2.1 (jsc#SLE-13711) + Bug fixes: + - zhypinfo: Fix memory leaks + - Makefile: Various fixes +- Removed obsolete qclib.makefile.libdir.patch. +- Removed obsolete qclib.fix.missing.makefile.if.statement.patch. +- Updated qclib.makefile.libdir.patch to fit the current version. + +------------------------------------------------------------------- Old: ---- qclib-2.2.0.tgz qclib.fix.missing.makefile.if.statement.patch qclib.makefile.libdir.patch New: ---- qclib-2.2.1.tgz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ qclib.spec ++++++ --- /var/tmp/diff_new_pack.QqzkoR/_old 2020-10-23 12:22:18.704681235 +0200 +++ /var/tmp/diff_new_pack.QqzkoR/_new 2020-10-23 12:22:18.704681235 +0200 @@ -17,7 +17,7 @@ Name: qclib -Version: 2.2.0 +Version: 2.2.1 Release: 0 Summary: Query Capacity library License: BSD-3-Clause @@ -25,8 +25,6 @@ URL: https://public.dhe.ibm.com/software/dw/linux390/ht_src/%{name}-%{version}.tgz Source: %{name}-%{version}.tgz Source1: %{name}-rpmlintrc -Patch1: qclib.fix.missing.makefile.if.statement.patch -Patch99: qclib.makefile.libdir.patch BuildRequires: doxygen BuildRequires: gcc-c++ ExclusiveArch: s390 s390x @@ -108,7 +106,7 @@ %make_build doc test-sh %install -%make_install LIBDIR=%{_lib} V=1 +%make_install V=1 gzip -9 %{buildroot}/%{_mandir}/man8/* make installdoc DESTDIR=%{buildroot} V=1 ++++++ qclib-2.2.0.tgz -> qclib-2.2.1.tgz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qclib-2.2.0/Makefile new/qclib-2.2.1/Makefile --- old/qclib-2.2.0/Makefile 2020-09-11 15:22:30.000000000 +0200 +++ new/qclib-2.2.1/Makefile 2020-10-15 22:23:08.000000000 +0200 @@ -1,18 +1,25 @@ -# Copyright IBM Corp. 2013, 2017 +# Copyright IBM Corp. 2013, 2020 # Versioning scheme: major.minor.bugfix # major : Backwards compatible changes to the API # minor : Additions leaving the API unmodified # bugfix: Bugfixes only -VERSION = 2.2.0 -VERM = $(shell echo $(VERSION) | cut -d '.' -f 1) -CFLAGS ?= -g -Wall -O2 -LDFLAGS ?= +VERSION = 2.2.1 +VERM = $(shell echo $(VERSION) | cut -d '.' -f 1) +CFLAGS ?= -g -Wall -O2 +LDFLAGS ?= +INSTFLAGS ?= -p CFILES = query_capacity.c query_capacity_data.c query_capacity_sysinfo.c \ query_capacity_sysfs.c query_capacity_hypfs.c query_capacity_sthyi.c OBJECTS = $(patsubst %.c,%.o,$(CFILES)) .SUFFIXES: .o .c -DOCDIR ?= /usr/share/doc/packages/ +PREFIX ?= /usr +BINDIR = ${PREFIX}/bin +DOCDIR = ${PREFIX}/share/doc/packages +INCDIR = ${PREFIX}/include +LIBDIR = ${PREFIX}/lib64 +MANDIR = ${PREFIX}/share/man + ifneq ("${V}","1") MAKEFLAGS += --quiet @@ -27,10 +34,6 @@ TAR = $(call cmd," TAR ",$@)tar GEN = $(call cmd," GEN ",$@)grep -INSTALL_FLAGS_BIN = -g $(GROUP) -o $(OWNER) -m755 -INSTALL_FLAGS_MAN = -g $(GROUP) -o $(OWNER) -m644 -INSTALL_FLAGS_LIB = -g $(GROUP) -o $(OWNER) -m755 - all: libqc.a libqc.so.$(VERSION) qc_test qc_test-sh zname zhypinfo hcpinfbk_qclib.h: hcpinfbk.h @@ -48,16 +51,16 @@ ln -s libqc.so.$(VERSION) libqc.so.$(VERM) zname: zname.c zhypinfo.h libqc.so.$(VERSION) - $(CC) $(CFLAGS) -L. $< -o $@ libqc.so.$(VERSION) + $(CC) $(CFLAGS) $(LDFLAGS) -L. $< -o $@ libqc.so.$(VERSION) zhypinfo: zhypinfo.c zhypinfo.h libqc.so.$(VERSION) - $(CC) $(CFLAGS) -L. $< -o $@ libqc.so.$(VERSION) + $(CC) $(CFLAGS) $(LDFLAGS) -L. $< -o $@ libqc.so.$(VERSION) qc_test: qc_test.c libqc.a $(CC) $(CFLAGS) -static $< -L. -lqc -o $@ qc_test-sh: qc_test.c libqc.so.$(VERSION) - $(CC) $(CFLAGS) -L. $< -o $@ libqc.so.$(VERSION) + $(CC) $(CFLAGS) $(LDFLAGS) -L. $< -o $@ libqc.so.$(VERSION) test: qc_test ./$< @@ -74,71 +77,27 @@ echo "Error: 'doxygen' not installed"; \ fi - cppcheck query_capacity*.[ch] 2>&1 | sed 's/^/ /'; \ - else \ - echo "cppcheck not available"; \ - fi - @echo; - -@if which smatch >/dev/null 2>&1; then \ - echo "Running smatch"; \ - smatch query_capacity*.[ch] 2>&1 | sed 's/^/ /'; \ - else \ - echo "smatch not available"; \ - fi - @echo; - -@if which sparse >/dev/null 2>&1; then \ - echo "Running sparse"; \ - sparse -Wsparse-all query_capacity*.[ch] 2>&1 | sed 's/^/ /'; \ - else \ - echo "sparse not available"; \ - fi - @echo; - -@if which valgrind >/dev/null 2>&1; then \ - echo "Running valgrind: qc_test"; \ - LD_LIBRARY_PATH=. valgrind --leak-check=full --show-leak-kinds=all ./qc_test-sh `find regtest_data -maxdepth 1 -mindepth 1 -type d | \ - grep -ve "^regtest_data/extras_" | sort` 2>&1 | grep -A 100 "HEAP SUMMARY:" | sed 's/^/ /'; \ - echo; \ - echo "zname: Running valgrind: zname -a"; \ - QC_USE_DUMP=regtest_data/dump_r3545038 LD_LIBRARY_PATH=. valgrind --leak-check=full --show-leak-kinds=all ./zname -a | \ - grep -A 100 "HEAP SUMMARY:" | sed 's/^/ /'; \ - echo; \ - echo "zname: Running valgrind: zhypinfo"; \ - QC_USE_DUMP=regtest_data/dump_r3545038 LD_LIBRARY_PATH=. valgrind --leak-check=full --show-leak-kinds=all ./zhypinfo | \ - grep -A 100 "HEAP SUMMARY:" | sed 's/^/ /'; \ - echo; \ - echo "zname: Running valgrind: zhypinfo -L"; \ - QC_USE_DUMP=regtest_data/dump_r3545038 LD_LIBRARY_PATH=. valgrind --leak-check=full --show-leak-kinds=all ./zhypinfo -L | \ - grep -A 100 "HEAP SUMMARY:" | sed 's/^/ /'; \ - echo; \ - echo "Running callgrind: qctest"; \ - LD_LIBRARY_PATH=. valgrind --callgrind-out-file=/dev/null --tool=callgrind ./zhypinfo -l `find regtest_data -maxdepth 1 -mindepth 1 -type d | \ - grep -ve "^regtest_data/extras_" | sort` 2>&1 | grep "refs:" | sed 's/^/ /'; \ - else \ - echo "valgrind not available"; \ - fi - @echo; - -install: libqc.a libqc.so.$(VERSION) +install: libqc.a libqc.so.$(VERSION) zhypinfo zname echo " INSTALL" - install -Dm 644 libqc.a $(DESTDIR)/usr/lib64/libqc.a - install -Dm 755 libqc.so.$(VERSION) $(DESTDIR)/usr/lib64/libqc.so.$(VERSION) - ln -sr $(DESTDIR)/usr/lib64/libqc.so.$(VERSION) $(DESTDIR)/usr/lib64/libqc.so.$(VERM) - ln -sr $(DESTDIR)/usr/lib64/libqc.so.$(VERSION) $(DESTDIR)/usr/lib64/libqc.so - install -Dm 755 zname $(DESTDIR)/usr/bin/zname - install -Dm 755 zhypinfo $(DESTDIR)/usr/bin/zhypinfo - install -Dm 644 zname.8 $(DESTDIR)/usr/share/man8/zname.8 - install -Dm 644 zhypinfo.8 $(DESTDIR)/usr/share/man8/zhypinfo.8 - install -Dm 644 query_capacity.h $(DESTDIR)/usr/include/query_capacity.h - install -Dm 644 README $(DESTDIR)/$(DOCDIR)/qclib/README - install -Dm 644 LICENSE $(DESTDIR)/$(DOCDIR)/qclib/LICENSE + install $(INSTFLAGS) -Dm 644 libqc.a $(DESTDIR)$(LIBDIR)/libqc.a + install $(INSTFLAGS) -Dm 755 libqc.so.$(VERSION) $(DESTDIR)$(LIBDIR)/libqc.so.$(VERSION) + ln -sr $(DESTDIR)$(LIBDIR)/libqc.so.$(VERSION) $(DESTDIR)$(LIBDIR)/libqc.so.$(VERM) + ln -sr $(DESTDIR)$(LIBDIR)/libqc.so.$(VERSION) $(DESTDIR)$(LIBDIR)/libqc.so + install $(INSTFLAGS) -Dm 755 zname $(DESTDIR)$(BINDIR)/zname + install $(INSTFLAGS) -Dm 755 zhypinfo $(DESTDIR)$(BINDIR)/zhypinfo + install $(INSTFLAGS) -Dm 644 zname.8 $(DESTDIR)$(MANDIR)/man8/zname.8 + install $(INSTFLAGS) -Dm 644 zhypinfo.8 $(DESTDIR)$(MANDIR)/man8/zhypinfo.8 + install $(INSTFLAGS) -Dm 644 query_capacity.h $(DESTDIR)$(INCDIR)/query_capacity.h + install $(INSTFLAGS) -Dm 644 README $(DESTDIR)$(DOCDIR)/qclib/README + install $(INSTFLAGS) -Dm 644 LICENSE $(DESTDIR)$(DOCDIR)/qclib/LICENSE installdoc: doc echo " INSTALLDOC" - install -dm 755 $(DESTDIR)/$(DOCDIR)/qclib/html - cp -r html/* $(DESTDIR)/$(DOCDIR)/qclib/html - chmod 644 $(DESTDIR)/$(DOCDIR)/qclib/html/search/* - chmod 644 $(DESTDIR)/$(DOCDIR)/qclib/html/* - chmod 755 $(DESTDIR)/$(DOCDIR)/qclib/html/search + install $(INSTFLAGS) -dm 755 $(DESTDIR)$(DOCDIR)/qclib/html + cp -rp html/* $(DESTDIR)$(DOCDIR)/qclib/html + chmod 644 $(DESTDIR)$(DOCDIR)/qclib/html/search/* + chmod 644 $(DESTDIR)$(DOCDIR)/qclib/html/* + chmod 755 $(DESTDIR)$(DOCDIR)/qclib/html/search clean: echo " CLEAN" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qclib-2.2.0/README new/qclib-2.2.1/README --- old/qclib-2.2.0/README 2020-09-11 15:22:30.000000000 +0200 +++ new/qclib-2.2.1/README 2020-10-15 22:23:08.000000000 +0200 @@ -31,10 +31,6 @@ information, refer to 'Device Drivers, Features, and Commands', chapter 'Identifying the z Systems hardware'. -Please refer to: - http://www.ibm.com/developerworks/linux/linux390/qclib.html -for the latest available version. - Usage ===== @@ -93,6 +89,11 @@ Release History: ================ +2.2.1 (2020-10-14) + Bug fixes: + - zhypinfo: Fix memory leaks + - Makefile: Various fixes + 2.2.0 (2020-09-09) Changes: - Add new tools zname and zhypinfo diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qclib-2.2.0/query_capacity.c new/qclib-2.2.1/query_capacity.c --- old/qclib-2.2.0/query_capacity.c 2020-09-11 15:22:30.000000000 +0200 +++ new/qclib-2.2.1/query_capacity.c 2020-10-15 22:23:08.000000000 +0200 @@ -30,16 +30,6 @@ iconv_close(qc_cd); } -struct qc_handle *qc_get_cec_handle(struct qc_handle *hdl) { - return hdl ? hdl->root : hdl; -} - -struct qc_handle *qc_get_lpar_handle(struct qc_handle *hdl) { - for (hdl = hdl->root; hdl != NULL && *(int *)(hdl->layer) != QC_LAYER_TYPE_LPAR; hdl = hdl->next); - - return hdl; -} - /* Update dbg_level from environment variable */ static void qc_update_dbg_level(void) { char *s, *end; @@ -111,7 +101,7 @@ goto out_err; } } - qc_debug(NULL, "This is qclib v2.2.0, level 33725a4f, date 2020-09-09 17:55:45 +0200\n"); + qc_debug(NULL, "This is qclib v2.2.1, level 857cc75f, date 2020-10-14 21:58:25 +0200\n"); } return 0; @@ -349,21 +339,8 @@ // De-alloc hdl, leaving out the actual handle static void qc_hdl_reinit(struct qc_handle *hdl) { - struct qc_handle *ptr = hdl, *arg = hdl; - - while (ptr) { - free(ptr->layer); - free(ptr->attr_present); - free(ptr->src); - hdl = ptr->next; - if (ptr == arg) { - memset(ptr, 0, sizeof(struct qc_handle)); - ptr->root = ptr; - } else - free(ptr); - ptr = hdl; - } - qc_hdl_unregister(arg); + qc_hdl_prune(hdl); + qc_hdl_unregister(hdl); } /** Verifies that either a and (b or c), or none are set. I.e. if only one of the attributes is set, then that's an error */ @@ -628,7 +605,7 @@ } static int qc_post_process_KVM_host(struct qc_handle *hdl) { - struct qc_handle *parent = qc_get_prev_handle(hdl); + struct qc_handle *parent = qc_hdl_get_prev(hdl); int *num_conf, rc, *cps, *ifls; qc_debug(hdl, "Fill KVM host layer\n"); @@ -673,7 +650,7 @@ } static int qc_post_process_KVM_guest(struct qc_handle *hdl) { - struct qc_handle *parent = qc_get_prev_handle(hdl); + struct qc_handle *parent = qc_hdl_get_prev(hdl); int rc = 0, *num_conf, *num_CPs, *num_IFLs; qc_debug(hdl, "Fill KVM guest layer\n"); @@ -709,9 +686,15 @@ } static int qc_post_processing(struct qc_handle *hdl) { + struct qc_handle *top_host = NULL; + int prune_to_host = 0; + char *s, *end; + qc_debug(hdl, "Post processing: Fill KVM layers\n"); qc_debug_indent_inc(); - for (; hdl; hdl = hdl->next) { + for (hdl = qc_hdl_get_root(hdl); hdl; hdl = hdl->next) { + if (((int *)(hdl->layer))[1] == QC_LAYER_CAT_HOST) + top_host = hdl; switch(*(int *)(hdl->layer)) { case QC_LAYER_TYPE_CEC: if (qc_post_process_CEC(hdl)) @@ -733,6 +716,20 @@ break; } } + + if ((s = getenv("QC_PRUNE_TO_HOST")) != NULL) { + prune_to_host = strtol(s, &end, 10); + if (end != s && prune_to_host != 0) { + // Suppress all layers on top of the topmost host above the LPAR layer + qc_debug(top_host, "QC_PRUNE_TO_HOST is set\n"); + if (*(int *)(top_host->layer) != QC_LAYER_TYPE_CEC) { + qc_debug_indent_inc(); + qc_debug(top_host, "Pruning layer %d and above\n", top_host->layer_no); + qc_hdl_prune(top_host->next); + qc_debug_indent_dec(); + } + } + } qc_debug_indent_dec(); return 0; @@ -752,8 +749,8 @@ qc_debug(hdl, "_qc_open()\n"); qc_debug_indent_inc(); *rc = 0; - if (qc_new_handle(NULL, &hdl, 0, QC_LAYER_TYPE_CEC) || - qc_new_handle(hdl, &lparhdl, 1, QC_LAYER_TYPE_LPAR)) { + if (qc_hdl_new(NULL, &hdl, 0, QC_LAYER_TYPE_CEC) || + qc_hdl_new(hdl, &lparhdl, 1, QC_LAYER_TYPE_LPAR)) { *rc = -1; goto out; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qclib-2.2.0/query_capacity.h new/qclib-2.2.1/query_capacity.h --- old/qclib-2.2.0/query_capacity.h 2020-09-11 15:22:30.000000000 +0200 +++ new/qclib-2.2.1/query_capacity.h 2020-10-15 22:23:08.000000000 +0200 @@ -371,7 +371,7 @@ * \b [1] Available starting with RHEL7.2 and SLES12SP1<br> * \b [2] <I>z/Architecture Principles of Operation</I>, SA22-7832<br> * \b [3] <I>z/VM: CP Commands and Utilities Reference</I>, SC24-6175<br> - * \b [4] Requires global performance data to be enabled in the LPAR's activation profile<br> + * \b [4] Requires global performance data (GDP) to be enabled in the LPAR's activation profile<br> * \b [5] As of this writing, in LPARs with both CPs and IFLs defined in its activation profile, only CPs can become operational. * Therefore, IFL counts would not appear in any of #qc_num_core_configured, #qc_num_core_standby, #qc_num_core_reserved, * #qc_num_core_dedicated or #qc_num_core_shared diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qclib-2.2.0/query_capacity_data.c new/qclib-2.2.1/query_capacity_data.c --- old/qclib-2.2.0/query_capacity_data.c 2020-09-11 15:22:30.000000000 +0200 +++ new/qclib-2.2.1/query_capacity_data.c 2020-10-15 22:23:08.000000000 +0200 @@ -732,8 +732,18 @@ return NULL; } +struct qc_handle *qc_hdl_get_cec(struct qc_handle *hdl) { + return hdl ? hdl->root : hdl; +} + +struct qc_handle *qc_hdl_get_lpar(struct qc_handle *hdl) { + for (hdl = hdl->root; hdl != NULL && *(int *)(hdl->layer) != QC_LAYER_TYPE_LPAR; hdl = hdl->next); + + return hdl; +} + // 'hdl' is for error reporting, as 'tgthdl' might not be part of the pointer lists yet -int qc_new_handle(struct qc_handle *hdl, struct qc_handle **tgthdl, int layer_no, +int qc_hdl_new(struct qc_handle *hdl, struct qc_handle **tgthdl, int layer_no, int layer_type_num) { int num_attrs, layer_category_num; char *layer_type, *layer_category; @@ -823,7 +833,7 @@ layer_type = "z/OS-zCX-Server"; break; default: - qc_debug(hdl, "Error: Unhandled layer type in qc_new_handle()\n"); + qc_debug(hdl, "Error: Unhandled layer type in qc_hdl_new()\n"); return -1; } @@ -874,12 +884,12 @@ return 0; } -int qc_insert_handle(struct qc_handle *hdl, struct qc_handle **inserted_hdl, int type) { - struct qc_handle *prev_hdl = qc_get_prev_handle(hdl); +int qc_hdl_insert(struct qc_handle *hdl, struct qc_handle **inserted_hdl, int type) { + struct qc_handle *prev_hdl = qc_hdl_get_prev(hdl); if (!prev_hdl) return -1; - if (qc_new_handle(hdl, inserted_hdl, hdl->layer_no, type)) + if (qc_hdl_new(hdl, inserted_hdl, hdl->layer_no, type)) return -2; (*inserted_hdl)->next = hdl; prev_hdl->next = *inserted_hdl; @@ -890,10 +900,41 @@ return 0; } -int qc_append_handle(struct qc_handle *hdl, struct qc_handle **appended_hdl, int type) { +void qc_hdl_prune(struct qc_handle *hdl) { + struct qc_handle *ptr = hdl, *skip = NULL; + + // Pruning at the root needs special handling as does intermediate pruning + if (hdl == qc_hdl_get_root(hdl)) + skip = hdl; + else { + hdl = qc_hdl_get_prev(hdl); + hdl->next = NULL; + } + + while (ptr) { + free(ptr->layer); + free(ptr->attr_present); + free(ptr->src); + hdl = ptr->next; + if (ptr == skip) { + memset(ptr, 0, sizeof(struct qc_handle)); + ptr->root = ptr; + } else + free(ptr); + ptr = hdl; + } + + return; +} + +int qc_hdl_get_layer_no(struct qc_handle *hdl) { + return hdl->layer_no; +} + +int qc_hdl_append(struct qc_handle *hdl, struct qc_handle **appended_hdl, int type) { struct qc_handle *next_hdl = hdl->next; - if (qc_new_handle(hdl, appended_hdl, hdl->layer_no + 1, type)) + if (qc_hdl_new(hdl, appended_hdl, hdl->layer_no + 1, type)) return -1; hdl->next = *appended_hdl; (*appended_hdl)->next = next_hdl; @@ -1087,17 +1128,17 @@ return qc_is_attr_set(hdl, id, string); } -struct qc_handle *qc_get_root_handle(struct qc_handle *hdl) { +struct qc_handle *qc_hdl_get_root(struct qc_handle *hdl) { return hdl ? hdl->root : NULL; } -struct qc_handle *qc_get_top_handle(struct qc_handle *hdl) { +struct qc_handle *qc_hdl_get_top(struct qc_handle *hdl) { for (; hdl->next != NULL; hdl = hdl->next); return hdl; } -struct qc_handle *qc_get_prev_handle(struct qc_handle *hdl) { +struct qc_handle *qc_hdl_get_prev(struct qc_handle *hdl) { struct qc_handle *prev_hdl = NULL; for (prev_hdl = hdl->root; prev_hdl->next != NULL; prev_hdl = prev_hdl->next) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qclib-2.2.0/query_capacity_hypfs.c new/qclib-2.2.1/query_capacity_hypfs.c --- old/qclib-2.2.0/query_capacity_hypfs.c 2020-09-11 15:22:30.000000000 +0200 +++ new/qclib-2.2.1/query_capacity_hypfs.c 2020-10-15 22:23:08.000000000 +0200 @@ -310,7 +310,7 @@ qc_debug(hdl, "Add LPAR values from textual hypfs API\n"); qc_debug_indent_inc(); - hdl = qc_get_lpar_handle(hdl); + hdl = qc_get_lpar(hdl); if ((s = qc_get_attr_value_string(hdl, qc_layer_name)) == NULL) { rc = -1; goto out; @@ -441,7 +441,7 @@ sys_hdr = (struct dfs_sys_hdr *)cpu; } qc_debug(hdl, "Found %d cpus total (%d CP, %d IFL, %d zIIP, %d UN)\n", cp + ifl + ziip + un, cp, ifl, ziip, un); - hdl = qc_get_lpar_handle(hdl); + hdl = qc_hdl_get_lpar(hdl); if (qc_set_attr_int(hdl, qc_num_cp_total, cp, ATTR_SRC_HYPFS) || qc_set_attr_int(hdl, qc_num_cp_dedicated, cp_ded, ATTR_SRC_HYPFS) || qc_set_attr_int(hdl, qc_num_cp_shared, cp - cp_ded, ATTR_SRC_HYPFS) || @@ -456,9 +456,9 @@ qc_set_attr_int(hdl, qc_ziip_absolute_capping, ziip_abs_cap * 0x10000 / 100, ATTR_SRC_HYPFS)) goto out_err; if (gpd_available) { - cp_sh = qc_get_attr_value_int(qc_get_cec_handle(hdl), qc_num_cp_shared); - ifl_sh = qc_get_attr_value_int(qc_get_cec_handle(hdl), qc_num_ifl_shared); - ziip_sh = qc_get_attr_value_int(qc_get_cec_handle(hdl), qc_num_ziip_shared); + cp_sh = qc_get_attr_value_int(qc_hdl_get_cec(hdl), qc_num_cp_shared); + ifl_sh = qc_get_attr_value_int(qc_hdl_get_cec(hdl), qc_num_ifl_shared); + ziip_sh = qc_get_attr_value_int(qc_hdl_get_cec(hdl), qc_num_ziip_shared); if (cap_active && cp_sh && ifl_sh && (qc_set_attr_int(hdl, qc_cp_weight_capping, cp_weight ? *cp_sh * 0x10000 * cp_weight / cp_all_weight : 0, ATTR_SRC_HYPFS) || qc_set_attr_int(hdl, qc_ifl_weight_capping, ifl_weight ? *ifl_sh * 0x10000 * ifl_weight / ifl_all_weight : 0, ATTR_SRC_HYPFS) || @@ -468,7 +468,7 @@ if (qc_is_nonempty_ebcdic((__u64*)tgt_lpar->grp_name)) { /* LPAR group is only defined in case group name is not binary zero */ qc_debug(hdl, "Insert LPAR group layer\n"); - if (qc_insert_handle(hdl, &group, QC_LAYER_TYPE_LPAR_GROUP)) { + if (qc_hdl_insert(hdl, &group, QC_LAYER_TYPE_LPAR_GROUP)) { qc_debug(hdl, "Error: Failed to insert LPAR group layer\n"); goto out_err; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qclib-2.2.0/query_capacity_int.h new/qclib-2.2.1/query_capacity_int.h --- old/qclib-2.2.0/query_capacity_int.h 2020-09-11 15:22:30.000000000 +0200 +++ new/qclib-2.2.1/query_capacity_int.h 2020-10-15 22:23:08.000000000 +0200 @@ -65,16 +65,19 @@ /* Utility functions */ int qc_ebcdic_to_ascii(struct qc_handle *hdl, char *inbuf, size_t insz); int qc_is_nonempty_ebcdic(__u64 *str); -int qc_new_handle(struct qc_handle *hdl, struct qc_handle **tgthdl, int layer_no, int layer_type); +int qc_hdl_new(struct qc_handle *hdl, struct qc_handle **tgthdl, int layer_no, int layer_type); // Insert new layer 'inserted_hdl' of type 'type' before 'hdl'. Won't support inserting a new root -int qc_insert_handle(struct qc_handle *hdl, struct qc_handle **inserted_hdl, int type); +int qc_hdl_insert(struct qc_handle *hdl, struct qc_handle **inserted_hdl, int type); // Insert new layer 'appended_hdl' of type 'type' after 'hdl' -int qc_append_handle(struct qc_handle *hdl, struct qc_handle **appended_hdl, int type); -struct qc_handle *qc_get_cec_handle(struct qc_handle *hdl); -struct qc_handle *qc_get_lpar_handle(struct qc_handle *hdl); -struct qc_handle *qc_get_root_handle(struct qc_handle *hdl); -struct qc_handle *qc_get_prev_handle(struct qc_handle *hdl); -struct qc_handle *qc_get_top_handle(struct qc_handle *hdl); +int qc_hdl_append(struct qc_handle *hdl, struct qc_handle **appended_hdl, int type); +// Remove the layer pointed to by the handle and all layers on top +void qc_hdl_prune(struct qc_handle *hdl); +struct qc_handle *qc_hdl_get_cec(struct qc_handle *hdl); +struct qc_handle *qc_hdl_get_lpar(struct qc_handle *hdl); +struct qc_handle *qc_hdl_get_root(struct qc_handle *hdl); +struct qc_handle *qc_hdl_get_top(struct qc_handle *hdl); +struct qc_handle *qc_hdl_get_prev(struct qc_handle *hdl); +int qc_hdl_get_layer_no(struct qc_handle *hdl); /* Debugging-related functions and variables */ extern long qc_dbg_level; @@ -95,11 +98,11 @@ time(&t); \ tm = localtime(&t); \ fprintf(qc_dbg_file, "%02d/%02d,%02d:%02d:%02d,%-10p: %*s" arg, \ - tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, qc_get_root_handle(hdl), qc_dbg_indent, "", ##__VA_ARGS__); \ + tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, qc_hdl_get_root(hdl), qc_dbg_indent, "", ##__VA_ARGS__); \ } }while(0); #else #define qc_debug(hdl, arg, ...) do {if (qc_dbg_level > 0) { \ - fprintf(qc_dbg_file, "%-10p: %*s" arg, qc_get_root_handle(hdl), qc_dbg_indent, "", ##__VA_ARGS__); \ + fprintf(qc_dbg_file, "%-10p: %*s" arg, qc_hdl_get_root(hdl), qc_dbg_indent, "", ##__VA_ARGS__); \ } } while(0); #endif #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qclib-2.2.0/query_capacity_sthyi.c new/qclib-2.2.1/query_capacity_sthyi.c --- old/qclib-2.2.0/query_capacity_sthyi.c 2020-09-11 15:22:30.000000000 +0200 +++ new/qclib-2.2.1/query_capacity_sthyi.c 2020-10-15 22:23:08.000000000 +0200 @@ -150,7 +150,8 @@ qc_set_attr_int(cec, qc_num_ziip_shared, htobe16(machine->infmsziip), ATTR_SRC_STHYI)) return -1; } - } + } else + qc_debug(cec, "No processor counts information available (most likely due to missing GPD data)\n"); if (machine->infmval1 & infmmid) { qc_debug(cec, "Add machine ID information\n"); @@ -231,7 +232,7 @@ if (partition->infpval1 & infplgvl && (rc = qc_is_nonempty_ebcdic((__u64*)partition->infplgnm)) > 0) { /* LPAR group is only defined in case group name is not empty */ qc_debug(lpar, "Insert LPAR group layer\n"); - if (qc_insert_handle(lpar, &group, QC_LAYER_TYPE_LPAR_GROUP)) { + if (qc_hdl_insert(lpar, &group, QC_LAYER_TYPE_LPAR_GROUP)) { qc_debug(lpar, "Error: Failed to insert LPAR group layer\n"); goto out_err; } @@ -426,7 +427,7 @@ goto err; } qc_debug(gst, "Layer %2d: %s\n", gst->layer_no, str); - if (qc_insert_handle(gst, &pool_hdl, ptype)) { + if (qc_hdl_insert(gst, &pool_hdl, ptype)) { qc_debug(gst, "Error: Failed to insert pool layer\n"); goto err; } @@ -527,7 +528,7 @@ goto out; } - hdl = qc_get_lpar_handle(hdl); + hdl = qc_hdl_get_lpar(hdl); if (!hdl) { qc_debug(hdl, "Error: No LPAR handle found\n"); rc = -4; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qclib-2.2.0/query_capacity_sysfs.c new/qclib-2.2.1/query_capacity_sysfs.c --- old/qclib-2.2.0/query_capacity_sysfs.c 2020-09-11 15:22:30.000000000 +0200 +++ new/qclib-2.2.1/query_capacity_sysfs.c 2020-10-15 22:23:08.000000000 +0200 @@ -330,7 +330,7 @@ // Set top layer attributes. // Note: This implies that all top layers must feature these attributes! - hdl = qc_get_top_handle(hdl); + hdl = qc_hdl_get_top(hdl); if ((p->has_secure >= 0 && qc_set_attr_int(hdl, qc_has_secure, p->has_secure, ATTR_SRC_SYSFS)) || (p->secure >= 0 && qc_set_attr_int(hdl, qc_secure, p->secure, ATTR_SRC_SYSFS))) { rc = -1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qclib-2.2.0/query_capacity_sysinfo.c new/qclib-2.2.1/query_capacity_sysinfo.c --- old/qclib-2.2.0/query_capacity_sysinfo.c 2020-09-11 15:22:30.000000000 +0200 +++ new/qclib-2.2.1/query_capacity_sysinfo.c 2020-10-15 22:23:08.000000000 +0200 @@ -239,12 +239,12 @@ goto out; } if (!hdl->next) - rc = qc_append_handle(hdl, &hosthdl, hosttype); + rc = qc_hdl_append(hdl, &hosthdl, hosttype); else - rc = qc_insert_handle(hdl->next, &hosthdl, hosttype); + rc = qc_hdl_insert(hdl->next, &hosthdl, hosttype); if (rc) goto out; - if (qc_append_handle(hosthdl, &guesthdl, guesttype)) + if (qc_hdl_append(hosthdl, &guesthdl, guesttype)) goto out_err; if (qc_set_attr_string(hosthdl, qc_control_program_id, str_buf, ATTR_SRC_SYSINFO) || qc_set_attr_string(guesthdl, qc_layer_name, layer_name, ATTR_SRC_SYSINFO)) @@ -428,7 +428,7 @@ } static int qc_sysinfo_process(struct qc_handle *hdl, char *sysinfo) { - struct qc_handle *lparhdl = qc_get_lpar_handle(hdl); + struct qc_handle *lparhdl = qc_hdl_get_lpar(hdl); char *sysi = NULL, *start, *sptr, *line; int rc = -1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qclib-2.2.0/zhypinfo.8 new/qclib-2.2.1/zhypinfo.8 --- old/qclib-2.2.0/zhypinfo.8 2020-09-11 15:22:30.000000000 +0200 +++ new/qclib-2.2.1/zhypinfo.8 2020-10-15 22:23:08.000000000 +0200 @@ -28,14 +28,14 @@ .SH OUTPUT .SS "#" -Index number of the respective layer. +Layer count. .SS "Layer_Type" Type of virtualization layer. .SS "Lvl" Virtualization level, where each layer of category 'HOST' constitutes a new level. .SS "Categ" -Cathegory the virtualization layer belongs to. +Category of the virtualization layer. .SS "Name" Name of the respective entity. .SS "IFLs" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qclib-2.2.0/zhypinfo.c new/qclib-2.2.1/zhypinfo.c --- old/qclib-2.2.0/zhypinfo.c 2020-09-11 15:22:30.000000000 +0200 +++ new/qclib-2.2.1/zhypinfo.c 2020-10-15 22:23:08.000000000 +0200 @@ -167,8 +167,8 @@ printf("\n"); printf(" -h, --help Print usage information and exit\n"); printf(" -j, --json Dump all available data in JSON format\n"); - printf(" -l, --layers Print number of layers\n"); - printf(" -L, --levels Print number of virtualization levels\n"); + printf(" -l, --layers Print layer count\n"); + printf(" -L, --levels Print virtualization level count\n"); printf("\n"); } @@ -203,11 +203,13 @@ goto out; if (json + lays + lvls > 1) { fprintf(stderr, "Error: Only one of options --json, --layers and --levels is allowed\n"); - return 2; + rc = 2; + goto out; } if (json) { qc_export_json(hdl); - return 0; + rc = 0; + goto out; } rc = print_layers(hdl, lvls, lays);