On 6/20/19 8:03 AM, Jack Wang wrote:
+static inline const char *ibtrs_clt_state_str(enum ibtrs_clt_state state)
+{
+ switch (state) {
+ case IBTRS_CLT_CONNECTING:
+ return "IBTRS_CLT_CONNECTING";
+ case IBTRS_CLT_CONNECTING_ERR:
+ return "IBTRS_CLT_CONNECTING_ERR";
+ case IBTRS_CLT_RECONNECTING:
+ return "IBTRS_CLT_RECONNECTING";
+ case IBTRS_CLT_CONNECTED:
+ return "IBTRS_CLT_CONNECTED";
+ case IBTRS_CLT_CLOSING:
+ return "IBTRS_CLT_CLOSING";
+ case IBTRS_CLT_CLOSED:
+ return "IBTRS_CLT_CLOSED";
+ case IBTRS_CLT_DEAD:
+ return "IBTRS_CLT_DEAD";
+ default:
+ return "UNKNOWN";
+ }
+}
Since this code is not in the hot path, please move it from a .h into a
.c file.
+static inline struct ibtrs_clt_con *to_clt_con(struct ibtrs_con *c)
+{
+ return container_of(c, struct ibtrs_clt_con, c);
+}
+
+static inline struct ibtrs_clt_sess *to_clt_sess(struct ibtrs_sess *s)
+{
+ return container_of(s, struct ibtrs_clt_sess, s);
+}
Is it really useful to define functions for these conversions? Has it
been considered to inline these functions?
Thanks,
Bart.