summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brown2010-12-01 02:23:50 +0100
committerMichael Brown2010-12-01 02:23:50 +0100
commitde6a59470b0e7f161b8143e4cb20589e811b10f8 (patch)
tree9bd0b506a6f6e03e3f59939bcada73ed46a38d66
parent[dns] Disambiguate "no nameserver" and "no DNS record" errors (diff)
downloadipxe-de6a59470b0e7f161b8143e4cb20589e811b10f8.tar.gz
ipxe-de6a59470b0e7f161b8143e4cb20589e811b10f8.tar.xz
ipxe-de6a59470b0e7f161b8143e4cb20589e811b10f8.zip
[iscsi] Disambiguate the common EINVAL cases
Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/net/tcp/iscsi.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/net/tcp/iscsi.c b/src/net/tcp/iscsi.c
index 5e003a81..dc272fdb 100644
--- a/src/net/tcp/iscsi.c
+++ b/src/net/tcp/iscsi.c
@@ -59,6 +59,22 @@ FEATURE ( FEATURE_PROTOCOL, "iSCSI", DHCP_EB_FEATURE_ISCSI, 1 );
__einfo_error ( EINFO_EACCES_INCORRECT_TARGET_PASSWORD )
#define EINFO_EACCES_INCORRECT_TARGET_PASSWORD \
__einfo_uniqify ( EINFO_EACCES, 0x02, "Incorrect target password" )
+#define EINVAL_ROOT_PATH_TOO_SHORT \
+ __einfo_error ( EINFO_EINVAL_ROOT_PATH_TOO_SHORT )
+#define EINFO_EINVAL_ROOT_PATH_TOO_SHORT \
+ __einfo_uniqify ( EINFO_EINVAL, 0x01, "Root path too short" )
+#define EINVAL_BAD_CREDENTIAL_MIX \
+ __einfo_error ( EINFO_EINVAL_BAD_CREDENTIAL_MIX )
+#define EINFO_EINVAL_BAD_CREDENTIAL_MIX \
+ __einfo_uniqify ( EINFO_EINVAL, 0x02, "Bad credential mix" )
+#define EINVAL_NO_ROOT_PATH \
+ __einfo_error ( EINFO_EINVAL_NO_ROOT_PATH )
+#define EINFO_EINVAL_NO_ROOT_PATH \
+ __einfo_uniqify ( EINFO_EINVAL, 0x03, "No root path" )
+#define EINVAL_NO_TARGET_IQN \
+ __einfo_error ( EINFO_EINVAL_NO_TARGET_IQN )
+#define EINFO_EINVAL_NO_TARGET_IQN \
+ __einfo_uniqify ( EINFO_EINVAL, 0x04, "No target IQN" )
#define ENOTSUP_INITIATOR_STATUS \
__einfo_error ( EINFO_ENOTSUP_INITIATOR_STATUS )
#define EINFO_ENOTSUP_INITIATOR_STATUS \
@@ -1787,7 +1803,7 @@ static int iscsi_parse_root_path ( struct iscsi_session *iscsi,
if ( ! *rp ) {
DBGC ( iscsi, "iSCSI %p root path \"%s\" "
"too short\n", iscsi, root_path );
- return -EINVAL;
+ return -EINVAL_ROOT_PATH_TOO_SHORT;
}
}
*(rp++) = '\0';
@@ -1870,7 +1886,7 @@ static int iscsi_set_auth ( struct iscsi_session *iscsi,
( initiator_password ? "" : "no " ),
( target_username ? "" : "no " ),
( target_password ? "" : "no " ) );
- return -EINVAL;
+ return -EINVAL_BAD_CREDENTIAL_MIX;
}
/**
@@ -1886,7 +1902,7 @@ static int iscsi_open ( struct interface *parent, struct uri *uri ) {
/* Sanity check */
if ( ! uri->opaque ) {
- rc = -EINVAL;
+ rc = -EINVAL_NO_ROOT_PATH;
goto err_sanity_uri;
}
@@ -1924,7 +1940,7 @@ static int iscsi_open ( struct interface *parent, struct uri *uri ) {
if ( ! iscsi->target_iqn ) {
DBGC ( iscsi, "iSCSI %p no target address supplied in %s\n",
iscsi, uri->opaque );
- rc = -EINVAL;
+ rc = -EINVAL_NO_TARGET_IQN;
goto err_sanity_iqn;
}