libublksrv: pass "struct ublk_io_data *" to target callbacks
'struct ublk_io_data *' points to variable on stack, and target
can get everything they need for handling the IO, such as tag, iod,
cqe, ...
Signed-off-by: Ming Lei <[email protected]>
diff --git a/include/ublksrv_tgt.h b/include/ublksrv_tgt.h
index c8765d9..4252c1e 100644
--- a/include/ublksrv_tgt.h
+++ b/include/ublksrv_tgt.h
@@ -117,11 +117,17 @@
int queued_tgt_io; /* obsolete */
};
-static inline struct ublk_io_tgt *ublk_get_io_tgt_data(struct ublk_io *io)
+static inline struct ublk_io_tgt *__ublk_get_io_tgt_data(struct ublk_io_data *io)
{
return (struct ublk_io_tgt *)io->private_data;
}
+static inline struct ublk_io_tgt *ublk_get_io_tgt_data(
+ const struct ublksrv_queue *q, int tag)
+{
+ return (struct ublk_io_tgt *)ublksrv_io_private_data(q, tag);
+}
+
//static_assert(sizeof(struct ublk_io_tgt) == sizeof(struct ublk_io), "ublk_io is defined as wrong");
#endif