Commit df3856a0 authored by Ralf Bächle's avatar Ralf Bächle

More reformatting of switch statements.

parent f7c8ad70
...@@ -533,7 +533,6 @@ static int nr_release(struct socket *sock) ...@@ -533,7 +533,6 @@ static int nr_release(struct socket *sock)
nr = nr_sk(sk); nr = nr_sk(sk);
switch (nr->state) { switch (nr->state) {
case NR_STATE_0: case NR_STATE_0:
case NR_STATE_1: case NR_STATE_1:
case NR_STATE_2: case NR_STATE_2:
...@@ -1160,7 +1159,6 @@ static int nr_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -1160,7 +1159,6 @@ static int nr_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
return dev_ioctl(cmd, (void *)arg); return dev_ioctl(cmd, (void *)arg);
} }
/*NOTREACHED*/
return 0; return 0;
} }
......
...@@ -71,10 +71,10 @@ static int nr_queue_rx_frame(struct sock *sk, struct sk_buff *skb, int more) ...@@ -71,10 +71,10 @@ static int nr_queue_rx_frame(struct sock *sk, struct sk_buff *skb, int more)
* The handling of the timer(s) is in file nr_timer.c. * The handling of the timer(s) is in file nr_timer.c.
* Handling of state 0 and connection release is in netrom.c. * Handling of state 0 and connection release is in netrom.c.
*/ */
static int nr_state1_machine(struct sock *sk, struct sk_buff *skb, int frametype) static int nr_state1_machine(struct sock *sk, struct sk_buff *skb,
int frametype)
{ {
switch (frametype) { switch (frametype) {
case NR_CONNACK: { case NR_CONNACK: {
nr_cb *nr = nr_sk(sk); nr_cb *nr = nr_sk(sk);
...@@ -111,10 +111,10 @@ static int nr_state1_machine(struct sock *sk, struct sk_buff *skb, int frametype ...@@ -111,10 +111,10 @@ static int nr_state1_machine(struct sock *sk, struct sk_buff *skb, int frametype
* The handling of the timer(s) is in file nr_timer.c * The handling of the timer(s) is in file nr_timer.c
* Handling of state 0 and connection release is in netrom.c. * Handling of state 0 and connection release is in netrom.c.
*/ */
static int nr_state2_machine(struct sock *sk, struct sk_buff *skb, int frametype) static int nr_state2_machine(struct sock *sk, struct sk_buff *skb,
int frametype)
{ {
switch (frametype) { switch (frametype) {
case NR_CONNACK | NR_CHOKE_FLAG: case NR_CONNACK | NR_CHOKE_FLAG:
nr_disconnect(sk, ECONNRESET); nr_disconnect(sk, ECONNRESET);
break; break;
...@@ -151,7 +151,6 @@ static int nr_state3_machine(struct sock *sk, struct sk_buff *skb, int frametype ...@@ -151,7 +151,6 @@ static int nr_state3_machine(struct sock *sk, struct sk_buff *skb, int frametype
ns = skb->data[17]; ns = skb->data[17];
switch (frametype) { switch (frametype) {
case NR_CONNREQ: case NR_CONNREQ:
nr_write_internal(sk, NR_CONNACK); nr_write_internal(sk, NR_CONNACK);
break; break;
......
...@@ -204,9 +204,14 @@ static int nr_add_node(ax25_address *nr, const char *mnemonic, ax25_address *ax2 ...@@ -204,9 +204,14 @@ static int nr_add_node(ax25_address *nr, const char *mnemonic, ax25_address *ax2
} }
if (nr_node->routes[2].quality > nr_node->routes[1].quality) { if (nr_node->routes[2].quality > nr_node->routes[1].quality) {
switch (nr_node->which) { switch (nr_node->which) {
case 1: nr_node->which = 2; break; case 1: nr_node->which = 2;
case 2: nr_node->which = 1; break; break;
default: break;
case 2: nr_node->which = 1;
break;
default:
break;
} }
nr_route = nr_node->routes[1]; nr_route = nr_node->routes[1];
nr_node->routes[1] = nr_node->routes[2]; nr_node->routes[1] = nr_node->routes[2];
...@@ -215,8 +220,12 @@ static int nr_add_node(ax25_address *nr, const char *mnemonic, ax25_address *ax2 ...@@ -215,8 +220,12 @@ static int nr_add_node(ax25_address *nr, const char *mnemonic, ax25_address *ax2
case 2: case 2:
if (nr_node->routes[1].quality > nr_node->routes[0].quality) { if (nr_node->routes[1].quality > nr_node->routes[0].quality) {
switch (nr_node->which) { switch (nr_node->which) {
case 0: nr_node->which = 1; break; case 0: nr_node->which = 1;
case 1: nr_node->which = 0; break; break;
case 1: nr_node->which = 0;
break;
default: break; default: break;
} }
nr_route = nr_node->routes[0]; nr_route = nr_node->routes[0];
...@@ -435,7 +444,6 @@ static int nr_dec_obs(void) ...@@ -435,7 +444,6 @@ static int nr_dec_obs(void)
for (i = 0; i < s->count; i++) { for (i = 0; i < s->count; i++) {
switch (s->routes[i].obs_count) { switch (s->routes[i].obs_count) {
case 0: /* A locked entry */ case 0: /* A locked entry */
break; break;
...@@ -600,7 +608,6 @@ int nr_rt_ioctl(unsigned int cmd, void *arg) ...@@ -600,7 +608,6 @@ int nr_rt_ioctl(unsigned int cmd, void *arg)
struct net_device *dev; struct net_device *dev;
switch (cmd) { switch (cmd) {
case SIOCADDRT: case SIOCADDRT:
if (copy_from_user(&nr_route, arg, sizeof(struct nr_route_struct))) if (copy_from_user(&nr_route, arg, sizeof(struct nr_route_struct)))
return -EFAULT; return -EFAULT;
......
...@@ -156,7 +156,6 @@ void nr_write_internal(struct sock *sk, int frametype) ...@@ -156,7 +156,6 @@ void nr_write_internal(struct sock *sk, int frametype)
dptr = skb_put(skb, skb_tailroom(skb)); dptr = skb_put(skb, skb_tailroom(skb));
switch (frametype & 0x0F) { switch (frametype & 0x0F) {
case NR_CONNREQ: case NR_CONNREQ:
timeout = nr->t1 / HZ; timeout = nr->t1 / HZ;
*dptr++ = nr->my_index; *dptr++ = nr->my_index;
......
...@@ -136,7 +136,6 @@ static void nr_heartbeat_expiry(unsigned long param) ...@@ -136,7 +136,6 @@ static void nr_heartbeat_expiry(unsigned long param)
nr_cb *nr = nr_sk(sk); nr_cb *nr = nr_sk(sk);
switch (nr->state) { switch (nr->state) {
case NR_STATE_0: case NR_STATE_0:
/* Magic here: If we listen() and a new link dies before it /* Magic here: If we listen() and a new link dies before it
is accepted() it isn't 'dead' so doesn't get removed. */ is accepted() it isn't 'dead' so doesn't get removed. */
...@@ -213,7 +212,6 @@ static void nr_t1timer_expiry(unsigned long param) ...@@ -213,7 +212,6 @@ static void nr_t1timer_expiry(unsigned long param)
nr_cb *nr = nr_sk(sk); nr_cb *nr = nr_sk(sk);
switch (nr->state) { switch (nr->state) {
case NR_STATE_1: case NR_STATE_1:
if (nr->n2count == nr->n2) { if (nr->n2count == nr->n2) {
nr_disconnect(sk, ETIMEDOUT); nr_disconnect(sk, ETIMEDOUT);
......
...@@ -629,7 +629,6 @@ static int rose_release(struct socket *sock) ...@@ -629,7 +629,6 @@ static int rose_release(struct socket *sock)
rose = rose_sk(sk); rose = rose_sk(sk);
switch (rose->state) { switch (rose->state) {
case ROSE_STATE_0: case ROSE_STATE_0:
rose_disconnect(sk, 0, -1, -1); rose_disconnect(sk, 0, -1, -1);
rose_destroy_socket(sk); rose_destroy_socket(sk);
...@@ -1308,7 +1307,8 @@ static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -1308,7 +1307,8 @@ static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
case SIOCADDRT: case SIOCADDRT:
case SIOCDELRT: case SIOCDELRT:
case SIOCRSCLRRT: case SIOCRSCLRRT:
if (!capable(CAP_NET_ADMIN)) return -EPERM; if (!capable(CAP_NET_ADMIN))
return -EPERM;
return rose_rt_ioctl(cmd, (void *)arg); return rose_rt_ioctl(cmd, (void *)arg);
case SIOCRSGCAUSE: { case SIOCRSGCAUSE: {
...@@ -1357,7 +1357,6 @@ static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -1357,7 +1357,6 @@ static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
return dev_ioctl(cmd, (void *)arg); return dev_ioctl(cmd, (void *)arg);
} }
/*NOTREACHED*/
return 0; return 0;
} }
......
...@@ -44,7 +44,6 @@ static int rose_state1_machine(struct sock *sk, struct sk_buff *skb, int framety ...@@ -44,7 +44,6 @@ static int rose_state1_machine(struct sock *sk, struct sk_buff *skb, int framety
rose_cb *rose = rose_sk(sk); rose_cb *rose = rose_sk(sk);
switch (frametype) { switch (frametype) {
case ROSE_CALL_ACCEPTED: case ROSE_CALL_ACCEPTED:
rose_stop_timer(sk); rose_stop_timer(sk);
rose_start_idletimer(sk); rose_start_idletimer(sk);
...@@ -82,7 +81,6 @@ static int rose_state2_machine(struct sock *sk, struct sk_buff *skb, int framety ...@@ -82,7 +81,6 @@ static int rose_state2_machine(struct sock *sk, struct sk_buff *skb, int framety
rose_cb *rose = rose_sk(sk); rose_cb *rose = rose_sk(sk);
switch (frametype) { switch (frametype) {
case ROSE_CLEAR_REQUEST: case ROSE_CLEAR_REQUEST:
rose_write_internal(sk, ROSE_CLEAR_CONFIRMATION); rose_write_internal(sk, ROSE_CLEAR_CONFIRMATION);
rose_disconnect(sk, 0, skb->data[3], skb->data[4]); rose_disconnect(sk, 0, skb->data[3], skb->data[4]);
...@@ -112,7 +110,6 @@ static int rose_state3_machine(struct sock *sk, struct sk_buff *skb, int framety ...@@ -112,7 +110,6 @@ static int rose_state3_machine(struct sock *sk, struct sk_buff *skb, int framety
int queued = 0; int queued = 0;
switch (frametype) { switch (frametype) {
case ROSE_RESET_REQUEST: case ROSE_RESET_REQUEST:
rose_stop_timer(sk); rose_stop_timer(sk);
rose_start_idletimer(sk); rose_start_idletimer(sk);
...@@ -221,7 +218,6 @@ static int rose_state4_machine(struct sock *sk, struct sk_buff *skb, int framety ...@@ -221,7 +218,6 @@ static int rose_state4_machine(struct sock *sk, struct sk_buff *skb, int framety
rose_cb *rose = rose_sk(sk); rose_cb *rose = rose_sk(sk);
switch (frametype) { switch (frametype) {
case ROSE_RESET_REQUEST: case ROSE_RESET_REQUEST:
rose_write_internal(sk, ROSE_RESET_CONFIRMATION); rose_write_internal(sk, ROSE_RESET_CONFIRMATION);
case ROSE_RESET_CONFIRMATION: case ROSE_RESET_CONFIRMATION:
......
...@@ -136,7 +136,6 @@ void rose_write_internal(struct sock *sk, int frametype) ...@@ -136,7 +136,6 @@ void rose_write_internal(struct sock *sk, int frametype)
lci2 = (rose->lci >> 0) & 0xFF; lci2 = (rose->lci >> 0) & 0xFF;
switch (frametype) { switch (frametype) {
case ROSE_CALL_REQUEST: case ROSE_CALL_REQUEST:
*dptr++ = ROSE_GFI | lci1; *dptr++ = ROSE_GFI | lci1;
*dptr++ = lci2; *dptr++ = lci2;
...@@ -354,7 +353,8 @@ static int rose_parse_ccitt(unsigned char *p, struct rose_facilities_struct *fac ...@@ -354,7 +353,8 @@ static int rose_parse_ccitt(unsigned char *p, struct rose_facilities_struct *fac
return n; return n;
} }
int rose_parse_facilities(unsigned char *p, struct rose_facilities_struct *facilities) int rose_parse_facilities(unsigned char *p,
struct rose_facilities_struct *facilities)
{ {
int facilities_len, len; int facilities_len, len;
...@@ -387,8 +387,8 @@ int rose_parse_facilities(unsigned char *p, struct rose_facilities_struct *facil ...@@ -387,8 +387,8 @@ int rose_parse_facilities(unsigned char *p, struct rose_facilities_struct *facil
p++; p++;
break; break;
} }
} } else
else break; /* Error in facilities format */ break; /* Error in facilities format */
} }
return 1; return 1;
......
...@@ -131,7 +131,6 @@ static void rose_heartbeat_expiry(unsigned long param) ...@@ -131,7 +131,6 @@ static void rose_heartbeat_expiry(unsigned long param)
rose_cb *rose = rose_sk(sk); rose_cb *rose = rose_sk(sk);
switch (rose->state) { switch (rose->state) {
case ROSE_STATE_0: case ROSE_STATE_0:
/* Magic here: If we listen() and a new link dies before it /* Magic here: If we listen() and a new link dies before it
is accepted() it isn't 'dead' so doesn't get removed. */ is accepted() it isn't 'dead' so doesn't get removed. */
...@@ -166,7 +165,6 @@ static void rose_timer_expiry(unsigned long param) ...@@ -166,7 +165,6 @@ static void rose_timer_expiry(unsigned long param)
rose_cb *rose = rose_sk(sk); rose_cb *rose = rose_sk(sk);
switch (rose->state) { switch (rose->state) {
case ROSE_STATE_1: /* T1 */ case ROSE_STATE_1: /* T1 */
case ROSE_STATE_4: /* T2 */ case ROSE_STATE_4: /* T2 */
rose_write_internal(sk, ROSE_CLEAR_REQUEST); rose_write_internal(sk, ROSE_CLEAR_REQUEST);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment