Browse Source

[libc] Use __einfo() tuple as first argument to EUNIQ()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 11 years ago
parent
commit
e42bc3aa37

+ 1
- 1
src/crypto/ocsp.c View File

84
 	__einfo_uniqify ( EINFO_EPROTO, OCSP_STATUS_UNAUTHORIZED,	\
84
 	__einfo_uniqify ( EINFO_EPROTO, OCSP_STATUS_UNAUTHORIZED,	\
85
 			  "Request unauthorized" )
85
 			  "Request unauthorized" )
86
 #define EPROTO_STATUS( status )						\
86
 #define EPROTO_STATUS( status )						\
87
-	EUNIQ ( EPROTO, (status), EPROTO_MALFORMED_REQUEST,		\
87
+	EUNIQ ( EINFO_EPROTO, (status), EPROTO_MALFORMED_REQUEST,	\
88
 		EPROTO_INTERNAL_ERROR, EPROTO_TRY_LATER,		\
88
 		EPROTO_INTERNAL_ERROR, EPROTO_TRY_LATER,		\
89
 		EPROTO_SIG_REQUIRED, EPROTO_UNAUTHORIZED )
89
 		EPROTO_SIG_REQUIRED, EPROTO_UNAUTHORIZED )
90
 
90
 

+ 1
- 1
src/drivers/block/scsi.c View File

89
 #define EINFO_EIO_COMPLETED \
89
 #define EINFO_EIO_COMPLETED \
90
 	__einfo_uniqify ( EINFO_EIO, 0x0f, "Completed" )
90
 	__einfo_uniqify ( EINFO_EIO, 0x0f, "Completed" )
91
 #define EIO_SENSE( key )						\
91
 #define EIO_SENSE( key )						\
92
-	EUNIQ ( EIO, (key), EIO_NO_SENSE, EIO_RECOVERED_ERROR,		\
92
+	EUNIQ ( EINFO_EIO, (key), EIO_NO_SENSE, EIO_RECOVERED_ERROR,	\
93
 		EIO_NOT_READY, EIO_MEDIUM_ERROR, EIO_HARDWARE_ERROR,	\
93
 		EIO_NOT_READY, EIO_MEDIUM_ERROR, EIO_HARDWARE_ERROR,	\
94
 		EIO_ILLEGAL_REQUEST, EIO_UNIT_ATTENTION,		\
94
 		EIO_ILLEGAL_REQUEST, EIO_UNIT_ATTENTION,		\
95
 		EIO_DATA_PROTECT, EIO_BLANK_CHECK, EIO_VENDOR_SPECIFIC,	\
95
 		EIO_DATA_PROTECT, EIO_BLANK_CHECK, EIO_VENDOR_SPECIFIC,	\

+ 1
- 1
src/drivers/block/srp.c View File

93
 	SRP_LOGIN_REJ_REASON_NO_MORE_CHANNELS,				      \
93
 	SRP_LOGIN_REJ_REASON_NO_MORE_CHANNELS,				      \
94
 	"RDMA channel limit reached for this initiator" )
94
 	"RDMA channel limit reached for this initiator" )
95
 #define EPERM_LOGIN_REJ( reason_nibble )				      \
95
 #define EPERM_LOGIN_REJ( reason_nibble )				      \
96
-	EUNIQ ( EPERM, (reason_nibble), EPERM_UNKNOWN,			      \
96
+	EUNIQ ( EINFO_EPERM, (reason_nibble), EPERM_UNKNOWN,		      \
97
 		EPERM_INSUFFICIENT_RESOURCES, EPERM_BAD_MAX_I_T_IU_LEN,	      \
97
 		EPERM_INSUFFICIENT_RESOURCES, EPERM_BAD_MAX_I_T_IU_LEN,	      \
98
 		EPERM_CANNOT_ASSOCIATE, EPERM_UNSUPPORTED_BUFFER_FORMAT,      \
98
 		EPERM_CANNOT_ASSOCIATE, EPERM_UNSUPPORTED_BUFFER_FORMAT,      \
99
 		EPERM_NO_MULTIPLE_CHANNELS, EPERM_NO_MORE_CHANNELS )
99
 		EPERM_NO_MULTIPLE_CHANNELS, EPERM_NO_MORE_CHANNELS )

