aboutsummaryrefslogtreecommitdiffstats
path: root/tools/syz-declextract/testdata/include/uapi/file_operations.h
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-12-02 10:57:36 +0100
committerDmitry Vyukov <dvyukov@google.com>2024-12-11 15:22:17 +0000
commitc756ba4e975097bf74b952367e2cd1a8db466c69 (patch)
tree7cf501f6dec263b38066b485c118e4cb372d3625 /tools/syz-declextract/testdata/include/uapi/file_operations.h
parent13dbd03bf7ca0a245cfdfd2d8c8b73e486bbaa7b (diff)
tools/syz-declextract: extract file_operations descriptions
Extend the clang tool to locate file_operations variables and arrays and dump open/read/write/mmap/ioctl callbacks for each. It also tries to extract set of ioctl commands and argument types for them in a simple best-effort way (for now). It just locates switch in the ioctl callback and extracts each case as a command.
Diffstat (limited to 'tools/syz-declextract/testdata/include/uapi/file_operations.h')
-rw-r--r--tools/syz-declextract/testdata/include/uapi/file_operations.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/syz-declextract/testdata/include/uapi/file_operations.h b/tools/syz-declextract/testdata/include/uapi/file_operations.h
new file mode 100644
index 000000000..6a2a8d259
--- /dev/null
+++ b/tools/syz-declextract/testdata/include/uapi/file_operations.h
@@ -0,0 +1,14 @@
+// Copyright 2024 syzkaller project authors. All rights reserved.
+// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
+
+#include "ioctl.h"
+
+#define FOO_IOCTL1 _IO('c', 1)
+#define FOO_IOCTL2 _IOR('c', 2, int)
+#define FOO_IOCTL3 _IOR('c', 3, struct foo_ioctl_arg)
+#define FOO_IOCTL4 _IOW('c', 4, struct foo_ioctl_arg)
+#define FOO_IOCTL5 _IOWR('c', 5, struct foo_ioctl_arg)
+
+struct foo_ioctl_arg {
+ int a, b;
+};