On 3/5/20 7:35 AM, Gabriel Krisman Bertazi wrote:
+static const struct {
+       int value;
+       char *name;
+} connection_state_names[] = {
+       {ISCSI_CONN_UP, "up"},
+       {ISCSI_CONN_DOWN, "down"},
+       {ISCSI_CONN_FAILED, "failed"}
+};
+
+static const char *connection_state_name(int state)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(connection_state_names); i++) {
+               if (connection_state_names[i].value == state)
+                       return connection_state_names[i].name;
+       }
+       return NULL;
+}
+
+static ssize_t show_conn_state(struct device *dev,
+                              struct device_attribute *attr, char *buf)
+{
+       struct iscsi_cls_conn *conn = iscsi_dev_to_conn(dev->parent);
+
+       return sprintf(buf, "%s\n", connection_state_name(conn->state));
+}
+static ISCSI_CLASS_ATTR(conn, state, S_IRUGO, show_conn_state,
+                       NULL);

What has been changed in v2 compared to v1? Please always include a changelog when posting a new version.

Additionally, it seems like the comment I posted on v1 has not been addressed?

Thanks,

Bart.

--
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/open-iscsi/bc70bd6d-6d13-4d1c-8559-140411e361d9%40acm.org.

Reply via email to