public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] io_uring: add header include guards to all header files
@ 2025-06-17 18:50 Vishwanath Seshagiri
  2025-06-17 19:16 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Vishwanath Seshagiri @ 2025-06-17 18:50 UTC (permalink / raw)
  To: Jens Axboe; +Cc: io-uring, Vishwanath Seshagiri

From: Vishwanath Seshagiri <vishs@fb.com>

Add missing header include guards to all *.h files in the io_uring/
directory to prevent multiple inclusion issues. This follows the
established pattern used in io_uring/zcrx.h and other kernel headers.

The guards use the format IOU_<NAME>_H to maintain consistency with
the io_uring subsystem naming conventions.

Testing: Verified functionality with liburing test suite - all tests pass.
---
 io_uring/advise.h    | 3 +++
 io_uring/epoll.h     | 3 +++
 io_uring/eventfd.h   | 4 ++++
 io_uring/fdinfo.h    | 3 +++
 io_uring/fs.h        | 4 +++-
 io_uring/futex.h     | 4 +++-
 io_uring/msg_ring.h  | 4 +++-
 io_uring/net.h       | 3 +++
 io_uring/nop.h       | 3 +++
 io_uring/openclose.h | 3 +++
 io_uring/rw.h        | 3 +++
 io_uring/splice.h    | 3 +++
 io_uring/sqpoll.h    | 3 +++
 io_uring/statx.h     | 3 +++
 io_uring/sync.h      | 3 +++
 io_uring/tctx.h      | 3 +++
 io_uring/timeout.h   | 3 +++
 io_uring/truncate.h  | 3 +++
 io_uring/uring_cmd.h | 3 +++
 io_uring/waitid.h    | 3 +++
 io_uring/xattr.h     | 3 +++
 21 files changed, 64 insertions(+), 3 deletions(-)

diff --git a/io_uring/advise.h b/io_uring/advise.h
index 5ece2a045185..d6ba942751da 100644
--- a/io_uring/advise.h
+++ b/io_uring/advise.h
@@ -1,7 +1,10 @@
 // SPDX-License-Identifier: GPL-2.0
+#ifndef IOU_ADVISE_H
+#define IOU_ADVISE_H
 
 int io_madvise_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
 int io_madvise(struct io_kiocb *req, unsigned int issue_flags);
 
 int io_fadvise_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
 int io_fadvise(struct io_kiocb *req, unsigned int issue_flags);
+#endif
diff --git a/io_uring/epoll.h b/io_uring/epoll.h
index 4111997c360b..b74ea0edb975 100644
--- a/io_uring/epoll.h
+++ b/io_uring/epoll.h
@@ -1,4 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
+#ifndef IOU_EPOLL_H
+#define IOU_EPOLL_H
 
 #if defined(CONFIG_EPOLL)
 int io_epoll_ctl_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
@@ -6,3 +8,4 @@ int io_epoll_ctl(struct io_kiocb *req, unsigned int issue_flags);
 int io_epoll_wait_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
 int io_epoll_wait(struct io_kiocb *req, unsigned int issue_flags);
 #endif
