head	1.54;
access;
symbols
	RELENG_8_4:1.54.0.2
	RELENG_9_1_0_RELEASE:1.47.4.2.2.2
	RELENG_9_1:1.47.4.2.0.2
	RELENG_9_1_BP:1.47.4.2
	RELENG_8_3_0_RELEASE:1.47.2.1.8.1
	RELENG_8_3:1.47.2.1.0.8
	RELENG_8_3_BP:1.47.2.1
	RELENG_9_0_0_RELEASE:1.47.4.1.2.1
	RELENG_9_0:1.47.4.1.0.2
	RELENG_9_0_BP:1.47.4.1
	RELENG_9:1.47.0.4
	RELENG_9_BP:1.47
	RELENG_7_4_0_RELEASE:1.39.2.2.4.1
	RELENG_8_2_0_RELEASE:1.47.2.1.6.1
	RELENG_7_4:1.39.2.2.0.4
	RELENG_7_4_BP:1.39.2.2
	RELENG_8_2:1.47.2.1.0.6
	RELENG_8_2_BP:1.47.2.1
	RELENG_8_1_0_RELEASE:1.47.2.1.4.1
	RELENG_8_1:1.47.2.1.0.4
	RELENG_8_1_BP:1.47.2.1
	RELENG_7_3_0_RELEASE:1.39.2.2.2.1
	RELENG_7_3:1.39.2.2.0.2
	RELENG_7_3_BP:1.39.2.2
	RELENG_8_0_0_RELEASE:1.47.2.1.2.1
	RELENG_8_0:1.47.2.1.0.2
	RELENG_8_0_BP:1.47.2.1
	RELENG_8:1.47.0.2
	RELENG_8_BP:1.47
	RELENG_7_2_0_RELEASE:1.39.2.1.4.1
	RELENG_7_2:1.39.2.1.0.4
	RELENG_7_2_BP:1.39.2.1
	RELENG_7_1_0_RELEASE:1.39.2.1.2.1
	RELENG_6_4_0_RELEASE:1.37.8.1.6.1
	RELENG_7_1:1.39.2.1.0.2
	RELENG_7_1_BP:1.39.2.1
	RELENG_6_4:1.37.8.1.0.6
	RELENG_6_4_BP:1.37.8.1
	RELENG_7_0_0_RELEASE:1.39
	RELENG_6_3_0_RELEASE:1.37.8.1
	RELENG_7_0:1.39.0.4
	RELENG_7_0_BP:1.39
	RELENG_6_3:1.37.8.1.0.4
	RELENG_6_3_BP:1.37.8.1
	RELENG_7:1.39.0.2
	RELENG_7_BP:1.39
	RELENG_6_2_0_RELEASE:1.37.8.1
	RELENG_6_2:1.37.8.1.0.2
	RELENG_6_2_BP:1.37.8.1
	RELENG_5_5_0_RELEASE:1.37
	RELENG_5_5:1.37.0.14
	RELENG_5_5_BP:1.37
	RELENG_6_1_0_RELEASE:1.37
	RELENG_6_1:1.37.0.12
	RELENG_6_1_BP:1.37
	RELENG_6_0_0_RELEASE:1.37
	RELENG_6_0:1.37.0.10
	RELENG_6_0_BP:1.37
	RELENG_6:1.37.0.8
	RELENG_6_BP:1.37
	RELENG_5_4_0_RELEASE:1.37
	RELENG_5_4:1.37.0.6
	RELENG_5_4_BP:1.37
	RELENG_4_11_0_RELEASE:1.15.2.5
	RELENG_4_11:1.15.2.5.0.8
	RELENG_4_11_BP:1.15.2.5
	RELENG_5_3_0_RELEASE:1.37
	RELENG_5_3:1.37.0.4
	RELENG_5_3_BP:1.37
	RELENG_5:1.37.0.2
	RELENG_5_BP:1.37
	RELENG_4_10_0_RELEASE:1.15.2.5
	RELENG_4_10:1.15.2.5.0.6
	RELENG_4_10_BP:1.15.2.5
	RELENG_5_2_1_RELEASE:1.35
	RELENG_5_2_0_RELEASE:1.35
	RELENG_5_2:1.35.0.4
	RELENG_5_2_BP:1.35
	RELENG_4_9_0_RELEASE:1.15.2.5
	RELENG_4_9:1.15.2.5.0.4
	RELENG_4_9_BP:1.15.2.5
	RELENG_5_1_0_RELEASE:1.35
	RELENG_5_1:1.35.0.2
	RELENG_5_1_BP:1.35
	RELENG_4_8_0_RELEASE:1.15.2.5
	RELENG_4_8:1.15.2.5.0.2
	RELENG_4_8_BP:1.15.2.5
	RELENG_5_0_0_RELEASE:1.34
	RELENG_5_0:1.34.0.2
	RELENG_5_0_BP:1.34
	RELENG_4_7_0_RELEASE:1.15.2.4
	RELENG_4_7:1.15.2.4.0.2
	RELENG_4_7_BP:1.15.2.4
	RELENG_4_6_2_RELEASE:1.15.2.3
	RELENG_4_6_1_RELEASE:1.15.2.3
	RELENG_4_6_0_RELEASE:1.15.2.3
	RELENG_4_6:1.15.2.3.0.8
	RELENG_4_6_BP:1.15.2.3
	RELENG_4_5_0_RELEASE:1.15.2.3
	RELENG_4_5:1.15.2.3.0.6
	RELENG_4_5_BP:1.15.2.3
	RELENG_4_4_0_RELEASE:1.15.2.3
	RELENG_4_4:1.15.2.3.0.4
	RELENG_4_4_BP:1.15.2.3
	RELENG_4_3_0_RELEASE:1.15.2.3
	RELENG_4_3:1.15.2.3.0.2
	RELENG_4_3_BP:1.15.2.3
	RELENG_4_2_0_RELEASE:1.15.2.1
	RELENG_4_1_1_RELEASE:1.15.2.1
	PRE_SMPNG:1.18
	RELENG_4_1_0_RELEASE:1.15.2.1
	RELENG_3_5_0_RELEASE:1.6
	RELENG_4_0_0_RELEASE:1.15
	RELENG_4:1.15.0.2
	RELENG_4_BP:1.15
	RELENG_3_4_0_RELEASE:1.6
	RELENG_3_3_0_RELEASE:1.6
	RELENG_3_2_PAO:1.6.0.4
	RELENG_3_2_PAO_BP:1.6
	RELENG_3_2_0_RELEASE:1.6
	RELENG_3_1_0_RELEASE:1.6
	RELENG_3:1.6.0.2
	RELENG_3_BP:1.6
	RELENG_2_2_8_RELEASE:1.4.2.1
	RELENG_3_0_0_RELEASE:1.5
	RELENG_2_2_7_RELEASE:1.4.2.1
	RELENG_2_2_6_RELEASE:1.4.2.1
	RELENG_2_2_5_RELEASE:1.4.2.1
	bsd_44_lite_2:1.1.1.2
	RELENG_2_2_2_RELEASE:1.4
	RELENG_2_2_1_RELEASE:1.4
	RELENG_2_2_0_RELEASE:1.4
	RELENG_2_1_7_RELEASE:1.2
	RELENG_2_1_6_1_RELEASE:1.2
	RELENG_2_1_6_RELEASE:1.2
	RELENG_2_2:1.4.0.2
	RELENG_2_2_BP:1.4
	RELENG_2_1_5_RELEASE:1.2
	RELENG_2_1_0_RELEASE:1.2
	RELENG_2_1_0:1.2.0.6
	RELENG_2_1_0_BP:1.2
	RELENG_2_0_5_RELEASE:1.2
	RELENG_2_0_5:1.2.0.4
	RELENG_2_0_5_BP:1.2
	RELENG_2_0_5_ALPHA:1.2
	RELEASE_2_0:1.2
	BETA_2_0:1.2
	ALPHA_2_0:1.2.0.2
	bsd_44_lite:1.1.1.1
	CSRG:1.1.1;
locks; strict;
comment	@# @;


1.54
date	2012.11.17.01.54.22;	author svnexp;	state Exp;
branches
	1.54.2.1;
next	1.53;

1.53
date	2012.05.24.14.07.44;	author mav;	state Exp;
branches;
next	1.52;

