changeset 434: |
37e1822fa6c1 |
parent 433: |
9ae13b700195 |
child 435: |
849bbe48e32d |
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Sun, 09 Jun 2024 22:09:18 -0400 |
files: |
lisp/ffi/ublk/constants.lisp lisp/ffi/ublk/pkg.lisp |
description: |
ublk constants and structs |
1.1--- a/lisp/ffi/ublk/constants.lisp Sun Jun 09 16:55:08 2024 -0400
1.2+++ b/lisp/ffi/ublk/constants.lisp Sun Jun 09 22:09:18 2024 -0400
1.3@@ -1,6 +1,5 @@
1.4 ("linux/types.h" "stdio.h" "stdarg.h" "stdlib.h" "stdbool.h" "assert.h" "sys/types.h" "sys/syscall.h" "liburing.h"
1.5 "ublk_cmd.h" "ublksrv.h")
1.6-
1.7 ((:integer +max-nr-hw-queues+ "MAX_NR_HW_QUEUES" nil t)
1.8 (:integer +max-qd+ "MAX_QD" nil t)
1.9 (:integer +max-buf-size+ "MAX_BUF_SIZE" nil t)
2.1--- a/lisp/ffi/ublk/pkg.lisp Sun Jun 09 16:55:08 2024 -0400
2.2+++ b/lisp/ffi/ublk/pkg.lisp Sun Jun 09 22:09:18 2024 -0400
2.3@@ -10,3 +10,75 @@
2.4 (in-package :ublk)
2.5
2.6 (define-alien-loader "ublksrv" t)
2.7+
2.8+(define-alien-type ublksrv-ctrl-cmd
2.9+ (struct ublksrv-ctrl-cmd
2.10+ (dev-id (unsigned 32))
2.11+ (queue-id (unsigned 16))
2.12+ (len (unsigned 16))
2.13+ (addr (unsigned 64))
2.14+ (data (array (unsigned 64) 1))
2.15+ (dev-path-len (unsigned 16))
2.16+ (pad (unsigned 16))
2.17+ (reserved (unsigned 32))))
2.18+
2.19+(define-alien-type ublksrv-ctrl-dev-info
2.20+ (struct ublksrv-ctrl-dev-info
2.21+ (nr-hw-queues (unsigned 16))
2.22+ (queue-depth (unsigned 16))
2.23+ (state (unsigned 16))
2.24+ (pad0 (unsigned 16))
2.25+ (max-io-buf-bytes (unsigned 32))
2.26+ (dev-id (unsigned 32))
2.27+ (ublksrv-pid (signed 32))
2.28+ (pad1 (unsigned 32))
2.29+ (flags (unsigned 64))
2.30+ (ublksrv-flags (unsigned 64))
2.31+ (owner-uid (unsigned 32))
2.32+ (owner-gid (unsigned 32))
2.33+ (reserved1 (unsigned 64))
2.34+ (reserved2 (unsigned 64))))
2.35+
2.36+(define-alien-type ublksrv-io-cmd
2.37+ (struct ublksrv-io-cmd
2.38+ (q-id (unsigned 16))
2.39+ (tag (unsigned 16))
2.40+ (result (signed 32))
2.41+ (addr (unsigned 64))))
2.42+
2.43+(define-alien-type ublk-param-basic
2.44+ (struct ublk-param-basic
2.45+ (attrs (unsigned 32))
2.46+ (logical-bs-shift (unsigned 8))
2.47+ (physical-bs-shift (unsigned 8))
2.48+ (io-opt-shift (unsigned 8))
2.49+ (io-min-shift (unsigned 8))
2.50+ (max-sectors (unsigned 32))
2.51+ (chunk-sectors (unsigned 32))
2.52+ (dev-sectors (unsigned 64))
2.53+ (virt-boundary-mask (unsigned 64))))
2.54+
2.55+(define-alien-type ublk-param-discard
2.56+ (struct ublk-param-discard
2.57+ (discard-alignment (unsigned 32))
2.58+ (discard-granularity (unsigned 32))
2.59+ (max-discard-sectors (unsigned 32))
2.60+ (max-write-zeroes-sectors (unsigned 32))
2.61+ (reserved0 (unsigned 16))))
2.62+
2.63+(define-alien-type ublk-param-devt
2.64+ (struct ublk-param-devt
2.65+ (char-major (unsigned 32))
2.66+ (char-minor (unsigned 32))
2.67+ (disk-major (unsigned 32))
2.68+ (disk-minor (unsigned 32))))
2.69+
2.70+(define-alien-type ublk-params
2.71+ (struct ublk-params
2.72+ (len (unsigned 32))
2.73+ (types (unsigned 32))
2.74+ (basic (struct ublk-param-basic))
2.75+ (discard (struct ublk-param-discard))
2.76+ (devt (struct ublk-param-devt))))
2.77+
2.78+;; (define-alien-type ublksrv-dev-data)