linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* modutils 2.4.2, please test asap
@ 2001-01-22 18:24 Keith Owens
  2001-01-22 19:28 ` Keith Owens
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: Keith Owens @ 2001-01-22 18:24 UTC (permalink / raw)
  To: linux-hotplug

Please test this modutils patch ASAP, at least one distribution is
waiting to burn their master CD for kernel 2.4.0.  Remove
patch-2.4.0-hotplug from the kernel if you have installed it.

This patch is being released under protest.  It completely drops
support for USB device ids on kernel 2.4.0-prerelease and earlier.
That will break USB support for anybody who installs modutils 2.4.2 and
tries to run a kernel before 2.4.0.

Breaking backwards compatibility goes completely against the grain for
modutils.  It goes to a lot of bother to support users on older kernels
and to ensure that any mix of new modutils and old kernels will work,
even down to kernel 2.0.  But since the USB maintainers are refusing to
support USB on anything older than 2.4.0, I have no choice but to break
backwards compatibility.

diff -Nur modutils-2.4.1/ChangeLog modutils-2.4.2/ChangeLog
--- modutils-2.4.1/ChangeLog	Tue Jan  9 02:16:00 2001
+++ modutils-2.4.2/ChangeLog	Tue Jan 23 05:13:16 2001
@@ -1,3 +1,13 @@
+2001-01-23  Keith Owens  <kaos@ocs.com.au>
+
+	modutils 2.4.2
+
+	* genksym changes: Remove 'attribute' as a C keyword, add 'restrict',
+	  '__restrict', '__restrict__', '_Bool'.  Thanks to Richard Henderson.
+	* Log modprobe commands in /var/log/ksymoops.  This one's for Wichert.
+	* Revert to a single USB table format.  USB maintainers will not support
+	  anybody on 2.4.0-prerelease or earlier.
+
 2001-01-09  Keith Owens  <kaos@ocs.com.au>
 
 	modutils 2.4.1
diff -Nur modutils-2.4.1/depmod/depmod.c modutils-2.4.2/depmod/depmod.c
--- modutils-2.4.1/depmod/depmod.c	Tue Jan  9 01:27:37 2001
+++ modutils-2.4.2/depmod/depmod.c	Tue Jan 23 05:13:16 2001
@@ -23,7 +23,7 @@
  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-#ident "$Id: depmod.c 1.2 Tue, 09 Jan 2001 01:27:37 +1100 kaos $"
+#ident "$Id: depmod.c 1.3 Tue, 23 Jan 2001 05:13:16 +1100 kaos $"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -96,6 +96,8 @@
 /* Version 1 table extracted from 2.4.0-test10-pre3 + David Brownell
  * usb-device_id patch 2.
  * Version 2 table extracted from 2.4.0 + Keith Owens 2.4.0-depmod patch.
+ * Update 23/01/2001.  Drop version 2 and old version 1.  New version 1
+ * is now from kernel 2.4.0.
  */
 
 #ifndef __u16
@@ -121,11 +123,23 @@
  * of the structure.  KAO moved it to before driver_info and defined that format
  * as a version 2 table for kernel 2.4.1 and modutils 2.4.1.  USB modules will
  * not be supported in standard kernel 2.4.0, with any version of modutils.
+ *
+ * Update 23/01/2001.  USB maintainers will not support anybody using the USB
+ * table format in 2.4.0-prerelease or earlier.  Without their support, Linus
+ * will not apply my patch to add version numbers to kernel tables.  Without the
+ * version number, depmod cannot distinguish between 2.4.0-prelease or earlier
+ * formats and 2.4.0.  So it has to assume 2.4.0 format for everybody.  This
+ * will break USB for anybody using modutils >= 2.4.2 on kernels before 2.4.0.
  */
 
 unsigned int usb_device_id_ver;
 
 struct usb_device_id {
+	/* This bitmask is used to determine which of the following fields
+	 * are to be used for matching.
+	 */
+	__u16		match_flags;
+
 	/*
 	 * vendor/product codes are checked, if vendor is nonzero
 	 * Range is for device revision (bcdDevice), inclusive;
@@ -151,15 +165,10 @@
 	__u8		bInterfaceSubClass;
 	__u8		bInterfaceProtocol;
 
-	/* This bitmask is used to determine which of the preceding fields
-	 * are to be used for matching.
-	 */
-	__u16		match_flags;	/* New in version 2 */
-
 	/*
 	 * for driver's use; not involved in driver matching.
 	 */
-	unsigned tgt_long		driver_info;
+	unsigned long	driver_info;
 };
 
 /* Supplied by Adam J. Richter, approx 2.4.0-test13, modified by KAO.
@@ -415,7 +424,8 @@
  *	Note: assumes same machine and arch for depmod and module.
  */
 static void extract_version(struct obj_file *f, void *image, unsigned long m_size,
-			    const char *table, unsigned int *version, int max_version)
+			    const char *table, unsigned int *version,
+			    int min_version, int max_version)
 {
 	ElfW(Addr) ref_ver;
 	unsigned tgt_long ver;
@@ -424,20 +434,20 @@
 	strcat(name, table);
 	strcat(name, "_ver");
 	ref_ver = obj_symbol_final_value(f, obj_find_symbol(f, name));
-	/* Kernels before 2.4.1 do not have __module_<table>_ver, default to version 1 */
+	/* Kernels before 2.4.1 do not have __module_<table>_ver, default to min_version */
 	if (ref_ver) {
 		if (!in_range(f, m_size, ref_ver, sizeof(ver)))
 			return;
 		memcpy(&ver, (char *)image + ref_ver - f->baseaddr, sizeof(ver));
 	}
 	else
-		ver = 1;
+		ver = min_version;
 	if (*version && *version != ver) {
 		error("Modules have a mixture of version %d and version %" tgt_long_fmt "d %s tables",
 			*version, ver, table);
 		exit(-1);
 	}
-	if (ver > max_version) {
+	if (ver < min_version || ver > max_version) {
 		error("Module %s has an unknown version (%" tgt_long_fmt "d) %s table%s",
 			f->filename, ver, table, has_kernel_changed);
 		exit(-1);
@@ -468,7 +478,7 @@
 	if (!in_range(f, m_size, ref_ref_pci, sizeof(ref_pci)))
 		return;
 	memcpy(&ref_pci, (char *)image + ref_ref_pci - f->baseaddr, sizeof(ref_pci));
-	extract_version(f, image, m_size, "pci_device", &pci_device_id_ver, 1);
+	extract_version(f, image, m_size, "pci_device", &pci_device_id_ver, 1, 1);
 	if (pci_device_size != sizeof(pci_device)) {
 		error("Unexpected value (%" tgt_long_fmt "d) in '%s' for pci_device_size%s",
 			pci_device_size, f->filename, has_kernel_changed);
@@ -503,7 +513,7 @@
 	if (!in_range(f, m_size, ref_ref_isapnp, sizeof(ref_isapnp)))
 		return;
 	memcpy(&ref_isapnp, (char *)image + ref_ref_isapnp - f->baseaddr, sizeof(ref_isapnp));
-	extract_version(f, image, m_size, "isapnp_device", &isapnp_device_id_ver, 1);
+	extract_version(f, image, m_size, "isapnp_device", &isapnp_device_id_ver, 1, 1);
 	if (isapnp_device_size != sizeof(isapnp_device)) {
 		error("Unexpected value (%" tgt_long_fmt "d) in '%s' for isapnp_device_size%s",
 			isapnp_device_size, f->filename, has_kernel_changed);
@@ -572,7 +582,7 @@
 	if (!in_range(f, m_size, ref_ref_usb, sizeof(ref_usb)))
 		return;
 	memcpy(&ref_usb, (char *)image + ref_ref_usb - f->baseaddr, sizeof(ref_usb));
-	extract_version(f, image, m_size, "usb_device", &usb_device_id_ver, 2);
+	extract_version(f, image, m_size, "usb_device", &usb_device_id_ver, 1, 1);
 	if (usb_device_size != sizeof(usb_device)) {
 		error("Unexpected value (%" tgt_long_fmt "d) in '%s' for usb_device_size%s",
 		usb_device_size, f->filename, has_kernel_changed);
@@ -608,7 +618,7 @@
 	if (!in_range(f, m_size, ref_ref_parport, sizeof(ref_parport)))
 		return;
 	memcpy(&ref_parport, (char *)image + ref_ref_parport - f->baseaddr, sizeof(ref_parport));
-	extract_version(f, image, m_size, "parport_device", &parport_device_id_ver, 1);
+	extract_version(f, image, m_size, "parport_device", &parport_device_id_ver, 1, 1);
 	if (parport_device_size != sizeof(parport_device)) {
 		error("Unexpected value (%" tgt_long_fmt "d) in '%s' for parport_device_size%s",
 			parport_device_size, f->filename, has_kernel_changed);
@@ -1150,8 +1160,8 @@
 
 	ptmod = modules;
 	fprintf(usbmap, "# usb module         ");
-	if (usb_device_id_ver > 1)
-		fprintf(usbmap, "match_flags ");
+	/* Requires all users to be on kernel 2.4.0 or later */
+	fprintf(usbmap, "match_flags ");
 	fprintf(usbmap, "idVendor idProduct bcdDevice_lo bcdDevice_hi"
 		" bDeviceClass bDeviceSubClass bDeviceProtocol bInterfaceClass bInterfaceSubClass"
 		" bInterfaceProtocol driver_info\n");
@@ -1162,10 +1172,9 @@
 			continue;
 		for (j = 0; j < ptmod->n_usb_device; j++, usb_device++) {
 			fprintf(usbmap, "%-20s ", shortname(ptmod->name));
-			if (usb_device_id_ver > 1) {
-				fprintf(usbmap, "0x%0*x      ",
+			/* Requires all users to be on kernel 2.4.0 or later */
+			fprintf(usbmap, "0x%0*x      ",
 				(int)(2*sizeof(usb_device->match_flags)), usb_device->match_flags);
-			}
 			fprintf(usbmap, "0x%0*x   0x%0*x    0x%0*x       0x%0*x       "
 				"0x%0*x         0x%0*x            0x%0*x            0x%0*x            0x%0*x               "
 				"0x%0*x               0x%0*" tgt_long_fmt "x\n",
diff -Nur modutils-2.4.1/genksyms/genksyms.c modutils-2.4.2/genksyms/genksyms.c
--- modutils-2.4.1/genksyms/genksyms.c	Fri Jan  5 12:45:19 2001
+++ modutils-2.4.2/genksyms/genksyms.c	Sun Jan 14 23:06:24 2001
@@ -20,7 +20,7 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-#ident "$Id: genksyms.c 1.1 Fri, 05 Jan 2001 12:45:19 +1100 kaos $"
+#ident "$Id: genksyms.c 1.2 Sun, 14 Jan 2001 23:06:24 +1100 kaos $"
 
 #include <stdio.h>
 #include <string.h>
@@ -111,7 +111,7 @@
 }
 
 struct symbol *
-add_symbol(const char *name, enum symbol_type type, struct string_list *defn)
+add_symbol(const char *name, enum symbol_type type, struct string_list *defn, int is_extern)
 {
   unsigned long h = crc32(name) % HASH_BUCKETS;
   struct symbol *sym;
@@ -130,6 +130,7 @@
   sym->type = type;
   sym->defn = defn;
   sym->expansion_trail = NULL;
+  sym->is_extern = is_extern;
 
   sym->hash_next = symtab[h];
   symtab[h] = sym;
@@ -137,6 +138,8 @@
   if (flag_debug)
     {
       fprintf(debugfile, "Defn for %s %s = <", symbol_type_name[type],  name);
+      if (is_extern)
+        fputs("extern ", debugfile);
       print_list(debugfile, defn);
       fputs(">\n", debugfile);
     }
@@ -350,7 +353,7 @@
 	      n->tag = SYM_NORMAL;
 	      n->next = t;
 
-	      subsym = add_symbol(cur->string, cur->tag, n);
+	      subsym = add_symbol(cur->string, cur->tag, n, 0);
 	    }
 	  if (subsym->expansion_trail)
 	    {
diff -Nur modutils-2.4.1/genksyms/genksyms.h modutils-2.4.2/genksyms/genksyms.h
--- modutils-2.4.1/genksyms/genksyms.h	Fri Jan  5 12:45:19 2001
+++ modutils-2.4.2/genksyms/genksyms.h	Sun Jan 14 23:06:24 2001
@@ -24,7 +24,7 @@
 #ifndef MODUTILS_GENKSYMS_H
 #define MODUTILS_GENKSYMS_H 1
 
-#ident "$Id: genksyms.h 1.1 Fri, 05 Jan 2001 12:45:19 +1100 kaos $"
+#ident "$Id: genksyms.h 1.2 Sun, 14 Jan 2001 23:06:24 +1100 kaos $"
 
 #include <stdio.h>
 
@@ -47,6 +47,7 @@
   enum symbol_type type;
   struct string_list *defn;
   struct symbol *expansion_trail;
+  int is_extern;
 };
 
 typedef struct string_list **yystype;
@@ -66,7 +67,7 @@
 
 struct symbol *find_symbol(const char *name, enum symbol_type ns);
 struct symbol *add_symbol(const char *name, enum symbol_type type,
-			   struct string_list *defn);
+			   struct string_list *defn, int is_extern);
 void export_symbol(const char *);
 
 struct string_list *reset_list(void);
diff -Nur modutils-2.4.1/genksyms/keywords.c modutils-2.4.2/genksyms/keywords.c
--- modutils-2.4.1/genksyms/keywords.c	Fri Jan  5 12:45:19 2001
+++ modutils-2.4.2/genksyms/keywords.c	Sun Jan 14 23:06:24 2001
@@ -1,116 +1,137 @@
-/* C code produced by gperf version 2.1 (K&R C version) */
-/* Command-line: gperf -a -C -g -H is_reserved_hash -k 1,3,$ -N is_reserved_word -p -t keywords.gperf  */
-
-
-#ident "$Id: keywords.c 1.1 Fri, 05 Jan 2001 12:45:19 +1100 kaos $"
+/* C code produced by gperf version 2.7 */
+/* Command-line: gperf -a -C -E -g -H is_reserved_hash -k 1,3,$ -N is_reserved_word -p -t genksyms/keywords.gperf  */
+#ident "$Id: keywords.c 1.2 Sun, 14 Jan 2001 23:06:24 +1100 kaos $"
 struct resword { const char *name; int token; };
-
-#define MIN_WORD_LENGTH 3
-#define MAX_WORD_LENGTH 13
-#define MIN_HASH_VALUE 3
-#define MAX_HASH_VALUE 65
-/*
-   35 keywords
-   63 is the maximum key range
-*/
+/* maximum key range = 101, duplicates = 0 */
 
 #ifdef __GNUC__
-inline
+__inline
 #endif
-static int
-is_reserved_hash (register const char *str, register int len)
+static unsigned int
+is_reserved_hash (str, len)
+     register const char *str;
+     register unsigned int len;
 {
-  static const unsigned char hash_table[] +  static const unsigned char asso_values[]      {
-     65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
-     65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
-     65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
-     65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
-     65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
-     65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
-     65, 65, 65, 65, 65, 65, 65, 65, 65,  5,
-     65, 65, 65, 65, 65, 65,  0, 65, 65, 65,
-      0, 65, 65, 65, 65, 65, 65, 65, 65, 65,
-     65, 65, 65, 65, 65,  0, 65,  0, 65, 30,
-     25,  0, 10, 15, 65, 20, 65, 65, 25,  0,
-     15, 20,  5, 65, 10,  0,  0, 25,  5, 65,
-     65, 65, 65, 65, 65, 65, 65, 65,
-  };
-  return len + hash_table[(int)str[2]] + hash_table[(int)str[0]] + hash_table[(int)str[len - 1]];
+      105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
+      105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
+      105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
+      105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
+      105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
+      105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
+      105, 105, 105, 105, 105, 105, 105, 105, 105,   5,
+      105, 105, 105, 105, 105, 105,   0, 105, 105, 105,
+        0, 105, 105, 105, 105, 105, 105, 105, 105, 105,
+      105, 105, 105, 105, 105,   0, 105,   0, 105,  15,
+       25,   0,  35,  30, 105,  20, 105, 105,  40,  30,
+       30,   0,   0, 105,   0,   0,   0,  10,   5, 105,
+      105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
+      105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
+      105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
+      105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
+      105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
+      105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
+      105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
+      105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
+      105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
+      105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
+      105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
+      105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
+      105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
+      105, 105, 105, 105, 105, 105
+    };
+  return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]] + asso_values[(unsigned char)str[len - 1]];
 }
 
 #ifdef __GNUC__
-inline
+__inline
 #endif
 const struct resword *
-is_reserved_word (register const char *str, register int len)
+is_reserved_word (str, len)
+     register const char *str;
+     register unsigned int len;
 {
+  enum
+    {
+      TOTAL_KEYWORDS = 38,
+      MIN_WORD_LENGTH = 3,
+      MAX_WORD_LENGTH = 13,
+      MIN_HASH_VALUE = 4,
+      MAX_HASH_VALUE = 104
+    };
 
-  static const struct resword  wordlist[] +  static const struct resword wordlist[]      {
-      {"",}, {"",}, {"",},
-      {"asm",  ASM_KEYW},
-      {"",},
-      {"__asm",  ASM_KEYW},
-      {"",},
-      {"__asm__",  ASM_KEYW},
-      {"",},
-      {"attribute",  ATTRIBUTE_KEYW},
-      {"__signed__",  SIGNED_KEYW},
-      {"__attribute",  ATTRIBUTE_KEYW},
-      {"",},
-      {"__attribute__",  ATTRIBUTE_KEYW},
-      {"",},
-      {"__volatile",  VOLATILE_KEYW},
-      {"struct",  STRUCT_KEYW},
-      {"__volatile__",  VOLATILE_KEYW},
-      {"EXPORT_SYMBOL",  EXPORT_SYMBOL_KEYW},
-      {"",}, {"",},
-      {"extern",  EXTERN_KEYW},
-      {"typedef",  TYPEDEF_KEYW},
-      {"int",  INT_KEYW},
-      {"auto",  AUTO_KEYW},
-      {"short",  SHORT_KEYW},
-      {"",}, {"",},
-      {"__inline",  INLINE_KEYW},
-      {"enum",  ENUM_KEYW},
-      {"__inline__",  INLINE_KEYW},
-      {"",}, {"",},
-      {"__signed",  SIGNED_KEYW},
-      {"",},
-      {"float",  FLOAT_KEYW},
-      {"static",  STATIC_KEYW},
-      {"__const",  CONST_KEYW},
-      {"volatile",  VOLATILE_KEYW},
-      {"__const__",  CONST_KEYW},
-      {"",}, {"",}, {"",},
-      {"register",  REGISTER_KEYW},
-      {"char",  CHAR_KEYW},
-      {"",},
-      {"signed",  SIGNED_KEYW},
-      {"",}, {"",}, {"",},
-      {"const",  CONST_KEYW},
-      {"inline",  INLINE_KEYW},
-      {"",}, {"",},
-      {"void",  VOID_KEYW},
-      {"",},
-      {"double",  DOUBLE_KEYW},
-      {"",},
-      {"unsigned",  UNSIGNED_KEYW},
-      {"long",  LONG_KEYW},
-      {"",}, {"",}, {"",}, {"",}, {"",},
-      {"union",  UNION_KEYW},
+      {""}, {""}, {""}, {""},
+      {"auto", AUTO_KEYW},
+      {"short", SHORT_KEYW},
+      {"struct", STRUCT_KEYW},
+      {"__asm__", ASM_KEYW},
+      {"restrict", RESTRICT_KEYW},
+      {"_restrict", RESTRICT_KEYW},
+      {"__signed__", SIGNED_KEYW},
+      {"__attribute", ATTRIBUTE_KEYW},
+      {"__restrict__", RESTRICT_KEYW},
+      {"__attribute__", ATTRIBUTE_KEYW},
+      {""},
+      {"__volatile", VOLATILE_KEYW},
+      {""},
+      {"__volatile__", VOLATILE_KEYW},
+      {"EXPORT_SYMBOL", EXPORT_SYMBOL_KEYW},
+      {"char", CHAR_KEYW},
+      {""},
+      {"static", STATIC_KEYW},
+      {"__const", CONST_KEYW},
+      {"int", INT_KEYW},
+      {"__const__", CONST_KEYW},
+      {""}, {""}, {""},
+      {"__inline", INLINE_KEYW},
+      {""},
+      {"__inline__", INLINE_KEYW},
+      {""}, {""},
+      {"__signed", SIGNED_KEYW},
+      {""},
+      {"__asm", ASM_KEYW},
+      {"extern", EXTERN_KEYW},
+      {""},
+      {"register", REGISTER_KEYW},
+      {""},
+      {"float", FLOAT_KEYW},
+      {"double", DOUBLE_KEYW},
+      {"typedef", TYPEDEF_KEYW},
+      {"unsigned", UNSIGNED_KEYW},
+      {"enum", ENUM_KEYW},
+      {"_Bool", BOOL_KEYW},
+      {""}, {""}, {""}, {""},
+      {"const", CONST_KEYW},
+      {""}, {""},
+      {"volatile", VOLATILE_KEYW},
+      {"void", VOID_KEYW},
+      {""}, {""}, {""}, {""}, {""}, {""},
+      {"signed", SIGNED_KEYW},
+      {""},
+      {"asm", ASM_KEYW},
+      {""},
+      {"union", UNION_KEYW},
+      {"inline", INLINE_KEYW},
+      {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
+      {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
+      {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
+      {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
+      {""},
+      {"long", LONG_KEYW}
     };
 
   if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
     {
       register int key = is_reserved_hash (str, len);
 
-      if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE)
+      if (key <= MAX_HASH_VALUE && key >= 0)
         {
           register const char *s = wordlist[key].name;
 
-          if (*s = *str && !strcmp (str + 1, s + 1))
+          if (*str = *s && !strcmp (str + 1, s + 1))
             return &wordlist[key];
         }
     }
diff -Nur modutils-2.4.1/genksyms/keywords.gperf modutils-2.4.2/genksyms/keywords.gperf
--- modutils-2.4.1/genksyms/keywords.gperf	Fri Jan  5 12:45:19 2001
+++ modutils-2.4.2/genksyms/keywords.gperf	Sun Jan 14 23:06:24 2001
@@ -1,5 +1,5 @@
 %{
-#ident "$Id: keywords.gperf 1.1 Fri, 05 Jan 2001 12:45:19 +1100 kaos $"
+#ident "$Id: keywords.gperf 1.2 Sun, 14 Jan 2001 23:06:24 +1100 kaos $"
 %}
 struct resword { const char *name; int token; }
 %%
@@ -16,8 +16,16 @@
 __signed__, SIGNED_KEYW
 __volatile, VOLATILE_KEYW
 __volatile__, VOLATILE_KEYW
+# According to rth, c99 defines _Bool, __restrict, __restrict__, restrict.  KAO
+_Bool, BOOL_KEYW
+_restrict, RESTRICT_KEYW
+__restrict__, RESTRICT_KEYW
+restrict, RESTRICT_KEYW
 asm, ASM_KEYW
-attribute, ATTRIBUTE_KEYW
+# attribute commented out in modutils 2.4.2.  People are using 'attribute' as a
+# field name which breaks the genksyms parser.  It is not a gcc keyword anyway.
+# KAO.
+#   attribute, ATTRIBUTE_KEYW
 auto, AUTO_KEYW
 char, CHAR_KEYW
 const, CONST_KEYW
diff -Nur modutils-2.4.1/genksyms/parse.y modutils-2.4.2/genksyms/parse.y
--- modutils-2.4.1/genksyms/parse.y	Fri Jan  5 12:45:19 2001
+++ modutils-2.4.2/genksyms/parse.y	Sun Jan 14 23:06:24 2001
@@ -22,12 +22,13 @@
 
 
 %{
-#ident "$Id: parse.y 1.1 Fri, 05 Jan 2001 12:45:19 +1100 kaos $"
+#ident "$Id: parse.y 1.2 Sun, 14 Jan 2001 23:06:24 +1100 kaos $"
 
 #include <assert.h>
 #include "genksyms.h"
 
 static int is_typedef;
+static int is_extern;
 static char *current_name;
 static struct string_list *decl_spec;
 
@@ -54,6 +55,7 @@
 %token ASM_KEYW
 %token ATTRIBUTE_KEYW
 %token AUTO_KEYW
+%token BOOL_KEYW
 %token CHAR_KEYW
 %token CONST_KEYW
 %token DOUBLE_KEYW
@@ -64,6 +66,7 @@
 %token INT_KEYW
 %token LONG_KEYW
 %token REGISTER_KEYW
+%token RESTRICT_KEYW
 %token SHORT_KEYW
 %token SIGNED_KEYW
 %token STATIC_KEYW
@@ -100,7 +103,7 @@
 	;
 
 declaration:
-	{ is_typedef = 0; current_name = NULL; decl_spec = NULL; }
+	{ is_typedef = 0; is_extern = 0; current_name = NULL; decl_spec = NULL; }
 	declaration1
 	{ free_list(*$2, NULL); *$2 = NULL; }
 	;
@@ -123,7 +126,7 @@
 		    (*$3)->next = NULL;
 		    add_symbol(current_name,
 			       is_typedef ? SYM_TYPEDEF : SYM_NORMAL,
-			       decl);
+			       decl, is_extern);
 		    current_name = NULL;
 		  }
 		  $$ = $3;
@@ -140,7 +143,7 @@
 		{ struct string_list *decl = *$1;
 		  *$1 = NULL;
 		  add_symbol(current_name,
-			     is_typedef ? SYM_TYPEDEF : SYM_NORMAL, decl);
+			     is_typedef ? SYM_TYPEDEF : SYM_NORMAL, decl, is_extern);
 		  current_name = NULL;
 		  $$ = $1;
 		}
@@ -150,7 +153,7 @@
 		  free_list(*$2, NULL);
 		  *$2 = decl_spec;
 		  add_symbol(current_name,
-			     is_typedef ? SYM_TYPEDEF : SYM_NORMAL, decl);
+			     is_typedef ? SYM_TYPEDEF : SYM_NORMAL, decl, is_extern);
 		  current_name = NULL;
 		  $$ = $3;
 		}
@@ -183,12 +186,16 @@
 	;
 
 storage_class_specifier:
-	AUTO_KEYW | REGISTER_KEYW | STATIC_KEYW | EXTERN_KEYW | INLINE_KEYW
+	AUTO_KEYW
+	| REGISTER_KEYW
+	| STATIC_KEYW
+	| EXTERN_KEYW	{ is_extern = 1; $$ = $1 }
+	| INLINE_KEYW	{ is_extern = 0; $$ = $1 }
 	;
 
 type_specifier:
 	simple_type_specifier
-	| cva_qualifier
+	| cvar_qualifier
 
 	/* References to s/u/e's defined elsewhere.  Rearrange things
 	   so that it is easier to expand the definition fully later.  */
@@ -204,21 +211,21 @@
 		{ struct string_list *s = *$3, *i = *$2, *r;
 		  r = copy_node(i); r->tag = SYM_STRUCT;
 		  r->next = (*$1)->next; *$3 = r; (*$1)->next = NULL;
-		  add_symbol(i->string, SYM_STRUCT, s);
+		  add_symbol(i->string, SYM_STRUCT, s, is_extern);
 		  $$ = $3;
 		}
 	| UNION_KEYW IDENT class_body
 		{ struct string_list *s = *$3, *i = *$2, *r;
 		  r = copy_node(i); r->tag = SYM_UNION;
 		  r->next = (*$1)->next; *$3 = r; (*$1)->next = NULL;
-		  add_symbol(i->string, SYM_UNION, s);
+		  add_symbol(i->string, SYM_UNION, s, is_extern);
 		  $$ = $3;
 		}
 	| ENUM_KEYW IDENT BRACE_PHRASE
 		{ struct string_list *s = *$3, *i = *$2, *r;
 		  r = copy_node(i); r->tag = SYM_ENUM;
 		  r->next = (*$1)->next; *$3 = r; (*$1)->next = NULL;
-		  add_symbol(i->string, SYM_ENUM, s);
+		  add_symbol(i->string, SYM_ENUM, s, is_extern);
 		  $$ = $3;
 		}
 
@@ -238,26 +245,32 @@
 	| FLOAT_KEYW
 	| DOUBLE_KEYW
 	| VOID_KEYW
+	| BOOL_KEYW
 	| TYPE			{ (*$1)->tag = SYM_TYPEDEF; $$ = $1; }
 	;
 
 ptr_operator:
-	'*' cva_qualifier_seq_opt
+	'*' cvar_qualifier_seq_opt
 		{ $$ = $2 ? $2 : $1; }
 	;
 
-cva_qualifier_seq_opt:
+cvar_qualifier_seq_opt:
 	/* empty */					{ $$ = NULL; }
-	| cva_qualifier_seq
+	| cvar_qualifier_seq
 	;
 
-cva_qualifier_seq:
-	cva_qualifier
-	| cva_qualifier_seq cva_qualifier		{ $$ = $2; }
+cvar_qualifier_seq:
+	cvar_qualifier
+	| cvar_qualifier_seq cvar_qualifier		{ $$ = $2; }
 	;
 
-cva_qualifier:
+cvar_qualifier:
 	CONST_KEYW | VOLATILE_KEYW | ATTRIBUTE_PHRASE
+	| RESTRICT_KEYW
+		{ /* restrict has no effect in prototypes so ignore it */
+		  remove_node($1);
+		  $$ = $1;
+		}
 	;
 
 declarator:
@@ -369,7 +382,7 @@
 	decl_specifier_seq_opt declarator BRACE_PHRASE
 		{ struct string_list *decl = *$2;
 		  *$2 = NULL;
-		  add_symbol(current_name, SYM_NORMAL, decl);
+		  add_symbol(current_name, SYM_NORMAL, decl, is_extern);
 		  $$ = $3;
 		}
 	;
diff -Nur modutils-2.4.1/include/util.h modutils-2.4.2/include/util.h
--- modutils-2.4.1/include/util.h	Fri Jan  5 12:45:19 2001
+++ modutils-2.4.2/include/util.h	Fri Jan 19 17:26:33 2001
@@ -23,7 +23,7 @@
 #ifndef MODUTILS_UTIL_H
 #define MODUTILS_UTIL_H 1
 
-#ident "$Id: util.h 1.1 Fri, 05 Jan 2001 12:45:19 +1100 kaos $"
+#ident "$Id: util.h 1.2 Fri, 19 Jan 2001 17:26:33 +1100 kaos $"
 
 #include <stdio.h>
 #include <sys/stat.h>
@@ -76,6 +76,7 @@
 #define ME_ALL			(ME_GLOB|ME_SHELL_COMMAND|ME_BUILTIN_COMMAND)
 
 extern void snap_shot(const char *module_name, int number);
+extern void snap_shot_log(const char *fmt,...);
 
 #ifdef CONFIG_USE_ZLIB
 int gzf_open(const char *name, int mode);
diff -Nur modutils-2.4.1/include/version.h modutils-2.4.2/include/version.h
--- modutils-2.4.1/include/version.h	Fri Jan  5 16:07:52 2001
+++ modutils-2.4.2/include/version.h	Fri Jan 12 21:28:45 2001
@@ -1 +1 @@
-#define MODUTILS_VERSION "2.4.1"
+#define MODUTILS_VERSION "2.4.2"
diff -Nur modutils-2.4.1/insmod/modprobe.c modutils-2.4.2/insmod/modprobe.c
--- modutils-2.4.1/insmod/modprobe.c	Fri Jan  5 12:45:19 2001
+++ modutils-2.4.2/insmod/modprobe.c	Fri Jan 19 17:26:33 2001
@@ -1503,6 +1503,17 @@
 		{"help", 0, 0, 'h'},
 		{0, 0, 0, 0}
 	};
+	int i, l = 0;
+	char *command;
+
+	for (i = 0; i < argc; ++i)
+		l += strlen(argv[i]) + 1;
+	command = alloca(l);
+	*command = '\0';
+	for (i = 0; i < argc; ++i) {
+		strcat(command, argv[i]);
+		strcat(command, " ");
+	}
 
 	error_file = "modprobe";
 
@@ -1644,6 +1655,8 @@
 	if (showconfig)
 		config_show();
 	else if (remove) {
+		if (runit)
+			snap_shot_log("start %ssafemode=%d", command, safemode);
 		if (argc > 0) {
 			int errs;
 			for (errs = 0; argc > 0; ++argv, --argc) {
@@ -1667,8 +1680,11 @@
 			struct module_stat *m;
 			int i;
 
-			if (!get_kernel_info(K_INFO | K_REFS))
+			if (!get_kernel_info(K_INFO | K_REFS)) {
+				if (runit)
+					snap_shot_log("get_kernel_info failed");
 				return 1;
+			}
 			for (m = module_stat, i = 0; i < n_module_stat; ++i, ++m) {
 				if ((m->flags & NEW_MOD_AUTOCLEAN) &&
 				    ((m->flags & NEW_MOD_VISITED) = 0) &&
@@ -1684,10 +1700,16 @@
 			 */
 			verbose("# autoclean\n");
 			if (runit && delete_module(NULL)) {
+				int save_errno = errno;
 				perror("rmmod");
+				errno = save_errno;
+				if (runit)
+					snap_shot_log("delete_module(NULL) failed %m");
 				return 1;
 			}
 		}
+		if (runit)
+			snap_shot_log("rmmod returned %d", ret);
 	} else if (list) {
 		if (argc > 0)
 			for (; argc > 0 && ret = 0; ++argv, --argc) {
@@ -1696,11 +1718,15 @@
 		else
 			modprobe_printlist("*", type);
 	} else { /* probe module list */
+		if (runit)
+			snap_shot_log("start %ssafemode=%d", command, safemode);
 		if (argc > 0) {
 			ret = modprobe_fromlist(argc, argv, type, loadall);
 		}
 		else
 			modprobe_nothing("load");
+		if (runit)
+			snap_shot_log("probe ended");
 	}
 
 	return ret;
diff -Nur modutils-2.4.1/man/modprobe.8 modutils-2.4.2/man/modprobe.8
--- modutils-2.4.1/man/modprobe.8	Fri Jan  5 12:45:19 2001
+++ modutils-2.4.2/man/modprobe.8	Fri Jan 19 17:26:33 2001
@@ -2,7 +2,7 @@
 .\" Copyright (c) 1995, 1999 Bjorn Ekwall (bj0rn@blox.se)
 .\" This program is distributed according to the Gnu General Public License.
 .\" See the file COPYING in the base distribution directory
-.\" $Id: modprobe.8 1.1 Fri, 05 Jan 2001 12:45:19 +1100 kaos $
+.\" $Id: modprobe.8 1.2 Fri, 19 Jan 2001 17:26:33 +1100 kaos $
 .\"
 .TH MODPROBE 8 "March 15, 1999" Linux "Linux Module Support"
 .SH NAME
@@ -275,6 +275,14 @@
 This detects modprobe execution from the kernel on kernels 2.2 though
 2.4.0-test11, even if uid = euid, which it does on the earlier
 kernels.
+.SH "LOGGING COMMANDS"
+If directory /var/log/ksymoops exists and modprobe is run with an
+option that could load or a delete a module then modprobe will log its
+command and return status in /var/log/ksymoops/`date\ +%Y%m%d.log`.
+There is no switch to disable this automatic logging, if you do not
+want it to occur, do not create /var/log/ksymoops.  If that directory
+exists, it should be owned by root and be mode 644 or 600 and you
+should run script insmod_ksymoops_clean every day or so.
 .SH REQUIRED UTILITIES
 depmod(8),
 insmod(8)
diff -Nur modutils-2.4.1/modutils.spec modutils-2.4.2/modutils.spec
--- modutils-2.4.1/modutils.spec	Fri Jan  5 16:07:52 2001
+++ modutils-2.4.2/modutils.spec	Fri Jan 12 21:28:45 2001
@@ -1,6 +1,6 @@
 Summary: Module utilities
 Name: modutils
-Version: 2.4.1
+Version: 2.4.2
 Release: 1
 Copyright: GPL
 Group: Utilities/System
diff -Nur modutils-2.4.1/util/snap_shot.c modutils-2.4.2/util/snap_shot.c
--- modutils-2.4.1/util/snap_shot.c	Fri Jan  5 12:45:19 2001
+++ modutils-2.4.2/util/snap_shot.c	Fri Jan 19 17:26:33 2001
@@ -20,10 +20,11 @@
    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
   */
 
-#ident "$Id: snap_shot.c 1.1 Fri, 05 Jan 2001 12:45:19 +1100 kaos $"
+#ident "$Id: snap_shot.c 1.2 Fri, 19 Jan 2001 17:26:33 +1100 kaos $"
 
 #include <errno.h>
 #include <stdio.h>
+#include <stdarg.h>
 #include <time.h>
 #include <unistd.h>
 #include <string.h>
@@ -33,13 +34,14 @@
 #include "modstat.h"
 #include "util.h"
 
+static char snap_dir[] = "/var/log/ksymoops";
+
 /* If snap_dir exists, take a snap shot of ksyms and modules to snap_dir.
  * Prefix the files with the equivalent of
  * date +%Y%m%d%T%M%S | sed -e 's/://g'
  */
 void snap_shot(const char *module_names, int n_module_names)
 {
-	static char snap_dir[] = "/var/log/ksymoops";
 	char file[] = "ccyymmddhhmmss.modules", buffer[4096];
 	static char *infile[] = { "/proc/ksyms", "/proc/modules" };
 	static char *suffix[] = {       "ksyms",       "modules" };
@@ -108,4 +110,45 @@
 		fclose(in);
 		fclose(out);
 	}
+}
+
+/* If snap_dir exists, log a message to snap_dir.  The log file is called the
+ * equivalent of date +%Y%m%d | sed -e 's/://g'.  Each line is prefixed with
+ * timestamp down to seconds and followed by a newline.
+ */
+void snap_shot_log(const char *fmt,...)
+{
+	char date[] = "ccyymmdd", file[] = "ccyymmdd.log", stamp[] = "ccyymmdd hhmmss";
+	struct tm *local;
+	time_t t;
+	FILE *log;
+	va_list args;
+	int save_errno = errno;
+
+	if (chdir(snap_dir))
+		return;
+	t = time(NULL);
+	local = localtime(&t);
+	snprintf(date, sizeof(date), "%04d%02d%02d",
+			local->tm_year+1900,
+			local->tm_mon + 1,
+			local->tm_mday);
+	snprintf(file, sizeof(file), "%s.log", date);
+	log = fopen(file, "a");
+	if (!log) {
+		error("cannot create %s/%s %m", snap_dir, file);
+		return;
+	}
+	snprintf(stamp, sizeof(stamp), "%s %02d%02d%02d",
+		date,
+		local->tm_hour,
+		local->tm_min,
+		local->tm_sec);
+	fprintf(log, "%s ", stamp);
+	va_start(args, fmt);
+	errno = save_errno;	/* fmt may use %m */
+	vfprintf(log, fmt, args);
+	va_end(args);
+	fprintf(log, "\n");
+	fclose(log);
 }


_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

end of thread, other threads:[~2001-01-23  3:25 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-01-22 18:24 modutils 2.4.2, please test asap Keith Owens
2001-01-22 19:28 ` Keith Owens
2001-01-22 19:37 ` Miles Lane
2001-01-22 19:58 ` Stephen J. Gowdy
2001-01-22 20:05 ` Miles Lane
2001-01-22 20:16 ` Johannes Erdfelt
2001-01-22 20:30 ` David Brownell
2001-01-22 21:40 ` Keith Owens
2001-01-22 22:29 ` Johannes Erdfelt
2001-01-22 22:51 ` Keith Owens
2001-01-22 23:09 ` Greg KH
2001-01-22 23:21 ` David Brownell
2001-01-22 23:38 ` Miles Lane
2001-01-22 23:42 ` Keith Owens
2001-01-23  2:52 ` David Brownell
2001-01-23  3:25 ` Keith Owens

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