Hello community,

here is the log from the commit of package kdumpid for openSUSE:Factory checked 
in at 2017-05-31 12:16:44
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/kdumpid (Old)
 and      /work/SRC/openSUSE:Factory/.kdumpid.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "kdumpid"

Wed May 31 12:16:44 2017 rev:6 rq:494938 version:1.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/kdumpid/kdumpid.changes  2016-02-03 
10:19:51.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.kdumpid.new/kdumpid.changes     2017-05-31 
12:17:45.833156283 +0200
@@ -1,0 +2,6 @@
+Mon May 15 12:36:23 UTC 2017 - ptesa...@suse.com
+
+- Update to version 1.2:
+  * Switch to libkdumpfile-0.3.0
+
+-------------------------------------------------------------------

Old:
----
  kdumpid-1.1.tar.bz2

New:
----
  kdumpid-1.2.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ kdumpid.spec ++++++
--- /var/tmp/diff_new_pack.ApOEYf/_old  2017-05-31 12:17:46.553054661 +0200
+++ /var/tmp/diff_new_pack.ApOEYf/_new  2017-05-31 12:17:46.557054096 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package kdumpid
 #
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -26,7 +26,7 @@
 BuildRequires:  binutils-devel
 %endif
 BuildRequires:  libkdumpfile-devel
-Version:        1.1
+Version:        1.2
 Release:        0
 Summary:        Utility to extract information from vmcores
 License:        GPL-2.0+

++++++ kdumpid-1.1.tar.bz2 -> kdumpid-1.2.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kdumpid-1.1/Makefile new/kdumpid-1.2/Makefile
--- old/kdumpid-1.1/Makefile    2016-02-01 15:01:04.781108765 +0100
+++ new/kdumpid-1.2/Makefile    2017-05-15 13:42:59.745768325 +0200
@@ -10,8 +10,8 @@
 MANDIR=$(PREFIX)/man
 endif
 
-CUSTOM_CFLAGS=
-LIBS += -lkdumpfile -lz -lopcodes -lbfd -liberty -ldl
+CUSTOM_CFLAGS= -ggdb -Wall -I/home/tesarik/include
+LIBS += -L/home/tesarik/lib64 -lkdumpfile -laddrxlat -lz -lopcodes -lbfd 
-liberty -ldl
 
 LD=ld
 
@@ -20,7 +20,7 @@
 ### CONFIGURATION END
 
 VER_MAJOR=1
-VER_MINOR=1
+VER_MINOR=2
 
 CFLAGS=-DVER_MAJOR=$(VER_MAJOR) -DVER_MINOR=$(VER_MINOR)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kdumpid-1.1/kdumpid.h new/kdumpid-1.2/kdumpid.h
--- old/kdumpid-1.1/kdumpid.h   2016-02-01 15:01:04.780108758 +0100
+++ new/kdumpid-1.2/kdumpid.h   2017-05-15 13:42:59.745768325 +0200
@@ -3,7 +3,7 @@
 
 #include <stdint.h>
 #include <unistd.h>
-#include <kdumpfile.h>
+#include <libkdumpfile/kdumpfile.h>
 
 #include "endian.h"
 
@@ -15,12 +15,14 @@
        const char *name;       /* file name */
        long flags;             /* see DIF_XXX below */
        int fd;                 /* dump file descriptor */
-       kdump_ctx *ctx;         /* kdumpfile context */
+       kdump_ctx_t *ctx;       /* kdumpfile context */
 
        void *page;             /* page data buffer */
-       size_t page_size;       /* target page size */
+       kdump_num_t page_size;  /* target page size */
        unsigned long max_pfn;  /* max PFN for read_page */
 
+       const char *format;     /* format name */
+
        const char *arch;       /* architecture (if known) */
        int endian;             /* __LITTLE_ENDIAN or __BIG_ENDIAN */
        uint64_t start_addr;    /* kernel start address */
@@ -32,6 +34,7 @@
        char *cfg;              /* kernel configuration */
        size_t cfglen;
 
