aboutsummaryrefslogtreecommitdiffstats
path: root/net/x25
diff options
context:
space:
mode:
authorandrew hendry <andrew.hendry@gmail.com>2010-05-16 18:59:41 -0400
committerDavid S. Miller <davem@davemloft.net>2010-05-17 20:39:26 -0400
commitcb863ffd4a04f9f8619f52c01d472a64ccc716bd (patch)
treec65de60a93641c36057b1e10accda36a54f64d76 /net/x25
parentc89af1a30870e04986e2c8d24c0c765de0935f4b (diff)
X25: Move qbit flag to bitfield
Moves the X25 q bit flag from char into a bitfield to allow BKL cleanup. Signed-off-by: Andrew Hendry <andrew.hendry@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/x25')
-rw-r--r--net/x25/af_x25.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index 296e65e01064..720534ce1fd9 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -465,7 +465,10 @@ static int x25_setsockopt(struct socket *sock, int level, int optname,
465 if (get_user(opt, (int __user *)optval)) 465 if (get_user(opt, (int __user *)optval))
466 goto out; 466 goto out;
467 467
468 x25_sk(sk)->qbitincl = !!opt; 468 if (opt)
469 set_bit(X25_Q_BIT_FLAG, &x25_sk(sk)->flags);
470 else
471 clear_bit(X25_Q_BIT_FLAG, &x25_sk(sk)->flags);
469 rc = 0; 472 rc = 0;
470out: 473out:
471 unlock_kernel(); 474 unlock_kernel();
@@ -496,7 +499,7 @@ static int x25_getsockopt(struct socket *sock, int level, int optname,
496 if (put_user(len, optlen)) 499 if (put_user(len, optlen))
497 goto out; 500 goto out;
498 501
499 val = x25_sk(sk)->qbitincl; 502 val = test_bit(X25_Q_BIT_FLAG, &x25_sk(sk)->flags);
500 rc = copy_to_user(optval, &val, len) ? -EFAULT : 0; 503 rc = copy_to_user(optval, &val, len) ? -EFAULT : 0;
501out: 504out:
502 unlock_kernel(); 505 unlock_kernel();
@@ -632,8 +635,8 @@ static struct sock *x25_make_new(struct sock *osk)
632 x25->t22 = ox25->t22; 635 x25->t22 = ox25->t22;
633 x25->t23 = ox25->t23; 636 x25->t23 = ox25->t23;
634 x25->t2 = ox25->t2; 637 x25->t2 = ox25->t2;
638 x25->flags = ox25->flags;
635 x25->facilities = ox25->facilities; 639 x25->facilities = ox25->facilities;
636 x25->qbitincl = ox25->qbitincl;
637 x25->dte_facilities = ox25->dte_facilities; 640 x25->dte_facilities = ox25->dte_facilities;
638 x25->cudmatchlength = ox25->cudmatchlength; 641 x25->cudmatchlength = ox25->cudmatchlength;
639 x25->accptapprv = ox25->accptapprv; 642 x25->accptapprv = ox25->accptapprv;
@@ -1186,7 +1189,7 @@ static int x25_sendmsg(struct kiocb *iocb, struct socket *sock,
1186 * If the Q BIT Include socket option is in force, the first 1189 * If the Q BIT Include socket option is in force, the first
1187 * byte of the user data is the logical value of the Q Bit. 1190 * byte of the user data is the logical value of the Q Bit.
1188 */ 1191 */
1189 if (x25->qbitincl) { 1192 if (test_bit(X25_Q_BIT_FLAG, &x25->flags)) {
1190 qbit = skb->data[0]; 1193 qbit = skb->data[0];
1191 skb_pull(skb, 1); 1194 skb_pull(skb, 1);
1192 } 1195 }
@@ -1242,7 +1245,7 @@ static int x25_sendmsg(struct kiocb *iocb, struct socket *sock,
1242 len = rc; 1245 len = rc;
1243 if (rc < 0) 1246 if (rc < 0)
1244 kfree_skb(skb); 1247 kfree_skb(skb);
1245 else if (x25->qbitincl) 1248 else if (test_bit(X25_Q_BIT_FLAG, &x25->flags))
1246 len++; 1249 len++;
1247 } 1250 }
1248 1251
@@ -1307,7 +1310,7 @@ static int x25_recvmsg(struct kiocb *iocb, struct socket *sock,
1307 /* 1310 /*
1308 * No Q bit information on Interrupt data. 1311 * No Q bit information on Interrupt data.
1309 */ 1312 */
1310 if (x25->qbitincl) { 1313 if (test_bit(X25_Q_BIT_FLAG, &x25->flags)) {
1311 asmptr = skb_push(skb, 1); 1314 asmptr = skb_push(skb, 1);
1312 *asmptr = 0x00; 1315 *asmptr = 0x00;
1313 } 1316 }
@@ -1325,7 +1328,7 @@ static int x25_recvmsg(struct kiocb *iocb, struct socket *sock,
1325 skb_pull(skb, x25->neighbour->extended ? 1328 skb_pull(skb, x25->neighbour->extended ?
1326 X25_EXT_MIN_LEN : X25_STD_MIN_LEN); 1329 X25_EXT_MIN_LEN : X25_STD_MIN_LEN);
1327 1330
1328 if (x25->qbitincl) { 1331 if (test_bit(X25_Q_BIT_FLAG, &x25->flags)) {
1329 asmptr = skb_push(skb, 1); 1332 asmptr = skb_push(skb, 1);
1330 *asmptr = qbit; 1333 *asmptr = qbit;
1331 } 1334 }