Upstream-Status: Backport

From 17e3860ee8684b397b99eea59b6458a8a7b88f5c Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@altlinux.org>
Date: Sat, 27 Oct 2012 01:11:13 +0000
Subject: [PATCH 29/31] Filter out redundant "*32" ioctl entries

* linux/ioctlent-filter.awk: New file.
* Makefile.am: Use it.
* linux/ioctlent.h.in: Removed redundant "*32" entries.
---
 Makefile.am               |  3 ++-
 linux/ioctlent-filter.awk | 19 +++++++++++++++++++
 linux/ioctlent.h.in       | 14 --------------
 3 files changed, 21 insertions(+), 15 deletions(-)
 create mode 100644 linux/ioctlent-filter.awk

diff --git a/Makefile.am b/Makefile.am
index 3e8c810..aa1a5f4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -151,4 +151,5 @@ $(ioctlent_h): $(top_builddir)/config.status $(ioctlent_h_deps)
 	$(MKDIR_P) $(builddir)/$(OS)
 	cat $(ioctlent_h_deps) | \
 		$(COMPILE) -E -P - | \
-		LC_ALL=C sort -u -k3,3 -k2,2 > $@
+		LC_ALL=C sort -u -k3,3 -k2,2 | \
+		awk -f $(srcdir)/linux/ioctlent-filter.awk > $@
diff --git a/linux/ioctlent-filter.awk b/linux/ioctlent-filter.awk
new file mode 100644
index 0000000..181c4bf
--- /dev/null
+++ b/linux/ioctlent-filter.awk
@@ -0,0 +1,19 @@
+#!/bin/awk -f
+# Filter out redundant "*32" symbols.
+
+BEGIN {
+	s=""
+	c=""
+}
+
+NF == 3 && $2 ~ /^"[^",]*",$/ {
+	if ($2 == s && $3 == c)
+		next
+	s = $2
+	sub(/",$/, "32\",", s)
+	c = $3
+}
+
+{
+	print
+}
diff --git a/linux/ioctlent.h.in b/linux/ioctlent.h.in
index 98ebbcc..895070c 100644
--- a/linux/ioctlent.h.in
+++ b/linux/ioctlent.h.in
@@ -103,7 +103,6 @@
 	{"linux/fs.h",	"BLKBSZSET",	0x1271},
 	{"linux/fs.h",	"BLKGETSIZE64",	0x1272},
 	{"linux/fs.h",	"BLKTRACESETUP",	0x1273},
-	{"linux/blktrace_api.h",	"BLKTRACESETUP32",	0x1273},
 	{"linux/fs.h",	"BLKTRACESTART",	0x1274},
 	{"linux/fs.h",	"BLKTRACESTOP",	0x1275},
 	{"linux/fs.h",	"BLKTRACETEARDOWN",	0x1276},
@@ -257,14 +256,12 @@
 	{"linux/cciss_ioctl.h",	"CCISS_GETDRIVVER",	0x4209},
 	{"linux/cciss_ioctl.h",	"CCISS_REVALIDVOLS",	0x420a},
 	{"linux/cciss_ioctl.h",	"CCISS_PASSTHRU",	0x420b},
-	{"linux/cciss_ioctl.h",	"CCISS_PASSTHRU32",	0x420b},
 	{"linux/cciss_ioctl.h",	"CCISS_DEREGDISK",	0x420c},
 	{"linux/cciss_ioctl.h",	"CCISS_REGNEWDISK",	0x420d},
 	{"linux/cciss_ioctl.h",	"CCISS_REGNEWD",	0x420e},
 	{"linux/cciss_ioctl.h",	"CCISS_RESCANDISK",	0x4210},
 	{"linux/cciss_ioctl.h",	"CCISS_GETLUNINFO",	0x4211},
 	{"linux/cciss_ioctl.h",	"CCISS_BIG_PASSTHRU",	0x4212},
-	{"linux/cciss_ioctl.h",	"CCISS_BIG_PASSTHRU32",	0x4212},
 	{"linux/soundcard.h",	"SNDCTL_COPR_RESET",	0x4300},
 	{"linux/capi.h",	"CAPI_REGISTER",	0x4301},
 	{"linux/soundcard.h",	"SNDCTL_COPR_LOAD",	0x4301},
@@ -775,25 +772,19 @@
 	{"linux/if_tun.h",	"TUNSETVNETHDRSZ",	0x54d8},
 	{"sound/asound.h",	"SNDRV_CTL_IOCTL_PVERSION",	0x5500},
 	{"linux/usbdevice_fs.h",	"USBDEVFS_CONTROL",	0x5500},
-	{"linux/usbdevice_fs.h",	"USBDEVFS_CONTROL32",	0x5500},
 	{"sound/asound.h",	"SNDRV_CTL_IOCTL_CARD_INFO",	0x5501},
 	{"linux/uinput.h",	"UI_DEV_CREATE",	0x5501},
 	{"linux/uinput.h",	"UI_DEV_DESTROY",	0x5502},
 	{"linux/usbdevice_fs.h",	"USBDEVFS_BULK",	0x5502},