+       kdump_num_t xen_type;    /* Xen dump type (or kdump_xen_none) */
        uint64_t xen_start_info; /* address of Xen start info */
 
        void *priv;
@@ -60,14 +63,6 @@
 
 /* utils */
 
-#ifdef KDUMPFILE_VER_MAJOR
-static inline int
-kdump_is_xen(kdump_ctx *ctx)
-{
-       return kdump_xen_type(ctx) != kdump_xen_none;
-}
-#endif
-
 int get_version_from_banner(struct dump_desc *dd);
 int need_explore(struct dump_desc *dd);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kdumpid-1.1/main.c new/kdumpid-1.2/main.c
--- old/kdumpid-1.1/main.c      2016-02-01 15:01:04.780108758 +0100
+++ new/kdumpid-1.2/main.c      2017-05-15 13:42:59.745768325 +0200
@@ -26,49 +26,32 @@
 
 #include "kdumpid.h"
 
-/* Compatibility with ancient versions */
-#ifndef KDUMPFILE_VER_MAJOR
 static void
-print_xen_info(kdump_ctx *ctx)
+print_xen_info(kdump_ctx_t *ctx)
 {
-       if (kdump_is_xen(ctx)) {
-               kdump_xen_version_t ver;
-               kdump_xen_version(ctx, &ver);
-               printf("Xen: %ld.%ld%s\n",
-                      ver.major, ver.minor, ver.extra ?: "");
-       }
-}
-
-#else
+       kdump_attr_t attr;
+       kdump_status status;
 
-static void
-print_xen_info(kdump_ctx *ctx)
-{
-       if (kdump_xen_type(ctx) != kdump_xen_none) {
-               struct kdump_attr attr;
-               kdump_status status;
-
-               fputs("Xen: ", stdout);
-               status = kdump_get_attr(ctx, "xen.version.major", &attr);
-               if (status == kdump_ok)
-                       printf("%ld.", attr.val.number);
-               else
-                       fputs("?.", stdout);
-
-               status = kdump_get_attr(ctx, "xen.version.minor", &attr);
-               if (status == kdump_ok)
-                       printf("%ld", attr.val.number);
-               else
-                       fputs("?", stdout);
-
-               status = kdump_get_attr(ctx, "xen.version.extra", &attr);
-               if (status == kdump_ok)
-                       puts(attr.val.string);
-       }
+       fputs("Xen: ", stdout);
+       status = kdump_get_attr(ctx, "xen.version.major", &attr);
+       if (status == KDUMP_OK)
+               printf("%ld.", attr.val.number);
+       else
+               fputs("?.", stdout);
+
+       status = kdump_get_attr(ctx, "xen.version.minor", &attr);
+       if (status == KDUMP_OK)
+               printf("%ld", attr.val.number);
+       else
+               fputs("?", stdout);
+
+       status = kdump_get_attr(ctx, "xen.version.extra", &attr);
+       if (status == KDUMP_OK)
+               puts(attr.val.string);
+       else
+               putchar('\n');
 }
 
-#endif
-
 static void
 version(FILE *out, const char *progname)
 {
@@ -88,11 +71,8 @@
 static void
 print_verbose(struct dump_desc *dd)
 {
-       const char *machine = kdump_machine(dd->ctx);
-       if (!machine)
-               machine = dd->machine;
-       if (*machine)
-               printf("Machine: %s\n", machine);
+       if (dd->machine[0])
+               printf("Machine: %s\n", dd->machine);
        if (*dd->banner)
                printf("Banner: %s\n", dd->banner);
 
@@ -122,9 +102,9 @@
                {0, 0, 0, 0}
        };
        struct dump_desc dd;
+       const char *str;
        kdump_status status;
        int c, opt;
-       int i;
 
        /* Initialize dd */
        memset(&dd, 0, sizeof dd);
@@ -155,20 +135,99 @@
                perror(dd.name);
                return 2;
        }
