Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/include/linux/sunrpc/stats.h |
| 3 | * |
| 4 | * Client statistics collection for SUN RPC |
| 5 | * |
| 6 | * Copyright (C) 1996 Olaf Kirch <okir@monad.swb.de> |
| 7 | */ |
| 8 | |
| 9 | #ifndef _LINUX_SUNRPC_STATS_H |
| 10 | #define _LINUX_SUNRPC_STATS_H |
| 11 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #include <linux/proc_fs.h> |
| 13 | |
| 14 | struct rpc_stat { |
Trond Myklebust | a613fa1 | 2012-01-20 13:53:56 -0500 | [diff] [blame] | 15 | const struct rpc_program *program; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | |
| 17 | unsigned int netcnt, |
| 18 | netudpcnt, |
| 19 | nettcpcnt, |
| 20 | nettcpconn, |
| 21 | netreconn; |
| 22 | unsigned int rpccnt, |
| 23 | rpcretrans, |
| 24 | rpcauthrefresh, |
| 25 | rpcgarbage; |
| 26 | }; |
| 27 | |
| 28 | struct svc_stat { |
| 29 | struct svc_program * program; |
| 30 | |
| 31 | unsigned int netcnt, |
| 32 | netudpcnt, |
| 33 | nettcpcnt, |
| 34 | nettcpconn; |
| 35 | unsigned int rpccnt, |
| 36 | rpcbadfmt, |
| 37 | rpcbadauth, |
| 38 | rpcbadclnt; |
| 39 | }; |
| 40 | |
Pavel Emelyanov | 4f42d0d | 2010-09-27 14:01:58 +0400 | [diff] [blame] | 41 | struct net; |
| 42 | #ifdef CONFIG_PROC_FS |
| 43 | int rpc_proc_init(struct net *); |
| 44 | void rpc_proc_exit(struct net *); |
| 45 | #else |
| 46 | static inline int rpc_proc_init(struct net *net) |
| 47 | { |
| 48 | return 0; |
| 49 | } |
| 50 | |
| 51 | static inline void rpc_proc_exit(struct net *net) |
| 52 | { |
| 53 | } |
| 54 | #endif |
| 55 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | #ifdef MODULE |
| 57 | void rpc_modcount(struct inode *, int); |
| 58 | #endif |
| 59 | |
| 60 | #ifdef CONFIG_PROC_FS |
Stanislav Kinsbursky | ec7652a | 2011-12-06 16:42:40 +0300 | [diff] [blame] | 61 | struct proc_dir_entry * rpc_proc_register(struct net *,struct rpc_stat *); |
| 62 | void rpc_proc_unregister(struct net *,const char *); |
Trond Myklebust | a613fa1 | 2012-01-20 13:53:56 -0500 | [diff] [blame] | 63 | void rpc_proc_zero(const struct rpc_program *); |
Stanislav Kinsbursky | 246590f | 2011-12-06 16:42:49 +0300 | [diff] [blame] | 64 | struct proc_dir_entry * svc_proc_register(struct net *, struct svc_stat *, |
Arjan van de Ven | 99ac48f | 2006-03-28 01:56:41 -0800 | [diff] [blame] | 65 | const struct file_operations *); |
Stanislav Kinsbursky | 246590f | 2011-12-06 16:42:49 +0300 | [diff] [blame] | 66 | void svc_proc_unregister(struct net *, const char *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | |
| 68 | void svc_seq_show(struct seq_file *, |
| 69 | const struct svc_stat *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | #else |
| 71 | |
Randy Dunlap | cc9f4be | 2012-01-24 03:28:07 +0000 | [diff] [blame] | 72 | static inline struct proc_dir_entry *rpc_proc_register(struct net *net, struct rpc_stat *s) { return NULL; } |
| 73 | static inline void rpc_proc_unregister(struct net *net, const char *p) {} |
Trond Myklebust | a613fa1 | 2012-01-20 13:53:56 -0500 | [diff] [blame] | 74 | static inline void rpc_proc_zero(const struct rpc_program *p) {} |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | |
Stanislav Kinsbursky | 246590f | 2011-12-06 16:42:49 +0300 | [diff] [blame] | 76 | static inline struct proc_dir_entry *svc_proc_register(struct net *net, struct svc_stat *s, |
Arjan van de Ven | 99ac48f | 2006-03-28 01:56:41 -0800 | [diff] [blame] | 77 | const struct file_operations *f) { return NULL; } |
Stanislav Kinsbursky | 246590f | 2011-12-06 16:42:49 +0300 | [diff] [blame] | 78 | static inline void svc_proc_unregister(struct net *net, const char *p) {} |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | |
| 80 | static inline void svc_seq_show(struct seq_file *seq, |
| 81 | const struct svc_stat *st) {} |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | #endif |
| 83 | |
| 84 | #endif /* _LINUX_SUNRPC_STATS_H */ |