-	{"linux/usbdevice_fs.h",	"USBDEVFS_BULK32",	0x5502},
 	{"linux/usbdevice_fs.h",	"USBDEVFS_RESETEP",	0x5503},
 	{"linux/usbdevice_fs.h",	"USBDEVFS_SETINTERFACE",	0x5504},
 	{"linux/usbdevice_fs.h",	"USBDEVFS_SETCONFIGURATION",	0x5505},
 	{"linux/usbdevice_fs.h",	"USBDEVFS_GETDRIVER",	0x5508},
 	{"linux/usbdevice_fs.h",	"USBDEVFS_SUBMITURB",	0x550a},
-	{"linux/usbdevice_fs.h",	"USBDEVFS_SUBMITURB32",	0x550a},
 	{"linux/usbdevice_fs.h",	"USBDEVFS_DISCARDURB",	0x550b},
 	{"linux/usbdevice_fs.h",	"USBDEVFS_REAPURB",	0x550c},
-	{"linux/usbdevice_fs.h",	"USBDEVFS_REAPURB32",	0x550c},
 	{"linux/usbdevice_fs.h",	"USBDEVFS_REAPURBNDELAY",	0x550d},
-	{"linux/usbdevice_fs.h",	"USBDEVFS_REAPURBNDELAY32",	0x550d},
 	{"linux/usbdevice_fs.h",	"USBDEVFS_DISCSIGNAL",	0x550e},
-	{"linux/usbdevice_fs.h",	"USBDEVFS_DISCSIGNAL32",	0x550e},
 	{"linux/usbdevice_fs.h",	"USBDEVFS_CLAIMINTERFACE",	0x550f},
 	{"sound/asound.h",	"SNDRV_CTL_IOCTL_ELEM_LIST",	0x5510},
 	{"linux/usbdevice_fs.h",	"USBDEVFS_RELEASEINTERFACE",	0x5510},
@@ -801,7 +792,6 @@
 	{"linux/usbdevice_fs.h",	"USBDEVFS_CONNECTINFO",	0x5511},
 	{"sound/asound.h",	"SNDRV_CTL_IOCTL_ELEM_READ",	0x5512},
 	{"linux/usbdevice_fs.h",	"USBDEVFS_IOCTL",	0x5512},
-	{"linux/usbdevice_fs.h",	"USBDEVFS_IOCTL32",	0x5512},
 	{"sound/asound.h",	"SNDRV_CTL_IOCTL_ELEM_WRITE",	0x5513},
 	{"linux/usbdevice_fs.h",	"USBDEVFS_HUB_PORTINFO",	0x5513},
 	{"sound/asound.h",	"SNDRV_CTL_IOCTL_ELEM_LOCK",	0x5514},
@@ -1119,7 +1109,6 @@
 	{"linux/ipmi.h",	"IPMICTL_RECEIVE_MSG_TRUNC",	0x690b},
 	{"media/lirc.h",	"LIRC_GET_MAX_FILTER_PULSE",	0x690b},
 	{"linux/i2o-dev.h",	"I2OPASSTHRU",	0x690c},
-	{"linux/i2o-dev.h",	"I2OPASSTHRU32",	0x690c},
 	{"linux/ipmi.h",	"IPMICTL_RECEIVE_MSG",	0x690c},
 	{"media/lirc.h",	"LIRC_GET_MIN_FILTER_SPACE",	0x690c},
 	{"linux/ipmi.h",	"IPMICTL_SEND_COMMAND",	0x690d},
@@ -1194,11 +1183,9 @@
 	{"linux/udf_fs_i.h",	"UDF_GETVOLIDENT",	0x6c42},
 	{"linux/udf_fs_i.h",	"UDF_RELOCATE_BLOCKS",	0x6c43},
 	{"linux/synclink.h",	"MGSL_IOCSPARAMS",	0x6d00},
-	{"linux/synclink.h",	"MGSL_IOCSPARAMS32",	0x6d00},
 	{"linux/mmtimer.h",	"MMTIMER_GETOFFSET",	0x6d00},
 	{"linux/soundcard.h",	"SNDCTL_MIDI_PRETIME",	0x6d00},
 	{"linux/synclink.h",	"MGSL_IOCGPARAMS",	0x6d01},
-	{"linux/synclink.h",	"MGSL_IOCGPARAMS32",	0x6d01},
 	{"linux/mmtimer.h",	"MMTIMER_GETRES",	0x6d01},
 	{"linux/msm_mdp.h",	"MSMFB_GRP_DISP",	0x6d01},
 	{"linux/mtio.h",	"MTIOCTOP",	0x6d01},
@@ -1754,7 +1741,6 @@
 	{"linux/auto_fs.h",	"AUTOFS_IOC_CATATONIC",	0x9362},
 	{"linux/auto_fs.h",	"AUTOFS_IOC_PROTOVER",	0x9363},
 	{"linux/auto_fs.h",	"AUTOFS_IOC_SETTIMEOUT",	0x9364},
-	{"linux/auto_fs.h",	"AUTOFS_IOC_SETTIMEOUT32",	0x9364},
 	{"linux/auto_fs.h",	"AUTOFS_IOC_EXPIRE",	0x9365},
 	{"linux/auto_fs4.h",	"AUTOFS_IOC_EXPIRE_MULTI",	0x9366},
 	{"linux/auto_fs4.h",	"AUTOFS_IOC_PROTOSUBVER",	0x9367},
-- 
1.8.0

