blob: 70e52f6b0b649444db7c60503cf2df170c03c1c7 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* 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
52static inline void rxrpc_discard_my_signals(void)
53{
54 while (signal_pending(current)) {
55 siginfo_t sinfo;
56
57 spin_lock_irq(&current->sighand->siglock);
58 dequeue_signal(current, &current->blocked, &sinfo);
59 spin_unlock_irq(&current->sighand->siglock);
60 }
61}
62
63/*
64 * call.c
65 */
66extern struct list_head rxrpc_calls;
67extern struct rw_semaphore rxrpc_calls_sem;
68
69/*
70 * connection.c
71 */
72extern struct list_head rxrpc_conns;
73extern struct rw_semaphore rxrpc_conns_sem;
74extern unsigned long rxrpc_conn_timeout;
75
76extern void rxrpc_conn_clearall(struct rxrpc_peer *peer);
77
78/*
79 * peer.c
80 */
81extern struct list_head rxrpc_peers;
82extern struct rw_semaphore rxrpc_peers_sem;
83extern unsigned long rxrpc_peer_timeout;
84
85extern void rxrpc_peer_calculate_rtt(struct rxrpc_peer *peer,
86 struct rxrpc_message *msg,
87 struct rxrpc_message *resp);
88
89extern void rxrpc_peer_clearall(struct rxrpc_transport *trans);
90
91
92/*
93 * proc.c
94 */
95#ifdef CONFIG_PROC_FS
96extern int rxrpc_proc_init(void);
97extern void rxrpc_proc_cleanup(void);
98#endif
99
100/*
101 * transport.c
102 */
103extern struct list_head rxrpc_proc_transports;
104extern struct rw_semaphore rxrpc_proc_transports_sem;
105
106#endif /* RXRPC_INTERNAL_H */