Commit cc008b4b authored by Thomas Graf's avatar Thomas Graf

[NET] Convert sk_debug into SOCK_DBG flag

Signed-off-by: default avatarThomas Graf <tgraf@suug.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7f96df9b
......@@ -61,10 +61,10 @@
* the other protocols.
*/
/* Define this to get the sk->sk_debug debugging facility. */
/* Define this to get the SOCK_DBG debugging facility. */
#define SOCK_DEBUGGING
#ifdef SOCK_DEBUGGING
#define SOCK_DEBUG(sk, msg...) do { if ((sk) && ((sk)->sk_debug)) \
#define SOCK_DEBUG(sk, msg...) do { if ((sk) && sock_flag((sk), SOCK_DBG)) \
printk(KERN_DEBUG msg); } while (0)
#else
#define SOCK_DEBUG(sk, msg...) do { } while (0)
......@@ -134,7 +134,6 @@ struct sock_common {
* @sk_sndbuf - size of send buffer in bytes
* @sk_flags - %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE, %SO_OOBINLINE settings
* @sk_no_check - %SO_NO_CHECK setting, wether or not checkup packets
* @sk_debug - %SO_DEBUG setting
* @sk_rcvtstamp - %SO_TIMESTAMP setting
* @sk_no_largesend - whether to sent large segments or not
* @sk_route_caps - route capabilities (e.g. %NETIF_F_TSO)
......@@ -208,7 +207,6 @@ struct sock {
int sk_sndbuf;
unsigned long sk_flags;
char sk_no_check;
unsigned char sk_debug;
unsigned char sk_rcvtstamp;
unsigned char sk_no_largesend;
int sk_route_caps;
......@@ -389,6 +387,7 @@ enum sock_flags {
SOCK_TIMESTAMP,
SOCK_ZAPPED,
SOCK_USE_WRITE_QUEUE, /* whether to call sk->sk_write_space in sock_wfree */
SOCK_DBG, /* %SO_DEBUG setting */
};
static inline void sock_set_flag(struct sock *sk, enum sock_flags flag)
......
......@@ -867,10 +867,12 @@ struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev)
sk->sk_protocol = osk->sk_protocol;
sk->sk_rcvbuf = osk->sk_rcvbuf;
sk->sk_sndbuf = osk->sk_sndbuf;
sk->sk_debug = osk->sk_debug;
sk->sk_state = TCP_ESTABLISHED;
sk->sk_sleep = osk->sk_sleep;
if (sock_flag(osk, SOCK_DBG))
sock_set_flag(sk, SOCK_DBG);
if (sock_flag(osk, SOCK_ZAPPED))
sock_set_flag(sk, SOCK_ZAPPED);
......
......@@ -228,8 +228,10 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
{
ret = -EACCES;
}
else if (valbool)
sock_set_flag(sk, SOCK_DBG);
else
sk->sk_debug = valbool;
sock_reset_flag(sk, SOCK_DBG);
break;
case SO_REUSEADDR:
sk->sk_reuse = valbool;
......@@ -466,7 +468,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
switch(optname)
{
case SO_DEBUG:
v.val = sk->sk_debug;
v.val = sock_flag(sk, SOCK_DBG);
break;
case SO_DONTROUTE:
......
......@@ -475,13 +475,15 @@ static struct sock *nr_make_new(struct sock *osk)
sk->sk_protocol = osk->sk_protocol;
sk->sk_rcvbuf = osk->sk_rcvbuf;
sk->sk_sndbuf = osk->sk_sndbuf;
sk->sk_debug = osk->sk_debug;
sk->sk_state = TCP_ESTABLISHED;
sk->sk_sleep = osk->sk_sleep;
if (sock_flag(osk, SOCK_ZAPPED))
sock_set_flag(sk, SOCK_ZAPPED);
if (sock_flag(osk, SOCK_DBG))
sock_set_flag(sk, SOCK_DBG);
skb_queue_head_init(&nr->ack_queue);
skb_queue_head_init(&nr->reseq_queue);
skb_queue_head_init(&nr->frag_queue);
......
......@@ -572,13 +572,15 @@ static struct sock *rose_make_new(struct sock *osk)
sk->sk_protocol = osk->sk_protocol;
sk->sk_rcvbuf = osk->sk_rcvbuf;
sk->sk_sndbuf = osk->sk_sndbuf;
sk->sk_debug = osk->sk_debug;
sk->sk_state = TCP_ESTABLISHED;
sk->sk_sleep = osk->sk_sleep;
if (sock_flag(osk, SOCK_ZAPPED))
sock_set_flag(sk, SOCK_ZAPPED);
if (sock_flag(osk, SOCK_DBG))
sock_set_flag(sk, SOCK_DBG);
init_timer(&rose->timer);
init_timer(&rose->idletimer);
......
......@@ -468,10 +468,12 @@ static struct sock *wanpipe_make_new(struct sock *osk)
wp_sk(sk)->num = wp_sk(osk)->num;
sk->sk_rcvbuf = osk->sk_rcvbuf;
sk->sk_sndbuf = osk->sk_sndbuf;
sk->sk_debug = osk->sk_debug;
sk->sk_state = WANSOCK_CONNECTING;
sk->sk_sleep = osk->sk_sleep;
if (sock_flag(osk, SOCK_DBG))
sock_set_flag(sk, SOCK_DBG);
return sk;
}
......
......@@ -525,13 +525,15 @@ static struct sock *x25_make_new(struct sock *osk)
sk->sk_protocol = osk->sk_protocol;
sk->sk_rcvbuf = osk->sk_rcvbuf;
sk->sk_sndbuf = osk->sk_sndbuf;
sk->sk_debug = osk->sk_debug;
sk->sk_state = TCP_ESTABLISHED;
sk->sk_sleep = osk->sk_sleep;
sk->sk_backlog_rcv = osk->sk_backlog_rcv;
if (sock_flag(osk, SOCK_ZAPPED))
sock_set_flag(sk, SOCK_ZAPPED);
if (sock_flag(osk, SOCK_DBG))
sock_set_flag(sk, SOCK_DBG);
ox25 = x25_sk(osk);
x25->t21 = ox25->t21;
......
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