diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1998-03-17 22:05:47 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1998-03-17 22:05:47 +0000 |
commit | 27cfca1ec98e91261b1a5355d10a8996464b63af (patch) | |
tree | 8e895a53e372fa682b4c0a585b9377d67ed70d0e /net/sunrpc/stats.c | |
parent | 6a76fb7214c477ccf6582bd79c5b4ccc4f9c41b1 (diff) |
Look Ma' what I found on my harddisk ...
o New faster syscalls for 2.1.x, too
o Upgrade to 2.1.89.
Don't try to run this. It's flaky as hell. But feel free to debug ...
Diffstat (limited to 'net/sunrpc/stats.c')
-rw-r--r-- | net/sunrpc/stats.c | 58 |
1 files changed, 53 insertions, 5 deletions
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c index 90a23a232..94a5ba21c 100644 --- a/net/sunrpc/stats.c +++ b/net/sunrpc/stats.c @@ -12,6 +12,8 @@ * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de> */ +#include <linux/module.h> + #include <linux/kernel.h> #include <linux/sched.h> #include <linux/proc_fs.h> @@ -20,7 +22,7 @@ #define RPCDBG_FACILITY RPCDBG_MISC -static struct proc_dir_entry *proc_net_rpc = 0; +static struct proc_dir_entry *proc_net_rpc = NULL; /* * Get RPC client stats @@ -161,15 +163,61 @@ void rpc_proc_init(void) { dprintk("RPC: registering /proc/net/rpc\n"); - if (!proc_net_rpc) - proc_net_rpc = create_proc_entry("net/rpc", S_IFDIR, 0); + if (!proc_net_rpc) { + struct proc_dir_entry *ent; + ent = create_proc_entry("net/rpc", S_IFDIR, 0); + if (ent) { +#ifdef MODULE + ent->fill_inode = rpc_modcount; +#endif + proc_net_rpc = ent; + } + } } void rpc_proc_exit(void) { dprintk("RPC: unregistering /proc/net/rpc\n"); - if (proc_net_rpc) + if (proc_net_rpc) { + proc_net_rpc = NULL; remove_proc_entry("net/rpc", 0); - proc_net_rpc = 0; + } +} + +#ifdef MODULE +/* + * This is called as the proc_dir_entry fill_inode function + * when an inode is going into or out of service (fill == 1 + * or 0 respectively). + * + * We use it here to keep the module from being unloaded + * while /proc inodes are in use. + */ +void rpc_modcount(struct inode *inode, int fill) +{ + if (fill) + MOD_INC_USE_COUNT; + else + MOD_DEC_USE_COUNT; +} + +int +init_module(void) +{ +#ifdef RPC_DEBUG + rpc_register_sysctl(); +#endif + rpc_proc_init(); + return 0; +} + +void +cleanup_module(void) +{ +#ifdef RPC_DEBUG + rpc_unregister_sysctl(); +#endif + rpc_proc_exit(); } +#endif |