Module Name:    src
Committed By:   pgoyette
Date:           Wed Oct 26 01:03:23 UTC 2016

Modified Files:
        src/sys/dev: devlist2h.awk
        src/sys/dev/hdaudio: Makefile.hdaudiodevs
        src/sys/dev/pci: Makefile.pcidevs
        src/sys/dev/usb: Makefile.usbdevs

Log Message:
Update the devlist2h.awk script to track the maximum lengths of vendor
and product strings, and report the max values at end of the run.

Update the Makefiles.{pci,usb,hdaudio}devs to point users at the places
which might need to be updated if the maximum lengths get larger.

Since this commit makes no changes to the generated files, we don't
need to regenerate them now.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/devlist2h.awk
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/hdaudio/Makefile.hdaudiodevs
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/Makefile.pcidevs
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/usb/Makefile.usbdevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/devlist2h.awk
diff -u src/sys/dev/devlist2h.awk:1.1 src/sys/dev/devlist2h.awk:1.2
--- src/sys/dev/devlist2h.awk:1.1	Sun Sep 21 14:30:22 2014
+++ src/sys/dev/devlist2h.awk	Wed Oct 26 01:03:23 2016
@@ -1,5 +1,5 @@
 #! /usr/bin/awk -f
-#	$NetBSD: devlist2h.awk,v 1.1 2014/09/21 14:30:22 christos Exp $
+#	$NetBSD: devlist2h.awk,v 1.2 2016/10/26 01:03:23 pgoyette Exp $
 #
 # Copyright (c) 1995, 1996 Christopher G. Demetriou
 # All rights reserved.
