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>
This commit is contained in:
parent
c89af1a308
commit
cb863ffd4a
2 changed files with 15 additions and 8 deletions
|
@ -113,6 +113,9 @@ enum {
|
||||||
#define X25_MAX_AE_LEN 40 /* Max num of semi-octets in AE - OSI Nw */
|
#define X25_MAX_AE_LEN 40 /* Max num of semi-octets in AE - OSI Nw */
|
||||||
#define X25_MAX_DTE_FACIL_LEN 21 /* Max length of DTE facility params */
|
#define X25_MAX_DTE_FACIL_LEN 21 /* Max length of DTE facility params */
|
||||||
|
|
||||||
|
/* Bitset in x25_sock->flags for misc flags */
|
||||||
|
#define X25_Q_BIT_FLAG 0
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct x25_route - x25 routing entry
|
* struct x25_route - x25 routing entry
|
||||||
* @node - entry in x25_list_lock
|
* @node - entry in x25_list_lock
|
||||||
|
@ -146,10 +149,11 @@ struct x25_sock {
|
||||||
struct x25_address source_addr, dest_addr;
|
struct x25_address source_addr, dest_addr;
|
||||||
struct x25_neigh *neighbour;
|
struct x25_neigh *neighbour;
|
||||||
unsigned int lci, cudmatchlength;
|
unsigned int lci, cudmatchlength;
|
||||||
unsigned char state, condition, qbitincl, intflag, accptapprv;
|
unsigned char state, condition, intflag, accptapprv;
|
||||||
unsigned short vs, vr, va, vl;
|
unsigned short vs, vr, va, vl;
|
||||||
unsigned long t2, t21, t22, t23;
|
unsigned long t2, t21, t22, t23;
|
||||||
unsigned short fraglen;
|
unsigned short fraglen;
|
||||||
|
unsigned long flags;
|
||||||
struct sk_buff_head ack_queue;
|
struct sk_buff_head ack_queue;
|
||||||
struct sk_buff_head fragment_queue;
|
struct sk_buff_head fragment_queue;
|
||||||
struct sk_buff_head interrupt_in_queue;
|
struct sk_buff_head interrupt_in_queue;
|
||||||
|
|
|
@ -465,7 +465,10 @@ static int x25_setsockopt(struct socket *sock, int level, int optname,
|
||||||
if (get_user(opt, (int __user *)optval))
|
if (get_user(opt, (int __user *)optval))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
x25_sk(sk)->qbitincl = !!opt;
|
if (opt)
|
||||||
|
set_bit(X25_Q_BIT_FLAG, &x25_sk(sk)->flags);
|
||||||
|
else
|
||||||
|
clear_bit(X25_Q_BIT_FLAG, &x25_sk(sk)->flags);
|
||||||
rc = 0;
|
rc = 0;
|
||||||
out:
|
out:
|
||||||
unlock_kernel();
|
unlock_kernel();
|
||||||
|
@ -496,7 +499,7 @@ static int x25_getsockopt(struct socket *sock, int level, int optname,
|
||||||
if (put_user(len, optlen))
|
if (put_user(len, optlen))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
val = x25_sk(sk)->qbitincl;
|
val = test_bit(X25_Q_BIT_FLAG, &x25_sk(sk)->flags);
|
||||||
rc = copy_to_user(optval, &val, len) ? -EFAULT : 0;
|
rc = copy_to_user(optval, &val, len) ? -EFAULT : 0;
|
||||||
out:
|
out:
|
||||||
unlock_kernel();
|
unlock_kernel();
|
||||||
|
@ -632,8 +635,8 @@ static struct sock *x25_make_new(struct sock *osk)
|
||||||
x25->t22 = ox25->t22;
|
x25->t22 = ox25->t22;
|
||||||
x25->t23 = ox25->t23;
|
x25->t23 = ox25->t23;
|
||||||
x25->t2 = ox25->t2;
|
x25->t2 = ox25->t2;
|
||||||
|
x25->flags = ox25->flags;
|
||||||
x25->facilities = ox25->facilities;
|
x25->facilities = ox25->facilities;
|
||||||
x25->qbitincl = ox25->qbitincl;
|
|
||||||
x25->dte_facilities = ox25->dte_facilities;
|
x25->dte_facilities = ox25->dte_facilities;
|
||||||
x25->cudmatchlength = ox25->cudmatchlength;
|
x25->cudmatchlength = ox25->cudmatchlength;
|
||||||
x25->accptapprv = ox25->accptapprv;
|
x25->accptapprv = ox25->accptapprv;
|
||||||
|
@ -1186,7 +1189,7 @@ static int x25_sendmsg(struct kiocb *iocb, struct socket *sock,
|
||||||
* If the Q BIT Include socket option is in force, the first
|
* If the Q BIT Include socket option is in force, the first
|
||||||
* byte of the user data is the logical value of the Q Bit.
|
* byte of the user data is the logical value of the Q Bit.
|
||||||
*/
|
*/
|
||||||
if (x25->qbitincl) {
|
if (test_bit(X25_Q_BIT_FLAG, &x25->flags)) {
|
||||||
qbit = skb->data[0];
|
qbit = skb->data[0];
|
||||||
skb_pull(skb, 1);
|
skb_pull(skb, 1);
|
||||||
}
|
}
|
||||||
|
@ -1242,7 +1245,7 @@ static int x25_sendmsg(struct kiocb *iocb, struct socket *sock,
|
||||||
len = rc;
|
len = rc;
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
else if (x25->qbitincl)
|
else if (test_bit(X25_Q_BIT_FLAG, &x25->flags))
|
||||||
len++;
|
len++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1307,7 +1310,7 @@ static int x25_recvmsg(struct kiocb *iocb, struct socket *sock,
|
||||||
/*
|
/*
|
||||||
* No Q bit information on Interrupt data.
|
* No Q bit information on Interrupt data.
|
||||||
*/
|
*/
|
||||||
if (x25->qbitincl) {
|
if (test_bit(X25_Q_BIT_FLAG, &x25->flags)) {
|
||||||
asmptr = skb_push(skb, 1);
|
asmptr = skb_push(skb, 1);
|
||||||
*asmptr = 0x00;
|
*asmptr = 0x00;
|
||||||
}
|
}
|
||||||
|
@ -1325,7 +1328,7 @@ static int x25_recvmsg(struct kiocb *iocb, struct socket *sock,
|
||||||
skb_pull(skb, x25->neighbour->extended ?
|
skb_pull(skb, x25->neighbour->extended ?
|
||||||
X25_EXT_MIN_LEN : X25_STD_MIN_LEN);
|
X25_EXT_MIN_LEN : X25_STD_MIN_LEN);
|
||||||
|
|
||||||
if (x25->qbitincl) {
|
if (test_bit(X25_Q_BIT_FLAG, &x25->flags)) {
|
||||||
asmptr = skb_push(skb, 1);
|
asmptr = skb_push(skb, 1);
|
||||||
*asmptr = qbit;
|
*asmptr = qbit;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue