1
2
3
4
5
6
7
8
9
10
11
12#include <linux/module.h>
13#include <linux/init.h>
14#include <linux/sched.h>
15#include <rxrpc/rxrpc.h>
16#include <rxrpc/krxiod.h>
17#include <rxrpc/krxsecd.h>
18#include <rxrpc/krxtimod.h>
19#include <rxrpc/transport.h>
20#include <rxrpc/connection.h>
21#include <rxrpc/call.h>
22#include <rxrpc/message.h>
23#include "internal.h"
24
25static int rxrpc_initialise(void);
26static void rxrpc_cleanup(void);
27
28module_init(rxrpc_initialise);
29module_exit(rxrpc_cleanup);
30
31MODULE_DESCRIPTION("Rx RPC implementation");
32MODULE_AUTHOR("Red Hat, Inc.");
33MODULE_LICENSE("GPL");
34
35__be32 rxrpc_epoch;
36
37
38
39
40
41static int rxrpc_initialise(void)
42{
43 int ret;
44
45
46 rxrpc_epoch = htonl(xtime.tv_sec);
47
48
49#ifdef CONFIG_PROC_FS
50 ret = rxrpc_proc_init();
51 if (ret<0)
52 return ret;
53#endif
54
55
56#ifdef CONFIG_SYSCTL
57 ret = rxrpc_sysctl_init();
58 if (ret<0)
59 goto error_proc;
60#endif
61
62
63 ret = rxrpc_krxtimod_start();
64 if (ret<0)
65 goto error_sysctl;
66
67
68 ret = rxrpc_krxiod_init();
69 if (ret<0)
70 goto error_krxtimod;
71
72
73 ret = rxrpc_krxsecd_init();
74 if (ret<0)
75 goto error_krxiod;
76
77 kdebug("\n\n");
78
79 return 0;
80
81 error_krxiod:
82 rxrpc_krxiod_kill();
83 error_krxtimod:
84 rxrpc_krxtimod_kill();
85 error_sysctl:
86#ifdef CONFIG_SYSCTL
87 rxrpc_sysctl_cleanup();
88#endif
89 error_proc:
90#ifdef CONFIG_PROC_FS
91 rxrpc_proc_cleanup();
92#endif
93 return ret;
94}
95
96
97
98
99
100static void __exit rxrpc_cleanup(void)
101{
102 kenter("");
103
104 __RXACCT(printk("Outstanding Messages : %d\n",
105 atomic_read(&rxrpc_message_count)));
106 __RXACCT(printk("Outstanding Calls : %d\n",
107 atomic_read(&rxrpc_call_count)));
108 __RXACCT(printk("Outstanding Connections: %d\n",
109 atomic_read(&rxrpc_connection_count)));
110 __RXACCT(printk("Outstanding Peers : %d\n",
111 atomic_read(&rxrpc_peer_count)));
112 __RXACCT(printk("Outstanding Transports : %d\n",
113 atomic_read(&rxrpc_transport_count)));
114
115 rxrpc_krxsecd_kill();
116 rxrpc_krxiod_kill();
117 rxrpc_krxtimod_kill();
118#ifdef CONFIG_SYSCTL
119 rxrpc_sysctl_cleanup();
120#endif
121#ifdef CONFIG_PROC_FS
122 rxrpc_proc_cleanup();
123#endif
124
125 __RXACCT(printk("Outstanding Messages : %d\n",
126 atomic_read(&rxrpc_message_count)));
127 __RXACCT(printk("Outstanding Calls : %d\n",
128 atomic_read(&rxrpc_call_count)));
129 __RXACCT(printk("Outstanding Connections: %d\n",
130 atomic_read(&rxrpc_connection_count)));
131 __RXACCT(printk("Outstanding Peers : %d\n",
132 atomic_read(&rxrpc_peer_count)));
133 __RXACCT(printk("Outstanding Transports : %d\n",
134 atomic_read(&rxrpc_transport_count)));
135
136 kleave("");
137}
138
139
140
141
142
143
144#if 0
145void __cyg_profile_func_enter (void *this_fn, void *call_site)
146__attribute__((no_instrument_function));
147
148void __cyg_profile_func_enter (void *this_fn, void *call_site)
149{
150 asm volatile(" movl %%esp,%%edi \n"
151 " andl %0,%%edi \n"
152 " addl %1,%%edi \n"
153 " movl %%esp,%%ecx \n"
154 " subl %%edi,%%ecx \n"
155 " shrl $2,%%ecx \n"
156 " movl $0xedededed,%%eax \n"
157 " rep stosl \n"
158 :
159 : "i"(~(THREAD_SIZE-1)), "i"(sizeof(struct thread_info))
160 : "eax", "ecx", "edi", "memory", "cc"
161 );
162}
163
164void __cyg_profile_func_exit(void *this_fn, void *call_site)
165__attribute__((no_instrument_function));
166
167void __cyg_profile_func_exit(void *this_fn, void *call_site)
168{
169 asm volatile(" movl %%esp,%%edi \n"
170 " andl %0,%%edi \n"
171 " addl %1,%%edi \n"
172 " movl %%esp,%%ecx \n"
173 " subl %%edi,%%ecx \n"
174 " shrl $2,%%ecx \n"
175 " movl $0xdadadada,%%eax \n"
176 " rep stosl \n"
177 :
178 : "i"(~(THREAD_SIZE-1)), "i"(sizeof(struct thread_info))
179 : "eax", "ecx", "edi", "memory", "cc"
180 );
181}
182#endif
183