Hi there, I've just started looking at the user-mode backend and, it
turned out, the headers do not quite work in the C++ mode. The issue is
minor - an explicit conversion is needed when returning a uint32 as
tcmu_opcode enum.
I've attached a patch. Could someone have a look please?
Thanks,
Oleg.
diff --git a/include/uapi/linux/target_core_user.h b/include/uapi/linux/target_core_user.h
index 95c6521..a0ec6b2 100644
--- a/include/uapi/linux/target_core_user.h
+++ b/include/uapi/linux/target_core_user.h
@@ -55,7 +55,11 @@ struct tcmu_mailbox {
} __packed;
-enum tcmu_opcode {
+enum tcmu_opcode
+#if defined(__cplusplus)
+ : __u32
+#endif
+{
TCMU_OP_PAD = 0,
TCMU_OP_CMD,
};
@@ -76,7 +80,12 @@ struct tcmu_cmd_entry_hdr {
static inline enum tcmu_opcode tcmu_hdr_get_op(__u32 len_op)
{
- return len_op & TCMU_OP_MASK;
+ __u32 rv = len_op & TCMU_OP_MASK;
+#if defined(__cplusplus)
+ return tcmu_opcode(rv);
+#else
+ return rv;
+#endif
}
static inline void tcmu_hdr_set_op(__u32 *len_op, enum tcmu_opcode op)