]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Fix fasttrap ioctls and headers_check.
authorNick Alcock <nick.alcock@oracle.com>
Wed, 31 Jul 2013 19:01:52 +0000 (20:01 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Wed, 31 Jul 2013 19:01:52 +0000 (20:01 +0100)
These were being included before their structure definitions, leading to the
possibility of wrong values for FASTTRAPIOC_*.

Instead, split the FASTTRAPIOC* definitions into a new header, fasttrap_ioctl.h:
this includes fasttrap.h to get the structure definitions, and is also included
by it, so that either header can be included to get the ioctl definitions. We
then extend "make headers_check" so that it does the extended ioctl checks on
all headers named *ioctl.h, not just ioctl.h. (These checks are quite grotesque:
we don't want to run them on every DTrace uapi header if that can be avoided.)

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
dtrace/Makefile
dtrace/include/uapi/linux/dtrace/fasttrap.h
dtrace/include/uapi/linux/dtrace/fasttrap_ioctl.h [new file with mode: 0644]

index 94dc1d77ea2047d8bc93b3597cb7162e340b1485..d31fdcfd77c1aace2bf8659ede7a800c6f84a2d0 100644 (file)
@@ -11,14 +11,14 @@ install:: modules_install
 %::
        $(MAKE) -C $(KERNELDIR) M=`pwd` $@
 
-# One header, ioctl.h, has to be compiled in kernel mode so that typechecking
-# is enabled.  The rest get compiled in user mode.  We go to some lengths
-# to use any ioctl() identifiers, since typechecking only kicks in at
+# Headers named *_ioctl.h have to be compiled in kernel mode so that
+# typechecking is enabled. The rest get compiled in user mode. We go to some
+# lengths to use any ioctl() identifiers, since typechecking only kicks in at
 # time of use.
 
 headers_check:
        @for name in $(notdir $(wildcard include/uapi/linux/dtrace/*.h)); do \
-               if [[ $$name = ioctl.h ]]; then \
+               if [[ $$name =~ .*ioctl\.h$$ ]]; then \
                        INC="-I../arch/x86/include -I../include -I../include/asm-generic -Iinclude -D__KERNEL__ -include linux/types.h -include dtrace/types.h"; \
                else \
                        INC="-include sys/types.h -include sys/ctf_types.h -include unistd.h -I../include"; \
index fad93dc588e30a2790eac72c33c3604479ae482f..f707ed3d67e3b65a67c2004d89980a6842b109f6 100644 (file)
 #include <linux/dtrace/universal.h>
 #include <linux/dtrace/fasttrap_defines.h>
 
-#define FASTTRAPIOC            0xf4
-#define FASTTRAPIOC_MAKEPROBE  _IOW(FASTTRAPIOC, 1, fasttrap_probe_spec_t)
-#define FASTTRAPIOC_GETINSTR   _IOR(FASTTRAPIOC, 2, fasttrap_instr_query_t)
-
 typedef enum fasttrap_probe_type {
        DTFTP_NONE = 0,
        DTFTP_ENTRY,
@@ -67,4 +63,12 @@ typedef struct fasttrap_instr_query {
        fasttrap_instr_t ftiq_instr;
 } fasttrap_instr_query_t;
 
+/*
+ * Include after the definitions, to get ioctl()s when fasttrap.h is included.
+ * fasttrap_ioctl.h also #includes this header, to get structures when it is
+ * included itself, as is done by headers_check.
+ */
+
+#include <linux/dtrace/fasttrap_ioctl.h>
+
 #endif /* _LINUX_DTRACE_FASTTRAP_H */
diff --git a/dtrace/include/uapi/linux/dtrace/fasttrap_ioctl.h b/dtrace/include/uapi/linux/dtrace/fasttrap_ioctl.h
new file mode 100644 (file)
index 0000000..556563a
--- /dev/null
@@ -0,0 +1,37 @@
+/* Copyright (C) 2011, 2012, 2013 Oracle, Inc. */
+
+#ifndef _LINUX_DTRACE_FASTRRAP_IOCTL_H_
+#define _LINUX_DTRACE_FASTTRAP_IOCTL_H_
+
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ * Copyright 2009 -- 2013 Oracle, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <linux/ioctl.h>
+#include <linux/dtrace/fasttrap.h>
+
+#define FASTTRAPIOC            0xf4
+#define FASTTRAPIOC_MAKEPROBE  _IOW(FASTTRAPIOC, 1, fasttrap_probe_spec_t)
+#define FASTTRAPIOC_GETINSTR   _IOR(FASTTRAPIOC, 2, fasttrap_instr_query_t)
+
+#endif /* _LINUX_DTRACE_FASTTRAP_IOCTL_H_ */