Downgrade from v3.2.0 to v3.1.10
authorJae-young Hwang <j-zero.hwang@samsung.com>
Tue, 22 Oct 2013 04:12:37 +0000 (21:12 -0700)
committerMaciej Wereski <m.wereski@partner.samsung.com>
Tue, 21 Jan 2014 08:59:18 +0000 (09:59 +0100)
Revert "pciutils version upgrade v3.1.10 -> v3.2.0"
This reverts commit 7afe8c3fa3e8eee6063a831b216c0f32f938a58e.
That commit was pushed and merged without reviewing,
so revert that for verification to upgrade.

Change-Id: I5ef1114342fa6e866b32a9e24661610dee515d07
Signed-off-by: Jae-young Hwang <j-zero.hwang@samsung.com>
15 files changed:
lib/access.c
lib/caps.c
lib/configure
lib/filter.c
lib/internal.h
lib/names-net.c
lib/names-parse.c
lib/pci.h
lib/sysfs.c
ls-kernel.c
lspci.c
lspci.h
packaging/pciutils.changes
packaging/pciutils.spec
setpci.c

index 5112504173f6814b371b66c1236308212e8010c5..691df39c30b607047696f6d15d6474544e3de3df 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     The PCI Library -- User Access
  *
- *     Copyright (c) 1997--2013 Martin Mares <mj@ucw.cz>
+ *     Copyright (c) 1997--2008 Martin Mares <mj@ucw.cz>
  *
  *     Can be freely distributed and used under the terms of the GNU GPL.
  */
@@ -59,7 +59,6 @@ void pci_free_dev(struct pci_dev *d)
   if (d->methods->cleanup_dev)
     d->methods->cleanup_dev(d);
   pci_free_caps(d);
-  pci_mfree(d->module_alias);
   pci_mfree(d->phy_slot);
   pci_mfree(d);
 }
@@ -153,7 +152,7 @@ pci_write_block(struct pci_dev *d, int pos, byte *buf, int len)
 }
 
 int
-pci_fill_info_v32(struct pci_dev *d, int flags)
+pci_fill_info_v31(struct pci_dev *d, int flags)
 {
   if (flags & PCI_FILL_RESCAN)
     {
@@ -167,13 +166,10 @@ pci_fill_info_v32(struct pci_dev *d, int flags)
 }
 
 /* In version 3.1, pci_fill_info got new flags => versioned alias */
-/* In version 3.2, the same has happened */
-STATIC_ALIAS(int pci_fill_info(struct pci_dev *d, int flags), pci_fill_info_v32(d, flags));
-DEFINE_ALIAS(int pci_fill_info_v30(struct pci_dev *d, int flags), pci_fill_info_v32);
-DEFINE_ALIAS(int pci_fill_info_v31(struct pci_dev *d, int flags), pci_fill_info_v32);
+STATIC_ALIAS(int pci_fill_info(struct pci_dev *d, int flags), pci_fill_info_v31(d,flags));
+DEFINE_ALIAS(int pci_fill_info_v30(struct pci_dev *d, int flags), pci_fill_info_v31);
 SYMBOL_VERSION(pci_fill_info_v30, pci_fill_info@LIBPCI_3.0);
-SYMBOL_VERSION(pci_fill_info_v31, pci_fill_info@LIBPCI_3.1);
-SYMBOL_VERSION(pci_fill_info_v32, pci_fill_info@@LIBPCI_3.2);
+SYMBOL_VERSION(pci_fill_info_v31, pci_fill_info@@LIBPCI_3.1);
 
 void
 pci_setup_cache(struct pci_dev *d, byte *cache, int len)
index 2378591fb739ed25d4b96449fef0b82331218c64..ff4d9c43c97f306a394d9f26ac7ed8b1c18322e4 100644 (file)
@@ -106,7 +106,7 @@ pci_find_cap(struct pci_dev *d, unsigned int id, unsigned int type)
 {
   struct pci_cap *c;
 
-  pci_fill_info_v32(d, ((type == PCI_CAP_NORMAL) ? PCI_FILL_CAPS : PCI_FILL_EXT_CAPS));
+  pci_fill_info_v31(d, ((type == PCI_CAP_NORMAL) ? PCI_FILL_CAPS : PCI_FILL_EXT_CAPS));
   for (c=d->first_cap; c; c=c->next)
     if (c->type == type && c->id == id)
       return c;
index 27388bc15b5e99f0d550e5bec30f861fa2b97115..4ae20d45f6a595b88199492a48e4c1ffc36c9b2f 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 # Configuration script for the PCI library
-# (c) 1998--2013 Martin Mares <mj@ucw.cz>
+# (c) 1998--2009 Martin Mares <mj@ucw.cz>
 
 LC_ALL=C
 export LC_ALL
@@ -86,7 +86,7 @@ case $sys in
                esac
                echo >>$c '#define PCI_HAVE_STDINT_H'
                ;;
-       freebsd*)
+       freebsd)
                echo_n " fbsd-device"
                echo >>$c '#define PCI_HAVE_PM_FBSD_DEVICE'
                echo >>$c '#define PCI_PATH_FBSD_DEVICE "/dev/pci"'
