diff options
author | Michael Brown | 2010-05-30 16:29:05 +0200 |
---|---|---|
committer | Michael Brown | 2010-05-31 04:11:57 +0200 |
commit | 6c0e8c14be9546b49c097f5e6e8307bda3e7f5ac (patch) | |
tree | b04dd064c978bf0525649e9d1b936a9724deadaf /src/net/netdevice.c | |
parent | [pxe] Remove obsolete pxe_errortab.c (diff) | |
download | ipxe-6c0e8c14be9546b49c097f5e6e8307bda3e7f5ac.tar.gz ipxe-6c0e8c14be9546b49c097f5e6e8307bda3e7f5ac.tar.xz ipxe-6c0e8c14be9546b49c097f5e6e8307bda3e7f5ac.zip |
[libc] Enable automated extraction of error usage reports
Add preprocessor magic to the error definitions to enable every error
usage to be tracked.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net/netdevice.c')
-rw-r--r-- | src/net/netdevice.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/net/netdevice.c b/src/net/netdevice.c index 9b42ad37..6c91b489 100644 --- a/src/net/netdevice.c +++ b/src/net/netdevice.c @@ -46,11 +46,13 @@ struct list_head net_devices = LIST_HEAD_INIT ( net_devices ); static struct list_head open_net_devices = LIST_HEAD_INIT ( open_net_devices ); /** Default link status code */ -#define EUNKNOWN_LINK_STATUS EINPROGRESS +#define EUNKNOWN_LINK_STATUS __einfo_error ( EINFO_EUNKNOWN_LINK_STATUS ) +#define EINFO_EUNKNOWN_LINK_STATUS \ + __einfo_uniqify ( EINFO_EINPROGRESS, 0x01, "Unknown" ) /** Human-readable message for the default link status */ struct errortab netdev_errors[] __errortab = { - { EUNKNOWN_LINK_STATUS, "Unknown" }, + __einfo_errortab ( EINFO_EUNKNOWN_LINK_STATUS ), }; /** @@ -60,16 +62,12 @@ struct errortab netdev_errors[] __errortab = { */ void netdev_link_down ( struct net_device *netdev ) { - switch ( netdev->link_rc ) { - case 0: - case -EUNKNOWN_LINK_STATUS: + /* Avoid clobbering a more detailed link status code, if one + * is already set. + */ + if ( ( netdev->link_rc == 0 ) || + ( netdev->link_rc == -EUNKNOWN_LINK_STATUS ) ) { netdev->link_rc = -ENOTCONN; - break; - default: - /* Avoid clobbering a more detailed link status code, - * if one is already set. - */ - break; } } |