From 2c839a208413b88878ac56f138b5423bba893785 Mon Sep 17 00:00:00 2001 From: Mike Christie Date: Sun, 30 Jan 2011 22:49:56 -0600 Subject: iscsi tools: fix iscsiadm exit codes iscsiadm/iscsistart return a mix of type of returns codes. Sometimes -1 and sometimes a EXYZ type of error code. This patch has them return a ISCSI_ERR value. See iscsiadm man page EXIT STATUS section for error code definitions. --- include/iscsi_err.h | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 include/iscsi_err.h (limited to 'include') diff --git a/include/iscsi_err.h b/include/iscsi_err.h new file mode 100644 index 0000000..c54edee --- /dev/null +++ b/include/iscsi_err.h @@ -0,0 +1,63 @@ +/* + * Return codes used by iSCSI tools. + */ +#ifndef _ISCSI_ERR_ +#define _ISCSI_ERR_ + +enum { + ISCSI_SUCCESS = 0, + /* Generic error */ + ISCSI_ERR = 1, + /* session could not be found */ + ISCSI_ERR_SESS_NOT_FOUND = 2, + /* Could not allocate resource for operation */ + ISCSI_ERR_NOMEM = 3, + /* Transport error caused operation to fail */ + ISCSI_ERR_TRANS = 4, + /* Generic login failure */ + ISCSI_ERR_LOGIN = 5, + /* Error accessing/managing iSCSI DB */ + ISCSI_ERR_IDBM = 6, + /* Invalid argument */ + ISCSI_ERR_INVAL = 7, + /* Connection timer exired while trying to connect */ + ISCSI_ERR_TRANS_TIMEOUT = 8, + /* Generic internal iscsid failure */ + ISCSI_ERR_INTERNAL = 9, + /* Logout failed */ + ISCSI_ERR_LOGOUT = 10, + /* iSCSI PDU timedout */ + ISCSI_ERR_PDU_TIMEOUT = 11, + /* iSCSI transport module not loaded in kernel or iscsid */ + ISCSI_ERR_TRANS_NOT_FOUND = 12, + /* Permission denied */ + ISCSI_ERR_ACCESS = 13, + /* Transport module did not support operation */ + ISCSI_ERR_TRANS_CAPS = 14, + /* Session is logged in */ + ISCSI_ERR_SESS_EXISTS = 15, + /* Invalid IPC MGMT request */ + ISCSI_ERR_INVALID_MGMT_REQ = 16, + /* iSNS service is not supported */ + ISCSI_ERR_ISNS_UNAVAILABLE = 17, + /* A read/write to iscsid failed */ + ISCSI_ERR_ISCSID_COMM_ERR = 18, + /* Fatal login error */ + ISCSI_ERR_FATAL_LOGIN = 19, + /* Could ont connect to iscsid */ + ISCSI_ERR_ISCSID_NOTCONN = 20, + /* No records/targets/sessions/portals found to execute operation on */ + ISCSI_ERR_NO_OBJS_FOUND = 21, + /* Could not lookup object in sysfs */ + ISCSI_ERR_SYSFS_LOOKUP = 22, + /* Could not lookup host */ + ISCSI_ERR_HOST_NOT_FOUND = 23, + + /* Always last. Indicates end of error code space */ + ISCSI_MAX_ERR_VAL, +} iscsi_err; + +extern void iscsi_err_print_msg(int err); +extern char *iscsi_err_to_str(int err); + +#endif -- cgit v1.2.1