Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* internal.h: internal Rx RPC stuff |
| 2 | * |
| 3 | * Copyright (c) 2002 David Howells (dhowells@redhat.com). |
| 4 | */ |
| 5 | |
| 6 | #ifndef RXRPC_INTERNAL_H |
| 7 | #define RXRPC_INTERNAL_H |
| 8 | |
| 9 | #include <linux/compiler.h> |
| 10 | #include <linux/kernel.h> |
| 11 | |
| 12 | /* |
| 13 | * debug accounting |
| 14 | */ |
| 15 | #if 1 |
| 16 | #define __RXACCT_DECL(X) X |
| 17 | #define __RXACCT(X) do { X; } while(0) |
| 18 | #else |
| 19 | #define __RXACCT_DECL(X) |
| 20 | #define __RXACCT(X) do { } while(0) |
| 21 | #endif |
| 22 | |
| 23 | __RXACCT_DECL(extern atomic_t rxrpc_transport_count); |
| 24 | __RXACCT_DECL(extern atomic_t rxrpc_peer_count); |
| 25 | __RXACCT_DECL(extern atomic_t rxrpc_connection_count); |
| 26 | __RXACCT_DECL(extern atomic_t rxrpc_call_count); |
| 27 | __RXACCT_DECL(extern atomic_t rxrpc_message_count); |
| 28 | |
| 29 | /* |
| 30 | * debug tracing |
| 31 | */ |
| 32 | #define kenter(FMT, a...) printk("==> %s("FMT")\n",__FUNCTION__ , ##a) |
| 33 | #define kleave(FMT, a...) printk("<== %s()"FMT"\n",__FUNCTION__ , ##a) |
| 34 | #define kdebug(FMT, a...) printk(" "FMT"\n" , ##a) |
| 35 | #define kproto(FMT, a...) printk("### "FMT"\n" , ##a) |
| 36 | #define knet(FMT, a...) printk(" "FMT"\n" , ##a) |
| 37 | |
| 38 | #if 0 |
| 39 | #define _enter(FMT, a...) kenter(FMT , ##a) |
| 40 | #define _leave(FMT, a...) kleave(FMT , ##a) |
| 41 | #define _debug(FMT, a...) kdebug(FMT , ##a) |
| 42 | #define _proto(FMT, a...) kproto(FMT , ##a) |
| 43 | #define _net(FMT, a...) knet(FMT , ##a) |
| 44 | #else |
| 45 | #define _enter(FMT, a...) do { if (rxrpc_ktrace) kenter(FMT , ##a); } while(0) |
| 46 | #define _leave(FMT, a...) do { if (rxrpc_ktrace) kleave(FMT , ##a); } while(0) |
| 47 | #define _debug(FMT, a...) do { if (rxrpc_kdebug) kdebug(FMT , ##a); } while(0) |
| 48 | #define _proto(FMT, a...) do { if (rxrpc_kproto) kproto(FMT , ##a); } while(0) |
| 49 | #define _net(FMT, a...) do { if (rxrpc_knet) knet (FMT , ##a); } while(0) |
| 50 | #endif |
| 51 | |
| 52 | static inline void rxrpc_discard_my_signals(void) |
| 53 | { |
| 54 | while (signal_pending(current)) { |
| 55 | siginfo_t sinfo; |
| 56 | |
| 57 | spin_lock_irq(¤t->sighand->siglock); |
| 58 | dequeue_signal(current, ¤t->blocked, &sinfo); |
| 59 | spin_unlock_irq(¤t->sighand->siglock); |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | /* |
| 64 | * call.c |
| 65 | */ |
| 66 | extern struct list_head rxrpc_calls; |
| 67 | extern struct rw_semaphore rxrpc_calls_sem; |
| 68 | |
| 69 | /* |
| 70 | * connection.c |
| 71 | */ |
| 72 | extern struct list_head rxrpc_conns; |
| 73 | extern struct rw_semaphore rxrpc_conns_sem; |
| 74 | extern unsigned long rxrpc_conn_timeout; |
| 75 | |
| 76 | extern void rxrpc_conn_clearall(struct rxrpc_peer *peer); |
| 77 | |
| 78 | /* |
| 79 | * peer.c |
| 80 | */ |
| 81 | extern struct list_head rxrpc_peers; |
| 82 | extern struct rw_semaphore rxrpc_peers_sem; |
| 83 | extern unsigned long rxrpc_peer_timeout; |
| 84 | |
| 85 | extern void rxrpc_peer_calculate_rtt(struct rxrpc_peer *peer, |
| 86 | struct rxrpc_message *msg, |
| 87 | struct rxrpc_message *resp); |
| 88 | |
| 89 | extern void rxrpc_peer_clearall(struct rxrpc_transport *trans); |
| 90 | |
| 91 | |
| 92 | /* |
| 93 | * proc.c |
| 94 | */ |
| 95 | #ifdef CONFIG_PROC_FS |
| 96 | extern int rxrpc_proc_init(void); |
| 97 | extern void rxrpc_proc_cleanup(void); |
| 98 | #endif |
| 99 | |
| 100 | /* |
| 101 | * transport.c |
| 102 | */ |
| 103 | extern struct list_head rxrpc_proc_transports; |
| 104 | extern struct rw_semaphore rxrpc_proc_transports_sem; |
| 105 | |
| 106 | #endif /* RXRPC_INTERNAL_H */ |