};
static struct svc_clnthash * clnt_hash[CLIENT_HASHMAX];
static svc_client * clients;
-static int initialized;
static int hash_lock;
static int want_lock;
struct svc_clnthash **hp, **head, *tmp;
unsigned long addr = sin->sin_addr.s_addr;
- if (!initialized)
- return NULL;
-
head = &clnt_hash[CLIENT_HASH(addr)];
for (hp = head; (tmp = *hp) != NULL; hp = &(tmp->h_next)) {
int i;
dprintk("nfsd: initializing export module.\n");
- if (initialized)
- return;
+
for (i = 0; i < CLIENT_HASHMAX; i++)
clnt_hash[i] = NULL;
clients = NULL;
- initialized = 1;
}
/*
int i;
dprintk("nfsd: shutting down export module.\n");
- if (!initialized)
- return;
+
if (exp_writelock() < 0) {
printk(KERN_WARNING "Weird: hashtable locked in exp_shutdown");
return;
static int nfsctl_ugidupdate(struct nfsctl_ugidmap *data);
#endif
-static int initialized;
-
extern struct seq_operations nfs_exports_op;
static int exports_open(struct inode *inode, struct file *file)
{
entry->proc_fops = &exports_operations;
}
-/*
- * Initialize nfsd
- */
-static void
-nfsd_init(void)
-{
- nfsd_stat_init(); /* Statistics */
- nfsd_cache_init(); /* RPC reply cache */
- nfsd_export_init(); /* Exports table */
- nfsd_lockd_init(); /* lockd->nfsd callbacks */
- proc_export_init();
- initialized = 1;
-}
-
static inline int
nfsctl_svc(struct nfsctl_svc *data)
{
int argsize, respsize;
lock_kernel ();
- if (!initialized)
- nfsd_init();
+
err = -EPERM;
if (!capable(CAP_SYS_ADMIN)) {
goto done;
return err;
}
-#ifdef MODULE
-/* New-style module support since 2.1.18 */
EXPORT_NO_SYMBOLS;
MODULE_AUTHOR("Olaf Kirch <okir@monad.swb.de>");
MODULE_LICENSE("GPL");
+#ifdef MODULE
struct nfsd_linkage nfsd_linkage_s = {
do_nfsservctl: handle_sys_nfsservctl,
owner: THIS_MODULE,
};
+#endif
/*
* Initialize the module
*/
-int
-init_module(void)
+static int __init
+nfsd_init(void)
{
printk(KERN_INFO "Installing knfsd (copyright (C) 1996 okir@monad.swb.de).\n");
+#ifdef MODULE
nfsd_linkage = &nfsd_linkage_s;
+#endif
+ nfsd_stat_init(); /* Statistics */
+ nfsd_cache_init(); /* RPC reply cache */
+ nfsd_export_init(); /* Exports table */
+ nfsd_lockd_init(); /* lockd->nfsd callbacks */
+ proc_export_init();
return 0;
}
/*
* Clean up the mess before unloading the module
*/
-void
-cleanup_module(void)
+static void __exit
+nfsd_exit(void)
{
+#ifdef MODULE
nfsd_linkage = NULL;
+#endif
nfsd_export_shutdown();
nfsd_cache_shutdown();
remove_proc_entry("fs/nfs/exports", NULL);
nfsd_stat_shutdown();
nfsd_lockd_shutdown();
}
-#endif
+
+module_init(nfsd_init);
+module_exit(nfsd_exit);