1.52
date	2012.04.09.14.47.18;	author dim;	state Exp;
branches;
next	1.51;

1.51
date	2011.10.21.11.08.25;	author des;	state Exp;
branches;
next	1.50;

1.50
date	2011.10.13.16.29.24;	author des;	state Exp;
branches;
next	1.49;

1.49
date	2011.10.12.21.45.12;	author des;	state Exp;
branches;
next	1.48;

1.48
date	2011.10.08.12.47.00;	author des;	state Exp;
branches;
next	1.47;

1.47
date	2009.07.18.10.36.18;	author bz;	state Exp;
branches
	1.47.2.1
	1.47.4.1;
next	1.46;

1.46
date	2009.05.31.15.41.46;	author zec;	state Exp;
branches;
next	1.45;

1.45
date	2009.05.27.16.16.56;	author thompsa;	state Exp;
branches;
next	1.44;

1.44
date	2009.05.25.20.07.41;	author ed;	state Exp;
branches;
next	1.43;

1.43
date	2009.05.09.15.09.40;	author ed;	state Exp;
branches;
next	1.42;

1.42
date	2009.02.24.00.53.10;	author thompsa;	state Exp;
branches;
next	1.41;

1.41
date	2008.05.25.22.11.38;	author rwatson;	state Exp;
branches;
next	1.40;

1.40
date	2008.02.03.11.33.27;	author des;	state Exp;
branches;
next	1.39;

1.39
date	2007.07.14.21.49.24;	author rwatson;	state Exp;
branches
	1.39.2.1;
next	1.38;

1.38
date	2006.06.05.10.06.51;	author rwatson;	state Exp;
branches;
next	1.37;

1.37
date	2004.06.16.23.39.33;	author mlaier;	state Exp;
branches
	1.37.8.1;
next	1.36;

1.36
date	2004.02.25.21.45.41;	author des;	state Exp;
branches;
next	1.35;

1.35
date	2003.03.05.19.19.08;	author peter;	state Exp;
branches;
next	1.34;

1.34
date	2002.09.16.10.06.02;	author bde;	state Exp;
branches;
next	1.33;

1.33
date	2002.09.07.12.20.47;	author sobomax;	state Exp;
branches;
next	1.32;

1.32
date	2002.09.07.06.16.22;	author sobomax;	state Exp;
branches;
next	1.31;

1.31
date	2002.06.24.16.35.19;	author markm;	state Exp;
branches;
next	1.30;

1.30
date	2002.06.21.10.22.39;	author markm;	state Exp;
branches;
next	1.29;

1.29
date	2002.04.01.10.45.09;	author dwmalone;	state Exp;
branches;
next	1.28;

1.28
date	2002.03.25.19.12.05;	author ru;	state Exp;
branches;
next	1.27;

1.27
date	2001.11.01.02.19.02;	author obrien;	state Exp;
branches;
next	1.26;

1.26
date	2001.11.01.02.16.10;	author obrien;	state Exp;
branches;
next	1.25;

1.25
date	2001.11.01.01.52.37;	author obrien;	state Exp;
branches;
next	1.24;

1.24
date	2001.11.01.01.50.38;	author obrien;	state Exp;
branches;
next	1.23;

1.23
date	2001.05.24.08.47.57;	author ru;	state Exp;
branches;
next	1.22;

1.22
date	2001.05.21.17.06.26;	author ru;	state Exp;
branches;
next	1.21;

1.21
date	2001.04.06.14.40.26;	author ru;	state Exp;
branches;
next	1.20;

1.20
date	2001.03.27.16.15.25;	author ru;	state Exp;
branches;
next	1.19;

1.19
date	2001.03.27.05.45.52;	author ken;	state Exp;
branches;
next	1.18;

1.18
date	2000.08.02.07.37.44;	author ru;	state Exp;
branches;
next	1.17;

1.17
date	2000.08.01.08.15.06;	author ru;	state Exp;
branches;
next	1.16;

1.16
date	2000.07.04.16.26.47;	author itojun;	state Exp;
branches;
next	1.15;

1.15
date	99.12.08.19.47.08;	author phk;	state Exp;
branches
	1.15.2.1;
next	1.14;

1.14
date	99.12.03.12.50.02;	author marcel;	state Exp;
branches;
next	1.13;

1.13
date	99.11.24.15.38.35;	author guido;	state Exp;
branches;
next	1.12;

1.12
date	99.11.10.08.41.08;	author dfr;	state Exp;
branches;
next	1.11;

1.11
date	99.11.09.22.32.29;	author dfr;	state Exp;
branches;
next	1.10;

1.10
date	99.10.11.16.14.22;	author peter;	state Exp;
branches;
next	1.9;

1.9
date	99.10.10.17.49.25;	author peter;	state Exp;
branches;
next	1.8;

1.8
date	99.10.06.07.45.18;	author n_hibma;	state Exp;
branches;
next	1.7;

1.7
date	99.05.08.05.48.54;	author phk;	state Exp;
branches;
next	1.6;

1.6
date	98.10.16.15.33.17;	author bde;	state Exp;
branches;
next	1.5;

1.5
date	96.12.10.17.11.40;	author wollman;	state Exp;
branches;
next	1.4;

1.4
date	96.06.23.17.05.10;	author bde;	state Exp;
branches
	1.4.2.1;
next	1.3;

1.3
date	96.03.11.12.56.07;	author davidg;	state Exp;
branches;
next	1.2;

1.2
date	94.09.15.05.47.41;	author swallace;	state Exp;
branches;
next	1.1;

1.1
date	94.05.27.12.31.52;	author rgrimes;	state Exp;
branches
	1.1.1.1;
next	;

1.54.2.1
date	2012.11.17.01.54.22;	author svnexp;	state dead;
branches;
next	1.54.2.2;

1.54.2.2
date	2013.03.28.13.06.04;	author svnexp;	state Exp;
branches;
next	;

1.47.2.1
date	2009.08.03.08.13.06;	author kensmith;	state Exp;
branches
	1.47.2.1.2.1
	1.47.2.1.4.1
	1.47.2.1.6.1
	1.47.2.1.8.1;
next	1.47.2.2;

1.47.2.2
date	2012.11.17.10.37.17;	author svnexp;	state Exp;
branches;
next	;

1.47.2.1.2.1
date	2009.10.25.01.10.29;	author kensmith;	state Exp;
branches;
next	;

1.47.2.1.4.1
date	2010.06.14.02.09.06;	author kensmith;	state Exp;
branches;
next	;

1.47.2.1.6.1
date	2010.12.21.17.09.25;	author kensmith;	state Exp;
branches;
next	;

1.47.2.1.8.1
date	2012.03.03.06.15.13;	author kensmith;	state Exp;
branches;
next	1.47.2.1.8.2;

1.47.2.1.8.2
date	2012.11.17.08.25.50;	author svnexp;	state Exp;
branches;
next	;

1.47.4.1
date	2011.09.23.00.51.37;	author kensmith;	state Exp;
branches
	1.47.4.1.2.1;
next	1.47.4.2;

1.47.4.2
date	2012.04.18.20.32.07;	author dim;	state Exp;
branches
	1.47.4.2.2.1;
next	1.47.4.3;

1.47.4.3
date	2012.11.17.11.37.39;	author svnexp;	state Exp;
branches;
next	1.47.4.4;

1.47.4.4
date	2013.02.07.00.14.06;	author svnexp;	state Exp;
branches;
next	1.47.4.5;

1.47.4.5
date	2013.11.21.21.01.52;	author svnexp;	state Exp;
branches;
next	;

1.47.4.1.2.1
date	2011.11.11.04.20.22;	author kensmith;	state Exp;
branches;
next	1.47.4.1.2.2;

1.47.4.1.2.2
date	2012.11.17.08.37.35;	author svnexp;	state Exp;
branches;
next	;

1.47.4.2.2.1
date	2012.08.05.23.54.33;	author kensmith;	state Exp;
branches;
next	1.47.4.2.2.2;

1.47.4.2.2.2
date	2012.11.17.08.48.27;	author svnexp;	state Exp;
branches;
next	;

1.39.2.1
date	2008.08.31.10.15.43;	author rwatson;	state Exp;
branches
	1.39.2.1.2.1
	1.39.2.1.4.1;
next	1.39.2.2;

