Coverage report: /home/ellis/comp/core/ffi/uring/macs.lisp
Kind | Covered | All | % |
expression | 7 | 35 | 20.0 |
branch | 0 | 0 | nil |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
1
;;; uring/macs.lisp --- Macros
8
(defmacro defalien-int (name &body args)
10
(defar ,name int ,@args)
11
(export '(,name) :uring)))
13
(defmacro def-with-ring (name &body args)
14
`(defalien-int ,name (ring (* io-uring)) ,@args))
16
(defvar *io-opcodes* nil)
18
(defmacro with-io-sqe ((var val) &body body)
19
`(with-alien ((,var io-uring-sqe ,val))
22
(defmacro with-new-io-sqe (var &body body)
23
`(with-alien ((,var io-uring-sqe))
26
(defmacro with-io-sqe-op ((var op val) &body body)
27
`(with-io-sqe (,var ,val)
28
(setf (slot ,var 'opcode) ,op)
32
(defmacro with-new-io-sqe-op ((var op) &body body)
33
`(with-new-io-sqe ,var
34
(setf (slot ,var 'opcode) ,op)
38
(defmacro with-io-cqe (var &body body)
39
`(with-alien ((,var io-uring-cqe))
42
(defmacro with-io-uring ((var &optional val) &body body)
43
`(let ((,var ,(or val (make-alien io-uring))))
46
(defmacro with-new-io-uring (var &body body)
47
`(with-alien ((,var io-uring))
51
(defmacro def-io-op (val name slots &body builder)
52
"Define a wrapper for an io-uring opcode. This macro will create a
53
structure class with NAME and SLOTS. BUILDER is the body of the BUILD
54
method for this struct, with CONST bound to VAR."
55
(let ((struct-name (symbolicate "IO-OP-" name))
56
(const-name (symbolicate "+IO-" name "+"))
57
(alien-name (symbolicate "IORING-OP-" name)))
59
(defconstant ,const-name ,val)
60
(defstruct ,struct-name ,@slots)
61
(defmethod build-from ((self ,struct-name) (from system-area-pointer) &key &allow-other-keys)
62
(with-io-sqe-op (sqe ,const-name (sap-alien from (struct io-uring-sqe)))
64
(pushnew ',alien-name *io-opcodes*)
65
(export '(,struct-name ,(symbolicate "MAKE-" struct-name) ,const-name ,alien-name)))))