+#endif
diff --git a/io_uring/eventfd.h b/io_uring/eventfd.h
index e2f1985c2cf9..200ea096786d 100644
--- a/io_uring/eventfd.h
+++ b/io_uring/eventfd.h
@@ -1,3 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
+#ifndef IOU_EVENT_FD_H
+#define IOU_EVENT_FD_H
 
 struct io_ring_ctx;
 int io_eventfd_register(struct io_ring_ctx *ctx, void __user *arg,
@@ -5,3 +8,4 @@ int io_eventfd_register(struct io_ring_ctx *ctx, void __user *arg,
 int io_eventfd_unregister(struct io_ring_ctx *ctx);
 
 void io_eventfd_signal(struct io_ring_ctx *ctx, bool cqe_event);
+#endif
diff --git a/io_uring/fdinfo.h b/io_uring/fdinfo.h
index 6fde48c450e3..56772731e7a1 100644
--- a/io_uring/fdinfo.h
+++ b/io_uring/fdinfo.h
@@ -1,3 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
+#ifndef IOU_FD_INFO_H
+#define IOU_FD_INFO_H
 
 void io_uring_show_fdinfo(struct seq_file *m, struct file *f);
+#endif
diff --git a/io_uring/fs.h b/io_uring/fs.h
index 0bb5efe3d6bb..b84fb1730b84 100644
--- a/io_uring/fs.h
+++ b/io_uring/fs.h
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
-
+#ifndef IOU_FS_H
+#define IOU_FS_H
 int io_renameat_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
 int io_renameat(struct io_kiocb *req, unsigned int issue_flags);
 void io_renameat_cleanup(struct io_kiocb *req);
@@ -18,3 +19,4 @@ int io_symlinkat(struct io_kiocb *req, unsigned int issue_flags);
 int io_linkat_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
 int io_linkat(struct io_kiocb *req, unsigned int issue_flags);
 void io_link_cleanup(struct io_kiocb *req);
+#endif
diff --git a/io_uring/futex.h b/io_uring/futex.h
index d789fcf715e3..abdc621690a1 100644
--- a/io_uring/futex.h
+++ b/io_uring/futex.h
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
-
+#ifndef IOU_FUTEX_H
+#define IOU_FUTEX_H
 #include "cancel.h"
 
 int io_futex_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
@@ -35,3 +36,4 @@ static inline void io_futex_cache_free(struct io_ring_ctx *ctx)
 {
 }
 #endif
+#endif
diff --git a/io_uring/msg_ring.h b/io_uring/msg_ring.h
index 32236d2fb778..e1c648652c30 100644
--- a/io_uring/msg_ring.h
+++ b/io_uring/msg_ring.h
@@ -1,6 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0
-
+#ifndef IOU_MSG_RING_H
+#define IOU_MSG_RING_H
 int io_uring_sync_msg_ring(struct io_uring_sqe *sqe);
 int io_msg_ring_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
 int io_msg_ring(struct io_kiocb *req, unsigned int issue_flags);
 void io_msg_ring_cleanup(struct io_kiocb *req);
+#endif
diff --git a/io_uring/net.h b/io_uring/net.h
index 43e5ce5416b7..3d8084d7b7e2 100644
--- a/io_uring/net.h
+++ b/io_uring/net.h
@@ -1,4 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
+#ifndef IOU_NET_H
+#define IOU_NET_H
 
 #include <linux/net.h>
 #include <linux/uio.h>
@@ -65,3 +67,4 @@ static inline void io_netmsg_cache_free(const void *entry)
 {
 }
 #endif
+#endif
diff --git a/io_uring/nop.h b/io_uring/nop.h
index 97f1535c9dec..23c715d9761c 100644
--- a/io_uring/nop.h
+++ b/io_uring/nop.h
@@ -1,4 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
+#ifndef IOU_NOP_H
+#define IOU_NOP_H
 
 int io_nop_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
 int io_nop(struct io_kiocb *req, unsigned int issue_flags);
+#endif
diff --git a/io_uring/openclose.h b/io_uring/openclose.h
index 4ca2a9935abc..1460650c1353 100644
--- a/io_uring/openclose.h
+++ b/io_uring/openclose.h
@@ -1,4 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
+#ifndef IOU_OPEN_CLOSE_H
+#define IOU_OPEN_CLOSE_H
 
 int __io_close_fixed(struct io_ring_ctx *ctx, unsigned int issue_flags,
 		     unsigned int offset);
@@ -18,3 +20,4 @@ int io_pipe(struct io_kiocb *req, unsigned int issue_flags);
 
 int io_install_fixed_fd_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
 int io_install_fixed_fd(struct io_kiocb *req, unsigned int issue_flags);
+#endif
diff --git a/io_uring/rw.h b/io_uring/rw.h
index 129a53fe5482..ce77feadd953 100644
--- a/io_uring/rw.h
+++ b/io_uring/rw.h
@@ -1,4 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
+#ifndef IOU_RW_H
+#define IOU_RW_H
 
 #include <linux/io_uring_types.h>
 #include <linux/pagemap.h>
@@ -50,3 +52,4 @@ void io_req_rw_complete(struct io_kiocb *req, io_tw_token_t tw);
 int io_read_mshot_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
 int io_read_mshot(struct io_kiocb *req, unsigned int issue_flags);
 void io_rw_cache_free(const void *entry);
+#endif
diff --git a/io_uring/splice.h b/io_uring/splice.h
index b9b2848327fb..0cf2d0e5ac3e 100644
--- a/io_uring/splice.h
+++ b/io_uring/splice.h
@@ -1,4 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
+#ifndef IOU_SPLICE_H
+#define IOU_SPLICE_H
 
 int io_tee_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
 int io_tee(struct io_kiocb *req, unsigned int issue_flags);
@@ -6,3 +8,4 @@ int io_tee(struct io_kiocb *req, unsigned int issue_flags);
 void io_splice_cleanup(struct io_kiocb *req);
 int io_splice_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
 int io_splice(struct io_kiocb *req, unsigned int issue_flags);
+#endif
diff --git a/io_uring/sqpoll.h b/io_uring/sqpoll.h
index b83dcdec9765..563e2c9bfac8 100644
--- a/io_uring/sqpoll.h
+++ b/io_uring/sqpoll.h
@@ -1,4 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
+#ifndef IOU_SQ_POLL_H
+#define IOU_SQ_POLL_H
 
 struct io_sq_data {
 	refcount_t		refs;
@@ -35,3 +37,4 @@ static inline struct task_struct *sqpoll_task_locked(struct io_sq_data *sqd)
 	return rcu_dereference_protected(sqd->thread,
 					 lockdep_is_held(&sqd->lock));
 }
+#endif
diff --git a/io_uring/statx.h b/io_uring/statx.h
index 9a17f4d45a7d..ea9122e6b1c6 100644
--- a/io_uring/statx.h
+++ b/io_uring/statx.h
@@ -1,5 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0
+#ifndef IOU_STATX_H
+#define IOU_STATX_H
 
 int io_statx_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
 int io_statx(struct io_kiocb *req, unsigned int issue_flags);
 void io_statx_cleanup(struct io_kiocb *req);
+#endif
diff --git a/io_uring/sync.h b/io_uring/sync.h
index e873c888da79..0efc35b34cf7 100644
--- a/io_uring/sync.h
+++ b/io_uring/sync.h
@@ -1,4 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
+#ifndef IOU_SYNC_H
+#define IOU_SYNC_H
 
 int io_sfr_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
 int io_sync_file_range(struct io_kiocb *req, unsigned int issue_flags);
@@ -8,3 +10,4 @@ int io_fsync(struct io_kiocb *req, unsigned int issue_flags);
 
 int io_fallocate(struct io_kiocb *req, unsigned int issue_flags);
 int io_fallocate_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
+#endif
diff --git a/io_uring/tctx.h b/io_uring/tctx.h
index 608e96de70a2..80894af31b94 100644
--- a/io_uring/tctx.h
+++ b/io_uring/tctx.h
@@ -1,4 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
+#ifndef IOU_TC_TX_H
+#define IOU_TC_TX_H
 
 struct io_tctx_node {
 	struct list_head	ctx_node;
@@ -31,3 +33,4 @@ static inline int io_uring_add_tctx_node(struct io_ring_ctx *ctx)
 
 	return __io_uring_add_tctx_node_from_submit(ctx);
 }
+#endif
diff --git a/io_uring/timeout.h b/io_uring/timeout.h
index 2b7c9ad72992..f766f95f8815 100644
--- a/io_uring/timeout.h
+++ b/io_uring/timeout.h
@@ -1,4 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
+#ifndef IOU_TIMEOUT_H
+#define IOU_TIMEOUT_H
 
 struct io_timeout_data {
 	struct io_kiocb			*req;
@@ -21,3 +23,4 @@ int io_link_timeout_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
 int io_timeout(struct io_kiocb *req, unsigned int issue_flags);
 int io_timeout_remove_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
 int io_timeout_remove(struct io_kiocb *req, unsigned int issue_flags);
+#endif
diff --git a/io_uring/truncate.h b/io_uring/truncate.h
index ec088293a478..87b7d0602c60 100644
--- a/io_uring/truncate.h
+++ b/io_uring/truncate.h
@@ -1,4 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
+#ifndef IOU_TRUNCATE_H
+#define IOU_TRUNCATE_H
 
 int io_ftruncate_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
 int io_ftruncate(struct io_kiocb *req, unsigned int issue_flags);
+#endif
diff --git a/io_uring/uring_cmd.h b/io_uring/uring_cmd.h
index a6dad47afc6b..4bfe4fc59244 100644
--- a/io_uring/uring_cmd.h
+++ b/io_uring/uring_cmd.h
@@ -1,4 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
+#ifndef IOU_URING_CMD_H
+#define IOU_URING_CMD_H
 
 #include <linux/io_uring/cmd.h>
 #include <linux/io_uring_types.h>
@@ -18,3 +20,4 @@ bool io_uring_try_cancel_uring_cmd(struct io_ring_ctx *ctx,
 				   struct io_uring_task *tctx, bool cancel_all);
 
 void io_cmd_cache_free(const void *entry);
+#endif
diff --git a/io_uring/waitid.h b/io_uring/waitid.h
index d5544aaf302a..dad2ecc4e629 100644
--- a/io_uring/waitid.h
+++ b/io_uring/waitid.h
@@ -1,4 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
+#ifndef IOU_WAIT_ID_H
+#define IOU_WAIT_ID_H
 
 #include "../kernel/exit.h"
 
@@ -13,3 +15,4 @@ int io_waitid_cancel(struct io_ring_ctx *ctx, struct io_cancel_data *cd,
 		     unsigned int issue_flags);
 bool io_waitid_remove_all(struct io_ring_ctx *ctx, struct io_uring_task *tctx,
 			  bool cancel_all);
+#endif
diff --git a/io_uring/xattr.h b/io_uring/xattr.h
index 9b459d2ae90c..a7abee1454cb 100644
--- a/io_uring/xattr.h
+++ b/io_uring/xattr.h
@@ -1,4 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
+#ifndef IOU_XATTR_H
+#define IOU_XATTR_H
 
 void io_xattr_cleanup(struct io_kiocb *req);
 
@@ -13,3 +15,4 @@ int io_fgetxattr(struct io_kiocb *req, unsigned int issue_flags);
 
 int io_getxattr_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
 int io_getxattr(struct io_kiocb *req, unsigned int issue_flags);
+#endif
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] io_uring: add header include guards to all header files
  2025-06-17 18:50 [PATCH] io_uring: add header include guards to all header files Vishwanath Seshagiri
@ 2025-06-17 19:16 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2025-06-17 19:16 UTC (permalink / raw)
  To: Vishwanath Seshagiri; +Cc: io-uring, Vishwanath Seshagiri

On 6/17/25 12:50 PM, Vishwanath Seshagiri wrote:
> From: Vishwanath Seshagiri <vishs@fb.com>
> 
> Add missing header include guards to all *.h files in the io_uring/
> directory to prevent multiple inclusion issues. This follows the
> established pattern used in io_uring/zcrx.h and other kernel headers.
> 
> The guards use the format IOU_<NAME>_H to maintain consistency with
> the io_uring subsystem naming conventions.

It's quite on purpose they don't have guards - because they don't need
them. These headers are included by only C files, the ones that need a
guard would have them (eg ones potentially included in nested headers).

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-06-17 19:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-17 18:50 [PATCH] io_uring: add header include guards to all header files Vishwanath Seshagiri
2025-06-17 19:16 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox