aboutsummaryrefslogtreecommitdiffstats
path: root/net/rxrpc/main.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /net/rxrpc/main.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'net/rxrpc/main.c')
-rw-r--r--net/rxrpc/main.c180
1 files changed, 180 insertions, 0 deletions
diff --git a/net/rxrpc/main.c b/net/rxrpc/main.c
new file mode 100644
index 000000000000..36fdcbcd80d1
--- /dev/null
+++ b/net/rxrpc/main.c
@@ -0,0 +1,180 @@
1/* main.c: Rx RPC interface
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
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
25MODULE_DESCRIPTION("Rx RPC implementation");
26MODULE_AUTHOR("Red Hat, Inc.");
27MODULE_LICENSE("GPL");
28
29__be32 rxrpc_epoch;
30
31/*****************************************************************************/
32/*
33 * initialise the Rx module
34 */
35static int __init rxrpc_initialise(void)
36{
37 int ret;
38
39 /* my epoch value */
40 rxrpc_epoch = htonl(xtime.tv_sec);
41
42 /* register the /proc interface */
43#ifdef CONFIG_PROC_FS
44 ret = rxrpc_proc_init();
45 if (ret<0)
46 return ret;
47#endif
48
49 /* register the sysctl files */
50#ifdef CONFIG_SYSCTL
51 ret = rxrpc_sysctl_init();
52 if (ret<0)
53 goto error_proc;
54#endif
55
56 /* start the krxtimod daemon */
57 ret = rxrpc_krxtimod_start();
58 if (ret<0)
59 goto error_sysctl;
60
61 /* start the krxiod daemon */
62 ret = rxrpc_krxiod_init();
63 if (ret<0)
64 goto error_krxtimod;
65
66 /* start the krxsecd daemon */
67 ret = rxrpc_krxsecd_init();
68 if (ret<0)
69 goto error_krxiod;
70
71 kdebug("\n\n");
72
73 return 0;
74
75 error_krxiod:
76 rxrpc_krxiod_kill();
77 error_krxtimod:
78 rxrpc_krxtimod_kill();
79 error_sysctl:
80#ifdef CONFIG_SYSCTL
81 rxrpc_sysctl_cleanup();
82#endif
83 error_proc:
84#ifdef CONFIG_PROC_FS
85 rxrpc_proc_cleanup();
86#endif
87 return ret;
88} /* end rxrpc_initialise() */
89
90module_init(rxrpc_initialise);
91
92/*****************************************************************************/
93/*
94 * clean up the Rx module
95 */
96static void __exit rxrpc_cleanup(void)
97{
98 kenter("");
99
100 __RXACCT(printk("Outstanding Messages : %d\n",
101 atomic_read(&rxrpc_message_count)));
102 __RXACCT(printk("Outstanding Calls : %d\n",
103 atomic_read(&rxrpc_call_count)));
104 __RXACCT(printk("Outstanding Connections: %d\n",
105 atomic_read(&rxrpc_connection_count)));
106 __RXACCT(printk("Outstanding Peers : %d\n",
107 atomic_read(&rxrpc_peer_count)));
108 __RXACCT(printk("Outstanding Transports : %d\n",
109 atomic_read(&rxrpc_transport_count)));
110
111 rxrpc_krxsecd_kill();
112 rxrpc_krxiod_kill();
113 rxrpc_krxtimod_kill();
114#ifdef CONFIG_SYSCTL
115 rxrpc_sysctl_cleanup();
116#endif
117#ifdef CONFIG_PROC_FS
118 rxrpc_proc_cleanup();
119#endif
120
121 __RXACCT(printk("Outstanding Messages : %d\n",
122 atomic_read(&rxrpc_message_count)));
123 __RXACCT(printk("Outstanding Calls : %d\n",
124 atomic_read(&rxrpc_call_count)));
125 __RXACCT(printk("Outstanding Connections: %d\n",
126 atomic_read(&rxrpc_connection_count)));
127 __RXACCT(printk("Outstanding Peers : %d\n",
128 atomic_read(&rxrpc_peer_count)));
129 __RXACCT(printk("Outstanding Transports : %d\n",
130 atomic_read(&rxrpc_transport_count)));
131
132 kleave("");
133} /* end rxrpc_cleanup() */
134
135module_exit(rxrpc_cleanup);
136
137/*****************************************************************************/
138/*
139 * clear the dead space between task_struct and kernel stack
140 * - called by supplying -finstrument-functions to gcc
141 */
142#if 0
143void __cyg_profile_func_enter (void *this_fn, void *call_site)
144__attribute__((no_instrument_function));
145
146void __cyg_profile_func_enter (void *this_fn, void *call_site)
147{
148 asm volatile(" movl %%esp,%%edi \n"
149 " andl %0,%%edi \n"
150 " addl %1,%%edi \n"
151 " movl %%esp,%%ecx \n"
152 " subl %%edi,%%ecx \n"
153 " shrl $2,%%ecx \n"
154 " movl $0xedededed,%%eax \n"
155 " rep stosl \n"
156 :
157 : "i"(~(THREAD_SIZE-1)), "i"(sizeof(struct thread_info))
158 : "eax", "ecx", "edi", "memory", "cc"
159 );
160}
161
162void __cyg_profile_func_exit(void *this_fn, void *call_site)
163__attribute__((no_instrument_function));
164
165void __cyg_profile_func_exit(void *this_fn, void *call_site)
166{
167 asm volatile(" movl %%esp,%%edi \n"
168 " andl %0,%%edi \n"
169 " addl %1,%%edi \n"
170 " movl %%esp,%%ecx \n"
171 " subl %%edi,%%ecx \n"
172 " shrl $2,%%ecx \n"
173 " movl $0xdadadada,%%eax \n"
174 " rep stosl \n"
175 :
176 : "i"(~(THREAD_SIZE-1)), "i"(sizeof(struct thread_info))
177 : "eax", "ecx", "edi", "memory", "cc"
178 );
179}
180#endif