127#define IRP_CANCELLED ((irp_cancel_t)1)
131#define IRP_MJ_WRITE 1
136#define IRP_MN_NORMAL 0
138#define IRP_ARGS_MAX 4
144typedef struct irp_frame
173static_assert(
sizeof(
irp_frame_t) == 64,
"irp_frame_t is not 64 bytes");
175#define IRP_FRAME_MAX 5
209static_assert(
sizeof(
irp_t) == 512,
"irp_t is not 512 bytes");
233typedef struct irp_vtable
346 irp->next =
next->next;
388 return &irp->stack[irp->frame];
403 return &irp->stack[irp->frame - 1];
487 next->complete = complete;
520 next->args[0] = arg0;
521 next->args[1] = arg1;
522 next->args[2] = arg2;
523 next->args[3] = arg3;
544 next->read.off = off;
545 next->read.len = len;
546 next->read.mode = mode;
567 next->write.off = off;
568 next->write.len = len;
569 next->write.mode = mode;
#define assert(expression)
EFI_PHYSICAL_ADDRESS buffer
uint16_t cpu_id_t
Type used to identify a CPU.
mode_t
Path flags and permissions.
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.
void irp_timeouts_check(void)
Check and handle expired IRP timeouts on the current CPU.
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_get_ctx(irp_t *irp)
Retrieve the context of the IRP pool that an IRP was allocated from.
#define IRP_CANCELLED
Sentinel value indicating that the IRP has been cancelled.
void irp_complete(irp_t *irp)
Complete the current frame in the IRP stack.
irp_t * irp_new(irp_pool_t *pool)
Allocate a new IRP from a pool.
static irp_frame_t * irp_current(irp_t *irp)
Retrieve the current frame in the IRP stack.
static irp_frame_t * irp_next(irp_t *irp)
Retrieve the next frame in the IRP stack.
uint64_t(* irp_cancel_t)(irp_t *irp)
IRP cancellation callback type.
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.
#define IRP_FRAME_MAX
The maximum number of frames in a IRP stack.
irp_pool_t * irp_pool_new(size_t size, process_t *process, void *ctx)
Allocate a new IRP pool.
void irp_call_direct(irp_t *irp, irp_func_t func)
Send an IRP to a specified function directly.
static irp_cancel_t irp_set_cancel(irp_t *irp, irp_cancel_t cancel)
Set the cancellation callback for an IRP.
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_pool_free(irp_pool_t *pool)
Free a IRP pool.
static irp_t * irp_chain_next(irp_t *irp)
Retrieve the next IRP in a chain and advance the chain.
static void irp_copy_to_next(irp_t *irp)
Copy the current frame in the IRP stack to the next.
#define IRP_ARGS_MAX
The maximum number of 64-bit arguments in an irp_frame_t.
static void irp_error(irp_t *irp, uint8_t err)
Helper to set an error code and complete the IRP.
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.
static process_t * irp_get_process(irp_t *irp)
Retrieve the process that owns an IRP.
void(* irp_complete_t)(irp_t *irp, void *ctx)
IRP complete callback type.
static irp_pool_t * irp_get_pool(irp_t *irp)
Retrieve the IRP pool that an IRP was allocated from.
void irp_call(irp_t *irp, vnode_t *vnode)
Send an IRP to a specified vnode.
void irp_timeout_remove(irp_t *irp)
Remove an IRP from its per-CPU timeout queue.
uint64_t irp_cancel(irp_t *irp)
Attempt to cancel an IRP.
void(* irp_func_t)(irp_t *irp)
IRP function type.
mdl_t * irp_get_mdl(irp_t *irp, const void *addr, size_t size)
Retrieve a memory descriptor list and associate it with an IRP.
void irp_timeout_add(irp_t *irp, clock_t timeout)
Add an IRP to a per-CPU timeout queue.
#define POOL_IDX_MAX
The maximum index value for pool.
uint16_t pool_idx_t
Pool index type.
#define UNREF(ptr)
Decrement reference count.
#define ALIGNED(alignment)
GCC aligned attribute.
size_t write(fd_t fd, const void *buffer, size_t count)
System call for writing to files.
size_t read(fd_t fd, void *buffer, size_t count)
System call for reading from files.
#define NULL
Pointer error value.
#define CONTAINER_OF(ptr, type, member)
Container of macro.
__UINT64_TYPE__ clock_t
A nanosecond time.
static page_stack_t * stack
#define atomic_compare_exchange_weak(object, expected, desired)
#define atomic_load(object)
IRP stack frame structure.
vnode_t * vnode
Vnode associated with the operation.
irp_complete_t complete
Completion callback.
irp_major_t major
Major function number.
irp_minor_t minor
Minor function number.
process_t * process
Will only hold a reference if there is at least one active IRP.
I/O Request Packet structure.
A entry in a doubly linked list.
Memory Descriptor List structure.
Asynchronous submission queue entry (SQE).