Refactor NIC logging

This commit is contained in:
Alexander Babikov 2022-02-07 18:05:58 +05:00
parent 1a7a93010d
commit 1cb301cf3b
5 changed files with 6 additions and 37 deletions

View File

@ -123,7 +123,7 @@ STUFF :=
# -DENABLE_3COM503_LOG=N sets logging level at N.
# -DENABLE_DP8390_LOG=N sets logging level at N.
# -DENABLE_NETWORK_LOG=N sets logging level at N.
# -DENABLE_NIC_LOG=N sets logging level at N.
# -DENABLE_NE2K_LOG=N sets logging level at N.
# -DENABLE_PCAP_LOG=N sets logging level at N.
# -DENABLE_PCNET_LOG=N sets logging level at N.
# -DENABLE_SLIRP_LOG=N sets logging level at N.

View File

@ -124,15 +124,15 @@ typedef struct {
} nic_t;
#ifdef ENABLE_NIC_LOG
int nic_do_log = ENABLE_NIC_LOG;
#ifdef ENABLE_NE2K_LOG
int ne2k_do_log = ENABLE_NE2K_LOG;
static void
nelog(int lvl, const char *fmt, ...)
{
va_list ap;
if (nic_do_log >= lvl) {
if (ne2k_do_log >= lvl) {
va_start(ap, fmt);
pclog_ex(fmt, ap);
va_end(ap);
@ -920,15 +920,6 @@ nic_init(const device_t *info)
uint32_t mac;
char *rom;
nic_t *dev;
#ifdef ENABLE_NIC_LOG
int i;
#endif
/* Get the desired debug level. */
#ifdef ENABLE_NIC_LOG
i = device_get_config_int("debug");
if (i > 0) nic_do_log = i;
#endif
dev = malloc(sizeof(nic_t));
memset(dev, 0x00, sizeof(nic_t));

View File

@ -2905,18 +2905,9 @@ pcnet_init(const device_t *info)
{
uint32_t mac;
nic_t *dev;
#ifdef ENABLE_NIC_LOG
int i;
#endif
int c;
uint16_t checksum;
/* Get the desired debug level. */
#ifdef ENABLE_NIC_LOG
i = device_get_config_int("debug");
if (i > 0) pcnet_do_log = i;
#endif
dev = malloc(sizeof(nic_t));
memset(dev, 0x00, sizeof(nic_t));
dev->name = info->name;

View File

@ -120,7 +120,7 @@ typedef struct {
#ifdef ENABLE_WD_LOG
int WE_do_log = ENABLE_WD_LOG;
int wd_do_log = ENABLE_WD_LOG;
static void
wdlog(const char *fmt, ...)
@ -596,12 +596,6 @@ wd_init(const device_t *info)
uint32_t mac;
wd_t *dev;
/* Get the desired debug level. */
#ifdef ENABLE_NIC_LOG
i = device_get_config_int("debug");
if (i > 0) WE_do_log = i;
#endif
dev = malloc(sizeof(wd_t));
memset(dev, 0x00, sizeof(wd_t));
dev->name = info->name;

View File

@ -112,9 +112,6 @@ char network_host[522];
netdev_t network_devs[32];
int network_rx_pause = 0,
network_tx_pause = 0;
#ifdef ENABLE_NIC_LOG
int nic_do_log = ENABLE_NIC_LOG;
#endif
/* Local variables. */
@ -490,13 +487,9 @@ network_reset(void)
{
int i = -1;
#ifdef ENABLE_NIC_LOG
network_log("NETWORK: reset (type=%d, card=%d) debug=%d\n",
network_type, network_card, nic_do_log);
#else
network_log("NETWORK: reset (type=%d, card=%d)\n",
network_type, network_card);
#endif
ui_sb_update_icon(SB_NETWORK, 0);
/* Just in case.. */