Skip to content

Commit 4df1f0d

Browse files
committed
util: Add ECONNECTREFUSED to enum nvme_connect_err
The kernel might return ECONNECTREFUSED when opening of a socket fails. Add this missing errno to enum nvme_connect_err. Signed-off-by: Daniel Wagner <[email protected]>
1 parent 39e421e commit 4df1f0d

3 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/nvme/fabrics.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,9 @@ static int __nvmf_add_ctrl(nvme_root_t r, const char *argstr)
561561
case EOPNOTSUPP:
562562
ret = -ENVME_CONNECT_OPNOTSUPP;
563563
break;
564+
case ECONNREFUSED :
565+
ret = -ENVME_CONNECT_CONNREFUSED;
566+
break;
564567
default:
565568
ret = -ENVME_CONNECT_WRITE;
566569
break;

src/nvme/util.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,7 @@ static const char * const libnvme_status[] = {
564564
[ENVME_CONNECT_ADDRINUSE] = "hostnqn already in use",
565565
[ENVME_CONNECT_NODEV] = "invalid interface",
566566
[ENVME_CONNECT_OPNOTSUPP] ="not supported",
567+
[ENVME_CONNECT_CONNREFUSED] = "connection refused",
567568
};
568569

569570
const char *nvme_errno_to_string(int status)

src/nvme/util.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
* @ENVME_CONNECT_ADDRINUSE: hostnqn already in use
3737
* @ENVME_CONNECT_NODEV: invalid interface
3838
* @ENVME_CONNECT_OPNOTSUPP: not supported
39+
* @ENVME_CONNECT_CONNREFUSED: connection refused
3940
*/
4041
enum nvme_connect_err {
4142
ENVME_CONNECT_RESOLVE = 1000,
@@ -55,6 +56,7 @@ enum nvme_connect_err {
5556
ENVME_CONNECT_ADDRINUSE,
5657
ENVME_CONNECT_NODEV,
5758
ENVME_CONNECT_OPNOTSUPP,
59+
ENVME_CONNECT_CONNREFUSED,
5860
};
5961

6062
/**

0 commit comments

Comments
 (0)