+ 6
- 5
src/include/errno.h View File

187
 /**
187
 /**
188
  * Disambiguate a base error based on non-constant information
188
  * Disambiguate a base error based on non-constant information
189
  *
189
  *
190
- * @v error_base	Base error
191
- * @v uniq		Error disambiguator
190
+ * @v einfo_base	Base error information
191
+ * @v uniq		Error disambiguator (0x00-0x1f)
192
  * @v ...		List of expected possible disambiguated errors
192
  * @v ...		List of expected possible disambiguated errors
193
  * @ret error		Error
193
  * @ret error		Error
194
  *
194
  *
200
  * EUNIQ() should not be used for constant error disambiguators; use
200
  * EUNIQ() should not be used for constant error disambiguators; use
201
  * __einfo_uniqify() instead.
201
  * __einfo_uniqify() instead.
202
  */
202
  */
203
-#define EUNIQ( errno, uniq, ... ) ( {					\
204
-	euniq_discard ( 0, ##__VA_ARGS__);				\
205
-	( ( int ) ( (errno) | ( (uniq) << 8 ) ) ); } )
203
+#define EUNIQ( einfo_base, uniq, ... ) ( {				\
204
+	euniq_discard ( 0, ##__VA_ARGS__ );				\
205
+	( ( int ) ( __einfo_error ( einfo_base ) |			\
206
+		    ( (uniq) << 8 ) ) ); } )
206
 static inline void euniq_discard ( int dummy __unused, ... ) {}
207
 static inline void euniq_discard ( int dummy __unused, ... ) {}
207
 
208
 
208
 /**
209
 /**

+ 75
- 73
src/include/ipxe/net80211_err.h View File

553
 
553
 
554
 /** Make return status code from 802.11 status code */
554
 /** Make return status code from 802.11 status code */
555
 #define E80211_STATUS( stat )						\
555
 #define E80211_STATUS( stat )						\
