Coverage report: /home/ellis/comp/core/ffi/uring/sq.lisp
Kind | Covered | All | % |
expression | 1 | 75 | 1.3 |
branch | 0 | 8 | 0.0 |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
1
;;; uring/sq.lisp --- Submission Queue
8
(defstruct submission-queue-offsets
11
(ring-mask 0 :type fixnum)
12
(ring-entries 0 :type fixnum)
13
(flags 0 :type fixnum)
14
(dropped 0 :type fixnum)
15
(array 0 :type fixnum)
17
(user-addr 0 :type fixnum))
19
(defmethod build ((self submission-queue-offsets) &key &allow-other-keys)
20
(with-slots (head tail ring-mask ring-entries flags dropped array user-addr) self
21
(with-io-sqring-offsets res
22
((head head) (tail tail) (ring-mask ring-mask) (ring-entries ring-entries) (flags flags)
23
(dropped dropped) (array array) (user-addr user-addr))
26
;; used to send IO requests to the kernel
27
(defstruct submission-queue
30
(queue (make-alien io-uring-sq) :type (alien io-uring-sq*))) ;; io-uring-sq*
33
(defstruct submission-queue-entry
34
(opcode 0 :type octet)
36
(ioprio 0 :type (unsigned-byte 16))
37
(fd 0 :type sb-posix:file-descriptor)
38
(off 0 :type (unsigned-byte 64))
41
(flags2 0 :type fixnum)
42
(user-data 0 :type fixnum)
43
(buf-index 0 :type fixnum)
44
(personality 0 :type fixnum)
45
(file-index 0 :type fixnum)
46
(addr2 0 :type (unsigned-byte 64))) ;; this is actually addr3. it's a u64 which is inside a struct, inside a union
48
(defun u64-bytes (int)
49
(make-array 8 :element-type 'octet
51
(loop for i from 0 below 8
52
collect (ldb (byte 8 (* i 8)) int))))
54
(defmethod build ((self submission-queue-entry) &key &allow-other-keys)
55
(with-slots (opcode flags ioprio fd off addr len flags2 user-data buf-index personality file-index addr2) self
56
(with-alien ((a (array unsigned-char 80)))
57
(clone-octets-to-alien (u64-bytes addr2) a)
59
;; (with-io-uring-sqe res
60
;; ((opcode opcode) (flags flags) (ioprio ioprio) (fd fd) (off off) (addr addr) (len len)
61
;; (flags2 flags2) (user-data user-data) (buf-index buf-index) (personality personality)
62
;; (file-index file-index)
68
(defstruct submission-queue-entry-128
69
(opcode 0 :type octet)
71
(ioprio 0 :type (unsigned-byte 16))
72
(fd 0 :type sb-posix:file-descriptor)
73
(off 0 :type (unsigned-byte 64))
76
(flags2 0 :type fixnum)
77
(user-data 0 :type fixnum)
78
(buf-index 0 :type fixnum)
79
(personality 0 :type fixnum)
80
(file-index 0 :type fixnum)
81
;; with sqe128, this field contains the last 72 bytes of the 80 byte
82
;; arbitrary command data field. The first 8 bytes live in the ADDR2
84
(cmd (make-array 80 :element-type 'octet) :type (octet-vector 80)))
86
(defmethod build ((self submission-queue-entry-128) &key &allow-other-keys)
87
(with-slots (opcode flags ioprio fd off addr len flags2 user-data buf-index personality file-index cmd) self
88
(with-alien ((a (array unsigned-char 80)))
89
(clone-octets-to-alien cmd a)
90
;; (with-io-uring-sqe res
91
;; ((opcode opcode) (flags flags) (ioprio ioprio) (fd fd) (off off) (addr addr) (len len)
92
;; (flags2 flags2) (user-data user-data) (buf-index buf-index) (personality personality)
93
;; (file-index file-index) (addr2 a))
98
;; sync, needs-wakeup-p, dropped, overflowp, taskrunp, push,
99
;; push-multiple, push* (unchecked), personality