aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormaximilian attems <max@stro.at>2011-07-07 17:54:47 +0200
committermaximilian attems <max@stro.at>2011-07-08 13:27:03 +0200
commitb0257eb54e05fa6c88859bb6f3d185cb62930c53 (patch)
tree5ff27024431215c283f74b64109dbb473477f1fd
parentf506a82a16fa45ad34500daa70bc2ef08509d49b (diff)
downloadklibc-b0257eb54e05fa6c88859bb6f3d185cb62930c53.tar.gz
[klibc] ipconfig: reduce checkpatch noise
fix for better codingstyle: ERROR: "foo * bar" should be "foo *bar" .. ERROR: switch and case should be at the same indent WARNING: braces {} are not necessary for single statement blocks WARNING: labels should not be indented .. WARNING: braces {} are not necessary for any arm of this statement .. ERROR: do not use assignment in if condition ERROR: space prohibited after that '&' (ctx:WxW) Signed-off-by: maximilian attems <max@stro.at>
-rw-r--r--usr/kinit/ipconfig/dhcp_proto.c2
-rw-r--r--usr/kinit/ipconfig/main.c42
-rw-r--r--usr/kinit/ipconfig/packet.c4
3 files changed, 23 insertions, 25 deletions
diff --git a/usr/kinit/ipconfig/dhcp_proto.c b/usr/kinit/ipconfig/dhcp_proto.c
index 993db520aa55d..afd2eca5b1351 100644
--- a/usr/kinit/ipconfig/dhcp_proto.c
+++ b/usr/kinit/ipconfig/dhcp_proto.c
@@ -80,7 +80,7 @@ static struct iovec dhcp_request_iov[DHCP_IOV_LEN] = {
* 6 = DHCPNACK
*/
static int dhcp_parse(struct netdev *dev, struct bootp_hdr *hdr,
- uint8_t * exts, int extlen)
+ uint8_t *exts, int extlen)
{
uint8_t type = 0;
uint32_t serverid = INADDR_NONE;
diff --git a/usr/kinit/ipconfig/main.c b/usr/kinit/ipconfig/main.c
index 8dc6cbe736d21..8782ae7feb64d 100644
--- a/usr/kinit/ipconfig/main.c
+++ b/usr/kinit/ipconfig/main.c
@@ -100,19 +100,19 @@ static void configure_device(struct netdev *dev)
* Always start with a single quote ('), then leave all characters
* except ' and ! unchanged.
*/
-static void write_option(FILE* f, const char* name, const char* chr)
+static void write_option(FILE *f, const char *name, const char *chr)
{
fprintf(f, "%s='", name);
while (*chr) {
switch (*chr) {
- case '!':
- case '\'':
- fprintf(f, "'\\%c'", *chr);
- break;
- default:
- fprintf(f, "%c", *chr);
- break;
+ case '!':
+ case '\'':
+ fprintf(f, "'\\%c'", *chr);
+ break;
+ default:
+ fprintf(f, "%c", *chr);
+ break;
}
++chr;
}
@@ -341,9 +341,8 @@ static int do_pkt_recv(int pkt_fd, time_t now)
int ret = 0;
struct state *s;
- for (s = slist; s; s = s->next) {
+ for (s = slist; s; s = s->next)
ret |= process_receive_event(s, now);
- }
return ret;
}
@@ -430,7 +429,7 @@ static int loop(void)
timeout_ms -= delta_ms;
}
}
- bail:
+bail:
packet_close();
return rc;
@@ -451,13 +450,12 @@ static int add_one_dev(struct netdev *dev)
/*
* Select the state that we start from.
*/
- if (dev->caps & CAP_DHCP && dev->ip_addr == INADDR_ANY) {
+ if (dev->caps & CAP_DHCP && dev->ip_addr == INADDR_ANY)
state->restart_state = state->state = DEVST_DHCPDISC;
- } else if (dev->caps & CAP_DHCP) {
+ else if (dev->caps & CAP_DHCP)
state->restart_state = state->state = DEVST_DHCPREQ;
- } else if (dev->caps & CAP_BOOTP) {
+ else if (dev->caps & CAP_BOOTP)
state->restart_state = state->state = DEVST_BOOTP;
- }
state->next = slist;
slist = state;
@@ -465,7 +463,7 @@ static int add_one_dev(struct netdev *dev)
return 0;
}
-static void parse_addr(uint32_t * addr, const char *ip)
+static void parse_addr(uint32_t *addr, const char *ip)
{
struct in_addr in;
if (inet_aton(ip, &in) == 0) {
@@ -497,7 +495,7 @@ static unsigned int parse_proto(const char *ip)
fprintf(stderr, "%s: invalid protocol '%s'\n", progname, ip);
longjmp(abort_buf, 1);
}
- bail:
+bail:
return caps;
}
@@ -584,11 +582,10 @@ static int parse_device(struct netdev *dev, const char *ip)
static void bringup_device(struct netdev *dev)
{
if (netdev_up(dev) == 0) {
- if (dev->caps) {
+ if (dev->caps)
add_one_dev(dev);
- } else {
+ else
complete_device(dev);
- }
}
}
@@ -646,7 +643,7 @@ static struct netdev *add_device(const char *info)
dev->caps & CAP_BOOTP ? " BOOTP" : "",
dev->caps & CAP_RARP ? " RARP" : "");
return dev;
- bail:
+bail:
free(dev);
return NULL;
}
@@ -694,7 +691,8 @@ static int add_all_devices(struct netdev *template)
(flags & (IFF_BROADCAST | IFF_POINTOPOINT))) {
dprintf("Trying to bring up %s\n", de->d_name);
- if (!(dev = add_device(de->d_name)))
+ dev = add_device(de->d_name);
+ if (!dev)
continue;
bringup_one_dev(template, dev);
}
diff --git a/usr/kinit/ipconfig/packet.c b/usr/kinit/ipconfig/packet.c
index ea5a25d23a1ea..446073aba2ae3 100644
--- a/usr/kinit/ipconfig/packet.c
+++ b/usr/kinit/ipconfig/packet.c
@@ -156,7 +156,7 @@ int packet_send(struct netdev *dev, struct iovec *iov, int iov_len)
ipudp_hdrs.ip.tot_len = htons(len);
ipudp_hdrs.ip.check = 0;
- ipudp_hdrs.ip.check = ip_checksum((uint16_t *) & ipudp_hdrs.ip,
+ ipudp_hdrs.ip.check = ip_checksum((uint16_t *) &ipudp_hdrs.ip,
ipudp_hdrs.ip.ihl);
ipudp_hdrs.udp.len = htons(len - sizeof(struct iphdr));
@@ -186,7 +186,7 @@ void packet_discard(struct netdev *dev)
* 0 = Discarded packet (non-DHCP/BOOTP traffic)
* >0 = Size of packet
*/
-int packet_recv(struct netdev* dev, struct iovec *iov, int iov_len)
+int packet_recv(struct netdev *dev, struct iovec *iov, int iov_len)
{
struct iphdr *ip, iph;
struct udphdr *udp;