556
-	EUNIQ ( ( ( stat & 0x20 ) ? EHOSTUNREACH : ECONNREFUSED ),	\
557
-		( stat &0x1f ),						\
558
-		ECONNREFUSED_FAILURE,					\
559
-		ECONNREFUSED_CAPAB_UNSUPP,				\
560
-		ECONNREFUSED_REASSOC_INVALID,				\
561
-		ECONNREFUSED_ASSOC_DENIED,				\
562
-		ECONNREFUSED_AUTH_ALGO_UNSUPP,				\
563
-		ECONNREFUSED_AUTH_SEQ_INVALID,				\
564
-		ECONNREFUSED_AUTH_CHALL_INVALID,			\
565
-		ECONNREFUSED_AUTH_TIMEOUT,				\
566
-		ECONNREFUSED_ASSOC_NO_ROOM,				\
567
-		ECONNREFUSED_ASSOC_NEED_RATE,				\
568
-		ECONNREFUSED_ASSOC_NEED_SHORT_PMBL,			\
569
-		ECONNREFUSED_ASSOC_NEED_PBCC,				\
570
-		ECONNREFUSED_ASSOC_NEED_CHAN_AGILITY,			\
571
-		ECONNREFUSED_ASSOC_NEED_SPECTRUM_MGMT,			\
572
-		ECONNREFUSED_ASSOC_BAD_POWER,				\
573
-		ECONNREFUSED_ASSOC_BAD_CHANNELS,			\
574
-		ECONNREFUSED_ASSOC_NEED_SHORT_SLOT,			\
575
-		ECONNREFUSED_ASSOC_NEED_DSSS_OFDM,			\
576
-		EHOSTUNREACH_QOS_FAILURE,				\
577
-		EHOSTUNREACH_QOS_NO_ROOM,				\
578
-		EHOSTUNREACH_LINK_IS_HORRIBLE,				\
579
-		EHOSTUNREACH_ASSOC_NEED_QOS,				\
580
-		EHOSTUNREACH_REQUEST_DECLINED,				\
581
-		EHOSTUNREACH_REQUEST_INVALID,				\
582
-		EHOSTUNREACH_TS_NOT_CREATED_AGAIN,			\
583
-		EHOSTUNREACH_INVALID_IE,				\
584
-		EHOSTUNREACH_GROUP_CIPHER_INVALID,			\
585
-		EHOSTUNREACH_PAIR_CIPHER_INVALID,			\
586
-		EHOSTUNREACH_AKMP_INVALID,				\
587
-		EHOSTUNREACH_RSN_VERSION_UNSUPP,			\
588
-		EHOSTUNREACH_RSN_CAPAB_INVALID,				\
589
-		EHOSTUNREACH_CIPHER_REJECTED,				\
590
-		EHOSTUNREACH_TS_NOT_CREATED_WAIT,			\
591
-		EHOSTUNREACH_DIRECT_LINK_FORBIDDEN,			\
592
-		EHOSTUNREACH_DEST_NOT_PRESENT,				\
593
-		EHOSTUNREACH_DEST_NOT_QOS,				\
594
-		EHOSTUNREACH_ASSOC_LISTEN_TOO_HIGH )
556
+	( ( (stat) & 0x20 ) ?						\
557
+	  EUNIQ ( EINFO_EHOSTUNREACH, ( (stat) & 0x1f ),		\
558
+		  EHOSTUNREACH_QOS_FAILURE,				\
559
+		  EHOSTUNREACH_QOS_NO_ROOM,				\
560
+		  EHOSTUNREACH_LINK_IS_HORRIBLE,			\
561
+		  EHOSTUNREACH_ASSOC_NEED_QOS,				\
562
+		  EHOSTUNREACH_REQUEST_DECLINED,			\
563
+		  EHOSTUNREACH_REQUEST_INVALID,				\
564
+		  EHOSTUNREACH_TS_NOT_CREATED_AGAIN,			\
565
+		  EHOSTUNREACH_INVALID_IE,				\
566
+		  EHOSTUNREACH_GROUP_CIPHER_INVALID,			\
567
+		  EHOSTUNREACH_PAIR_CIPHER_INVALID,			\
568
+		  EHOSTUNREACH_AKMP_INVALID,				\
569
+		  EHOSTUNREACH_RSN_VERSION_UNSUPP,			\
570
+		  EHOSTUNREACH_RSN_CAPAB_INVALID,			\
571
+		  EHOSTUNREACH_CIPHER_REJECTED,				\
572
+		  EHOSTUNREACH_TS_NOT_CREATED_WAIT,			\
573
+		  EHOSTUNREACH_DIRECT_LINK_FORBIDDEN,			\
574
+		  EHOSTUNREACH_DEST_NOT_PRESENT,			\
575
+		  EHOSTUNREACH_DEST_NOT_QOS,				\
576
+		  EHOSTUNREACH_ASSOC_LISTEN_TOO_HIGH ) :		\
577
+	  EUNIQ ( EINFO_ECONNREFUSED, ( (stat) & 0x1f ),		\
578
+		  ECONNREFUSED_FAILURE,					\
579
+		  ECONNREFUSED_CAPAB_UNSUPP,				\
580
+		  ECONNREFUSED_REASSOC_INVALID,				\
581
+		  ECONNREFUSED_ASSOC_DENIED,				\
582
+		  ECONNREFUSED_AUTH_ALGO_UNSUPP,			\
583
+		  ECONNREFUSED_AUTH_SEQ_INVALID,			\
584
+		  ECONNREFUSED_AUTH_CHALL_INVALID,			\
585
+		  ECONNREFUSED_AUTH_TIMEOUT,				\
586
+		  ECONNREFUSED_ASSOC_NO_ROOM,				\
587
+		  ECONNREFUSED_ASSOC_NEED_RATE,				\
588
+		  ECONNREFUSED_ASSOC_NEED_SHORT_PMBL,			\
589
+		  ECONNREFUSED_ASSOC_NEED_PBCC,				\
590
+		  ECONNREFUSED_ASSOC_NEED_CHAN_AGILITY,			\
591
+		  ECONNREFUSED_ASSOC_NEED_SPECTRUM_MGMT,		\
592
+		  ECONNREFUSED_ASSOC_BAD_POWER,				\
593
+		  ECONNREFUSED_ASSOC_BAD_CHANNELS,			\
594
+		  ECONNREFUSED_ASSOC_NEED_SHORT_SLOT,			\
595
+		  ECONNREFUSED_ASSOC_NEED_DSSS_OFDM ) )
595
 
