File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -526,7 +526,26 @@ static int __nvmf_add_ctrl(nvme_root_t r, const char *argstr)
526526 if (ret != len ) {
527527 nvme_msg (r , LOG_NOTICE , "Failed to write to %s: %s\n" ,
528528 nvmf_dev , strerror (errno ));
529- ret = - ENVME_CONNECT_WRITE ;
529+ switch (errno ) {
530+ case EALREADY :
531+ ret = - ENVME_CONNECT_ALREADY ;
532+ break ;
533+ case EINVAL :
534+ ret = - ENVME_CONNECT_INVAL ;
535+ break ;
536+ case EADDRINUSE :
537+ ret = - ENVME_CONNECT_ADDRINUSE ;
538+ break ;
539+ case ENODEV :
540+ ret = - ENVME_CONNECT_NODEV ;
541+ break ;
542+ case EOPNOTSUPP :
543+ ret = - ENVME_CONNECT_OPNOTSUPP ;
544+ break ;
545+ default :
546+ ret = - ENVME_CONNECT_WRITE ;
547+ break ;
548+ }
530549 goto out_close ;
531550 }
532551
Original file line number Diff line number Diff line change @@ -536,6 +536,11 @@ static const char * const libnvme_status[] = {
536536 [ENVME_CONNECT_INVAL_TR ] = "invalid transport type" ,
537537 [ENVME_CONNECT_LOOKUP_SUBSYS_NAME ] = "failed to lookup subsystem name" ,
538538 [ENVME_CONNECT_LOOKUP_SUBSYS ] = "failed to lookup subsystem" ,
539+ [ENVME_CONNECT_ALREADY ] = "already connnected" ,
540+ [ENVME_CONNECT_INVAL ] = "invalid arguments/configuration" ,
541+ [ENVME_CONNECT_ADDRINUSE ] = "hostnqn already in use" ,
542+ [ENVME_CONNECT_NODEV ] = "invalid interface" ,
543+ [ENVME_CONNECT_OPNOTSUPP ] = "not supported" ,
539544};
540545
541546const char * nvme_errno_to_string (int status )
Original file line number Diff line number Diff line change 3131 * @ENVME_CONNECT_INVAL_TR: invalid transport type
3232 * @ENVME_CONNECT_LOOKUP_SUBSYS_NAME: failed to lookup subsystem name
3333 * @ENVME_CONNECT_LOOKUP_SUBSYS: failed to lookup subsystem
34+ * @ENVME_CONNECT_ALREADY: the connect attempt failed, already connected
35+ * @ENVME_CONNECT_INVAL: invalid arguments/configuration
36+ * @ENVME_CONNECT_ADDRINUSE: hostnqn already in use
37+ * @ENVME_CONNECT_NODEV: invalid interface
38+ * @ENVME_CONNECT_OPNOTSUPP: not supported
3439 */
3540enum nvme_connect_err {
3641 ENVME_CONNECT_RESOLVE = 1000 ,
@@ -45,6 +50,11 @@ enum nvme_connect_err {
4550 ENVME_CONNECT_INVAL_TR ,
4651 ENVME_CONNECT_LOOKUP_SUBSYS_NAME ,
4752 ENVME_CONNECT_LOOKUP_SUBSYS ,
53+ ENVME_CONNECT_ALREADY ,
54+ ENVME_CONNECT_INVAL ,
55+ ENVME_CONNECT_ADDRINUSE ,
56+ ENVME_CONNECT_NODEV ,
57+ ENVME_CONNECT_OPNOTSUPP ,
4858};
4959
5060/**
You can’t perform that action at this time.
0 commit comments