changelog shortlog graph tags branches changeset file revisions annotate raw help

Mercurial > core / lisp/ffi/ublk/srv.lisp

revision 698: 96958d3eb5b0
parent 696: 38e9c3be2392
     1.1--- a/lisp/ffi/ublk/srv.lisp	Fri Oct 04 21:45:59 2024 -0400
     1.2+++ b/lisp/ffi/ublk/srv.lisp	Fri Oct 04 22:04:59 2024 -0400
     1.3@@ -6,28 +6,6 @@
     1.4 (in-package :ublk)
     1.5 
     1.6 (define-alien-type ublksrv-ctrl-dev (struct ublksrv-ctrl-dev))
     1.7-(define-alien-type ublksrv-tgt-type (struct ublksrv-tgt-type))
     1.8-;; TODO 2024-09-29: add all of these as callbacks :C
     1.9-;; (define-alien-type ublksrv-tgt-type 
    1.10-;;   (struct ublksrv-tgt-type
    1.11-;;           (handle-io-async (function int (* ublksrv-queue) (* ublk-io-data)))
    1.12-;;           (tgt-io-done (function void (* ublksrv-queue) (* ublk-io-data) (* io-uring-cqe)))
    1.13-;;           (handle-event (function void (* ublksrv-queue)))
    1.14-;;           (handle-io-background (function void (* ublksrv-queue) int))
    1.15-;;           (usage-for-add (function void))
    1.16-;;           (init-tgt (function int (* ublksrv-dev) int int (array c-string)))
    1.17-;;           (deinit-tgt (function void (* ublksrv-dev)))
    1.18-;;           (alloc-io-buf (function (* t) (* ublksrv-queue) (* t) int))
    1.19-;;           (idle-fn (function void (* ublksrv-queue) bool))
    1.20-;;           (type int)
    1.21-;;           (ublk-flags unsigned)
    1.22-;;           (ublksrv-flags unsigned)
    1.23-;;           (pad unsigned)
    1.24-;;           (name c-string)
    1.25-;;           (recovery-tgt (function int (* ublksrv-dev) int))
    1.26-;;           (init-queue (function int (* ublksrv-queue) (* (* t))))
    1.27-;;           (deinit-queue (function void (* ublksrv-queue)))
    1.28-;;           (reserved (array unsigned-long 5))))
    1.29 
    1.30 (define-alien-type ublksrv-dev-data
    1.31   (struct ublksrv-dev-data
    1.32@@ -44,6 +22,7 @@
    1.33           (ublksrv-flags unsigned-long)
    1.34           (reserved (array unsigned-long 7))))
    1.35 
    1.36+;; early def
    1.37 (define-alien-type ublksrv-tgt-info
    1.38   (struct ublksrv-tgt-info
    1.39           (dev-size unsigned-long-long)
    1.40@@ -53,7 +32,7 @@
    1.41           (tgt-data (* t))
    1.42           (extra-ios unsigned-int)
    1.43           (io-data-size unsigned-int)
    1.44-          (ops (* ublksrv-tgt-type))
    1.45+          (ops (* (struct nil)))
    1.46           (iowq-max-workers (array unsigned-int 2))
    1.47           (reserved (array unsigned-long 4))))
    1.48 
    1.49@@ -69,6 +48,41 @@
    1.50             (dev (* ublksrv-dev))
    1.51             (private-data (* t))))
    1.52 
    1.53+(define-alien-type ublksrv-handle-io-async-function (function int (* ublksrv-queue) (* ublk-io-data)))
    1.54+(define-alien-type ublksrv-tgt-io-done-function (function void (* ublksrv-queue) (* ublk-io-data) (* io-uring-cqe)))
    1.55+(define-alien-type ublksrv-handle-event-function (function void (* ublksrv-queue)))
    1.56+(define-alien-type ublksrv-handle-io-background-function (function void (* ublksrv-queue) int))
    1.57+(define-alien-type ublksrv-usage-for-add-function (function void))
    1.58+(define-alien-type ublksrv-init-tgt-function (function int (* ublksrv-dev) int int (array c-string)))
    1.59+(define-alien-type ublksrv-deinit-tgt-function (function void (* ublksrv-dev)))
    1.60+(define-alien-type ublksrv-alloc-io-buf-function (function (* t) (* ublksrv-queue) (* t) int))
    1.61+(define-alien-type ublksrv-idle-function (function void (* ublksrv-queue) boolean))
    1.62+(define-alien-type ublksrv-recovery-tgt-function (function int (* ublksrv-dev) int))
    1.63+(define-alien-type ublksrv-init-queue-function (function int (* ublksrv-dev) (* (* t))))
    1.64+(define-alien-type ublksrv-deinit-queue-function (function void (* ublksrv-queue)))
    1.65+
    1.66+;; TODO 2024-09-29: add all of these as callbacks :C
    1.67+(define-alien-type ublksrv-tgt-type 
    1.68+  (struct ublksrv-tgt-type
    1.69+          (handle-io-async (* ublksrv-handle-io-async-function))
    1.70+          (tgt-io-done (* ublksrv-tgt-io-done-function))
    1.71+          (handle-event (* ublksrv-handle-event-function))
    1.72+          (handle-io-background (* ublksrv-handle-io-background-function))
    1.73+          (usage-for-add (* ublksrv-usage-for-add-function))
    1.74+          (init-tgt (* ublksrv-init-tgt-function))
    1.75+          (deinit-tgt (* ublksrv-deinit-tgt-function))
    1.76+          (alloc-io-buf (* ublksrv-alloc-io-buf-function))
    1.77+          (idle-fn (* ublksrv-idle-function))
    1.78+          (type int)
    1.79+          (ublk-flags unsigned)
    1.80+          (ublksrv-flags unsigned)
    1.81+          (pad unsigned)
    1.82+          (name c-string)
    1.83+          (recovery-tgt (* ublksrv-recovery-tgt-function))
    1.84+          (init-queue (* ublksrv-init-queue-function))
    1.85+          (deinit-queue (* ublksrv-deinit-queue-function))
    1.86+          (reserved (array unsigned-long 5))))
    1.87+
    1.88 (define-alien-type ublk-io-data
    1.89   (struct ublk-io-data
    1.90           (tag int)