596
 
596
 /** Make return status code from 802.11 reason code */
597
 /** Make return status code from 802.11 reason code */
597
 #define E80211_REASON( reas )						\
598
 #define E80211_REASON( reas )						\
598
-	EUNIQ ( ( ( reas & 0x20 ) ? ENETRESET : ECONNRESET ),		\
599
-		( reas & 0x1f ),					\
600
-		ECONNRESET_UNSPECIFIED,					\
601
-		ECONNRESET_AUTH_NO_LONGER_VALID,			\
602
-		ECONNRESET_LEAVING,					\
603
-		ECONNRESET_INACTIVITY,					\
604
-		ECONNRESET_OUT_OF_RESOURCES,				\
605
-		ECONNRESET_NEED_AUTH,					\
606
-		ECONNRESET_NEED_ASSOC,					\
607
-		ECONNRESET_LEAVING_TO_ROAM,				\
608
-		ECONNRESET_REASSOC_INVALID,				\
609
-		ECONNRESET_BAD_POWER,					\
610
-		ECONNRESET_BAD_CHANNELS,				\
611
-		ECONNRESET_INVALID_IE,					\
612
-		ECONNRESET_MIC_FAILURE,					\
613
-		ECONNRESET_4WAY_TIMEOUT,				\
614
-		ECONNRESET_GROUPKEY_TIMEOUT,				\
615
-		ECONNRESET_4WAY_INVALID,				\
616
-		ECONNRESET_GROUP_CIPHER_INVALID,			\
617
-		ECONNRESET_PAIR_CIPHER_INVALID,				\
618
-		ECONNRESET_AKMP_INVALID,				\
619
-		ECONNRESET_RSN_VERSION_INVALID,				\
620
-		ECONNRESET_RSN_CAPAB_INVALID,				\
621
-		ECONNRESET_8021X_FAILURE,				\
622
-		ECONNRESET_CIPHER_REJECTED,				\
623
-		ENETRESET_QOS_UNSPECIFIED,				\
624
-		ENETRESET_QOS_OUT_OF_RESOURCES,				\
625
-		ENETRESET_LINK_IS_HORRIBLE,				\
626
-		ENETRESET_INVALID_TXOP,					\
627
-		ENETRESET_REQUESTED_LEAVING,				\
628
-		ENETRESET_REQUESTED_NO_USE,				\
629
-		ENETRESET_REQUESTED_NEED_SETUP,				\
630
-		ENETRESET_REQUESTED_TIMEOUT,				\
631
-		ENETRESET_CIPHER_UNSUPPORTED )
599
+	( ( (reas) & 0x20 ) ?						\
600
+	  EUNIQ ( EINFO_ENETRESET, ( (reas) & 0x1f ),			\
601
+		  ENETRESET_QOS_UNSPECIFIED,				\
602
+		  ENETRESET_QOS_OUT_OF_RESOURCES,			\
603
+		  ENETRESET_LINK_IS_HORRIBLE,				\
604
+		  ENETRESET_INVALID_TXOP,				\
605
+		  ENETRESET_REQUESTED_LEAVING,				\
606
+		  ENETRESET_REQUESTED_NO_USE,				\
607
+		  ENETRESET_REQUESTED_NEED_SETUP,			\
608
+		  ENETRESET_REQUESTED_TIMEOUT,				\
609
+		  ENETRESET_CIPHER_UNSUPPORTED ) :			\
610
+	  EUNIQ ( EINFO_ECONNRESET, ( (reas) & 0x1f ),			\
611
+		  ECONNRESET_UNSPECIFIED,				\
612
+		  ECONNRESET_AUTH_NO_LONGER_VALID,			\
613
+		  ECONNRESET_LEAVING,					\
614
+		  ECONNRESET_INACTIVITY,				\
615
+		  ECONNRESET_OUT_OF_RESOURCES,				\
616
+		  ECONNRESET_NEED_AUTH,					\
617
+		  ECONNRESET_NEED_ASSOC,				\
618
+		  ECONNRESET_LEAVING_TO_ROAM,				\
619
+		  ECONNRESET_REASSOC_INVALID,				\
620
+		  ECONNRESET_BAD_POWER,					\
621
+		  ECONNRESET_BAD_CHANNELS,				\
622
+		  ECONNRESET_INVALID_IE,				\
623
+		  ECONNRESET_MIC_FAILURE,				\
624
+		  ECONNRESET_4WAY_TIMEOUT,				\
625
+		  ECONNRESET_GROUPKEY_TIMEOUT,				\
626
+		  ECONNRESET_4WAY_INVALID,				\
627
+		  ECONNRESET_GROUP_CIPHER_INVALID,			\
628
+		  ECONNRESET_PAIR_CIPHER_INVALID,			\
629
+		  ECONNRESET_AKMP_INVALID,				\
630
+		  ECONNRESET_RSN_VERSION_INVALID,			\
631
+		  ECONNRESET_RSN_CAPAB_INVALID,				\
632
+		  ECONNRESET_8021X_FAILURE,				\
633
+		  ECONNRESET_CIPHER_REJECTED ) )
632
 
