From 6ccb48f81a0242c3ba2ddd583ded0582364eeacd Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 19 Jan 2026 09:00:00 +0100 Subject: all: reformat C/C++ files --- tools/syz-declextract/testdata/include/fs.h | 9 ++-- tools/syz-declextract/testdata/include/netlink.h | 49 ++++++++++++---------- tools/syz-declextract/testdata/include/syscall.h | 5 ++- tools/syz-declextract/testdata/include/types.h | 8 ++-- .../testdata/include/uapi/file_operations.h | 18 ++++---- .../syz-declextract/testdata/include/uapi/ioctl.h | 34 +++++++-------- .../testdata/include/uapi/netlink_family.h | 22 +++++----- .../testdata/include/uapi/unused_ioctl.h | 2 +- 8 files changed, 78 insertions(+), 69 deletions(-) (limited to 'tools/syz-declextract/testdata/include') diff --git a/tools/syz-declextract/testdata/include/fs.h b/tools/syz-declextract/testdata/include/fs.h index b4eba0bd7..0d0875b65 100644 --- a/tools/syz-declextract/testdata/include/fs.h +++ b/tools/syz-declextract/testdata/include/fs.h @@ -11,13 +11,16 @@ struct file_operations { void (*mmap)(void); }; -static int alloc_fd() { +static int alloc_fd() +{ return 1; } -static void __fget_light(int fd) { +static void __fget_light(int fd) +{ } -static int from_kuid() { +static int from_kuid() +{ return 1; } diff --git a/tools/syz-declextract/testdata/include/netlink.h b/tools/syz-declextract/testdata/include/netlink.h index ee8091290..e40ec994d 100644 --- a/tools/syz-declextract/testdata/include/netlink.h +++ b/tools/syz-declextract/testdata/include/netlink.h @@ -30,34 +30,36 @@ enum { }; struct nla_policy { - u8 type; - u8 validation_type; - u16 len; + u8 type; + u8 validation_type; + u16 len; union { const u32 bitfield32_valid; const u32 mask; - const struct nla_policy *nested_policy; - struct { s16 min, max; }; + const struct nla_policy* nested_policy; + struct { + s16 min, max; + }; }; }; -#define NLA_POLICY_NESTED(policy) { .type = NLA_NESTED, .nested_policy = policy, .len = sizeof(policy)/sizeof(policy[0]) } +#define NLA_POLICY_NESTED(policy) {.type = NLA_NESTED, .nested_policy = policy, .len = sizeof(policy) / sizeof(policy[0])} #define GENL_ADMIN_PERM 0x01 #define GENL_UNS_ADMIN_PERM 0x10 struct genl_ops { - u8 cmd; - u8 flags; - const struct nla_policy* policy; - void (*doit)(void); - void (*dumpit)(void); + u8 cmd; + u8 flags; + const struct nla_policy* policy; + void (*doit)(void); + void (*dumpit)(void); }; struct genl_split_ops { - u8 cmd; - u8 flags; - const struct nla_policy *policy; + u8 cmd; + u8 flags; + const struct nla_policy* policy; union { struct { void (*pre_doit)(void); @@ -72,15 +74,16 @@ struct genl_split_ops { }; }; -struct genl_small_ops {}; +struct genl_small_ops { +}; struct genl_family { - char name[64]; - u8 n_ops; - u8 n_small_ops; - u8 n_split_ops; - const struct nla_policy* policy; - const struct genl_ops* ops; - const struct genl_small_ops* mall_ops; - const struct genl_split_ops* split_ops; + char name[64]; + u8 n_ops; + u8 n_small_ops; + u8 n_split_ops; + const struct nla_policy* policy; + const struct genl_ops* ops; + const struct genl_small_ops* mall_ops; + const struct genl_split_ops* split_ops; }; diff --git a/tools/syz-declextract/testdata/include/syscall.h b/tools/syz-declextract/testdata/include/syscall.h index 601480cb4..a377ab7d6 100644 --- a/tools/syz-declextract/testdata/include/syscall.h +++ b/tools/syz-declextract/testdata/include/syscall.h @@ -3,5 +3,6 @@ #define SYSCALL_DEFINE1(NAME, ...) SYSCALL_DEFINEx(1, NAME, __VA_ARGS__) #define SYSCALL_DEFINE2(NAME, ...) SYSCALL_DEFINEx(2, NAME, __VA_ARGS__) -#define SYSCALL_DEFINEx(NARGS, NAME, ...) long __do_sys_##NAME(__VA_ARGS__); \ -long __do_sys_##NAME(__VA_ARGS__) +#define SYSCALL_DEFINEx(NARGS, NAME, ...) \ + long __do_sys_##NAME(__VA_ARGS__); \ + long __do_sys_##NAME(__VA_ARGS__) diff --git a/tools/syz-declextract/testdata/include/types.h b/tools/syz-declextract/testdata/include/types.h index 286d29089..03bebb953 100644 --- a/tools/syz-declextract/testdata/include/types.h +++ b/tools/syz-declextract/testdata/include/types.h @@ -12,12 +12,14 @@ typedef unsigned long long u64; #define __user __attribute__((btf_type_tag("user"))) -#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0])) +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) -static inline u32 atomic_load32(u32* p) { +static inline u32 atomic_load32(u32* p) +{ return __atomic_load_n(p, __ATOMIC_RELAXED); } -inline u64 atomic_load64(u64* p) { +inline u64 atomic_load64(u64* p) +{ return __atomic_load_n(p, __ATOMIC_RELAXED); } diff --git a/tools/syz-declextract/testdata/include/uapi/file_operations.h b/tools/syz-declextract/testdata/include/uapi/file_operations.h index a4fa3a21e..c874415d3 100644 --- a/tools/syz-declextract/testdata/include/uapi/file_operations.h +++ b/tools/syz-declextract/testdata/include/uapi/file_operations.h @@ -3,15 +3,15 @@ #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) -#define FOO_IOCTL6 _IO('c', 6) -#define FOO_IOCTL7 _IO('c', 7) -#define FOO_IOCTL8 _IO('c', 8) -#define FOO_IOCTL9 _IO('c', 9) +#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) +#define FOO_IOCTL6 _IO('c', 6) +#define FOO_IOCTL7 _IO('c', 7) +#define FOO_IOCTL8 _IO('c', 8) +#define FOO_IOCTL9 _IO('c', 9) enum { FOO_IOCTL10 = _IOR('c', 10, int), diff --git a/tools/syz-declextract/testdata/include/uapi/ioctl.h b/tools/syz-declextract/testdata/include/uapi/ioctl.h index fae14a74e..6c0b01bfe 100644 --- a/tools/syz-declextract/testdata/include/uapi/ioctl.h +++ b/tools/syz-declextract/testdata/include/uapi/ioctl.h @@ -1,24 +1,24 @@ // 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. -#define _IOC_NONE 0U -#define _IOC_WRITE 1U -#define _IOC_READ 2U +#define _IOC_NONE 0U +#define _IOC_WRITE 1U +#define _IOC_READ 2U -#define _IOC_NRBITS 8 -#define _IOC_TYPEBITS 8 -#define _IOC_SIZEBITS 14 -#define _IOC_DIRBITS 2 +#define _IOC_NRBITS 8 +#define _IOC_TYPEBITS 8 +#define _IOC_SIZEBITS 14 +#define _IOC_DIRBITS 2 -#define _IOC_NRSHIFT 0 -#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) -#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) -#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) +#define _IOC_NRSHIFT 0 +#define _IOC_TYPESHIFT (_IOC_NRSHIFT + _IOC_NRBITS) +#define _IOC_SIZESHIFT (_IOC_TYPESHIFT + _IOC_TYPEBITS) +#define _IOC_DIRSHIFT (_IOC_SIZESHIFT + _IOC_SIZEBITS) -#define _IOC(dir, type, nr, size) (((dir) << _IOC_DIRSHIFT) | ((type) << _IOC_TYPESHIFT) | \ - ((nr) << _IOC_NRSHIFT) | ((size) << _IOC_SIZESHIFT)) +#define _IOC(dir, type, nr, size) (((dir) << _IOC_DIRSHIFT) | ((type) << _IOC_TYPESHIFT) | \ + ((nr) << _IOC_NRSHIFT) | ((size) << _IOC_SIZESHIFT)) -#define _IO(type, nr) _IOC(_IOC_NONE, (type), (nr), 0) -#define _IOR(type, nr, arg) _IOC(_IOC_READ, (type), (nr), (sizeof(arg))) -#define _IOW(type, nr, arg) _IOC(_IOC_WRITE, (type), (nr), (sizeof(arg))) -#define _IOWR(type, nr, arg) _IOC(_IOC_READ|_IOC_WRITE, (type), (nr), (sizeof(arg))) +#define _IO(type, nr) _IOC(_IOC_NONE, (type), (nr), 0) +#define _IOR(type, nr, arg) _IOC(_IOC_READ, (type), (nr), (sizeof(arg))) +#define _IOW(type, nr, arg) _IOC(_IOC_WRITE, (type), (nr), (sizeof(arg))) +#define _IOWR(type, nr, arg) _IOC(_IOC_READ | _IOC_WRITE, (type), (nr), (sizeof(arg))) diff --git a/tools/syz-declextract/testdata/include/uapi/netlink_family.h b/tools/syz-declextract/testdata/include/uapi/netlink_family.h index ffaf66bf7..11a5dee8f 100644 --- a/tools/syz-declextract/testdata/include/uapi/netlink_family.h +++ b/tools/syz-declextract/testdata/include/uapi/netlink_family.h @@ -4,24 +4,24 @@ // Description of some hypothetic netlink family. enum netlink_foo_cmds { - NETLINK_FOO_CMD_FOO, - NETLINK_FOO_CMD_BAR, + NETLINK_FOO_CMD_FOO, + NETLINK_FOO_CMD_BAR, }; enum netlink_foo_attrs { - NETLINK_FOO_ATTR1, - NETLINK_FOO_ATTR2, - NETLINK_FOO_ATTR3 = NETLINK_FOO_ATTR2 + 3, // make them non-dense - NETLINK_FOO_ATTR4, - NETLINK_FOO_ATTR5, - NETLINK_FOO_ATTR6, - NETLINK_FOO_ATTR7, + NETLINK_FOO_ATTR1, + NETLINK_FOO_ATTR2, + NETLINK_FOO_ATTR3 = NETLINK_FOO_ATTR2 + 3, // make them non-dense + NETLINK_FOO_ATTR4, + NETLINK_FOO_ATTR5, + NETLINK_FOO_ATTR6, + NETLINK_FOO_ATTR7, }; struct netlink_foo_struct1 { - int a, b, c; + int a, b, c; }; typedef struct { - double a, b, c; + double a, b, c; } netlink_foo_struct2; diff --git a/tools/syz-declextract/testdata/include/uapi/unused_ioctl.h b/tools/syz-declextract/testdata/include/uapi/unused_ioctl.h index 6c3dbb036..b8176ffdc 100644 --- a/tools/syz-declextract/testdata/include/uapi/unused_ioctl.h +++ b/tools/syz-declextract/testdata/include/uapi/unused_ioctl.h @@ -3,4 +3,4 @@ #include "ioctl.h" -#define UNUSED_IOCTL1 _IO('c', 1) +#define UNUSED_IOCTL1 _IO('c', 1) -- cgit mrf-deployment