Browse Source

[iscsi] Disambiguate the common EINVAL cases

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 14 years ago
parent
commit
de6a59470b
1 changed files with 20 additions and 4 deletions
  1. 20
    4
      src/net/tcp/iscsi.c

+ 20
- 4
src/net/tcp/iscsi.c View File

59
 	__einfo_error ( EINFO_EACCES_INCORRECT_TARGET_PASSWORD )
59
 	__einfo_error ( EINFO_EACCES_INCORRECT_TARGET_PASSWORD )
60
 #define EINFO_EACCES_INCORRECT_TARGET_PASSWORD \
60
 #define EINFO_EACCES_INCORRECT_TARGET_PASSWORD \
61
 	__einfo_uniqify ( EINFO_EACCES, 0x02, "Incorrect target password" )
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
 #define ENOTSUP_INITIATOR_STATUS \
78
 #define ENOTSUP_INITIATOR_STATUS \
63
 	__einfo_error ( EINFO_ENOTSUP_INITIATOR_STATUS )
79
 	__einfo_error ( EINFO_ENOTSUP_INITIATOR_STATUS )
64
 #define EINFO_ENOTSUP_INITIATOR_STATUS \
80
 #define EINFO_ENOTSUP_INITIATOR_STATUS \
1787
 			if ( ! *rp ) {
1803
 			if ( ! *rp ) {
1788
 				DBGC ( iscsi, "iSCSI %p root path \"%s\" "
1804
 				DBGC ( iscsi, "iSCSI %p root path \"%s\" "
1789
 				       "too short\n", iscsi, root_path );
1805
 				       "too short\n", iscsi, root_path );
1790
-				return -EINVAL;
1806
+				return -EINVAL_ROOT_PATH_TOO_SHORT;
1791
 			}
1807
 			}
1792
 		}
1808
 		}
1793
 		*(rp++) = '\0';
1809
 		*(rp++) = '\0';
1870
 	       ( initiator_password ? "" : "no " ),
1886
 	       ( initiator_password ? "" : "no " ),
1871
 	       ( target_username ? "" : "no " ),
1887
 	       ( target_username ? "" : "no " ),
1872
 	       ( target_password ? "" : "no " ) );
1888
 	       ( target_password ? "" : "no " ) );
1873
-	return -EINVAL;
1889
+	return -EINVAL_BAD_CREDENTIAL_MIX;
1874
 }
1890
 }
1875
 
1891
 
1876
 /**
1892
 /**
1886
 
1902
 
1887
 	/* Sanity check */
1903
 	/* Sanity check */
1888
 	if ( ! uri->opaque ) {
1904
 	if ( ! uri->opaque ) {
1889
-		rc = -EINVAL;
1905
+		rc = -EINVAL_NO_ROOT_PATH;
1890
 		goto err_sanity_uri;
1906
 		goto err_sanity_uri;
1891
 	}
1907
 	}
1892
 
1908
 
1924
 	if ( ! iscsi->target_iqn ) {
1940
 	if ( ! iscsi->target_iqn ) {
1925
 		DBGC ( iscsi, "iSCSI %p no target address supplied in %s\n",
1941
 		DBGC ( iscsi, "iSCSI %p no target address supplied in %s\n",
1926
 		       iscsi, uri->opaque );
1942
 		       iscsi, uri->opaque );
1927
-		rc = -EINVAL;
1943
+		rc = -EINVAL_NO_TARGET_IQN;
1928
 		goto err_sanity_iqn;
1944
 		goto err_sanity_iqn;
1929
 	}
1945
 	}
1930
 
1946
 

Loading…
Cancel
Save