mirror of
https://github.com/Stichting-MINIX-Research-Foundation/u-boot.git
synced 2025-09-19 08:54:48 -04:00
net: cosmetic: netconsole.c checkpatch compliance
Requires: --ignore CONSIDER_KSTRTO Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
13dfe94379
commit
e1902ac698
@ -29,16 +29,16 @@
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
static char input_buffer[512];
|
||||
static int input_size = 0; /* char count in input buffer */
|
||||
static int input_offset = 0; /* offset to valid chars in input buffer */
|
||||
static int input_recursion = 0;
|
||||
static int output_recursion = 0;
|
||||
static int input_size; /* char count in input buffer */
|
||||
static int input_offset; /* offset to valid chars in input buffer */
|
||||
static int input_recursion;
|
||||
static int output_recursion;
|
||||
static int net_timeout;
|
||||
static uchar nc_ether[6]; /* server enet address */
|
||||
static IPaddr_t nc_ip; /* server ip */
|
||||
static short nc_port; /* source/target port */
|
||||
static const char *output_packet; /* used by first send udp */
|
||||
static int output_packet_len = 0;
|
||||
static int output_packet_len;
|
||||
|
||||
static void nc_wait_arp_handler(uchar *pkt, unsigned dest,
|
||||
IPaddr_t sip, unsigned src,
|
||||
@ -71,7 +71,8 @@ void NcStart (void)
|
||||
NetSetHandler(nc_wait_arp_handler);
|
||||
pkt = (uchar *)NetTxPacket + NetEthHdrSize() + IP_HDR_SIZE;
|
||||
memcpy(pkt, output_packet, output_packet_len);
|
||||
NetSendUDPPacket (nc_ether, nc_ip, nc_port, nc_port, output_packet_len);
|
||||
NetSendUDPPacket(nc_ether, nc_ip, nc_port, nc_port,
|
||||
output_packet_len);
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,18 +83,18 @@ int nc_input_packet (uchar * pkt, unsigned dest, unsigned src, unsigned len)
|
||||
if (dest != nc_port || !len)
|
||||
return 0; /* not for us */
|
||||
|
||||
if (input_size == sizeof input_buffer)
|
||||
if (input_size == sizeof(input_buffer))
|
||||
return 1; /* no space */
|
||||
if (len > sizeof input_buffer - input_size)
|
||||
len = sizeof input_buffer - input_size;
|
||||
if (len > sizeof(input_buffer) - input_size)
|
||||
len = sizeof(input_buffer) - input_size;
|
||||
|
||||
end = input_offset + input_size;
|
||||
if (end > sizeof input_buffer)
|
||||
end -= sizeof input_buffer;
|
||||
if (end > sizeof(input_buffer))
|
||||
end -= sizeof(input_buffer);
|
||||
|
||||
chunk = len;
|
||||
if (end + len > sizeof input_buffer) {
|
||||
chunk = sizeof input_buffer - end;
|
||||
if (end + len > sizeof(input_buffer)) {
|
||||
chunk = sizeof(input_buffer) - end;
|
||||
memcpy(input_buffer, pkt + chunk, len - chunk);
|
||||
}
|
||||
memcpy(input_buffer + end, pkt, chunk);
|
||||
@ -111,9 +112,9 @@ static void nc_send_packet (const char *buf, int len)
|
||||
uchar *ether;
|
||||
IPaddr_t ip;
|
||||
|
||||
if ((eth = eth_get_dev ()) == NULL) {
|
||||
eth = eth_get_dev();
|
||||
if (eth == NULL)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!memcmp(nc_ether, NetEtherNullAddr, 6)) {
|
||||
if (eth->state == ETH_STATE_ACTIVE)
|
||||
@ -152,7 +153,8 @@ static int nc_start(void)
|
||||
nc_ip = getenv_IPaddr("ncip");
|
||||
if (!nc_ip)
|
||||
return -1; /* ncip is 0.0.0.0 */
|
||||
if ((p = strchr (getenv ("ncip"), ':')) != NULL)
|
||||
p = strchr(getenv("ncip"), ':');
|
||||
if (p != NULL)
|
||||
nc_port = simple_strtoul(p + 1, NULL, 10);
|
||||
} else
|
||||
nc_ip = ~0; /* ncip is not set */
|
||||
@ -163,9 +165,9 @@ static int nc_start(void)
|
||||
if (nc_ip == ~0 || /* 255.255.255.255 */
|
||||
((netmask & our_ip) == (netmask & nc_ip) && /* on the same net */
|
||||
(netmask | nc_ip) == ~0)) /* broadcast to our net */
|
||||
memset (nc_ether, 0xff, sizeof nc_ether);
|
||||
memset(nc_ether, 0xff, sizeof(nc_ether));
|
||||
else
|
||||
memset (nc_ether, 0, sizeof nc_ether); /* force arp request */
|
||||
memset(nc_ether, 0, sizeof(nc_ether)); /* force arp request */
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -214,8 +216,8 @@ static int nc_getc(void)
|
||||
|
||||
c = input_buffer[input_offset++];
|
||||
|
||||
if (input_offset >= sizeof input_buffer)
|
||||
input_offset -= sizeof input_buffer;
|
||||
if (input_offset >= sizeof(input_buffer))
|
||||
input_offset -= sizeof(input_buffer);
|
||||
input_size--;
|
||||
|
||||
return c;
|
||||
|
Loading…
x
Reference in New Issue
Block a user