Re: [PATCH v2] iscsi: Report connection state on sysfs

2020-03-06 Thread Bart Van Assche
On 3/6/20 11:59 AM, Gabriel Krisman Bertazi wrote: +static const char *const connection_state_names[] = { + [ISCSI_CONN_UP] = "up", + [ISCSI_CONN_DOWN] = "down", + [ISCSI_CONN_FAILED] = "failed" +}; + +static ssize_t show_conn_state(struct device *dev, +

Re: [PATCH v2] iscsi: Report connection state on sysfs

2020-03-06 Thread Gabriel Krisman Bertazi
Bart Van Assche writes: > How about removing the loop as follows? > Hey, Thanks for the review. I understand designated initializers :-P My point was following the pattern of the other statuses sysfs files in the iSCSI layer. But, I really don't mind. What do you think of v3 below? -- >8

Re: [PATCH v2] iscsi: Report connection state on sysfs

2020-03-05 Thread Bart Van Assche
On 3/5/20 11:20 AM, Gabriel Krisman Bertazi wrote: Bart Van Assche writes: 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"}, +

Re: [PATCH v2] iscsi: Report connection state on sysfs

2020-03-05 Thread Gabriel Krisman Bertazi
Bart Van Assche writes: > 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"} >> +}; >> + >>

Re: [PATCH v2] iscsi: Report connection state on sysfs

2020-03-05 Thread Bart Van Assche
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

[PATCH v2] iscsi: Report connection state on sysfs

2020-03-05 Thread Gabriel Krisman Bertazi
If an iSCSI connection happens to fail while the daemon isn't running (due to a crash or for another reason), the kernel failure report is not received. When the daemon restarts, there is insufficient kernel state in sysfs for it to know that this happened. open-iscsi tries to reopen every