cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

io_uring.h (2048B)


      1/* SPDX-License-Identifier: GPL-2.0-or-later */
      2#ifndef _LINUX_IO_URING_H
      3#define _LINUX_IO_URING_H
      4
      5#include <linux/sched.h>
      6#include <linux/xarray.h>
      7
      8enum io_uring_cmd_flags {
      9	IO_URING_F_COMPLETE_DEFER	= 1,
     10	IO_URING_F_UNLOCKED		= 2,
     11	/* int's last bit, sign checks are usually faster than a bit test */
     12	IO_URING_F_NONBLOCK		= INT_MIN,
     13
     14	/* ctx state flags, for URING_CMD */
     15	IO_URING_F_SQE128		= 4,
     16	IO_URING_F_CQE32		= 8,
     17	IO_URING_F_IOPOLL		= 16,
     18};
     19
     20struct io_uring_cmd {
     21	struct file	*file;
     22	const void	*cmd;
     23	/* callback to defer completions to task context */
     24	void (*task_work_cb)(struct io_uring_cmd *cmd);
     25	u32		cmd_op;
     26	u32		pad;
     27	u8		pdu[32]; /* available inline for free use */
     28};
     29
     30#if defined(CONFIG_IO_URING)
     31void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_t ret, ssize_t res2);
     32void io_uring_cmd_complete_in_task(struct io_uring_cmd *ioucmd,
     33			void (*task_work_cb)(struct io_uring_cmd *));
     34struct sock *io_uring_get_socket(struct file *file);
     35void __io_uring_cancel(bool cancel_all);
     36void __io_uring_free(struct task_struct *tsk);
     37void io_uring_unreg_ringfd(void);
     38const char *io_uring_get_opcode(u8 opcode);
     39
     40static inline void io_uring_files_cancel(void)
     41{
     42	if (current->io_uring) {
     43		io_uring_unreg_ringfd();
     44		__io_uring_cancel(false);
     45	}
     46}
     47static inline void io_uring_task_cancel(void)
     48{
     49	if (current->io_uring)
     50		__io_uring_cancel(true);
     51}
     52static inline void io_uring_free(struct task_struct *tsk)
     53{
     54	if (tsk->io_uring)
     55		__io_uring_free(tsk);
     56}
     57#else
     58static inline void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_t ret,
     59		ssize_t ret2)
     60{
     61}
     62static inline void io_uring_cmd_complete_in_task(struct io_uring_cmd *ioucmd,
     63			void (*task_work_cb)(struct io_uring_cmd *))
     64{
     65}
     66static inline struct sock *io_uring_get_socket(struct file *file)
     67{
     68	return NULL;
     69}
     70static inline void io_uring_task_cancel(void)
     71{
     72}
     73static inline void io_uring_files_cancel(void)
     74{
     75}
     76static inline void io_uring_free(struct task_struct *tsk)
     77{
     78}
     79static inline const char *io_uring_get_opcode(u8 opcode)
     80{
     81	return "";
     82}
     83#endif
     84
     85#endif