[AFS]: Update the AFS fs documentation.
[deliverable/linux.git] / fs / afs / main.c
CommitLineData
ec26815a 1/* AFS client file system
1da177e4
LT
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/moduleparam.h>
14#include <linux/init.h>
1da177e4 15#include <linux/completion.h>
1da177e4
LT
16#include "internal.h"
17
1da177e4
LT
18MODULE_DESCRIPTION("AFS Client File System");
19MODULE_AUTHOR("Red Hat, Inc.");
20MODULE_LICENSE("GPL");
21
08e0e7c8
DH
22unsigned afs_debug;
23module_param_named(debug, afs_debug, uint, S_IWUSR | S_IRUGO);
24MODULE_PARM_DESC(afs_debug, "AFS debugging mask");
25
1da177e4
LT
26static char *rootcell;
27
28module_param(rootcell, charp, 0);
29MODULE_PARM_DESC(rootcell, "root AFS cell name and VL server IP addr list");
30
1da177e4
LT
31#ifdef AFS_CACHING_SUPPORT
32static struct cachefs_netfs_operations afs_cache_ops = {
33 .get_page_cookie = afs_cache_get_page_cookie,
34};
35
36struct cachefs_netfs afs_cache_netfs = {
37 .name = "afs",
38 .version = 0,
39 .ops = &afs_cache_ops,
40};
41#endif
42
1da177e4
LT
43/*
44 * initialise the AFS client FS module
45 */
46static int __init afs_init(void)
47{
08e0e7c8 48 int ret;
1da177e4
LT
49
50 printk(KERN_INFO "kAFS: Red Hat AFS client v0.1 registering.\n");
51
1da177e4
LT
52 /* register the /proc stuff */
53 ret = afs_proc_init();
54 if (ret < 0)
55 return ret;
56
57#ifdef AFS_CACHING_SUPPORT
58 /* we want to be able to cache */
59 ret = cachefs_register_netfs(&afs_cache_netfs,
60 &afs_cache_cell_index_def);
1da177e4
LT
61 if (ret < 0)
62 goto error_cache;
63#endif
64
65 /* initialise the cell DB */
66 ret = afs_cell_init(rootcell);
67 if (ret < 0)
ec26815a 68 goto error_cell_init;
1da177e4 69
08e0e7c8
DH
70 /* initialise the VL update process */
71 ret = afs_vlocation_update_init();
1da177e4 72 if (ret < 0)
08e0e7c8 73 goto error_vl_update_init;
1da177e4 74
08e0e7c8
DH
75 /* initialise the callback update process */
76 ret = afs_callback_update_init();
1da177e4
LT
77
78 /* create the RxRPC transport */
08e0e7c8 79 ret = afs_open_socket();
1da177e4 80 if (ret < 0)
08e0e7c8 81 goto error_open_socket;
1da177e4
LT
82
83 /* register the filesystems */
84 ret = afs_fs_init();
85 if (ret < 0)
ec26815a 86 goto error_fs;
1da177e4
LT
87
88 return ret;
89
ec26815a 90error_fs:
08e0e7c8
DH
91 afs_close_socket();
92error_open_socket:
93error_vl_update_init:
ec26815a 94error_cell_init:
1da177e4
LT
95#ifdef AFS_CACHING_SUPPORT
96 cachefs_unregister_netfs(&afs_cache_netfs);
ec26815a 97error_cache:
1da177e4 98#endif
08e0e7c8
DH
99 afs_callback_update_kill();
100 afs_vlocation_purge();
1da177e4
LT
101 afs_cell_purge();
102 afs_proc_cleanup();
103 printk(KERN_ERR "kAFS: failed to register: %d\n", ret);
104 return ret;
ec26815a 105}
1da177e4
LT
106
107/* XXX late_initcall is kludgy, but the only alternative seems to create
108 * a transport upon the first mount, which is worse. Or is it?
109 */
110late_initcall(afs_init); /* must be called after net/ to create socket */
ec26815a 111
1da177e4
LT
112/*
113 * clean up on module removal
114 */
115static void __exit afs_exit(void)
116{
117 printk(KERN_INFO "kAFS: Red Hat AFS client v0.1 unregistering.\n");
118
119 afs_fs_exit();
08e0e7c8
DH
120 afs_close_socket();
121 afs_purge_servers();
122 afs_callback_update_kill();
123 afs_vlocation_purge();
124 flush_scheduled_work();
1da177e4 125 afs_cell_purge();
1da177e4
LT
126#ifdef AFS_CACHING_SUPPORT
127 cachefs_unregister_netfs(&afs_cache_netfs);
128#endif
129 afs_proc_cleanup();
ec26815a 130}
1da177e4
LT
131
132module_exit(afs_exit);
This page took 1.695456 seconds and 5 git commands to generate.