@@ -179,40 +179,6 @@ if [ "$DNS" = yes ] ; then
        echo >>$m "WITH_LIBS+=$LIBRESOLV"
 fi
 
-if [ "$sys" = linux ] ; then
-       echo_n "Checking for libkmod... "
-       LIBKMOD_DETECTED=
-       if [ -z "$PKG_CONFIG" ] ; then
-               PKG_CONFIG=pkg-config
-       fi
-       if [ "$LIBKMOD" != no ] ; then
-               if ! which $PKG_CONFIG >/dev/null ; then
-                       echo_n "($PKG_CONFIG not found) "
-               elif $PKG_CONFIG libkmod ; then
-                       LIBKMOD_DETECTED=1
-               fi
-       fi
-       if [ "$LIBKMOD" = yes -o "$LIBKMOD" = no ] ; then
-               echo "$LIBKMOD (set manually)"
-               if [ "$LIBKMOD" = yes -a -z "$LIBKMOD_DETECTED" ] ; then
-                       echo "Requested use of libkmod, but it is not available. Giving up."
-                       exit 1
-               fi
-       else
-               if [ -n "$LIBKMOD_DETECTED" ] ; then
-                       LIBKMOD=yes
-               else
-                       LIBKMOD=no
-               fi
-               echo "$LIBKMOD (auto-detected)"
-       fi
-       if [ "$LIBKMOD" = yes ] ; then
-               echo >>$c "#define PCI_USE_LIBKMOD"
-               echo >>$m "LIBKMOD_CFLAGS=$($PKG_CONFIG --cflags libkmod)"
-               echo >>$m "LIBKMOD_LIBS=$($PKG_CONFIG --libs libkmod)"
-       fi
-fi
-
 echo "Checking whether to build a shared library... $SHARED (set manually)"
 if [ "$SHARED" = no ] ; then
        echo >>$m 'PCILIB=$(LIBNAME).a'
