PatchworkOS  19e446b
A non-POSIX operating system.
Loading...
Searching...
No Matches
irp.h File Reference
#include <kernel/fs/path.h>
#include <kernel/mem/mdl.h>
#include <kernel/mem/pool.h>
#include <kernel/sync/lock.h>
#include <kernel/utils/ref.h>
#include <assert.h>
#include <stdatomic.h>
#include <stddef.h>
#include <stdlib.h>
#include <sys/fs.h>
#include <sys/ioring.h>
#include <sys/list.h>
#include <sys/math.h>
#include <time.h>
Include dependency graph for irp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  irp_frame_t
 IRP stack frame structure. More...
 
struct  irp_pool_t
 
struct  irp_vtable_t
 IRP vtable structure. More...
 

Macros

#define IRP_CANCELLED   ((irp_cancel_t)1)
 Sentinel value indicating that the IRP has been cancelled.
 
#define IRP_MJ_READ   0
 
#define IRP_MJ_WRITE   1
 
#define IRP_MJ_POLL   2
 
#define IRP_MJ_MAX   3
 
#define IRP_MN_NORMAL   0
 
#define IRP_ARGS_MAX   4
 The maximum number of 64-bit arguments in an irp_frame_t.
 
#define IRP_FRAME_MAX   5
 The maximum number of frames in a IRP stack.
 

Typedefs

typedef struct file file_t
 
typedef struct process process_t
 
typedef struct vnode vnode_t
 
typedef struct irp irp_t
 
typedef void(* irp_complete_t) (irp_t *irp, void *ctx)
 IRP complete callback type.
 
typedef uint64_t(* irp_cancel_t) (irp_t *irp)
 IRP cancellation callback type.
 
typedef uint16_t irp_major_t
 
typedef uint16_t irp_minor_t
 
typedef void(* irp_func_t) (irp_t *irp)
 IRP function type.
 

Functions

struct ALIGNED (64) irp
 
irp_pool_tirp_pool_new (size_t size, process_t *process, void *ctx)
 Allocate a new IRP pool.
 
void irp_pool_free (irp_pool_t *pool)
 Free a IRP pool.
 
void irp_timeout_add (irp_t *irp, clock_t timeout)
 Add an IRP to a per-CPU timeout queue.
 
void irp_timeout_remove (irp_t *irp)
 Remove an IRP from its per-CPU timeout queue.
 
void irp_timeouts_check (void)
 Check and handle expired IRP timeouts on the current CPU.
 
irp_tirp_new (irp_pool_t *pool)
 Allocate a new IRP from a pool.
 
mdl_tirp_get_mdl (irp_t *irp, const void *addr, size_t size)
 Retrieve a memory descriptor list and associate it with an IRP.
 
static irp_pool_tirp_get_pool (irp_t *irp)
 Retrieve the IRP pool that an IRP was allocated from.
 
static void * irp_get_ctx (irp_t *irp)
 Retrieve the context of the IRP pool that an IRP was allocated from.
 
static process_tirp_get_process (irp_t *irp)
 Retrieve the process that owns an IRP.
 
static irp_tirp_chain_next (irp_t *irp)
 Retrieve the next IRP in a chain and advance the chain.
 
uint64_t irp_cancel (irp_t *irp)
 Attempt to cancel an IRP.
 
static irp_cancel_t irp_set_cancel (irp_t *irp, irp_cancel_t cancel)
 Set the cancellation callback for an IRP.
 
static irp_frame_tirp_current (irp_t *irp)
 Retrieve the current frame in the IRP stack.
 
static irp_frame_tirp_next (irp_t *irp)
 Retrieve the next frame in the IRP stack.
 
static void irp_copy_to_next (irp_t *irp)
 Copy the current frame in the IRP stack to the next.
 
static void irp_skip (irp_t *irp)
 Skip the current stack frame, meaning the next call will run in the same stack frame.
 
void irp_call (irp_t *irp, vnode_t *vnode)
 Send an IRP to a specified vnode.
 
void irp_call_direct (irp_t *irp, irp_func_t func)
 Send an IRP to a specified function directly.
 
void irp_complete (irp_t *irp)
 Complete the current frame in the IRP stack.
 
static void irp_set_complete (irp_t *irp, irp_complete_t complete, void *ctx)
 Set the completion callback and context for the next frame in the IRP stack.
 
static void irp_error (irp_t *irp, uint8_t err)
 Helper to set an error code and complete the IRP.
 
static void irp_prepare_generic (irp_t *irp, irp_major_t major, uint64_t arg0, uint64_t arg1, uint64_t arg2, uint64_t arg3)
 Prepares the next IRP stack frame for a generic operation.
 
static void irp_prepare_read (irp_t *irp, mdl_t *buffer, void *data, uint64_t off, uint32_t len, mode_t mode)
 Prepares the next IRP stack frame for a read operation.
 
static void irp_prepare_write (irp_t *irp, mdl_t *buffer, void *data, uint64_t off, uint32_t len, mode_t mode)
 Prepares the next IRP stack frame for a write operation.
 

Typedef Documentation

◆ file_t

typedef struct file file_t

Definition at line 19 of file irp.h.

◆ process_t

typedef struct process process_t

Definition at line 20 of file irp.h.

◆ vnode_t

typedef struct vnode vnode_t

Definition at line 21 of file irp.h.