1.39.2.2
date	2009.05.26.21.40.15;	author des;	state Exp;
branches
	1.39.2.2.2.1
	1.39.2.2.4.1;
next	1.39.2.3;

1.39.2.3
date	2012.11.17.08.08.29;	author svnexp;	state Exp;
branches;
next	;

1.39.2.1.2.1
date	2008.11.25.02.59.29;	author kensmith;	state Exp;
branches;
next	;

1.39.2.1.4.1
date	2009.04.15.03.14.26;	author kensmith;	state Exp;
branches;
next	;

1.39.2.2.2.1
date	2010.02.10.00.26.20;	author kensmith;	state Exp;
branches;
next	;

1.39.2.2.4.1
date	2010.12.21.17.10.29;	author kensmith;	state Exp;
branches;
next	1.39.2.2.4.2;

1.39.2.2.4.2
date	2012.11.17.08.17.42;	author svnexp;	state Exp;
branches;
next	;

1.37.8.1
date	2006.09.03.08.29.20;	author rwatson;	state Exp;
branches
	1.37.8.1.6.1;
next	1.37.8.2;

1.37.8.2
date	2012.11.17.07.45.43;	author svnexp;	state Exp;
branches;
next	;

1.37.8.1.6.1
date	2008.10.02.02.57.24;	author kensmith;	state Exp;
branches;
next	;

1.15.2.1
date	2000.07.15.07.29.29;	author kris;	state Exp;
branches;
next	1.15.2.2;

1.15.2.2
date	2001.04.05.08.04.40;	author ru;	state Exp;
branches;
next	1.15.2.3;

1.15.2.3
date	2001.04.07.11.09.28;	author ru;	state Exp;
branches;
next	1.15.2.4;

1.15.2.4
date	2002.07.22.14.21.52;	author ru;	state Exp;
branches;
next	1.15.2.5;

1.15.2.5
date	2002.11.15.18.22.31;	author ru;	state Exp;
branches;
next	1.15.2.6;

1.15.2.6
date	2012.11.17.07.27.33;	author svnexp;	state Exp;
branches;
next	;

1.4.2.1
date	97.09.15.08.32.05;	author jkh;	state Exp;
branches;
next	;

1.1.1.1
date	94.05.27.12.31.53;	author rgrimes;	state Exp;
branches;
next	1.1.1.2;

1.1.1.2
date	97.07.06.06.54.00;	author bde;	state Exp;
branches;
next	;


desc
@@


1.54
log
@Switching exporter and resync
@
text
@#!/bin/sh
#
# $FreeBSD: head/usr.bin/kdump/mkioctls 235911 2012-05-24 14:07:44Z mav $
#
# When editing this script, keep in mind that truss also uses it.
#

set -e

if [ $# -ne 2 -o \( $1 != "print" -a $1 != "return" \) ]; then
	echo "usage: sh $0 print|return include-dir"
	exit 1
fi

style="$1"
includedir="$2"

LC_ALL=C; export LC_ALL

# Build a list of headers that have ioctls in them.
# XXX should we use an ANSI cpp?
ioctl_includes=$(
	cd $includedir
	find -H -s * -name '*.h' | grep -v '.*disk.*\.h' | \
		xargs egrep -l \
'^#[ 	]*define[ 	]+[A-Za-z_][A-Za-z0-9_]*[ 	]+_IO[^a-z0-9_]' |
		awk '{printf("#include <%s>\\n", $1)}'
)

: ${MACHINE=$(uname -m)}
case "${MACHINE}" in
*pc98*)
	ioctl_includes="$ioctl_includes#include <sys/diskpc98.h>\\n"
	;;
*)
	ioctl_includes="$ioctl_includes#include <sys/diskmbr.h>\\n"
	;;
esac

awk -v x="$ioctl_includes" 'BEGIN {print x}' |
	$CPP -I$1 -dM -DCOMPAT_43TTY - |
	awk -v ioctl_includes="$ioctl_includes" -v style="$style" '
BEGIN {
	print "/* XXX obnoxious prerequisites. */"
	print "#define COMPAT_43"
	print "#define COMPAT_43TTY"
	print "#include <sys/param.h>"
	print "#include <sys/devicestat.h>"
	print "#include <sys/disklabel.h>"
	print "#include <sys/socket.h>"
	print "#include <sys/time.h>"
	print "#include <sys/tty.h>"
	print "#include <bsm/audit.h>"
	print "#include <net/ethernet.h>"
	print "#include <net/if.h>"
	print "#include <net/if_var.h>"
	print "#include <net/pfvar.h>"
	print "#include <net/route.h>"
	print "#include <netinet/in.h>"
	print "#include <netinet/ip_mroute.h>"
	print "#include <netinet6/in6_var.h>"
	print "#include <netinet6/nd6.h>"
	print "#include <netinet6/ip6_mroute.h>"
	print "#include <stdio.h>"
	print "#include <cam/cam.h>"
	print "#include <stddef.h>"
	print "#include <stdint.h>"
	print ""
	print ioctl_includes
	print ""
	if (style == "print") {
		print "void ioctlname(unsigned long val, int decimal);"
		print ""
		print "void"
		print "ioctlname(unsigned long val, int decimal)"
	} else {
		print "const char *ioctlname(unsigned long val);"
		print ""
		print "const char *"
		print "ioctlname(unsigned long val)"
	}
	print "{"
	print "\tconst char *str = NULL;"
	print ""
}

/^#[ 	]*define[ 	]+[A-Za-z_][A-Za-z0-9_]*[ 	]+_IO/ {

	# find where the name starts
	for (i = 1; i <= NF; i++)
		if ($i ~ /define/)
			break;
	++i;
	#
	printf("\t");
	if (n++ > 0)
		printf("else ");
	printf("if (val == %s)\n", $i);
	printf("\t\tstr = \"%s\";\n", $i);
}
END {
	print ""
	if (style == "print") {
		print "\tif (str != NULL)"
		print "\t\tprintf(\"%s\", str);"
		print "\telse if (decimal)"
		print "\t\tprintf(\"%lu\", val);"
		print "\telse"
		print "\t\tprintf(\"%#lx\", val);"
	} else {
		print "\treturn (str);"
	}
	print "}"
}
'
@


1.54.2.1
log
@file mkioctls was added on branch RELENG_8_4 on 2013-03-28 13:06:04 +0000
@
text
@d1 115
@


1.54.2.2
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/248810
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@a0 90
#!/bin/sh
#
# $FreeBSD: releng/8.4/usr.bin/kdump/mkioctls 195751 2009-07-18 10:36:18Z bz $

set -e

if [ "x$1" = "x-s" ]; then
	use_switch=1
	shift
else
	use_switch=0
fi

if [ -z "$1" ]; then
	echo "usage: sh $0 [-s] include-dir"
	exit 1
fi

LC_ALL=C; export LC_ALL

# Build a list of headers that have ioctls in them.
# XXX should we use an ANSI cpp?
ioctl_includes=`
	cd $1
	find -H -s * -name '*.h' |
		xargs egrep -l \
'^#[ 	]*define[ 	]+[A-Za-z_][A-Za-z0-9_]*[ 	]+_IO[^a-z0-9_]' |
		awk '{printf("#include <%s>\\\\n", $1)}'
`

awk -v x="$ioctl_includes" 'BEGIN {print x}' |
	gcc -E -I$1 -dM -DCOMPAT_43TTY - |
	awk -v ioctl_includes="$ioctl_includes" -v use_switch="$use_switch" '
BEGIN {
	print "/* XXX obnoxious prerequisites. */"
	print "#define COMPAT_43"
	print "#define COMPAT_43TTY"
	print "#include <sys/param.h>"
	print "#include <sys/devicestat.h>"
	print "#include <sys/disklabel.h>"
	print "#include <sys/socket.h>"
	print "#include <sys/time.h>"
	print "#include <sys/tty.h>"
	print "#include <bsm/audit.h>"
	print "#include <net/ethernet.h>"
	print "#include <net/if.h>"
	print "#include <net/if_var.h>"
	print "#include <net/pfvar.h>"
	print "#include <net/route.h>"
	print "#include <netinet/in.h>"
	print "#include <netinet/ip_mroute.h>"
	print "#include <netinet6/in6_var.h>"
	print "#include <netinet6/nd6.h>"
	print "#include <netinet6/ip6_mroute.h>"
	print "#include <stdio.h>"
	print "#include <cam/cam.h>"
	print ""
	print "const char *ioctlname(u_long val);"
	print ""
	print ioctl_includes
	print ""
	print "const char *"
	print "ioctlname(u_long val)"
	print "{"
	print ""
	if (use_switch)
		print "\tswitch(val) {"
}

/^#[ 	]*define[ 	]+[A-Za-z_][A-Za-z0-9_]*[ 	]+_IO/ {

	# find where the name starts
	for (i = 1; i <= NF; i++)
		if ($i ~ /define/)
			break;
	++i;
	#
	if (use_switch)
		printf("\tcase %s:\n\t\treturn(\"%s\");\n", $i, $i);
	else
		printf("\tif (val ==  %s)\n\t\treturn(\"%s\");\n", $i, $i);

}
END {
	if (use_switch)
		print "\t}"
	print "\n\treturn(NULL);"
	print "}"
}
'
@


1.53
log
@SVN rev 235911 on 2012-05-24 14:07:44Z by mav

MFprojects/zfsd:
Revamp the CAM enclosure services driver.
This updated driver uses an in-kernel daemon to track state changes and
publishes physical path location information\for disk elements into the
CAM device database.

Sponsored by:   Spectra Logic Corporation
Sponsored by:   iXsystems, Inc.
Submitted by:   gibbs, will, mav
@
text
@d3 1
a3 1
# $FreeBSD$
@


1.52
log
@SVN rev 234058 on 2012-04-09 14:47:18Z by dim

In kdump's mkioctls script, use '${CPP}' instead of hardcodedly using
'gcc -E'.  This fixes building when WITH_CLANG_IS_CC is in effect.

Report by:	Niclas Zeising <zeising@@daemonic.se>
MFC after:	1 week
@
text
@d66 2
@


1.51
log
@SVN rev 226608 on 2011-10-21 11:08:25Z by des

It turns out that truss also used kdump's mkioctls script, and expected
ioctlname() to return a pointer to the name rather than print it.  This did
not show up in testing because truss had its own prototype for ioctlname(),
so it would build fine and run fine as long as the program being traced did
not issue an ioctl.

Teach mkioctls to generate different versions of ioctlname() based on its
first command-line argument.

Pointed out by:	Garrett Cooper <yanegomi@@gmail.com>
@
text
@d41 1
a41 1
	gcc -E -I$1 -dM -DCOMPAT_43TTY - |
@


1.50
log
@SVN rev 226344 on 2011-10-13 16:29:24Z by des

Clean up mkioctls a bit, and fix cross-building by checking ${MACHINE}
instead of $(uname -m).

Pointed out by:	nyan@@
@
text
@d4 3
d10 2
a11 2
if [ -z "$1" ]; then
	echo "usage: sh $0 include-dir"
d15 3
d23 1
a23 1
	cd $1
d42 1
a42 1
	awk -v ioctl_includes="$ioctl_includes" '
a66 2
	print "void ioctlname(unsigned long val, int decimal);"
	print ""
d69 11
a79 2
	print "void"
	print "ioctlname(unsigned long val, int decimal)"
d93 1
a93 1
	print("\t");
d95 1
a95 1
		print("else ");
d100 11
a110 7
	print "\n"
	print "\tif (str != NULL)\n"
	print "\t\tprintf(\"%s\", str);\n"
	print "\telse if (decimal)\n"
	print "\t\tprintf(\"%lu\", val);\n"
	print "\telse\n"
	print "\t\tprintf(\"%#lx\", val);\n"
@


1.49
log
@SVN rev 226329 on 2011-10-12 21:45:12Z by des

Make kdump compile cleanly at WARNS level 6, with one exception: the
ipfilter headers contain a duplicated function declaration.  Turn off
-Werror to allow kdump to compile in spite of this.

It would be neat to be able to turn off -Werror on a file-by-file basis...

PR:		bin/161478
Submitted by:	Garrett Cooper <yanegomi@@gmail.com>
@
text
@d16 1
a16 1
ioctl_includes=`
d21 2
a22 2
		awk '{printf("#include <%s>\\\\n", $1)}'
`
d24 2
a25 1
case "`uname -m`" in
@


1.48
log
@SVN rev 226157 on 2011-10-08 12:47:00Z by des

Bring ioctlname() in line with all the other *name() functions, which
actually print the name (or the numeric value, if they can't figure out
the correct name) instead of just returning a pointer to it.  Also, since
ioctl numbers are not and probably never will be unique, drop support for
using a switch statement instead of an if/else chain.
@
text
@d18 1
a18 1
	find -H -s * -name '*.h' |
d24 9
@


1.47
log
@SVN rev 195751 on 2009-07-18 10:36:18Z by bz

Remove no longer needed #include after removing the legacy
vimage API in r195741.

Reviewed by:	rwatson
Approved by:	re (kib)
@
text
@a6 7
if [ "x$1" = "x-s" ]; then
	use_switch=1
	shift
else
	use_switch=0
fi

d8 1
a8 1
	echo "usage: sh $0 [-s] include-dir"
d26 1
a26 1
	awk -v ioctl_includes="$ioctl_includes" -v use_switch="$use_switch" '
d51 1
a51 1
	print "const char *ioctlname(u_long val);"
d55 2
a56 2
	print "const char *"
	print "ioctlname(u_long val)"
d58 1
a59 2
	if (use_switch)
		print "\tswitch(val) {"
d70 5
a74 5
	if (use_switch)
		printf("\tcase %s:\n\t\treturn(\"%s\");\n", $i, $i);
	else
		printf("\tif (val ==  %s)\n\t\treturn(\"%s\");\n", $i, $i);

d77 7
a83 3
	if (use_switch)
		print "\t}"
	print "\n\treturn(NULL);"
@


1.47.4.1
log
@SVN rev 225736 on 2011-09-23 00:51:37Z by kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by:	re (implicit)
@
text
@@


1.47.4.2
log
@SVN rev 234444 on 2012-04-18 20:32:07Z by dim

MFC r234058:
  In kdump's mkioctls script, use '${CPP}' instead of hardcodedly using
  'gcc -E'.  This fixes building when WITH_CLANG_IS_CC is in effect.

  Report by:	Niclas Zeising <zeising@@daemonic.se>

MFC r234060:
  Since truss also uses kdump's mkioctls script, pass the value of ${CPP}
  there too, similar to r234058.
@
text
@d32 1
a32 1
	$CPP -I$1 -dM -DCOMPAT_43TTY - |
@


1.47.4.3
log
@## SVN ##
## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/ 242902
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ## r242902 | dteske | 2012-11-11 23:29:45 +0000 (Sun, 11 Nov 2012) | 10 lines
## SVN ##
## SVN ## Fix a regression introduced by SVN r211417 that saw the breakage of a feature
## SVN ## documented in usr.sbin/sysinstall/help/shortcuts.hlp (reproduced below):
## SVN ##
## SVN ## If /usr/sbin/sysinstall is linked to another filename, say
## SVN ## `/usr/local/bin/configPackages', then the basename will be used
## SVN ## as an implicit command name.
## SVN ##
## SVN ## Reviewed by:	adrian (co-mentor)
## SVN ## Approved by:	adrian (co-mentor)
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ##
@
text
@d3 1
a3 1
# $FreeBSD: stable/9/usr.bin/kdump/mkioctls 234444 2012-04-18 20:32:07Z dim $
@


1.47.4.4
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/246437
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d3 1
a3 1
# $FreeBSD: stable/9/usr.bin/kdump/mkioctls 246437 2013-02-06 22:07:38Z mav $
a56 2
	print "#include <stddef.h>"
	print "#include <stdint.h>"
@


1.47.4.5
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/258442
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d3 1
a3 4
# $FreeBSD: stable/9/usr.bin/kdump/mkioctls 258442 2013-11-21 20:09:44Z jhb $
#
# When editing this script, keep in mind that truss also uses it.
#
d7 9
a15 2
if [ $# -ne 2 -o \( $1 != "print" -a $1 != "return" \) ]; then
	echo "usage: sh $0 print|return include-dir"
a18 3
style="$1"
includedir="$2"

d23 3
a25 3
ioctl_includes=$(
	cd $includedir
	find -H -s * -name '*.h' | grep -v '.*disk.*\.h' | \
d28 2
a29 12
		awk '{printf("#include <%s>\\n", $1)}'
)

: ${MACHINE=$(uname -m)}
case "${MACHINE}" in
*pc98*)
	ioctl_includes="$ioctl_includes#include <sys/diskpc98.h>\\n"
	;;
*)
	ioctl_includes="$ioctl_includes#include <sys/diskmbr.h>\\n"
	;;
esac
d33 1
a33 1
	awk -v ioctl_includes="$ioctl_includes" -v style="$style" '
d60 2
d64 2
a65 11
	if (style == "print") {
		print "void ioctlname(unsigned long val, int decimal);"
		print ""
		print "void"
		print "ioctlname(unsigned long val, int decimal)"
	} else {
		print "const char *ioctlname(unsigned long val);"
		print ""
		print "const char *"
		print "ioctlname(unsigned long val)"
	}
a66 1
	print "\tconst char *str = NULL;"
d68 2
d80 5
a84 5
	printf("\t");
	if (n++ > 0)
		printf("else ");
	printf("if (val == %s)\n", $i);
	printf("\t\tstr = \"%s\";\n", $i);
d87 3
a89 11
	print ""
	if (style == "print") {
		print "\tif (str != NULL)"
		print "\t\tprintf(\"%s\", str);"
		print "\telse if (decimal)"
		print "\t\tprintf(\"%lu\", val);"
		print "\telse"
		print "\t\tprintf(\"%#lx\", val);"
	} else {
		print "\treturn (str);"
	}
@


1.47.4.2.2.1
log
@SVN rev 239080 on 2012-08-05 23:54:33Z by kensmith

Copy stable/9 to releng/9.1 as part of the 9.1-RELEASE release process.

Approved by:	re (implicit)
@
text
@@


1.47.4.2.2.2
log
@Switch importer
@
text
@d3 1
a3 1
# $FreeBSD: releng/9.1/usr.bin/kdump/mkioctls 234444 2012-04-18 20:32:07Z dim $
@


1.47.4.1.2.1
log
@SVN rev 227445 on 2011-11-11 04:20:22Z by kensmith

Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
cycle.

Approved by:	re (implicit)
@
text
@@


1.47.4.1.2.2
log
@Switch importer
@
text
@d3 1
a3 1
# $FreeBSD: releng/9.0/usr.bin/kdump/mkioctls 195751 2009-07-18 10:36:18Z bz $
@


1.47.2.1
log
@SVN rev 196045 on 2009-08-03 08:13:06Z by kensmith

Copy head to stable/8 as part of 8.0 Release cycle.

Approved by:	re (Implicit)
@
text
@@


1.47.2.2
log
@## SVN ##
## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/ 242909
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ## r242909 | dim | 2012-11-12 07:47:19 +0000 (Mon, 12 Nov 2012) | 20 lines
## SVN ##
## SVN ## MFC r242625:
## SVN ##
## SVN ## Remove duplicate const specifiers in many drivers (I hope I got all of
## SVN ## them, please let me know if not).  Most of these are of the form:
## SVN ##
## SVN ## static const struct bzzt_type {
## SVN ##       [...list of members...]
## SVN ## } const bzzt_devs[] = {
## SVN ##       [...list of initializers...]
## SVN ## };
## SVN ##
## SVN ## The second const is unnecessary, as arrays cannot be modified anyway,
## SVN ## and if the elements are const, the whole thing is const automatically
## SVN ## (e.g. it is placed in .rodata).
## SVN ##
## SVN ## I have verified this does not change the binary output of a full kernel
## SVN ## build (except for build timestamps embedded in the object files).
## SVN ##
## SVN ## Reviewed by:	yongari, marius
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ##
@
text
@d3 1
a3 1
# $FreeBSD: stable/8/usr.bin/kdump/mkioctls 195751 2009-07-18 10:36:18Z bz $
@


1.47.2.1.8.1
log
@SVN rev 232438 on 2012-03-03 06:15:13Z by kensmith

Copy stable/8 to releng/8.3 as part of 8.3-RELEASE release cycle.

Approved by:	re (implicit)
@
text
@@


1.47.2.1.8.2
log
@Switch importer
@
text
@d3 1
a3 1
# $FreeBSD: releng/8.3/usr.bin/kdump/mkioctls 195751 2009-07-18 10:36:18Z bz $
@


1.47.2.1.6.1
log
@SVN rev 216617 on 2010-12-21 17:09:25Z by kensmith

Copy stable/8 to releng/8.2 in preparation for FreeBSD-8.2 release.

Approved by:	re (implicit)
@
text
@@


1.47.2.1.4.1
log
@SVN rev 209145 on 2010-06-14 02:09:06Z by kensmith

Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.

Approved by:	re (implicit)
@
text
@@


1.47.2.1.2.1
log
@SVN rev 198460 on 2009-10-25 01:10:29Z by kensmith

Copy stable/8 to releng/8.0 as part of 8.0-RELEASE release procedure.

Approved by:	re (implicit)
@
text
@@


1.46
log
@SVN rev 193177 on 2009-05-31 15:41:46Z by zec

Unbreak buildworld.

(not waiting for an approval from mentor (julian) due to emergency)
@
text
@a43 1
	print "#include <sys/vimage.h>"
@


1.45
log
@SVN rev 192901 on 2009-05-27 16:16:56Z by thompsa

Delete the old USB stack. The new stack has settled in and has all the
drivers/functionality and then some.
@
text
@d44 1
@


1.44
log
@SVN rev 192768 on 2009-05-25 20:07:41Z by ed

Fix kdump build when building it by hand.

I don't entirely like this approach, but it will only be temporarily,
namely until we get rid of COMPAT_43TTY. I do want <sys/ioctl_compat.h>
to cause a compiler error when included, because it's just there for
binary compatibility.

Reported by:	Andrzej Tobola <ato iem pw edu pl>
@
text
@a20 3
# include subdirs to exclude from the search
exclude="^legacy/.*"

d25 1
a25 1
	find -H -s * -name '*.h' \! -regex $exclude |
@


1.43
log
@SVN rev 191936 on 2009-05-09 15:09:40Z by ed

Add support for old TTY ioctls to kdump.

At first I allowed ioctl_compat.h to be included, but it just returned
an empty file. I had to do this, to keep kdump happy. I really want to
raise a compiler error when including this header, so now it will just
throw an error if you don't set COMPAT_43TTY.
@
text
@d35 1
a35 1
	gcc -E -I$1 -dM - |
@


1.42
log
@SVN rev 188978 on 2009-02-24 00:53:10Z by thompsa

Install the old usb headers under /usr/include/legacy/dev/usb as they are
needed by the hal port. This will be removed before 8.0.

Add an exclusion to kdump as some structs will be redefined.

Requested by:	marcus
@
text
@d40 1
@


1.41
log
@Remove netatm from HEAD as it is not MPSAFE and relies on the now removed
NET_NEEDS_GIANT.  netatm has been disconnected from the build for ten
months in HEAD/RELENG_7.  Specifics:

- netatm include files
- netatm command line management tools
- libatm
- ATM parts in rescue and sysinstall
- sample configuration files and documents
- kernel support as a module or in NOTES
- netgraph wrapper nodes for netatm
- ctags data for netatm.
- netatm-specific device drivers.

MFC after:	3 weeks
Reviewed by:	bz
Discussed with:	bms, bz, harti
@
text
@d21 3
d28 1
a28 1
	find -H -s * -name '*.h' |
@


1.40
log
@These are files are shell scripts; give smart editors a chance to figure
it out by adding the usual shebang.

MFC after:	2 weeks
@
text
@a48 5
# Disabled in 7.0 as netatm is not MPSAFE.
#	print "#include <netatm/atm.h>"
#	print "#include <netatm/atm_if.h>"
#	print "#include <netatm/atm_sap.h>"
#	print "#include <netatm/atm_sys.h>"
@


1.39
log
@Disconnect netatm from the build as it is not MPSAFE and relies on
NET_NEEDS_GIANT, which will shortly be removed.  This is done in a
away that it may be easily reattached to the build before 7.1 if
appropriate locking is added.  Specifics:

- Don't install netatm include files
- Disconnect netatm command line management tools
- Don't build libatm
- Don't include ATM parts in rescue or sysinstall
- Don't install sample configuration files and documents
- Don't build kernel support as a module or in NOTES
- Don't build netgraph wrapper nodes for netatm

