aboutsummaryrefslogtreecommitdiffstats
path: root/fs/afs/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/afs/main.c')
-rw-r--r--fs/afs/main.c94
1 files changed, 16 insertions, 78 deletions
diff --git a/fs/afs/main.c b/fs/afs/main.c
index f2704ba53857..5bf39f66f4ce 100644
--- a/fs/afs/main.c
+++ b/fs/afs/main.c
@@ -1,4 +1,4 @@
1/* main.c: AFS client file system 1/* AFS client file system
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -62,7 +62,6 @@ struct cachefs_netfs afs_cache_netfs = {
62}; 62};
63#endif 63#endif
64 64
65/*****************************************************************************/
66/* 65/*
67 * initialise the AFS client FS module 66 * initialise the AFS client FS module
68 */ 67 */
@@ -87,70 +86,61 @@ static int __init afs_init(void)
87 ret = cachefs_register_netfs(&afs_cache_netfs, 86 ret = cachefs_register_netfs(&afs_cache_netfs,
88 &afs_cache_cell_index_def); 87 &afs_cache_cell_index_def);
89 if (ret < 0) 88 if (ret < 0)
90 goto error;
91#endif
92
93#ifdef CONFIG_KEYS_TURNED_OFF
94 ret = afs_key_register();
95 if (ret < 0)
96 goto error_cache; 89 goto error_cache;
97#endif 90#endif
98 91
99 /* initialise the cell DB */ 92 /* initialise the cell DB */
100 ret = afs_cell_init(rootcell); 93 ret = afs_cell_init(rootcell);
101 if (ret < 0) 94 if (ret < 0)
102 goto error_keys; 95 goto error_cell_init;
103 96
104 /* start the timeout daemon */ 97 /* start the timeout daemon */
105 ret = afs_kafstimod_start(); 98 ret = afs_kafstimod_start();
106 if (ret < 0) 99 if (ret < 0)
107 goto error_keys; 100 goto error_kafstimod;
108 101
109 /* start the async operation daemon */ 102 /* start the async operation daemon */
110 ret = afs_kafsasyncd_start(); 103 ret = afs_kafsasyncd_start();
111 if (ret < 0) 104 if (ret < 0)
112 goto error_kafstimod; 105 goto error_kafsasyncd;
113 106
114 /* create the RxRPC transport */ 107 /* create the RxRPC transport */
115 ret = rxrpc_create_transport(7001, &afs_transport); 108 ret = rxrpc_create_transport(7001, &afs_transport);
116 if (ret < 0) 109 if (ret < 0)
117 goto error_kafsasyncd; 110 goto error_transport;
118 111
119 afs_transport->peer_ops = &afs_peer_ops; 112 afs_transport->peer_ops = &afs_peer_ops;
120 113
121 /* register the filesystems */ 114 /* register the filesystems */
122 ret = afs_fs_init(); 115 ret = afs_fs_init();
123 if (ret < 0) 116 if (ret < 0)
124 goto error_transport; 117 goto error_fs;
125 118
126 return ret; 119 return ret;
127 120
128 error_transport: 121error_fs:
129 rxrpc_put_transport(afs_transport); 122 rxrpc_put_transport(afs_transport);
130 error_kafsasyncd: 123error_transport:
131 afs_kafsasyncd_stop(); 124 afs_kafsasyncd_stop();
132 error_kafstimod: 125error_kafsasyncd:
133 afs_kafstimod_stop(); 126 afs_kafstimod_stop();
134 error_keys: 127error_kafstimod:
135#ifdef CONFIG_KEYS_TURNED_OFF 128error_cell_init:
136 afs_key_unregister();
137 error_cache:
138#endif
139#ifdef AFS_CACHING_SUPPORT 129#ifdef AFS_CACHING_SUPPORT
140 cachefs_unregister_netfs(&afs_cache_netfs); 130 cachefs_unregister_netfs(&afs_cache_netfs);
141 error: 131error_cache:
142#endif 132#endif
143 afs_cell_purge(); 133 afs_cell_purge();
144 afs_proc_cleanup(); 134 afs_proc_cleanup();
145 printk(KERN_ERR "kAFS: failed to register: %d\n", ret); 135 printk(KERN_ERR "kAFS: failed to register: %d\n", ret);
146 return ret; 136 return ret;
147} /* end afs_init() */ 137}
148 138
149/* XXX late_initcall is kludgy, but the only alternative seems to create 139/* XXX late_initcall is kludgy, but the only alternative seems to create
150 * a transport upon the first mount, which is worse. Or is it? 140 * a transport upon the first mount, which is worse. Or is it?
151 */ 141 */
152late_initcall(afs_init); /* must be called after net/ to create socket */ 142late_initcall(afs_init); /* must be called after net/ to create socket */
153/*****************************************************************************/ 143
154/* 144/*
155 * clean up on module removal 145 * clean up on module removal
156 */ 146 */
@@ -163,19 +153,14 @@ static void __exit afs_exit(void)
163 afs_kafstimod_stop(); 153 afs_kafstimod_stop();
164 afs_kafsasyncd_stop(); 154 afs_kafsasyncd_stop();
165 afs_cell_purge(); 155 afs_cell_purge();
166#ifdef CONFIG_KEYS_TURNED_OFF
167 afs_key_unregister();
168#endif
169#ifdef AFS_CACHING_SUPPORT 156#ifdef AFS_CACHING_SUPPORT
170 cachefs_unregister_netfs(&afs_cache_netfs); 157 cachefs_unregister_netfs(&afs_cache_netfs);
171#endif 158#endif
172 afs_proc_cleanup(); 159 afs_proc_cleanup();
173 160}
174} /* end afs_exit() */
175 161
176module_exit(afs_exit); 162module_exit(afs_exit);
177 163
178/*****************************************************************************/
179/* 164/*
180 * notification that new peer record is being added 165 * notification that new peer record is being added
181 * - called from krxsecd 166 * - called from krxsecd
@@ -208,9 +193,8 @@ static int afs_adding_peer(struct rxrpc_peer *peer)
208 afs_put_server(server); 193 afs_put_server(server);
209 194
210 return 0; 195 return 0;
211} /* end afs_adding_peer() */ 196}
212 197
213/*****************************************************************************/
214/* 198/*
215 * notification that a peer record is being discarded 199 * notification that a peer record is being discarded
216 * - called from krxiod or krxsecd 200 * - called from krxiod or krxsecd
@@ -236,50 +220,4 @@ static void afs_discarding_peer(struct rxrpc_peer *peer)
236 spin_unlock(&afs_server_peer_lock); 220 spin_unlock(&afs_server_peer_lock);
237 221
238 _leave(""); 222 _leave("");
239
240} /* end afs_discarding_peer() */
241
242/*****************************************************************************/
243/*
244 * clear the dead space between task_struct and kernel stack
245 * - called by supplying -finstrument-functions to gcc
246 */
247#if 0
248void __cyg_profile_func_enter (void *this_fn, void *call_site)
249__attribute__((no_instrument_function));
250
251void __cyg_profile_func_enter (void *this_fn, void *call_site)
252{
253 asm volatile(" movl %%esp,%%edi \n"
254 " andl %0,%%edi \n"
255 " addl %1,%%edi \n"
256 " movl %%esp,%%ecx \n"
257 " subl %%edi,%%ecx \n"
258 " shrl $2,%%ecx \n"
259 " movl $0xedededed,%%eax \n"
260 " rep stosl \n"
261 :
262 : "i"(~(THREAD_SIZE - 1)), "i"(sizeof(struct thread_info))
263 : "eax", "ecx", "edi", "memory", "cc"
264 );
265}
266
267void __cyg_profile_func_exit(void *this_fn, void *call_site)
268__attribute__((no_instrument_function));
269
270void __cyg_profile_func_exit(void *this_fn, void *call_site)
271{
272 asm volatile(" movl %%esp,%%edi \n"
273 " andl %0,%%edi \n"
274 " addl %1,%%edi \n"
275 " movl %%esp,%%ecx \n"
276 " subl %%edi,%%ecx \n"
277 " shrl $2,%%ecx \n"
278 " movl $0xdadadada,%%eax \n"
279 " rep stosl \n"
280 :
281 : "i"(~(THREAD_SIZE - 1)), "i"(sizeof(struct thread_info))
282 : "eax", "ecx", "edi", "memory", "cc"
283 );
284} 223}
285#endif