Mercurial > core / lisp/ffi/uring/sq.lisp
changeset 698: |
96958d3eb5b0 |
parent: |
cebda1469eb1
|
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Fri, 04 Oct 2024 22:04:59 -0400 |
permissions: |
-rw-r--r-- |
description: |
fixes |
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)) 27 ;; used to send IO requests to the kernel 28 (defstruct submission-queue 31 (queue (make-alien io-uring-sq) :type (alien io-uring-sq*))) ;; io-uring-sq* 34 (defstruct submission-queue-entry 35 (opcode 0 :type octet) 37 (ioprio 0 :type (unsigned-byte 16)) 38 (fd 0 :type sb-posix:file-descriptor) 39 (off 0 :type (unsigned-byte 64)) 42 (flags2 0 :type fixnum) 43 (user-data 0 :type fixnum) 44 (buf-index 0 :type fixnum) 45 (personality 0 :type fixnum) 46 (file-index 0 :type fixnum) 47 (addr2 0 :type (unsigned-byte 64))) ;; this is actually addr3. it's a u64 which is inside a struct, inside a union 49 (defun u64-bytes (int) 50 (make-array 8 :element-type 'octet 52 (loop for i from 0 below 8 53 collect (ldb (byte 8 (* i 8)) int)))) 55 ;; (defmethod build ((self submission-queue-entry) &key &allow-other-keys) 56 ;; (with-slots (opcode flags ioprio fd off addr len flags2 user-data buf-index personality file-index addr2) self 57 ;; (with-alien ((a (array unsigned-char 80))) 58 ;; (clone-octets-to-alien (u64-bytes addr2) a) 60 ;; ;; (with-io-uring-sqe res 61 ;; ;; ((opcode opcode) (flags flags) (ioprio ioprio) (fd fd) (off off) (addr addr) (len len) 62 ;; ;; (flags2 flags2) (user-data user-data) (buf-index buf-index) (personality personality) 63 ;; ;; (file-index file-index) 69 (defstruct submission-queue-entry-128 70 (opcode 0 :type octet) 72 (ioprio 0 :type (unsigned-byte 16)) 73 (fd 0 :type sb-posix:file-descriptor) 74 (off 0 :type (unsigned-byte 64)) 77 (flags2 0 :type fixnum) 78 (user-data 0 :type fixnum) 79 (buf-index 0 :type fixnum) 80 (personality 0 :type fixnum) 81 (file-index 0 :type fixnum) 82 ;; with sqe128, this field contains the last 72 bytes of the 80 byte 83 ;; arbitrary command data field. The first 8 bytes live in the ADDR2 85 (cmd (make-array 80 :element-type 'octet) :type (octet-vector 80))) 87 ;; (defmethod build ((self submission-queue-entry-128) &key &allow-other-keys) 88 ;; (with-slots (opcode flags ioprio fd off addr len flags2 user-data buf-index personality file-index cmd) self 89 ;; (with-alien ((a (array unsigned-char 80))) 90 ;; (clone-octets-to-alien cmd a) 91 ;; ;; (with-io-uring-sqe res 92 ;; ;; ((opcode opcode) (flags flags) (ioprio ioprio) (fd fd) (off off) (addr addr) (len len) 93 ;; ;; (flags2 flags2) (user-data user-data) (buf-index buf-index) (personality personality) 94 ;; ;; (file-index file-index) (addr2 a)) 99 ;; sync, needs-wakeup-p, dropped, overflowp, taskrunp, push, 100 ;; push-multiple, push* (unchecked), personality