634
 
633
 #endif /* _IPXE_NET80211_ERR_H */
635
 #endif /* _IPXE_NET80211_ERR_H */

+ 2
- 2
src/net/80211/sec80211.c View File

45
 #define ENOTSUP_CCMP __einfo_error ( EINFO_ENOTSUP_CCMP )
45
 #define ENOTSUP_CCMP __einfo_error ( EINFO_ENOTSUP_CCMP )
46
 #define EINFO_ENOTSUP_CCMP __einfo_uniqify ( EINFO_ENOTSUP, \
46
 #define EINFO_ENOTSUP_CCMP __einfo_uniqify ( EINFO_ENOTSUP, \
47
 	( 0x10 | NET80211_CRYPT_CCMP ), "CCMP not supported" )
47
 	( 0x10 | NET80211_CRYPT_CCMP ), "CCMP not supported" )
48
-#define ENOTSUP_CRYPT( crypt )		     \
49
-	EUNIQ ( ENOTSUP, ( 0x10 | (crypt) ), \
48
+#define ENOTSUP_CRYPT( crypt )			   \
49
+	EUNIQ ( EINFO_ENOTSUP, ( 0x10 | (crypt) ), \
50
 		ENOTSUP_WEP, ENOTSUP_TKIP, ENOTSUP_CCMP )
50
 		ENOTSUP_WEP, ENOTSUP_TKIP, ENOTSUP_CCMP )
51
 
51
 
52
 /** Mapping from net80211 crypto/secprot types to RSN OUI descriptors */
52
 /** Mapping from net80211 crypto/secprot types to RSN OUI descriptors */

Loading…
Cancel
Save