This removes the last remaining consumer of NET_NEEDS_GIANT.

Reviewed by:	harti
Discussed with:	bz, bms
Approved by:	re (kensmith)
@
text
@d1 4
a6 2
# $FreeBSD$

d75 1
a75 1
	
d81 1
a81 1
	# 
@


1.39.2.1
log
@SVN rev 182526 on 2008-08-31 10:15:43Z by rwatson

Merge r179308 from head to stable/7:

  Remove netatm from HEAD as it is not MPSAFE and relies on the now removed
  NET_NEEDS_GIANT.  netatm has been disconnected from the build for ten
  months in HEAD/RELENG_7.  Specifics:

  - netatm include files
  - netatm command line management tools
  - libatm
  - ATM parts in rescue and sysinstall
  - sample configuration files and documents
  - kernel support as a module or in NOTES
  - netgraph wrapper nodes for netatm
  - ctags data for netatm.
  - netatm-specific device drivers.

  Reviewed by:    bz
  Discussed with: bms, bz, harti

MFC discussed with:	des, peter
@
text
@d47 5
@


1.39.2.2
log
@SVN rev 192860 on 2009-05-26 21:40:15Z by des

MFC r175936: add shebang.
@
text
@d1 2
a2 2
#!/bin/sh
#
a4 2
set -e

d68 1
a68 1

d74 1
a74 1
	#
@


1.39.2.3
log
@Switch importer
@
text
@d3 1
a3 1
# $FreeBSD: stable/7/usr.bin/kdump/mkioctls 192860 2009-05-26 21:40:15Z des $
@


1.39.2.2.4.1
log
@SVN rev 216618 on 2010-12-21 17:10:29Z by kensmith

Copy stable/7 to releng/7.4 in preparation for FreeBSD-7.4 release.

Approved by:	re (implicit)
@
text
@@


1.39.2.2.4.2
log
@Switch importer
@
text
@d3 1
a3 1
# $FreeBSD: releng/7.4/usr.bin/kdump/mkioctls 192860 2009-05-26 21:40:15Z des $
@


1.39.2.2.2.1
log
@SVN rev 203736 on 2010-02-10 00:26:20Z by kensmith

Copy stable/7 to releng/7.3 as part of the 7.3-RELEASE process.

Approved by:	re (implicit)
@
text
@@


1.39.2.1.4.1
log
@SVN rev 191087 on 2009-04-15 03:14:26Z by kensmith

Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.

Approved by:	re (implicit)
@
text
@@


1.39.2.1.2.1
log
@SVN rev 185281 on 2008-11-25 02:59:29Z by kensmith

Create releng/7.1 in preparation for moving into RC phase of 7.1 release
cycle.

Approved by:	re (implicit)
@
text
@@


1.38
log
@Add audit.h to mkioctls inclusion list: audit pipe ioctls need access
to the audit types.

Submitted by:	wsalamon
Obtained from:	TrustedBSD Project
@
text
@d47 5
a51 4
	print "#include <netatm/atm.h>"
	print "#include <netatm/atm_if.h>"
	print "#include <netatm/atm_sap.h>"
	print "#include <netatm/atm_sys.h>"
@


1.37
log
@Commit userland part of pf version 3.5 from OpenBSD (OPENBSD_3_5_BASE).
@
text
@d41 1
@


1.37.8.1
log
@Merge mkioctls:1.38 from HEAD to RELENG_6:

  Add audit.h to mkioctls inclusion list: audit pipe ioctls need access
  to the audit types.

Obtained from:	TrustedBSD Project
@
text
@a40 1
	print "#include <bsm/audit.h>"
@


1.37.8.2
log
@Switch importer
@
text
@d3 1
a3 1
# $FreeBSD: stable/6/usr.bin/kdump/mkioctls 161940 2006-09-03 08:29:20Z rwatson $
@


1.37.8.1.6.1
log
@SVN rev 183531 on 2008-10-02 02:57:24Z by kensmith

Create releng/6.4 from stable/6 in preparation for 6.4-RC1.

Approved by:	re (implicit)
@
text
@@


1.36
log
@Use the -H option instead of the deprecated -follow predicate.
@
text
@d44 1
@


1.35
log
@Kill references to netns in comment about how it conflicted with netipx so
it was ignored all this time.
@
text
@d23 1
a23 1
	find -s * -name '*.h' -follow |
@


1.34
log
@Backed out revs 1.32-1.33.  The problem has been fixed better by
depolluting <netinet/if_gre.h> in the !_KERNEL case.

Reviewed by:	sobomax
@
text
@a20 1
# XXX netipx conflicts with netns (leave out netns).
a23 1
		egrep -v '^(netns)/' |
@


1.33
log
@Also add #include <netinet/in_systm.h> before <neinet/ip.h> to fix the
world.

Submitted by:	Brooks Davis <brooks@@one-eyed-alien.net>
@
text
@a51 2
	print "#include <netinet/in_systm.h>"
	print "#include <netinet/ip.h>"
@


1.32
log
@Add #include <netinet/ip.h> in attempt to fix the world.
@
text
@d52 1
@


1.31
log
@Better warnings fixes. Use more sane argument types instead of bogus casts

Submitted by:	bde
@
text
@d52 1
@


1.30
log
@Fix warnings generated elsewhere.
@
text
@d59 1
a59 1
	print "const char *ioctlname(register_t val);"
d64 1
a64 1
	print "ioctlname(register_t val)"
d82 1
a82 1
		printf("\tif (val ==  (register_t)%s)\n\t\treturn(\"%s\");\n", $i, $i);
@


1.29
log
@Const the code.
@
text
@d82 1
a82 1
		printf("\tif (val ==  %s)\n\t\treturn(\"%s\");\n", $i, $i);
@


1.28
log
@Back out revision 1.13 (addition of ipfilter includes).  A proper
fix for the relevant world breakage was later committed in revision
1.20, and this now breaks -DNO_IPFILTER world.
@
text
@d59 2
d63 1
a63 1
	print "char *"
@


1.27
log
@Revision 1.26 was

Submitted by:	David Wolfskill <david@@catwhisker.org>
                (when are we ever going to make him a committer? :-) )
@
text
@a51 6
	print "#include <netinet/ip_compat.h>"
	print "#include <netinet/ip_fil.h>"
	print "#include <netinet/ip_auth.h>"
	print "#include <netinet/ip_nat.h>"
	print "#include <netinet/ip_frag.h>"
	print "#include <netinet/ip_state.h>"
@


1.26
log
@Really fix this work to work.  While rev 1.24 did allow awk to run w/o
complaining; the resulting output was useless.
@
text
@@


1.25
log
@Rev 1.24 allows use to use a pure POSIX awk.  Tolerating newlines w/in
a command-line variable assignment is a Gawk'ism I believe.
@
text
@d28 1
a28 1
		sed -e 's/^/#include </' -e s'/$/>/'
d31 1
a31 1
echo "$ioctl_includes" |
d33 1
a33 1
	awk -v ioctl_includes="`echo $ioctl_includes`" -v use_switch="$use_switch" '
@


1.24
log
@Utilize the property of 'echo' in that it removes \n from its input.
@
text
@@


1.23
log
@Backout rev. 1.22 as the change that caused problems was also backed out.
@
text
@d3 1
a3 1
# $FreeBSD: src/usr.bin/kdump/mkioctls,v 1.22 2001/05/21 17:06:26 ru Exp $
d33 1
a33 1
	awk -v ioctl_includes="$ioctl_includes" -v use_switch="$use_switch" '
@