-       status = kdump_fdopen(&dd.ctx, dd.fd);
-       if (status != kdump_ok) {
-               fprintf(stderr, "Cannot initialize %s: %s\n", dd.name,
-                       status == kdump_syserr
-                       ? strerror(errno)
-                       : "libkdumpfile failure");
+
+       dd.ctx = kdump_new();
+       if (!dd.ctx) {
+               perror("Cannot allocate dump file context");
                close(dd.fd);
                return 2;
        }
 
-       dd.page_size = kdump_pagesize(dd.ctx);
-       strcpy(dd.ver, kdump_release(dd.ctx) ?: "");
-       strcpy(dd.machine, kdump_machine(dd.ctx) ?: "");
-       dd.arch = kdump_arch_name(dd.ctx);
+       status = kdump_set_number_attr(dd.ctx, KDUMP_ATTR_FILE_FD, dd.fd);
+       if (status != KDUMP_OK) {
+               fprintf(stderr, "File initialization failed: %s\n",
+                       kdump_get_err(dd.ctx));
+               close(dd.fd);
+               return 2;
+       }
+
+       if (dd.flags & DIF_FORCE) {
+               status = kdump_get_number_attr(dd.ctx, "max_pfn",
+                                              &dd.max_pfn);
+               if (status != KDUMP_OK) {
+                       fprintf(stderr, "Cannot get max PFN: %s\n",
+                               kdump_get_err(dd.ctx));
+                       kdump_free(dd.ctx);
+                       return 2;
+               }
+       }
+
+       kdump_set_string_attr(dd.ctx, KDUMP_ATTR_OSTYPE, "linux");
+
+       status = kdump_get_number_attr(dd.ctx, KDUMP_ATTR_PAGE_SIZE,
+                                      &dd.page_size);
+       if (status != KDUMP_OK) {
+               fprintf(stderr, "Cannot get page size: %s\n",
+                       kdump_get_err(dd.ctx));
+               kdump_free(dd.ctx);
+               return 2;
+       }
+
+       status = kdump_get_string_attr(dd.ctx, "linux.uts.release", &str);
+       if (status == KDUMP_OK)
+               strcpy(dd.ver, str);
+       else if (status == KDUMP_ERR_NODATA)
+               dd.ver[0] = '\0';
+       else {
+               fprintf(stderr, "Cannot get UTS release: %s\n",
+                       kdump_get_err(dd.ctx));
+               kdump_free(dd.ctx);
+               return 2;
+       }
+
+       status = kdump_get_string_attr(dd.ctx, "linux.uts.machine", &str);
+       if (status == KDUMP_OK)
+               strcpy(dd.machine, str);
+       else if (status == KDUMP_ERR_NODATA)
+               dd.machine[0] = '\0';
+       else {
+               fprintf(stderr, "Cannot get UTS machine: %s\n",
+                       kdump_get_err(dd.ctx));
+               kdump_free(dd.ctx);
+               return 2;
+       }
+
+       status = kdump_get_string_attr(dd.ctx, KDUMP_ATTR_ARCH_NAME, &dd.arch);
+       if (status == KDUMP_ERR_NODATA)
+               dd.arch = NULL;
+       else if (status != KDUMP_OK) {
+               fprintf(stderr, "Cannot get architecture name: %s\n",
+                       kdump_get_err(dd.ctx));
+               kdump_free(dd.ctx);
+               return 2;
+       }
+
+       status = kdump_get_string_attr(dd.ctx, KDUMP_ATTR_FILE_FORMAT,
+                                      &dd.format);
+       if (status == KDUMP_ERR_NODATA)
+               dd.format = NULL;
+       else if (status != KDUMP_OK) {
+               fprintf(stderr, "Cannot get architecture name: %s\n",
+                       kdump_get_err(dd.ctx));
+               kdump_free(dd.ctx);
+               return 2;
+       }
+
+       status = kdump_get_number_attr(dd.ctx, KDUMP_ATTR_XEN_TYPE,
+                                      &dd.xen_type);
+       if (status == KDUMP_ERR_NODATA)
+               dd.xen_type = KDUMP_XEN_NONE;
+       else if (status != KDUMP_OK) {
+               fprintf(stderr, "Cannot determine Xen type: %s\n",
+                       kdump_get_err(dd.ctx));
+               kdump_free(dd.ctx);
+               return 2;
+       }
 
        if (need_explore(&dd))
                explore_raw_data(&dd);
@@ -176,11 +235,12 @@
        if (!*dd.ver)
                get_version_from_banner(&dd);
 
-       printf("Format: %s%s\n", kdump_format(dd.ctx),
-              kdump_is_xen(dd.ctx) ? ", Xen" : "");
+       printf("Format: %s%s\n", dd.format ?: "<unknown>",
+              dd.xen_type != KDUMP_XEN_NONE ? ", Xen" : "");
        printf("Arch: %s\n", dd.arch);
        printf("Version: %s\n", dd.ver);
-       print_xen_info(dd.ctx);
+       if (dd.xen_type != KDUMP_XEN_NONE)
+               print_xen_info(dd.ctx);
 
        if (dd.flags & DIF_VERBOSE)
                print_verbose(&dd);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kdumpid-1.1/util.c new/kdumpid-1.2/util.c
--- old/kdumpid-1.1/util.c      2016-02-01 15:01:04.780108758 +0100
+++ new/kdumpid-1.2/util.c      2017-05-15 13:42:59.745768325 +0200
@@ -16,6 +16,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <zlib.h>
+#include <libkdumpfile/addrxlat.h>
 
 #include "kdumpid.h"
 
@@ -38,7 +39,7 @@
        if (!strcmp(machine, "i386") ||
            !strcmp(machine, "i586") ||
            !strcmp(machine, "i686"))
-               return "i386";
+               return "ia32";
        else if (!strcmp(machine, "arm64"))
                 return "aarch64";
        else if (!strncmp(machine, "arm", 3))
@@ -53,7 +54,7 @@
        if (strstr(cfg, "CONFIG_X86_64=y"))
                return "x86_64";
        if (strstr(cfg, "CONFIG_X86_32=y"))
-               return "i386";
+               return "ia32";
        if (strstr(cfg, "CONFIG_PPC64=y"))
                return "ppc64";
        if (strstr(cfg, "CONFIG_PPC32=y"))
@@ -135,26 +136,15 @@
 int read_page(struct dump_desc *dd, unsigned long pfn)
 {
        size_t rd = dd->page_size;
-#ifndef KDUMPFILE_VER_MAJOR
-       return kdump_readp(dd->ctx, pfn * dd->page_size, dd->page, &rd,
-                          KDUMP_PHYSADDR);
-#else
-       return kdump_readp(dd->ctx, KDUMP_KPHYSADDR, pfn * dd->page_size,
-                          dd->page, &rd);
-#endif
+       return kdump_read(dd->ctx, KDUMP_KPHYSADDR, pfn * dd->page_size,
+                         dd->page, &rd);
 }
 
 size_t
 dump_cpin(struct dump_desc *dd, void *buf, uint64_t paddr, size_t len)
 {
-       ssize_t rd;
-#ifndef KDUMPFILE_VER_MAJOR
-       rd = kdump_read(dd->ctx, paddr, buf, len, KDUMP_PHYSADDR);
-#else
-       rd = kdump_read(dd->ctx, KDUMP_KPHYSADDR, paddr, buf, len);
-#endif
-       if (rd <= 0)
-               return len;
+       size_t rd = len;
+       kdump_read(dd->ctx, KDUMP_KPHYSADDR, paddr, buf, &rd);
        return len - rd;
 }
 
@@ -213,11 +203,11 @@
                "alpha", "arm", "ia64",
                "ppc", "ppc64",
                "s390", "s390x",
-               "x86", "x86_64",
+               "ia32", "x86_64",
                NULL
        };
        static const char *const x86_biarch[] = {
-               "x86", "x86_64", NULL
+               "ia32", "x86_64", NULL
        };
        static const char *const zarch[] = {
                "s390", "s390x", NULL
@@ -237,7 +227,7 @@
        if (arch_in_array(dd->arch, x86_biarch)) {
                /* Xen pv kernels are loaded low */
                addr = 0x2000;
-               if (kdump_is_xen(dd->ctx) &&
+               if (dd->xen_type != KDUMP_XEN_NONE &&
                    looks_like_kcode_x86(dd, addr) > 0 &&
                    !fn(dd, addr, addr + MAX_KERNEL_SIZE, x86_biarch)) {
                        dd->start_addr = addr;
@@ -355,9 +345,11 @@
 
                arch = get_machine_arch(uts.machine);
                if (arch && arch_in_array(arch, expected_archs)) {
-                       dd->arch = arch;
                        copy_uts_string(dd->machine, uts.machine);
                        copy_uts_string(dd->ver, uts.release);
+                       dd->arch = (arch == uts.machine
+                                   ? dd->machine
+                                   : arch);
                        return 0;
                }
        }
@@ -422,6 +414,8 @@
 int
 explore_raw_data(struct dump_desc *dd)
 {
+       addrxlat_sys_t *sys;
+       addrxlat_map_t *map;
        int ret;
 
        if ( (dd->page = malloc(dd->page_size)) == NULL) {
@@ -429,6 +423,36 @@
                return -1;
        }
 
+       sys = kdump_get_addrxlat_sys(dd->ctx);
+       map = addrxlat_sys_get_map(sys, ADDRXLAT_SYS_MAP_KPHYS_MACHPHYS);
+       if (!map) {
+               addrxlat_range_t range;
+               addrxlat_meth_t meth;
+               addrxlat_status status;
+
+               meth.kind = ADDRXLAT_LINEAR;
+               meth.target_as = ADDRXLAT_MACHPHYSADDR;
+               meth.param.linear.off = 0;
+               addrxlat_sys_set_meth(sys, ADDRXLAT_SYS_METH_KPHYS_MACHPHYS,
+                                     &meth);
+
+               map = addrxlat_map_new();
+               if (!map) {
+                       perror("Cannot allocate identity map");
+                       return -1;
+               }
+
+               range.endoff = ADDRXLAT_ADDR_MAX;
+               range.meth = ADDRXLAT_SYS_METH_KPHYS_MACHPHYS;
+               status = addrxlat_map_set(map, 0, &range);
+               if (status != ADDRXLAT_OK) {
+                       fprintf(stderr, "Cannot set identity range: %s\n",
+                               addrxlat_strerror(status));
+                       return -1;
+               }
+               addrxlat_sys_set_map(sys, ADDRXLAT_SYS_MAP_KPHYS_MACHPHYS, map);
+       }
+
        ret = -1;
        ret &= explore_kernel(dd, explore_utsname);
        explore_kernel(dd, explore_ikcfg);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kdumpid-1.1/x86.c new/kdumpid-1.2/x86.c
--- old/kdumpid-1.1/x86.c       2016-02-01 15:01:04.781108765 +0100
+++ new/kdumpid-1.2/x86.c       2017-05-15 13:42:59.745768325 +0200
@@ -182,7 +182,7 @@
                        if (cont)
                                continue;
 
-                       if (!state.depth && kdump_is_xen(dd->ctx)
+                       if (!state.depth && dd->xen_type != KDUMP_XEN_NONE
                            && state.flags & SI_STORED) {
                                if (state.flags & SP_MODIFIED &&
                                    looks_like_kvaddr(info, state.sp_value))
@@ -218,7 +218,7 @@
                                return 1;
                        if (is_reg(arg1, "si")) {
                                state.flags |= SI_STORED;
-                               if (kdump_is_xen(dd->ctx) &&
+                               if (dd->xen_type != KDUMP_XEN_NONE &&
                                    !(state.flags & SI_MODIFIED) &&
                                    sscanf(arg2, "0x%llx", &a) == 1)
                                        dd->xen_start_info = a;


Reply via email to