af_x25.c (d585a021c0b10b0477d6b608c53e1feb8cde0507) | af_x25.c (14ebaf81e13ce66bff275380b246796fd16cbfa1) |
---|---|
1/* 2 * X.25 Packet Layer release 002 3 * 4 * This is ALPHA test software. This code may break your machine, 5 * randomly fail to work with new releases, misbehave and/or generally 6 * screw up. It might even work. 7 * 8 * This code REQUIRES 2.1.15 or higher --- 318 unchanged lines hidden (view full) --- 327 328 read_unlock_bh(&x25_list_lock); 329 return lci; 330} 331 332/* 333 * Deferred destroy. 334 */ | 1/* 2 * X.25 Packet Layer release 002 3 * 4 * This is ALPHA test software. This code may break your machine, 5 * randomly fail to work with new releases, misbehave and/or generally 6 * screw up. It might even work. 7 * 8 * This code REQUIRES 2.1.15 or higher --- 318 unchanged lines hidden (view full) --- 327 328 read_unlock_bh(&x25_list_lock); 329 return lci; 330} 331 332/* 333 * Deferred destroy. 334 */ |
335void x25_destroy_socket(struct sock *); | 335static void __x25_destroy_socket(struct sock *); |
336 337/* 338 * handler for deferred kills. 339 */ 340static void x25_destroy_timer(unsigned long data) 341{ | 336 337/* 338 * handler for deferred kills. 339 */ 340static void x25_destroy_timer(unsigned long data) 341{ |
342 x25_destroy_socket((struct sock *)data); | 342 x25_destroy_socket_from_timer((struct sock *)data); |
343} 344 345/* 346 * This is called from user mode and the timers. Thus it protects itself 347 * against interrupt users but doesn't worry about being called during 348 * work. Once it is removed from the queue no interrupt or bottom half 349 * will touch it and we are (fairly 8-) ) safe. 350 * Not static as it's used by the timer 351 */ | 343} 344 345/* 346 * This is called from user mode and the timers. Thus it protects itself 347 * against interrupt users but doesn't worry about being called during 348 * work. Once it is removed from the queue no interrupt or bottom half 349 * will touch it and we are (fairly 8-) ) safe. 350 * Not static as it's used by the timer 351 */ |
352void x25_destroy_socket(struct sock *sk) | 352static void __x25_destroy_socket(struct sock *sk) |
353{ 354 struct sk_buff *skb; 355 | 353{ 354 struct sk_buff *skb; 355 |
356 sock_hold(sk); 357 lock_sock(sk); | |
358 x25_stop_heartbeat(sk); 359 x25_stop_timer(sk); 360 361 x25_remove_socket(sk); 362 x25_clear_queues(sk); /* Flush the queues */ 363 364 while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { 365 if (skb->sk != sk) { /* A pending connection */ --- 14 unchanged lines hidden (view full) --- 380 sk->sk_timer.expires = jiffies + 10 * HZ; 381 sk->sk_timer.function = x25_destroy_timer; 382 sk->sk_timer.data = (unsigned long)sk; 383 add_timer(&sk->sk_timer); 384 } else { 385 /* drop last reference so sock_put will free */ 386 __sock_put(sk); 387 } | 356 x25_stop_heartbeat(sk); 357 x25_stop_timer(sk); 358 359 x25_remove_socket(sk); 360 x25_clear_queues(sk); /* Flush the queues */ 361 362 while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { 363 if (skb->sk != sk) { /* A pending connection */ --- 14 unchanged lines hidden (view full) --- 378 sk->sk_timer.expires = jiffies + 10 * HZ; 379 sk->sk_timer.function = x25_destroy_timer; 380 sk->sk_timer.data = (unsigned long)sk; 381 add_timer(&sk->sk_timer); 382 } else { 383 /* drop last reference so sock_put will free */ 384 __sock_put(sk); 385 } |
386} |
|
388 | 387 |
388void x25_destroy_socket_from_timer(struct sock *sk) 389{ 390 sock_hold(sk); 391 bh_lock_sock(sk); 392 __x25_destroy_socket(sk); 393 bh_unlock_sock(sk); 394 sock_put(sk); 395} 396 397static void x25_destroy_socket(struct sock *sk) 398{ 399 sock_hold(sk); 400 lock_sock(sk); 401 __x25_destroy_socket(sk); |
|
389 release_sock(sk); 390 sock_put(sk); 391} 392 393/* 394 * Handling for system calls applied via the various interfaces to a 395 * X.25 socket object. 396 */ --- 1292 unchanged lines hidden --- | 402 release_sock(sk); 403 sock_put(sk); 404} 405 406/* 407 * Handling for system calls applied via the various interfaces to a 408 * X.25 socket object. 409 */ --- 1292 unchanged lines hidden --- |