ublksrv_tgt: add ublksrv_tgt_set_io_data_size() for setting target io data size
The only place for target code to modify 'struct ublksrv_dev & struct ublksrv_tgt_info'
is ->init_tgt() and ->recovery_tgt() callbacks.
So add one helper for target code to set io data size, and we will not
be allowed to touch device/tgt in ublksrv_io_handler().
Signed-off-by: Ming Lei <[email protected]>
diff --git a/include/ublksrv_tgt.h b/include/ublksrv_tgt.h
index 395f95d..3ef0259 100644
--- a/include/ublksrv_tgt.h
+++ b/include/ublksrv_tgt.h
@@ -139,6 +139,11 @@
return (struct ublk_io_tgt *)ublksrv_io_private_data(q, tag);
}
+static inline void ublksrv_tgt_set_io_data_size(struct ublksrv_tgt_info *tgt)
+{
+ tgt->io_data_size = sizeof(struct ublk_io_tgt);
+}
+
//static_assert(sizeof(struct ublk_io_tgt) == sizeof(struct ublk_io), "ublk_io is defined as wrong");
enum {