Pārlūkot izejas kodu

[iscsi] Disambiguate the common EINVAL cases

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 14 gadus atpakaļ
vecāks
revīzija
de6a59470b
1 mainītis faili ar 20 papildinājumiem un 4 dzēšanām
  1. 20
    4
      src/net/tcp/iscsi.c

+ 20
- 4
src/net/tcp/iscsi.c Parādīt failu

@@ -59,6 +59,22 @@ FEATURE ( FEATURE_PROTOCOL, "iSCSI", DHCP_EB_FEATURE_ISCSI, 1 );
59 59
 	__einfo_error ( EINFO_EACCES_INCORRECT_TARGET_PASSWORD )
60 60
 #define EINFO_EACCES_INCORRECT_TARGET_PASSWORD \
61 61
 	__einfo_uniqify ( EINFO_EACCES, 0x02, "Incorrect target password" )
62
+#define EINVAL_ROOT_PATH_TOO_SHORT \
63
+	__einfo_error ( EINFO_EINVAL_ROOT_PATH_TOO_SHORT )
64
+#define EINFO_EINVAL_ROOT_PATH_TOO_SHORT \
65
+	__einfo_uniqify ( EINFO_EINVAL, 0x01, "Root path too short" )
66
+#define EINVAL_BAD_CREDENTIAL_MIX \
67
+	__einfo_error ( EINFO_EINVAL_BAD_CREDENTIAL_MIX )
68
+#define EINFO_EINVAL_BAD_CREDENTIAL_MIX \
69
+	__einfo_uniqify ( EINFO_EINVAL, 0x02, "Bad credential mix" )
70
+#define EINVAL_NO_ROOT_PATH \
71
+	__einfo_error ( EINFO_EINVAL_NO_ROOT_PATH )
72
+#define EINFO_EINVAL_NO_ROOT_PATH \
73
+	__einfo_uniqify ( EINFO_EINVAL, 0x03, "No root path" )
74
+#define EINVAL_NO_TARGET_IQN \
75
+	__einfo_error ( EINFO_EINVAL_NO_TARGET_IQN )
76
+#define EINFO_EINVAL_NO_TARGET_IQN \
77
+	__einfo_uniqify ( EINFO_EINVAL, 0x04, "No target IQN" )
62 78
 #define ENOTSUP_INITIATOR_STATUS \
63 79
 	__einfo_error ( EINFO_ENOTSUP_INITIATOR_STATUS )
64 80
 #define EINFO_ENOTSUP_INITIATOR_STATUS \
@@ -1787,7 +1803,7 @@ static int iscsi_parse_root_path ( struct iscsi_session *iscsi,
1787 1803
 			if ( ! *rp ) {
1788 1804
 				DBGC ( iscsi, "iSCSI %p root path \"%s\" "
1789 1805
 				       "too short\n", iscsi, root_path );
1790
-				return -EINVAL;
1806
+				return -EINVAL_ROOT_PATH_TOO_SHORT;
1791 1807
 			}
1792 1808
 		}
1793 1809
 		*(rp++) = '\0';
@@ -1870,7 +1886,7 @@ static int iscsi_set_auth ( struct iscsi_session *iscsi,
1870 1886
 	       ( initiator_password ? "" : "no " ),
1871 1887
 	       ( target_username ? "" : "no " ),
1872 1888
 	       ( target_password ? "" : "no " ) );
1873
-	return -EINVAL;
1889
+	return -EINVAL_BAD_CREDENTIAL_MIX;
1874 1890
 }
1875 1891
 
1876 1892
 /**
@@ -1886,7 +1902,7 @@ static int iscsi_open ( struct interface *parent, struct uri *uri ) {
1886 1902
 
1887 1903
 	/* Sanity check */
1888 1904
 	if ( ! uri->opaque ) {
1889
-		rc = -EINVAL;
1905
+		rc = -EINVAL_NO_ROOT_PATH;
1890 1906
 		goto err_sanity_uri;
1891 1907
 	}
1892 1908
 
@@ -1924,7 +1940,7 @@ static int iscsi_open ( struct interface *parent, struct uri *uri ) {
1924 1940
 	if ( ! iscsi->target_iqn ) {
1925 1941
 		DBGC ( iscsi, "iSCSI %p no target address supplied in %s\n",
1926 1942
 		       iscsi, uri->opaque );
1927
-		rc = -EINVAL;
1943
+		rc = -EINVAL_NO_TARGET_IQN;
1928 1944
 		goto err_sanity_iqn;
1929 1945
 	}
1930 1946
 

Notiek ielāde…
Atcelt
Saglabāt