index f321b0f57b7bf007ac12626d4ce4611e8434a8fd..0b7ce6e6e9bb6df8500683caf2001d2e0f07b3c1 100644 (file)
@@ -114,7 +114,7 @@ pci_filter_match(struct pci_filter *f, struct pci_dev *d)
     return 0;
   if (f->device >= 0 || f->vendor >= 0)
     {
-      pci_fill_info_v32(d, PCI_FILL_IDENT);
+      pci_fill_info_v31(d, PCI_FILL_IDENT);
       if ((f->device >= 0 && f->device != d->device_id) ||
          (f->vendor >= 0 && f->vendor != d->vendor_id))
        return 0;
index 9718be610680ce2fc9afa675de70a8054611bb3a..0d9510915a029c03727c49d285e2b7a392978af0 100644 (file)
@@ -56,7 +56,6 @@ int pci_link_dev(struct pci_access *, struct pci_dev *);
 
 int pci_fill_info_v30(struct pci_dev *, int flags) PCI_ABI;
 int pci_fill_info_v31(struct pci_dev *, int flags) PCI_ABI;
-int pci_fill_info_v32(struct pci_dev *, int flags) PCI_ABI;
 
 /* params.c */
 void pci_define_param(struct pci_access *acc, char *param, char *val, char *help);
index 16010300efd52b74c531f35abaf1769dcacd8510..a1a6e275dd4bcf6c2c4966b4255c6c883dd73420 100644 (file)
@@ -75,8 +75,7 @@ static int
 dns_parse_packet(struct dns_state *s, byte *p, unsigned int plen)
 {
   byte *end = p + plen;
-  unsigned int i, j, len;
-  unsigned int UNUSED x;
+  unsigned int i, j, x, len;
 
 #if 0
   /* Dump the packet */
index 9d979ad5ed39539e79ed938b1346263a60bc9a69..cff410a1b1cad8ed516f82e271fd1c014fae1dce 100644 (file)
@@ -30,7 +30,7 @@ static pci_file pci_open(struct pci_access *a)
   if (result)
     return result;
   len = strlen(a->id_file_name);
-  if (len < 3 || memcmp(a->id_file_name + len - 3, ".gz", 3) != 0)
+  if (len >= 3 && memcmp(a->id_file_name + len - 3, ".gz", 3) != 0)
     return result;
   new_name = malloc(len - 2);
   memcpy(new_name, a->id_file_name, len - 3);
index 38e2e9911d228f3e21ba82924f36591a3ae25606..7a5a6b80c9f9cde500b240b14c49684d7d6bb97c 100644 (file)
--- a/lib/pci.h
+++ b/lib/pci.h
@@ -1,7 +1,7 @@
 /*
  *     The PCI Library
  *
- *     Copyright (c) 1997--2013 Martin Mares <mj@ucw.cz>
+ *     Copyright (c) 1997--2009 Martin Mares <mj@ucw.cz>
  *
  *     Can be freely distributed and used under the terms of the GNU GPL.
  */
@@ -16,7 +16,7 @@
 #include "header.h"
 #include "types.h"
 
-#define PCI_LIB_VERSION 0x030200
+#define PCI_LIB_VERSION 0x030100
 
 #ifndef PCI_ABI
 #define PCI_ABI
@@ -130,7 +130,6 @@ struct pci_dev {
   pciaddr_t rom_size;                  /* Expansion ROM size */
   struct pci_cap *first_cap;           /* List of capabilities */
   char *phy_slot;                      /* Physical slot */
-  char *module_alias;                  /* Linux kernel module alias */
 
   /* Fields used internally: */
   struct pci_access *access;
@@ -166,7 +165,6 @@ int pci_fill_info(struct pci_dev *, int flags) PCI_ABI; /* Fill in device inform
 #define PCI_FILL_CAPS          64
 #define PCI_FILL_EXT_CAPS      128
 #define PCI_FILL_PHYS_SLOT     256
-#define PCI_FILL_MODULE_ALIAS  512
 #define PCI_FILL_RESCAN                0x10000
 
 void pci_setup_cache(struct pci_dev *, u8 *cache, int len) PCI_ABI;
index 3b33a11f79f373671f9b42685be8e07f4b3cdf0d..b3e411ffab9d9516cc5dd91ac4ded8e04b5798a7 100644 (file)
@@ -85,39 +85,24 @@ sysfs_obj_name(struct pci_dev *d, char *object, char *buf)
     d->access->error("File name too long");
 }
 
-#define OBJBUFSIZE 1024
-
 static int
-sysfs_get_string(struct pci_dev *d, char *object, char *buf, int mandatory)
+sysfs_get_value(struct pci_dev *d, char *object)
 {
   struct pci_access *a = d->access;
   int fd, n;
-  char namebuf[OBJNAMELEN];
+  char namebuf[OBJNAMELEN], buf[256];
 
   sysfs_obj_name(d, object, namebuf);
   fd = open(namebuf, O_RDONLY|O_CLOEXEC);
   if (fd < 0)
-    {
-      if (mandatory)
-       a->error("Cannot open %s: %s", namebuf, strerror(errno));
-      return 0;
-    }
-  n = read(fd, buf, OBJBUFSIZE);
+    a->error("Cannot open %s: %s", namebuf, strerror(errno));
+  n = read(fd, buf, sizeof(buf));
   close(fd);
   if (n < 0)
     a->error("Error reading %s: %s", namebuf, strerror(errno));
-  if (n >= OBJBUFSIZE)
+  if (n >= (int) sizeof(buf))
     a->error("Value in %s too long", namebuf);
   buf[n] = 0;
-  return 1;
-}
-
-static int
-sysfs_get_value(struct pci_dev *d, char *object)
-{
-  char buf[OBJBUFSIZE];
-
-  sysfs_get_string(d, object, buf, 1);
   return strtol(buf, NULL, 0);
 }
 
@@ -259,7 +244,10 @@ sysfs_fill_slots(struct pci_access *a)
        {
          for (d = a->devices; d; d = d->next)
            if (dom == d->domain && bus == d->bus && dev == d->dev && !d->phy_slot)
-             d->phy_slot = pci_strdup(a, entry->d_name);
+             {
+               d->phy_slot = pci_malloc(a, strlen(entry->d_name) + 1);
+               strcpy(d->phy_slot, entry->d_name);
+             }
        }
       fclose(file);
     }
@@ -276,14 +264,6 @@ sysfs_fill_info(struct pci_dev *d, int flags)
       for (pd = d->access->devices; pd; pd = pd->next)
        pd->known_fields |= PCI_FILL_PHYS_SLOT;
     }
-
-  if ((flags & PCI_FILL_MODULE_ALIAS) && !(d->known_fields & PCI_FILL_MODULE_ALIAS))
-    {
-      char buf[OBJBUFSIZE];
-      if (sysfs_get_string(d, "modalias", buf, 0))
-       d->module_alias = pci_strdup(d->access, buf);
-    }
-
   return pci_generic_fill_info(d, flags);
 }
 
index 78b70f19e1f5eeef68a901b5f59476d2bae3f5c0..41afefe4430e34163ebad6fc457728f8e854ac02 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     The PCI Utilities -- Show Kernel Drivers
  *
- *     Copyright (c) 1997--2013 Martin Mares <mj@ucw.cz>
+ *     Copyright (c) 1997--2008 Martin Mares <mj@ucw.cz>
  *
  *     Can be freely distributed and used under the terms of the GNU GPL.
  */
 
 #include <sys/utsname.h>
 
-#ifdef PCI_USE_LIBKMOD
-
-#include <libkmod.h>
-
-static struct kmod_ctx *kmod_ctx;
-
-static int
-show_kernel_init(void)
-{
-  static int show_kernel_inited = -1;
-  if (show_kernel_inited >= 0)
-    return show_kernel_inited;
-
-  struct utsname uts;
-  if (uname(&uts) < 0)
-    die("uname() failed: %m");
-  char *name = alloca(64 + strlen(uts.release));
-  sprintf(name, "/lib/modules/%s", uts.release);
-
-  kmod_ctx = kmod_new(name, NULL);
-  if (!kmod_ctx)
-    {
-      fprintf(stderr, "lspci: Unable to initialize libkmod context\n");
-      goto failed;
-    }
-
-  int err;
-  if ((err = kmod_load_resources(kmod_ctx)) < 0)
-    {
-      fprintf(stderr, "lspci: Unable to load libkmod resources: error %d\n", err);
-      goto failed;
-    }
-
-  show_kernel_inited = 1;
-  return 1;
-
-failed:
-  show_kernel_inited = 0;
-  return 0;
-}
-
-void
-show_kernel_cleanup(void)
-{
-  if (kmod_ctx)
-    kmod_unref(kmod_ctx);
-}
-
-static const char *next_module(struct device *d)
-{
-  static struct kmod_list *klist, *kcurrent;
-  static struct kmod_module *kmodule;
-
-  if (kmodule)
-    {
-      kmod_module_unref(kmodule);
-      kmodule = NULL;
-    }
-
-  if (!klist)
-    {
-      pci_fill_info(d->dev, PCI_FILL_MODULE_ALIAS);
-      if (!d->dev->module_alias)
-       return NULL;
-      int err = kmod_module_new_from_lookup(kmod_ctx, d->dev->module_alias, &klist);
-      if (err < 0)
-       {
-         fprintf(stderr, "lspci: libkmod lookup failed: error %d\n", err);
-         return NULL;
-       }
-      kcurrent = klist;
-    }
-  else
-    kcurrent = kmod_list_next(klist, kcurrent);
-
-  if (kcurrent)
-    {
-      kmodule = kmod_module_get_module(kcurrent);
-      return kmod_module_get_name(kmodule);
-    }
-
-  kmod_module_unref_list(klist);
-  klist = NULL;
-  return NULL;
-}
-
-#else
-
 struct pcimap_entry {
   struct pcimap_entry *next;
   unsigned int vendor, device;
@@ -114,8 +26,8 @@ struct pcimap_entry {
 
 static struct pcimap_entry *pcimap_head;
 
-static int
-show_kernel_init(void)
+static void
+load_pcimap(void)
 {
   static int tried_pcimap;
   struct utsname uts;
@@ -123,7 +35,7 @@ show_kernel_init(void)
   FILE *f;
 
   if (tried_pcimap)
-    return 1;
+    return;
   tried_pcimap = 1;
 
   if (name = opt_pcimap)
@@ -140,7 +52,7 @@ show_kernel_init(void)
       sprintf(name, "/lib/modules/%s/modules.pcimap", uts.release);
       f = fopen(name, "r");
       if (!f)
-       return 1;
+       return;
     }
 
   while (fgets(line, sizeof(line), f))
@@ -172,8 +84,6 @@ show_kernel_init(void)
       strcpy(e->module, line);
     }
   fclose(f);
-
-  return 1;
 }
 
 static int
@@ -194,32 +104,6 @@ match_pcimap(struct device *d, struct pcimap_entry *e)
 #undef MATCH
 }
 
-static const char *next_module(struct device *d)
-{
-  static struct pcimap_entry *current;
-
-  if (!current)
-    current = pcimap_head;
-  else
-    current = current->next;
-
-  while (current)
-    {
-      if (match_pcimap(d, current))
-       return current->module;
-      current = current->next;
-    }
-
-  return NULL;
-}
-
-void
-show_kernel_cleanup(void)
-{
-}
-
-#endif
-
 #define DRIVER_BUF_SIZE 1024
 
 static char *
@@ -254,41 +138,24 @@ find_driver(struct device *d, char *buf)
     return buf;
 }
 
-static const char *
-next_module_filtered(struct device *d)
-{
-  static char prev_module[256];
-  const char *module;
-
-  while (module = next_module(d))
-    {
-      if (strcmp(module, prev_module))
-       {
-         strncpy(prev_module, module, sizeof(prev_module));
-         prev_module[sizeof(prev_module) - 1] = 0;
-         return module;
-       }
-    }
-  prev_module[0] = 0;
-  return NULL;
-}
-
 void
 show_kernel(struct device *d)
 {
   char buf[DRIVER_BUF_SIZE];
-  const char *driver, *module;
+  char *driver;
+  struct pcimap_entry *e, *last = NULL;
 
   if (driver = find_driver(d, buf))
     printf("\tKernel driver in use: %s\n", driver);
 
-  if (!show_kernel_init())
-    return;
-
-  int cnt = 0;
-  while (module = next_module_filtered(d))
-    printf("%s %s", (cnt++ ? "," : "\tKernel modules:"), module);
-  if (cnt)
+  load_pcimap();
+  for (e=pcimap_head; e; e=e->next)
+    if (match_pcimap(d, e) && (!last || strcmp(last->module, e->module)))
+      {
+       printf("%s %s", (last ? "," : "\tKernel modules:"), e->module);
+       last = e;
+      }
+  if (last)
     putchar('\n');
 }
 
@@ -296,16 +163,19 @@ void
 show_kernel_machine(struct device *d)
 {
   char buf[DRIVER_BUF_SIZE];
-  const char *driver, *module;
+  char *driver;
+  struct pcimap_entry *e, *last = NULL;
 
   if (driver = find_driver(d, buf))
     printf("Driver:\t%s\n", driver);
 
-  if (!show_kernel_init())
-    return;
-
-  while (module = next_module_filtered(d))
-    printf("Module:\t%s\n", module);
+  load_pcimap();
+  for (e=pcimap_head; e; e=e->next)
+    if (match_pcimap(d, e) && (!last || strcmp(last->module, e->module)))
+      {
+       printf("Module:\t%s\n", e->module);
+       last = e;
+      }
 }
 
 #else
@@ -320,10 +190,5 @@ show_kernel_machine(struct device *d UNUSED)
 {
 }
 
-void
-show_kernel_cleanup(void)
-{
-}
-
 #endif
 
diff --git a/lspci.c b/lspci.c
index dbba6782401eb8598b023088e54c3a2c529b42e6..2187894ce2a976f9df7408ebc32eb0bad0e598b5 100644 (file)
--- a/lspci.c
+++ b/lspci.c
@@ -1014,7 +1014,6 @@ main(int argc, char **argv)
       else
        show();
     }
