net: cosmetic: Clean up netconsole variables and functions
Make a thorough pass through all variables and function names contained within netconsole.c and remove CamelCase and improve naming. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
786eac5f9d
commit
6a38a5f3df
|
@ -48,7 +48,7 @@ static void nc_handler(uchar *pkt, unsigned dest, struct in_addr sip,
|
||||||
net_set_state(NETLOOP_SUCCESS); /* got input - quit net loop */
|
net_set_state(NETLOOP_SUCCESS); /* got input - quit net loop */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nc_timeout(void)
|
static void nc_timeout_handler(void)
|
||||||
{
|
{
|
||||||
net_set_state(NETLOOP_SUCCESS);
|
net_set_state(NETLOOP_SUCCESS);
|
||||||
}
|
}
|
||||||
|
@ -91,8 +91,9 @@ static int refresh_settings_from_env(void)
|
||||||
nc_out_port = simple_strtoul(p + 1, NULL, 10);
|
nc_out_port = simple_strtoul(p + 1, NULL, 10);
|
||||||
nc_in_port = nc_out_port;
|
nc_in_port = nc_out_port;
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
nc_ip.s_addr = ~0; /* ncip is not set, so broadcast */
|
nc_ip.s_addr = ~0; /* ncip is not set, so broadcast */
|
||||||
|
}
|
||||||
|
|
||||||
p = getenv("ncoutport");
|
p = getenv("ncoutport");
|
||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
|
@ -114,13 +115,13 @@ static int refresh_settings_from_env(void)
|
||||||
/**
|
/**
|
||||||
* Called from NetLoop in net/net.c before each packet
|
* Called from NetLoop in net/net.c before each packet
|
||||||
*/
|
*/
|
||||||
void NcStart(void)
|
void nc_start(void)
|
||||||
{
|
{
|
||||||
refresh_settings_from_env();
|
refresh_settings_from_env();
|
||||||
if (!output_packet_len || memcmp(nc_ether, net_null_ethaddr, 6)) {
|
if (!output_packet_len || memcmp(nc_ether, net_null_ethaddr, 6)) {
|
||||||
/* going to check for input packet */
|
/* going to check for input packet */
|
||||||
net_set_udp_handler(nc_handler);
|
net_set_udp_handler(nc_handler);
|
||||||
NetSetTimeout(net_timeout, nc_timeout);
|
NetSetTimeout(net_timeout, nc_timeout_handler);
|
||||||
} else {
|
} else {
|
||||||
/* send arp request */
|
/* send arp request */
|
||||||
uchar *pkt;
|
uchar *pkt;
|
||||||
|
@ -198,8 +199,9 @@ static void nc_send_packet(const char *buf, int len)
|
||||||
if (eth_init() < 0)
|
if (eth_init() < 0)
|
||||||
return;
|
return;
|
||||||
eth_set_last_protocol(NETCONS);
|
eth_set_last_protocol(NETCONS);
|
||||||
} else
|
} else {
|
||||||
eth_init_state_only();
|
eth_init_state_only();
|
||||||
|
}
|
||||||
|
|
||||||
inited = 1;
|
inited = 1;
|
||||||
}
|
}
|
||||||
|
@ -217,7 +219,7 @@ static void nc_send_packet(const char *buf, int len)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nc_start(struct stdio_dev *dev)
|
static int nc_stdio_start(struct stdio_dev *dev)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
|
@ -237,7 +239,7 @@ static int nc_start(struct stdio_dev *dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nc_putc(struct stdio_dev *dev, char c)
|
static void nc_stdio_putc(struct stdio_dev *dev, char c)
|
||||||
{
|
{
|
||||||
if (output_recursion)
|
if (output_recursion)
|
||||||
return;
|
return;
|
||||||
|
@ -248,7 +250,7 @@ static void nc_putc(struct stdio_dev *dev, char c)
|
||||||
output_recursion = 0;
|
output_recursion = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nc_puts(struct stdio_dev *dev, const char *s)
|
static void nc_stdio_puts(struct stdio_dev *dev, const char *s)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
|
@ -267,7 +269,7 @@ static void nc_puts(struct stdio_dev *dev, const char *s)
|
||||||
output_recursion = 0;
|
output_recursion = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nc_getc(struct stdio_dev *dev)
|
static int nc_stdio_getc(struct stdio_dev *dev)
|
||||||
{
|
{
|
||||||
uchar c;
|
uchar c;
|
||||||
|
|
||||||
|
@ -288,7 +290,7 @@ static int nc_getc(struct stdio_dev *dev)
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nc_tstc(struct stdio_dev *dev)
|
static int nc_stdio_tstc(struct stdio_dev *dev)
|
||||||
{
|
{
|
||||||
struct eth_device *eth;
|
struct eth_device *eth;
|
||||||
|
|
||||||
|
@ -321,11 +323,11 @@ int drv_nc_init(void)
|
||||||
|
|
||||||
strcpy(dev.name, "nc");
|
strcpy(dev.name, "nc");
|
||||||
dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM;
|
dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM;
|
||||||
dev.start = nc_start;
|
dev.start = nc_stdio_start;
|
||||||
dev.putc = nc_putc;
|
dev.putc = nc_stdio_putc;
|
||||||
dev.puts = nc_puts;
|
dev.puts = nc_stdio_puts;
|
||||||
dev.getc = nc_getc;
|
dev.getc = nc_stdio_getc;
|
||||||
dev.tstc = nc_tstc;
|
dev.tstc = nc_stdio_tstc;
|
||||||
|
|
||||||
rc = stdio_register(&dev);
|
rc = stdio_register(&dev);
|
||||||
|
|
||||||
|
|
|
@ -640,7 +640,7 @@ int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport,
|
||||||
void net_process_received_packet(uchar *in_packet, int len);
|
void net_process_received_packet(uchar *in_packet, int len);
|
||||||
|
|
||||||
#ifdef CONFIG_NETCONSOLE
|
#ifdef CONFIG_NETCONSOLE
|
||||||
void NcStart(void);
|
void nc_start(void);
|
||||||
int nc_input_packet(uchar *pkt, struct in_addr src_ip, unsigned dest_port,
|
int nc_input_packet(uchar *pkt, struct in_addr src_ip, unsigned dest_port,
|
||||||
unsigned src_port, unsigned len);
|
unsigned src_port, unsigned len);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -417,7 +417,7 @@ restart:
|
||||||
#endif
|
#endif
|
||||||
#if defined (CONFIG_NETCONSOLE) && !(CONFIG_SPL_BUILD)
|
#if defined (CONFIG_NETCONSOLE) && !(CONFIG_SPL_BUILD)
|
||||||
case NETCONS:
|
case NETCONS:
|
||||||
NcStart();
|
nc_start();
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_CMD_SNTP)
|
#if defined(CONFIG_CMD_SNTP)
|
||||||
|
|
Loading…
Reference in New Issue