Mercurial > core / lisp/ffi/ublk/srv.lisp
changeset 686: |
8e16efedfd76 |
child: |
c2f4e7ee921b |
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Sun, 29 Sep 2024 23:43:03 -0400 |
permissions: |
-rw-r--r-- |
description: |
prim work on ffi/ublk |
1 ;;; ublk/srv.lisp --- ublksrv API 8 (define-alien-type ublksrv-ctrl-dev (struct ublksrv-ctrl-dev)) 10 (define-alien-type ublksrv-queue 14 (ring-ptr (* io-uring)) 16 (private-data (* t)))) 18 (define-alien-type ublk-io-data 22 (iod (* ublksrv-io-desc)) 23 (private-data (* t)))) 25 ;; TODO 2024-09-29: add all of these as callbacks :C 26 ;; (define-alien-type ublksrv-tgt-type 27 ;; (struct ublksrv-tgt-type 28 ;; (handle-io-async (function int (* ublksrv-queue) (* ublk-io-data))) 29 ;; (tgt-io-done (function void (* ublksrv-queue) (* ublk-io-data) (* io-uring-cqe))) 30 ;; (handle-event (function void (* ublksrv-queue))) 31 ;; (handle-io-background (function void (* ublksrv-queue) int)) 32 ;; (usage-for-add (function void)) 33 ;; (init-tgt (function int (* ublksrv-dev) int int (array c-string))) 34 ;; (deinit-tgt (function void (* ublksrv-dev))) 35 ;; (alloc-io-buf (function (* t) (* ublksrv-queue) (* t) int)) 36 ;; (idle-fn (function void (* ublksrv-queue) bool)) 38 ;; (ublk-flags unsigned) 39 ;; (ublksrv-flags unsigned) 42 ;; (recovery-tgt (function int (* ublksrv-dev) int)) 43 ;; (init-queue (function int (* ublksrv-queue) (* (* t)))) 44 ;; (deinit-queue (function void (* ublksrv-queue))) 45 ;; (reserved (array unsigned-long 5)))) 47 (define-alien-type ublksrv-dev-data 48 (struct ublksrv-dev-data 50 (max-io-buf-bytes unsigned) 51 (nr-hw-queues unsigned-short) 52 (queue-depth unsigned-short) 54 (tgt-ops (* ublksrv-tgt-type)) 56 (tgt-argv (* (c-string))) 59 (ublksrv-flags unsigned-long) 60 (reserved (array unsigned-long 7)))) 62 (define-alien-type ublksrv-tgt-info 63 (struct ublksrv-tgt-info 64 (dev-size unsigned-long-long) 65 (tgt-ring-depth unsigned-int) 67 (fds (array int #.+ublksrv-tgt-max-fds+)) 69 (extra-ios unsigned-int) 70 (io-data-size unsigned-int) 71 (ops (* ublksrv-tgt-type)) 72 (iowq-max-workers (array unsigned-int 2)) 73 (reserved (array unsigned-long 4)))) 75 (define-alien-type ublksrv-dev 77 (tgt ublksrv-tgt-info))) 79 (define-alien-routine build-user-data (unsigned 64) 83 (is-target-io unsigned)) 85 (define-alien-routine ublksrv-ctrl-deinit void 86 (dev (* ublksrv-ctrl-dev)))