1.22
log
@Work around the side effect of src/include/Makefile,v 1.137 changes.
(The proper fix is to add missing #include directives.)
@
text
@d3 1
a3 1
# $FreeBSD: src/usr.bin/kdump/mkioctls,v 1.21 2001/04/06 14:40:26 ru Exp $
d25 1
a25 1
		egrep -v '^(netns|dev/(asr|dpt|mly|ray|twe|vinum))/' |
@


1.21
log
@Execute this script in a "C" locale environment.

Currently, cs_CZ.ISO_8859-2 locale's collation sequence is
broken, and this caused grep(1) to skip some include files.

Reported by:	Michal Mertl <mime@@traveller.cz>
@
text
@d3 1
a3 1
# $FreeBSD: src/usr.bin/kdump/mkioctls,v 1.20 2001/03/27 16:15:25 ru Exp $
d25 1
a25 1
		egrep -v '^(netns)/' |
@


1.20
log
@Traverse ${DESTDIR}/usr/include in lexographical order.
This should fix problems reported recently on -current.
@
text
@d3 1
a3 1
# $FreeBSD: src/usr.bin/kdump/mkioctls,v 1.19 2001/03/27 05:45:52 ken Exp $
d16 2
@


1.19
log
@Rewrite of the CAM error recovery code.

Some of the major changes include:

	- The SCSI error handling portion of cam_periph_error() has
	  been broken out into a number of subfunctions to better
	  modularize the code that handles the hierarchy of SCSI errors.
	  As a result, the code is now much easier to read.

	- String handling and error printing has been significantly
	  revamped.  We now use sbufs to do string formatting instead
	  of using printfs (for the kernel) and snprintf/strncat (for
	  userland) as before.

	  There is a new catchall error printing routine,
	  cam_error_print() and its string-based counterpart,
	  cam_error_string() that allow the kernel and userland
	  applications to pass in a CCB and have errors printed out
	  properly, whether or not they're SCSI errors.  Among other
	  things, this helped eliminate a fair amount of duplicate code
	  in camcontrol.

	  We now print out more information than before, including
	  the CAM status and SCSI status and the error recovery action
	  taken to remedy the problem.

	- sbufs are now available in userland, via libsbuf.  This
	  change was necessary since most of the error printing code
	  is shared between libcam and the kernel.

	- A new transfer settings interface is included in this checkin.
	  This code is #ifdef'ed out, and is primarily intended to aid
	  discussion with HBA driver authors on the final form the
	  interface should take.  There is example code in the ahc(4)
	  driver that implements the HBA driver side of the new
	  interface.  The new transfer settings code won't be enabled
	  until we're ready to switch all HBA drivers over to the new
	  interface.

src/Makefile.inc1,
lib/Makefile:		Add libsbuf.  It must be built before libcam,
			since libcam uses sbuf routines.

libcam/Makefile:	libcam now depends on libsbuf.

libsbuf/Makefile:	Add a makefile for libsbuf.  This pulls in the
			sbuf sources from sys/kern.

bsd.libnames.mk:	Add LIBSBUF.

camcontrol/Makefile:	Add -lsbuf.  Since camcontrol is statically
			linked, we can't depend on the dynamic linker
			to pull in libsbuf.

camcontrol.c:		Use cam_error_print() instead of checking for
			CAM_SCSI_STATUS_ERROR on every failed CCB.

sbuf.9:			Change the prototypes for sbuf_cat() and
			sbuf_cpy() so that the source string is now a
			const char *.  This is more in line wth the
			standard system string functions, and helps
			eliminate warnings when dealing with a const
			source buffer.

			Fix a typo.

cam.c:			Add description strings for the various CAM
			error status values, as well as routines to
			look up those strings.

			Add new cam_error_string() and
			cam_error_print() routines for userland and
			the kernel.

cam.h:			Add a new CAM flag, CAM_RETRY_SELTO.

			Add enumerated types for the various options
			available with cam_error_print() and
			cam_error_string().

cam_ccb.h:		Add new transfer negotiation structures/types.

			Change inq_len in the ccb_getdev structure to
			be "reserved".  This field has never been
			filled in, and will be removed when we next
			bump the CAM version.

cam_debug.h:		Fix typo.

cam_periph.c:		Modularize cam_periph_error().  The SCSI error
			handling part of cam_periph_error() is now
			in camperiphscsistatuserror() and
			camperiphscsisenseerror().

			In cam_periph_lock(), increase the reference
			count on the periph while we wait for our lock
			attempt to succeed so that the periph won't go
			away while we're sleeping.

cam_xpt.c:		Add new transfer negotiation code.  (ifdefed
			out)

			Add a new function, xpt_path_string().  This
			is a string/sbuf analog to xpt_print_path().

scsi_all.c:		Revamp string handing and error printing code.
			We now use sbufs for much of the string
			formatting code.  More of that code is shared
			between userland the kernel.

scsi_all.h:		Get rid of SS_TURSTART, it wasn't terribly
			useful in the first place.

			Add a new error action, SS_REQSENSE.  (Send a
			request sense and then retry the command.)
			This is useful when the controller hasn't
			performed autosense for some reason.

			Change the default actions around a bit.

scsi_cd.c,
scsi_da.c,
scsi_pt.c,
scsi_ses.c:		SF_RETRY_SELTO -> CAM_RETRY_SELTO.  Selection
			timeouts shouldn't be covered by a sense flag.

scsi_pass.[ch]:		SF_RETRY_SELTO -> CAM_RETRY_SELTO.

			Get rid of the last vestiges of a read/write
			interface.

libkern/bsearch.c,
sys/libkern.h,
conf/files:		Add bsearch.c, which is needed for some of the
			new table lookup routines.

aic7xxx_freebsd.c:	Define AHC_NEW_TRAN_SETTINGS if
			CAM_NEW_TRAN_CODE is defined.

sbuf.h,
subr_sbuf.c:		Add the appropriate #ifdefs so sbufs can
			compile and run in userland.

			Change sbuf_printf() to use vsnprintf()
			instead of kvprintf(), which is only available
			in the kernel.

			Change the source string for sbuf_cpy() and
			sbuf_cat() to be a const char *.

			Add __BEGIN_DECLS and __END_DECLS around
			function prototypes since they're now exported
			to userland.

kdump/mkioctls:		Include stdio.h before cam.h since cam.h now
			includes a function with a FILE * argument.

Submitted by:	gibbs (mostly)
Reviewed by:	jdp, marcel (libsbuf makefile changes)
Reviewed by:	des (sbuf changes)
Reviewed by:	ken
@
text
@d3 1
a3 1
# $FreeBSD: src/usr.bin/kdump/mkioctls,v 1.18 2000/08/02 07:37:44 ru Exp $
d22 1
a22 1
	find * -name '*.h' -follow |
@


1.18
log
@Unbreak world build by adding the necessary <net/ethernet.h> include.

Submitted by:	Nickolay Dudorov <nnd@@wint.itfs.nsk.su>
@
text
@d3 1
a3 1
# $FreeBSD: src/usr.bin/kdump/mkioctls,v 1.17 2000/08/01 08:15:06 ru Exp $
d60 1
a61 1
	print "#include <stdio.h>"
@


1.17
log
@Fix an off-by-nine error when building a list of includes.
@
text
@d3 1
a3 1
# $FreeBSD: src/usr.bin/kdump/mkioctls,v 1.16 2000/07/04 16:26:47 itojun Exp $
d41 1
@


1.16
log
@more pre-requisite for new ipv6 ioctls
@
text
@d3 1
a3 1
# $FreeBSD: src/usr.bin/kdump/mkioctls,v 1.15 1999/12/08 19:47:08 phk Exp $
d25 1
a25 1
'^#[ 	]*define[ 	]+[A-Za-z_][A-Za-z0-0_]*[ 	]+_IO[^a-z0-9_]' |
@


1.15
log
@sys/dkbad.h is no more.
@
text
@d3 1
a3 1
# $FreeBSD: src/usr.bin/kdump/mkioctls,v 1.14 1999/12/03 12:50:02 marcel Exp $
d56 3
@


1.15.2.1
log
@MFC: Merge KAME 2000/07 code.
@
text
@d3 1
a3 1
# $FreeBSD$
a55 3
	print "#include <netinet6/in6_var.h>"
	print "#include <netinet6/nd6.h>"
	print "#include <netinet6/ip6_mroute.h>"
@


1.15.2.2
log
@MFC:

- rev 1.17 (off-by-nine error when building a list of include files)
- rev 1.18 (fix to rev 1.17)
- rev 1.20 (search for include files in lexicographical order)

Approved by:	jkh
@
text
@d3 1
a3 1
# $FreeBSD: src/usr.bin/kdump/mkioctls,v 1.15.2.1 2000/07/15 07:29:29 kris Exp $
d22 1
a22 1
	find -s * -name '*.h' -follow |
d25 1
a25 1
'^#[ 	]*define[ 	]+[A-Za-z_][A-Za-z0-9_]*[ 	]+_IO[^a-z0-9_]' |
a40 1
	print "#include <net/ethernet.h>"
@


1.15.2.3
log
@MFC: (rev 1.21) Execute this script in a "C" locale environment.

Approved by:	jkh
@
text
@d3 1
a3 1
# $FreeBSD: src/usr.bin/kdump/mkioctls,v 1.15.2.2 2001/04/05 08:04:40 ru Exp $
a15 2

LC_ALL=C; export LC_ALL
@


1.15.2.4
log
@MFC: bsd.incs.mk support and assorted header fixes:

Install sys/<arch>/include/pc/*.h to /usr/include/machine/pc/.

Install sys/netatm/*/*.h to /usr/include/netatm/*/.

Don't install compatibility symlinks for <machine/soundcard.h>
and <machine/joystick.h>.

Don't install IPFILTER headers.  Userland utilities fetch them
directly, and they were not visible in the SHARED=symlinks case.

Resurrect SHARED=symlinks in Makefile.inc1.

PR:		docs/29534, bin/28002
@
text
@d3 1
a3 1
# $FreeBSD$
d52 6
@


1.15.2.5
log
@MFC: Make this work with a pure POSIX awk(1).

(This is to restore the ability to downgrade to RELENG_4.)
@
text
@d28 1
a28 1
		awk '{printf("#include <%s>\\\\n", $1)}'
d31 1
a31 1
awk -v x="$ioctl_includes" 'BEGIN {print x}' |
@


1.15.2.6
log
@Switch importer
@
text
@d3 1
a3 1
# $FreeBSD: stable/4/usr.bin/kdump/mkioctls 106953 2002-11-15 18:22:31Z ru $
@


1.14
log
@Avoid hardcoding any paths and variables. The include directory must
now be specified on the command line. Accept a '-s' option which
controls whether a switch-statement is to be used instead of a series
of if-statements.

Replace cpp with gcc -E.

Discussed with: bde
@
text
@d3 1
a3 1
# $FreeBSD: src/usr.bin/kdump/mkioctls,v 1.13 1999/11/24 15:38:35 guido Exp $
a37 1
	print "#include <sys/dkbad.h>"
@


1.13
log
@Unbreak build world by readding the necessary ipfilter includes.
@
text
@d3 13
a15 1
# $FreeBSD: src/usr.bin/kdump/mkioctls,v 1.12 1999/11/10 08:41:08 dfr Exp $
d21 1
a21 1
	cd $DESTDIR/usr/include
d30 2
a31 2
	cpp -I$DESTDIR/usr/include -dM |
	awk -v ioctl_includes="$ioctl_includes" '
d66 1
a66 2
	generate_case_statement = 0
	if (generate_case_statement)
d78 1
a78 1
	if (generate_case_statement)
d85 1
a85 1
	if (generate_case_statement)
@


1.12
log
@ioctlname() is actually passed a register_t.

Pointed out by: bde
@
text
@d3 1
a3 1
# $FreeBSD: src/usr.bin/kdump/mkioctls,v 1.11 1999/11/09 22:32:29 dfr Exp $
d38 6
@


1.11
log
@Fix a boatload of warnings in the generated code on the alpha.
@
text
@d3 1
a3 1
# $FreeBSD: src/usr.bin/kdump/mkioctls,v 1.10 1999/10/11 16:14:22 peter Exp $
d45 1
a45 1
	print "ioctlname(u_long val)"
@


1.10
log
@Ack, ip_mroute.h is not an ipfilter include. :-/

Submitted by:	Mike Heffner <spock@@techfour.net>
@
text
@d3 1
a3 1
# $FreeBSD: src/usr.bin/kdump/mkioctls,v 1.9 1999/10/10 17:49:25 peter Exp $
d45 1
a45 1
	print "ioctlname(val)"
@


1.9
log
@Don't #include ipfilter includes that aren't there anymore.
@
text
@d3 1
a3 1
# $FreeBSD: src/usr.bin/kdump/mkioctls,v 1.8 1999/10/06 07:45:18 n_hibma Exp $
d38 1
@


1.8
log
@Remove the inclusion of device.h. It's no longer there.
@
text
@d3 1
a3 1
# $FreeBSD$
a37 7
	print "#include <netinet/ip_compat.h>"
	print "#include <netinet/ip_fil.h>"
	print "#include <netinet/ip_auth.h>"
	print "#include <netinet/ip_nat.h>"
	print "#include <netinet/ip_frag.h>"
	print "#include <netinet/ip_mroute.h>"
	print "#include <netinet/ip_state.h>"
@


1.7
log
@we don't have <sys/disk.h> anymore.
@
text
@d3 2
a23 1
	print "#include <sys/device.h>"
@


1.6
log
@Generate code to interpret ioctl numbers for all ioctls defined in
headers under /usr/include, not just for the ones in <sys/ioctl.h>.
The generated file includes all headers that seem to define ioctls,
so build errors will probably occur if headers become less self-
sufficient than they are already.  This is a feature.  Build errors
shall not be fixed by adding more includes here.

Optionally generate a case statement instead of a list of if
statements.  This source must be edited to change this.  The case
statement should be non-optional.  It currently can't be, because
many ioctl numbers are not unique.
@
text
@a24 1
	print "#include <sys/disk.h>"
@


1.5
log
@Fix up programs which expect <net/if.h> to include <sys/time.h> to instead
do it themselves.  (Some of these programs actually depended on this
beyond compiling the definition of struct ifinfo!)  Also fix up some
other #include messes while we're at it.
@
text
@d1 3
d5 13
a17 4
# XXX does -I$DESTDIR/usr/include actually work?
(echo "#include <sys/ioctl.h>"
 echo "#include <sys/ioctl_compat.h>"
) | cpp -I$DESTDIR/usr/include -dM | awk '
d19 2
d22 5
a26 1
	print "#include <sys/queue.h>"
a27 1
	print "#include <sys/socketvar.h>"
d29 3
d33 4
a36 1
	print "#include <net/if.h>"
d38 5
d44 5
a48 3
	print "#include <sys/termios.h>"
	print "#define COMPAT_43"
	print "#include <sys/ioctl.h>"
d54 3
d59 1
a59 1
/^#[ 	]*define[ 	]*(TIO|FIO|SIO|OSIO)[A-Z]*[ 	]*_IO/ {
d67 4
a70 1
	printf("\tif (val ==  %s)\n\t\treturn(\"%s\");\n", $i, $i);
d74 2
@


1.4
log
@Run the headers through cpp -dM to find the #defines.  The direct search
has been broken at least since 4.4Lite moved most of the #defines out of
<sys/ioctl.h>.  This should be done better.  Only a few headers are
searched.

Added some #includes so that ioctl.c compiles.  The networking headers
have a maze of undocumented interdependencies and ioctl.c now actually
supports networking ioctls.
@
text
@d11 1
@


1.4.2.1
log
@MFC: cosmetics.
@
text
@a10 1
	print "#include <sys/time.h>"
@


1.3
log
@Include queue.h in preparation for upcoming struct socket changes.
@
text
@d1 5
a5 1
awk '
d13 2
d40 1
a40 1
' $DESTDIR/usr/include/sys/ioctl.h $DESTDIR/usr/include/sys/ioctl_compat.h
@


1.2
log
@Added $DESTDIR to
  $DESTDIR/usr/include/sys/ioctl.h $DESTDIR/usr/include/sys/ioctl_compat.h
so ioctl.c is generated properly using 2.0 include files in $DESTDIR.
@
text
@d4 1
@


1.1
log
@Initial revision
@
text
@d33 1
a33 1
' /usr/include/sys/ioctl.h /usr/include/sys/ioctl_compat.h
@


1.1.1.1
log
@BSD 4.4 Lite Usr.bin Sources
@
text
@@


1.1.1.2
log
@Finish importing Lite2's src/usr.bin, except for ex, diff, grep, mail,
pascal and vmstat.sparc.  All changed files on the vendor branch should
already have been imported.
@
text
@a0 35
#!/bin/sh -
#
# Copyright (c) 1994
#	The Regents of the University of California.  All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
#    must display the following acknowledgement:
#	This product includes software developed by the University of
#	California, Berkeley and its contributors.
# 4. Neither the name of the University nor the names of its contributors
#    may be used to endorse or promote products derived from this software
#    without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
#	@@(#)mkioctls	8.2 (Berkeley) 4/28/95
#
@