@@ -31,6 +31,7 @@
 #
 NR == 1 {
 	nproducts = nvendors = blanklines = 0
+	vendormaxlen = productmaxlen = 0
 	nchars = 1
 	dfile= FILENAME "_data.h"
 	hfile= FILENAME ".h"
@@ -117,6 +118,10 @@ NF > 0 && $1 == "vendor" {
 		printf(" */") > hfile
 	printf("\n") > hfile
 
+	if (length($2) > vendormaxlen) {
+		vendormaxlen = length($2)
+	}
+
 	next
 }
 NF > 0 && $1 == "product" {
@@ -131,7 +136,7 @@ NF > 0 && $1 == "product" {
 	i=4; f = 5;
 
 	# comments
-	ocomment = oparen = 0
+	productlen = ocomment = oparen = 0
 	if (f <= NF) {
 		printf("\t\t/* ") > hfile
 		ocomment = 1;
@@ -161,6 +166,7 @@ NF > 0 && $1 == "product" {
 			wordlist[nwords, 3] = nchars;
 			nchars = nchars + l + 1;
 		}
+		productlen += words[$f, 2] + 1;
 		wordlist[words[$f, 1], 2]++;
 		products[nproducts, i] = words[$f, 1];
 		printf("%s", $f) > hfile
@@ -174,6 +180,10 @@ NF > 0 && $1 == "product" {
 		printf(" */") > hfile
 	printf("\n") > hfile
 
+	if (productlen > productmaxlen) {
+		productmaxlen = productlen;
+	}
+
 	next
 }
 {
@@ -240,6 +250,11 @@ END {
 
 	printf("\n") > dfile
 
+	printf("Maximum vendor string length:  %d\n", vendormaxlen + 1)
+	printf("Maximum product string length: %d\n", productmaxlen + 1)
+	printf("\nEnsure that device-specific values are sufficiently large");
+	printf("\ncheck Makefile.%s for details).\n", FILENAME);
+
 	close(dfile)
 	close(hfile)
 }

Index: src/sys/dev/hdaudio/Makefile.hdaudiodevs
diff -u src/sys/dev/hdaudio/Makefile.hdaudiodevs:1.2 src/sys/dev/hdaudio/Makefile.hdaudiodevs:1.3
--- src/sys/dev/hdaudio/Makefile.hdaudiodevs:1.2	Sat May 30 14:10:01 2015
+++ src/sys/dev/hdaudio/Makefile.hdaudiodevs	Wed Oct 26 01:03:23 2016
@@ -1,11 +1,16 @@
-#	$NetBSD: Makefile.hdaudiodevs,v 1.2 2015/05/30 14:10:01 jmcneill Exp $
+#	$NetBSD: Makefile.hdaudiodevs,v 1.3 2016/10/26 01:03:23 pgoyette Exp $
 #
 # As per t...@netbsd.org, the proper procedure is
 #
 # 1.) Change "src/sys/dev/hdaudio/hdaudiodevs".
 # 2.) Commit "src/sys/dev/hdaudio/hdaudiodevs".
 # 3.) Execute "make -f Makefile.hdaudiodevs" in "src/sys/dev/hdaudio".
-# 4.) Commit "src/sys/dev/hdaudio/hdaudiodevs.h" and "src/sys/dev/hdaudio/hdaudiodevs_data.h".
+# 4.) Ensure that the value of MAX_AUDIO_DEV_LEN is at least as large as
+#     the values reported.  If necessary, update "src/sys/sys/audioio.h"
+#     and bump the kernel version in "src/sys/sys/param/h".
+# 5.) Commit "src/sys/dev/hdaudio/hdaudiodevs.h" and
+#     "src/sys/dev/hdaudio/hdaudiodevs_data.h"; if you changed them, also
+#     commit "src/sys/sys/audioio.h" and "src/sys/sys/param/h".
 
 .include <bsd.own.mk>
 

Index: src/sys/dev/pci/Makefile.pcidevs
diff -u src/sys/dev/pci/Makefile.pcidevs:1.6 src/sys/dev/pci/Makefile.pcidevs:1.7
--- src/sys/dev/pci/Makefile.pcidevs:1.6	Sun Sep 21 14:30:22 2014
+++ src/sys/dev/pci/Makefile.pcidevs	Wed Oct 26 01:03:23 2016
@@ -1,11 +1,17 @@
-#	$NetBSD: Makefile.pcidevs,v 1.6 2014/09/21 14:30:22 christos Exp $
+#	$NetBSD: Makefile.pcidevs,v 1.7 2016/10/26 01:03:23 pgoyette Exp $
 #
 # As per t...@netbsd.org, the proper procedure is
 #
 # 1.) Change "src/sys/dev/pci/pcidevs".
 # 2.) Commit "src/sys/dev/pci/pcidevs".
 # 3.) Execute "make -f Makefile.pcidevs" in "src/sys/dev/pci".
-# 4.) Commit "src/sys/dev/pci/pcidevs.h" and "src/sys/dev/pci/pcidevs_data.h".
+# 4.) Ensure that the values of PCI_VENDORSTR_LEN and PCI_PRODUCTSTR_LEN
+#     are at least as large as the values reported.  If necessary, update
+#     the values in "src/sys/dev/pci/pci_verbose.h" and bump the kernel
+#     version in "src/sys/sys/param/h".
+# 5.) Commit "src/sys/dev/pci/pcidevs.h" and "src/sys/dev/pci/pcidevs_data.h";
+#     if you changed them, also commit "src/sys/dev/pci/pci_verbose.h" and
+#     "src/sys/sys/param/h".
 
 .include <bsd.own.mk>
 

Index: src/sys/dev/usb/Makefile.usbdevs
diff -u src/sys/dev/usb/Makefile.usbdevs:1.7 src/sys/dev/usb/Makefile.usbdevs:1.8
--- src/sys/dev/usb/Makefile.usbdevs:1.7	Sun Sep 21 14:30:22 2014
+++ src/sys/dev/usb/Makefile.usbdevs	Wed Oct 26 01:03:23 2016
@@ -1,11 +1,18 @@
-#	$NetBSD: Makefile.usbdevs,v 1.7 2014/09/21 14:30:22 christos Exp $
+#	$NetBSD: Makefile.usbdevs,v 1.8 2016/10/26 01:03:23 pgoyette Exp $
 #
 # As per t...@netbsd.org, the proper procedure is
 #
 # 1.) Change "src/sys/dev/usb/usbdevs".
 # 2.) Commit "src/sys/dev/usb/usbdevs".
 # 3.) Execute "make -f Makefile.usbdevs" in "src/sys/dev/usb".
-# 4.) Commit "src/sys/dev/usb/usbdevs.h" and "src/sys/dev/usb/usbdevs_data.h".
+
+# 4.) Ensure that the value of USB_MAX_STRING_LEN is at least as large as
+#     the values reported.  If necessary, update "src/sys/dev/usb/usb.h"
+#     and bump the kernel version in "src/sys/sys/param/h".
+# 5.) Commit "src/sys/dev/usb/usbdevs.h" and "src/sys/dev/usb/usbdevs_data.h";
+#     if you changed them, also commit "src/sys/dev/usb/usb.h" and
+#     "src/sys/sys/param/h".
+
 
 .include <bsd.own.mk>
 

Reply via email to