-  show_kernel_cleanup();
   pci_cleanup(pacc);
 
   return (seen_errors ? 2 : 0);
diff --git a/lspci.h b/lspci.h
index 86429b2c73b43c8291729376ae693e9c8862d295..4edaf6f3ec7c19254ec7fd880088975d4ff08f48 100644 (file)
--- a/lspci.h
+++ b/lspci.h
@@ -74,7 +74,6 @@ void show_ext_caps(struct device *d);
 
 void show_kernel_machine(struct device *d UNUSED);
 void show_kernel(struct device *d UNUSED);
-void show_kernel_cleanup(void);
 
 /* ls-tree.c */
 
index 8b7706e6ebdce06b0b8040b2646cc4f939486e9a..c0812c0d235720076fc16e6b0c183b61fbf82449 100644 (file)
@@ -1,5 +1,5 @@
-* Tue Oct 15 2013 Jae-young Hwang <j-zero.hwang@samsung.com> accepted/tizen/20130912.195043@df41534
-- pciutils version upgrade v3.1.10 -> v3.2.0
+* Thu Oct 24 2013 Jae-young Hwang <j-zero.hwang@samsung.com> accepted/tizen/20130912.195043@993d6a5
+- Downgrade from v3.2.0 to v3.1.10
 
 * Mon Mar 18 2013 Anas Nashif <anas.nashif@intel.com> submit/trunk/20130305.105339@d088459
 - Update package groups
