Skip to content

Commit

Permalink
net: cosmetic: Fix checkpatch.pl failures in net.c
Browse files Browse the repository at this point in the history
Finish eliminating CamelCase from net.c and other failures

Signed-off-by: Joe Hershberger <[email protected]>
Acked-by: Simon Glass <[email protected]>
  • Loading branch information
jhershbe authored and sjg20 committed Apr 18, 2015
1 parent a34f207 commit bc0571f
Show file tree
Hide file tree
Showing 21 changed files with 181 additions and 184 deletions.
6 changes: 3 additions & 3 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -3340,9 +3340,9 @@ Legacy uImage format:
65 net/eth.c Ethernet found.

-80 common/cmd_net.c usage wrong
80 common/cmd_net.c before calling NetLoop()
-81 common/cmd_net.c some error in NetLoop() occurred
81 common/cmd_net.c NetLoop() back without error
80 common/cmd_net.c before calling net_loop()
-81 common/cmd_net.c some error in net_loop() occurred
81 common/cmd_net.c net_loop() back without error
-82 common/cmd_net.c size == 0 (File with size 0 loaded)
82 common/cmd_net.c trying automatic boot
83 common/cmd_net.c running "source" command
Expand Down
2 changes: 1 addition & 1 deletion common/cmd_elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
* Check to see if we need to tftp the image ourselves before starting
*/
if ((argc == 2) && (strcmp(argv[1], "tftp") == 0)) {
if (NetLoop(TFTPGET) <= 0)
if (net_loop(TFTPGET) <= 0)
return 1;
printf("Automatic boot of VxWorks image at address 0x%08lx ...\n",
addr);
Expand Down
22 changes: 11 additions & 11 deletions common/cmd_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ static void netboot_update_env(void)
setenv("domain", net_nis_domain);

#if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_TIMEOFFSET)
if (NetTimeOffset) {
sprintf(tmp, "%d", NetTimeOffset);
if (net_ntp_time_offset) {
sprintf(tmp, "%d", net_ntp_time_offset);
setenv("timeoffset", tmp);
}
#endif
Expand Down Expand Up @@ -227,14 +227,14 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
}
bootstage_mark(BOOTSTAGE_ID_NET_START);

size = NetLoop(proto);
size = net_loop(proto);
if (size < 0) {
bootstage_error(BOOTSTAGE_ID_NET_NETLOOP_OK);
return CMD_RET_FAILURE;
}
bootstage_mark(BOOTSTAGE_ID_NET_NETLOOP_OK);

/* NetLoop ok, update environment */
/* net_loop ok, update environment */
netboot_update_env();

/* done if no file was loaded (no errors though) */
Expand Down Expand Up @@ -267,7 +267,7 @@ static int do_ping(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (net_ping_ip.s_addr == 0)
return CMD_RET_USAGE;

if (NetLoop(PING) < 0) {
if (net_loop(PING) < 0) {
printf("ping failed; host %s is not alive\n", argv[1]);
return CMD_RET_FAILURE;
}
Expand Down Expand Up @@ -310,7 +310,7 @@ int do_cdp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
int r;

r = NetLoop(CDP);
r = net_loop(CDP);
if (r < 0) {
printf("cdp failed; perhaps not a CISCO switch?\n");
return CMD_RET_FAILURE;
Expand Down Expand Up @@ -349,11 +349,11 @@ int do_sntp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])

toff = getenv("timeoffset");
if (toff == NULL)
NetTimeOffset = 0;
net_ntp_time_offset = 0;
else
NetTimeOffset = simple_strtol(toff, NULL, 10);
net_ntp_time_offset = simple_strtol(toff, NULL, 10);

if (NetLoop(SNTP) < 0) {
if (net_loop(SNTP) < 0) {
printf("SNTP failed: host %pI4 not responding\n",
&net_ntp_server);
return CMD_RET_FAILURE;
Expand Down Expand Up @@ -399,7 +399,7 @@ int do_dns(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
else
net_dns_env_var = NULL;

if (NetLoop(DNS) < 0) {
if (net_loop(DNS) < 0) {
printf("dns lookup of %s failed, check setup\n", argv[1]);
return CMD_RET_FAILURE;
}
Expand All @@ -421,7 +421,7 @@ static int do_link_local(cmd_tbl_t *cmdtp, int flag, int argc,
{
char tmp[22];

if (NetLoop(LINKLOCAL) < 0)
if (net_loop(LINKLOCAL) < 0)
return CMD_RET_FAILURE;

net_gateway.s_addr = 0;
Expand Down
2 changes: 1 addition & 1 deletion common/spl/spl_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void spl_net_load_image(const char *device)
}
if (device)
setenv("ethact", device);
rv = NetLoop(BOOTP);
rv = net_loop(BOOTP);
if (rv < 0) {
printf("Problem booting with BOOTP\n");
hang();
Expand Down
2 changes: 1 addition & 1 deletion common/update.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
/* download the update file */
load_addr = addr;
copy_filename(net_boot_file_name, filename, sizeof(net_boot_file_name));
size = NetLoop(TFTPGET);
size = net_loop(TFTPGET);

if (size < 0)
rv = 1;
Expand Down
4 changes: 2 additions & 2 deletions doc/README.link-local
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ after successful negotiation to enable network access.
-------------

RFC3927 requires that addresses are continuously checked to
avoid conflicts, however this can only happen when the NetLoop
avoid conflicts, however this can only happen when the net_loop
is getting called. It is possible for a conflict to go undetected
until a command that accesses the network is executed.

Using NetConsole is one way to ensure that NetLoop is always
Using NetConsole is one way to ensure that net_loop is always
processing packets and monitoring for conflicts.

This is also not a concern if the feature is use to connect
Expand Down
12 changes: 6 additions & 6 deletions drivers/net/netconsole.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ static int refresh_settings_from_env(void)
}

/**
* Called from NetLoop in net/net.c before each packet
* Called from net_loop in net/net.c before each packet
*/
void nc_start(void)
{
refresh_settings_from_env();
if (!output_packet_len || memcmp(nc_ether, net_null_ethaddr, 6)) {
/* going to check for input packet */
net_set_udp_handler(nc_handler);
NetSetTimeout(net_timeout, nc_timeout_handler);
net_set_timeout_handler(net_timeout, nc_timeout_handler);
} else {
/* send arp request */
uchar *pkt;
Expand Down Expand Up @@ -188,7 +188,7 @@ static void nc_send_packet(const char *buf, int len)
output_packet = buf;
output_packet_len = len;
input_recursion = 1;
NetLoop(NETCONS); /* wait for arp reply and send packet */
net_loop(NETCONS); /* wait for arp reply and send packet */
input_recursion = 0;
output_packet_len = 0;
return;
Expand Down Expand Up @@ -232,7 +232,7 @@ static int nc_stdio_start(struct stdio_dev *dev)

/*
* Initialize the static IP settings and buffer pointers
* incase we call net_send_udp_packet before NetLoop
* incase we call net_send_udp_packet before net_loop
*/
net_init();

Expand Down Expand Up @@ -277,7 +277,7 @@ static int nc_stdio_getc(struct stdio_dev *dev)

net_timeout = 0; /* no timeout */
while (!input_size)
NetLoop(NETCONS);
net_loop(NETCONS);

input_recursion = 0;

Expand Down Expand Up @@ -307,7 +307,7 @@ static int nc_stdio_tstc(struct stdio_dev *dev)
input_recursion = 1;

net_timeout = 1;
NetLoop(NETCONS); /* kind of poll */
net_loop(NETCONS); /* kind of poll */

input_recursion = 0;

Expand Down
18 changes: 7 additions & 11 deletions include/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,6 @@ extern uchar *net_tx_packet; /* THE transmit packet */
extern uchar *net_rx_packets[PKTBUFSRX]; /* Receive packets */
extern uchar *net_rx_packet; /* Current receive packet */
extern int net_rx_packet_len; /* Current rx packet length */
extern unsigned NetIPID; /* IP ID (counting) */
extern const u8 net_bcast_ethaddr[6]; /* Ethernet broadcast address */
extern const u8 net_null_ethaddr[6];

Expand All @@ -494,7 +493,7 @@ extern const u8 net_null_ethaddr[6];
extern ushort net_our_vlan; /* Our VLAN */
extern ushort net_native_vlan; /* Our Native VLAN */

extern int NetRestartWrap; /* Tried all network devices */
extern int net_restart_wrap; /* Tried all network devices */

enum proto_t {
BOOTP, RARP, ARP, TFTPGET, DHCP, PING, DNS, NFS, CDP, NETCONS, SNTP,
Expand Down Expand Up @@ -534,7 +533,7 @@ static inline int is_cdp_packet(const uchar *ethaddr)

#if defined(CONFIG_CMD_SNTP)
extern struct in_addr net_ntp_server; /* the ip address to NTP */
extern int NetTimeOffset; /* offset time from UTC */
extern int net_ntp_time_offset; /* offset time from UTC */
#endif

#if defined(CONFIG_MCAST_TFTP)
Expand All @@ -543,13 +542,10 @@ extern struct in_addr net_mcast_addr;

/* Initialize the network adapter */
void net_init(void);
int NetLoop(enum proto_t);

/* Shutdown adapters and cleanup */
void NetStop(void);
int net_loop(enum proto_t);

/* Load failed. Start again. */
int NetStartAgain(void);
int net_start_again(void);

/* Get size of the ethernet header when we send */
int net_eth_hdr_size(void);
Expand Down Expand Up @@ -599,7 +595,7 @@ void net_set_udp_handler(rxhand_f *); /* Set UDP RX packet handler */
rxhand_f *net_get_arp_handler(void); /* Get ARP RX packet handler */
void net_set_arp_handler(rxhand_f *); /* Set ARP RX packet handler */
void net_set_icmp_handler(rxhand_icmp_f *f); /* Set ICMP RX handler */
void NetSetTimeout(ulong, thand_f *);/* Set timeout handler */
void net_set_timeout_handler(ulong, thand_f *);/* Set timeout handler */

/* Network loop state */
enum net_loop_state {
Expand Down Expand Up @@ -688,7 +684,7 @@ static inline struct in_addr net_read_ip(void *from)
}

/* return ulong *in network byteorder* */
static inline ulong NetReadLong(ulong *from)
static inline ulong net_read_long(ulong *from)
{
ulong l;

Expand All @@ -709,7 +705,7 @@ static inline void net_copy_ip(void *to, void *from)
}

/* copy ulong */
static inline void NetCopyLong(ulong *to, ulong *from)
static inline void net_copy_long(ulong *to, ulong *from)
{
memcpy((void *)to, (void *)from, sizeof(ulong));
}
Expand Down
2 changes: 1 addition & 1 deletion net/arp.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void arp_timeout_check(void)
if (arp_wait_try >= ARP_TIMEOUT_COUNT) {
puts("\nARP Retry count exceeded; starting again\n");
arp_wait_try = 0;
NetStartAgain();
net_start_again();
} else {
arp_wait_timer_start = t;
arp_request();
Expand Down
33 changes: 17 additions & 16 deletions net/bootp.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ static int check_packet(uchar *pkt, unsigned dest, unsigned src, unsigned len)
retval = -4;
else if (bp->bp_hlen != HWL_ETHER)
retval = -5;
else if (!bootp_match_id(NetReadLong((ulong *)&bp->bp_id)))
else if (!bootp_match_id(net_read_long((ulong *)&bp->bp_id)))
retval = -6;

debug("Filtering pkt = %d\n", retval);
Expand Down Expand Up @@ -356,10 +356,11 @@ static void bootp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
store_net_params(bp); /* Store net parameters from reply */

/* Retrieve extended information (we must parse the vendor area) */
if (NetReadLong((ulong *)&bp->bp_vend[0]) == htonl(BOOTP_VENDOR_MAGIC))
if (net_read_long((ulong *)&bp->bp_vend[0]) ==
htonl(BOOTP_VENDOR_MAGIC))
bootp_process_vendor((uchar *)&bp->bp_vend[4], len);

NetSetTimeout(0, (thand_f *)0);
net_set_timeout_handler(0, (thand_f *)0);
bootstage_mark_name(BOOTSTAGE_ID_BOOTP_STOP, "bootp_stop");

debug("Got good BOOTP\n");
Expand All @@ -381,13 +382,13 @@ static void bootp_timeout_handler(void)
net_set_state(NETLOOP_FAIL);
#else
puts("\nRetry time exceeded; starting again\n");
NetStartAgain();
net_start_again();
#endif
} else {
bootp_timeout *= 2;
if (bootp_timeout > 2000)
bootp_timeout = 2000;
NetSetTimeout(bootp_timeout, bootp_timeout_handler);
net_set_timeout_handler(bootp_timeout, bootp_timeout_handler);
bootp_request();
}
}
Expand Down Expand Up @@ -740,7 +741,7 @@ void bootp_request(void)
bootp_id += get_timer(0);
bootp_id = htonl(bootp_id);
bootp_add_id(bootp_id);
NetCopyLong(&bp->bp_id, &bootp_id);
net_copy_long(&bp->bp_id, &bootp_id);

/*
* Calculate proper packet lengths taking into account the
Expand All @@ -750,7 +751,7 @@ void bootp_request(void)
pktlen = eth_hdr_size + IP_UDP_HDR_SIZE + iplen;
bcast_ip.s_addr = 0xFFFFFFFFL;
net_set_udp_header(iphdr, bcast_ip, PORT_BOOTPS, PORT_BOOTPC, iplen);
NetSetTimeout(bootp_timeout, bootp_timeout_handler);
net_set_timeout_handler(bootp_timeout, bootp_timeout_handler);

#if defined(CONFIG_CMD_DHCP)
dhcp_state = SELECTING;
Expand Down Expand Up @@ -778,9 +779,9 @@ static void dhcp_process_options(uchar *popt, struct bootp_hdr *bp)
break;
#if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_TIMEOFFSET)
case 2: /* Time offset */
to_ptr = &NetTimeOffset;
NetCopyLong((ulong *)to_ptr, (ulong *)(popt + 2));
NetTimeOffset = ntohl(NetTimeOffset);
to_ptr = &net_ntp_time_offset;
net_copy_long((ulong *)to_ptr, (ulong *)(popt + 2));
net_ntp_time_offset = ntohl(net_ntp_time_offset);
break;
#endif
case 3:
Expand Down Expand Up @@ -815,7 +816,7 @@ static void dhcp_process_options(uchar *popt, struct bootp_hdr *bp)
break;
#endif
case 51:
NetCopyLong(&dhcp_leasetime, (ulong *) (popt + 2));
net_copy_long(&dhcp_leasetime, (ulong *)(popt + 2));
break;
case 53: /* Ignore Message Type Option */
break;
Expand Down Expand Up @@ -869,7 +870,7 @@ static void dhcp_process_options(uchar *popt, struct bootp_hdr *bp)

static int dhcp_message_type(unsigned char *popt)
{
if (NetReadLong((ulong *)popt) != htonl(BOOTP_VENDOR_MAGIC))
if (net_read_long((ulong *)popt) != htonl(BOOTP_VENDOR_MAGIC))
return -1;

popt += 4;
Expand Down Expand Up @@ -923,7 +924,7 @@ static void dhcp_send_request_packet(struct bootp_hdr *bp_offer)
* ID is the id of the OFFER packet
*/

NetCopyLong(&bp->bp_id, &bp_offer->bp_id);
net_copy_long(&bp->bp_id, &bp_offer->bp_id);

/*
* Copy options from OFFER packet if present
Expand Down Expand Up @@ -982,11 +983,11 @@ static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
debug("TRANSITIONING TO REQUESTING STATE\n");
dhcp_state = REQUESTING;

if (NetReadLong((ulong *)&bp->bp_vend[0]) ==
if (net_read_long((ulong *)&bp->bp_vend[0]) ==
htonl(BOOTP_VENDOR_MAGIC))
dhcp_process_options((u8 *)&bp->bp_vend[4], bp);

NetSetTimeout(5000, bootp_timeout_handler);
net_set_timeout_handler(5000, bootp_timeout_handler);
dhcp_send_request_packet(bp);
#ifdef CONFIG_SYS_BOOTFILE_PREFIX
}
Expand All @@ -998,7 +999,7 @@ static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
debug("DHCP State: REQUESTING\n");

if (dhcp_message_type((u8 *)bp->bp_vend) == DHCP_ACK) {
if (NetReadLong((ulong *)&bp->bp_vend[0]) ==
if (net_read_long((ulong *)&bp->bp_vend[0]) ==
htonl(BOOTP_VENDOR_MAGIC))
dhcp_process_options((u8 *)&bp->bp_vend[4], bp);
/* Store net params from reply */
Expand Down
Loading

0 comments on commit bc0571f

Please sign in to comment.