index 4e087d2c7d7732d58c8befd0f3ec8c4b496ca0ad..3c10e04480220521d125fcd561421e3fc216699e 100644 (file)
@@ -1,5 +1,5 @@
 Name:           pciutils
-Version:        3.2.0
+Version:        3.1.10
 Release:        0
 License:        GPL-2.0+
 Summary:        PCI utilities for Kernel version 2
index acf768971702edcaff5d9e14c28eb18268f6669d..731c612504e15e9404942407112581e1139606fe 100644 (file)
--- a/setpci.c
+++ b/setpci.c
@@ -637,14 +637,14 @@ static void parse_op(char *c, struct pci_dev **selected_devices)
       if (parse_x32(value, &f, &ll) < 0 || f && *f != ':')
        parse_err("Invalid value \"%s\"", value);
       lim = max_values[op->width];
-      if (ll > lim && ll < ~0U - lim)
+      if (ll > lim && ll < ~0UL - lim)
        parse_err("Value \"%s\" is out of range", value);
       op->values[j].value = ll;
       if (f && *f == ':')
        {
          if (parse_x32(f+1, NULL, &ll) <= 0)
            parse_err("Invalid mask \"%s\"", f+1);
-         if (ll > lim && ll < ~0U - lim)
+         if (ll > lim && ll < ~0UL - lim)
            parse_err("Mask \"%s\" is out of range", f+1);
          op->values[j].mask = ll;
          op->values[j].value &= ll;