Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / include / lprocfs_status.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *  Copyright (C) 2002 Cluster File Systems, Inc.
5  *
6  *   This file is part of Lustre, http://www.lustre.org.
7  *
8  *   Lustre is free software; you can redistribute it and/or
9  *   modify it under the terms of version 2 of the GNU General Public
10  *   License as published by the Free Software Foundation.
11  *
12  *   Lustre is distributed in the hope that it will be useful,
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *   GNU General Public License for more details.
16  *
17  *   You should have received a copy of the GNU General Public License
18  *   along with Lustre; if not, write to the Free Software
19  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  *
21  *   Top level header file for LProc SNMP
22  *   Author: Hariharan Thantry thantry@users.sourceforge.net
23  */
24 #ifndef _LPROCFS_SNMP_H
25 #define _LPROCFS_SNMP_H
26
27 #if defined(__linux__)
28 #include <linux/lprocfs_status.h>
29 #elif defined(__APPLE__)
30 #include <darwin/lprocfs_status.h>
31 #elif defined(__WINNT__)
32 #include <winnt/lprocfs_status.h>
33 #else
34 #error Unsupported operating system.
35 #endif
36
37 #undef LPROCFS
38 #if (defined(__KERNEL__) && defined(CONFIG_PROC_FS))
39 # define LPROCFS
40 #endif
41
42 struct lprocfs_vars {
43         const char   *name;
44         cfs_read_proc_t *read_fptr;
45         cfs_write_proc_t *write_fptr;
46         void *data;
47         struct file_operations *fops;
48 };
49
50 struct lprocfs_static_vars {
51         struct lprocfs_vars *module_vars;
52         struct lprocfs_vars *obd_vars;
53 };
54
55 /* if we find more consumers this could be generalized */
56 #define OBD_HIST_MAX 32
57 struct obd_histogram {
58         spinlock_t      oh_lock;
59         unsigned long   oh_buckets[OBD_HIST_MAX];
60 };
61
62 enum {
63         BRW_R_PAGES = 0,
64         BRW_W_PAGES,
65         BRW_R_RPC_HIST,
66         BRW_W_RPC_HIST,
67         BRW_R_IO_TIME,
68         BRW_W_IO_TIME,
69         BRW_R_DISCONT_PAGES,
70         BRW_W_DISCONT_PAGES,
71         BRW_R_DISCONT_BLOCKS,
72         BRW_W_DISCONT_BLOCKS,
73         BRW_R_DISK_IOSIZE,
74         BRW_W_DISK_IOSIZE,
75         BRW_R_DIO_FRAGS,
76         BRW_W_DIO_FRAGS,
77         BRW_LAST,
78 };
79
80 struct brw_stats {
81         struct obd_histogram hist[BRW_LAST];
82 };
83
84
85 /* An lprocfs counter can be configured using the enum bit masks below.
86  *
87  * LPROCFS_CNTR_EXTERNALLOCK indicates that an external lock already
88  * protects this counter from concurrent updates. If not specified,
89  * lprocfs an internal per-counter lock variable. External locks are
90  * not used to protect counter increments, but are used to protect
91  * counter readout and resets.
92  *
93  * LPROCFS_CNTR_AVGMINMAX indicates a multi-valued counter samples,
94  * (i.e. counter can be incremented by more than "1"). When specified,
95  * the counter maintains min, max and sum in addition to a simple
96  * invocation count. This allows averages to be be computed.
97  * If not specified, the counter is an increment-by-1 counter.
98  * min, max, sum, etc. are not maintained.
99  *
100  * LPROCFS_CNTR_STDDEV indicates that the counter should track sum of
101  * squares (for multi-valued counter samples only). This allows
102  * external computation of standard deviation, but involves a 64-bit
103  * multiply per counter increment.
104  */
105
106 enum {
107         LPROCFS_CNTR_EXTERNALLOCK = 0x0001,
108         LPROCFS_CNTR_AVGMINMAX    = 0x0002,
109         LPROCFS_CNTR_STDDEV       = 0x0004,
110
111         /* counter data type */
112         LPROCFS_TYPE_REGS         = 0x0100,
113         LPROCFS_TYPE_BYTES        = 0x0200,
114         LPROCFS_TYPE_PAGES        = 0x0400,
115         LPROCFS_TYPE_CYCLE        = 0x0800,
116 };
117
118 struct lprocfs_atomic {
119         atomic_t               la_entry;
120         atomic_t               la_exit;
121 };
122
123 struct lprocfs_counter {
124         struct lprocfs_atomic  lc_cntl;  /* may need to move to per set */
125         unsigned int           lc_config;
126         __s64                  lc_count;
127         __s64                  lc_sum;
128         __s64                  lc_min;
129         __s64                  lc_max;
130         __s64                  lc_sumsquare;
131         const char            *lc_name;   /* must be static */
132         const char            *lc_units;  /* must be static */
133 };
134
135 struct lprocfs_percpu {
136         struct lprocfs_counter lp_cntr[0];
137 };
138
139 #define LPROCFS_GET_NUM_CPU 0x0001
140 #define LPROCFS_GET_SMP_ID  0x0002
141
142 enum lprocfs_stats_flags {
143         LPROCFS_STATS_FLAG_PERCPU   = 0x0000, /* per cpu counter */
144         LPROCFS_STATS_FLAG_NOPERCPU = 0x0001, /* stats have no percpu
145                                                * area and need locking */
146 };
147
148 enum lprocfs_fields_flags {
149         LPROCFS_FIELDS_FLAGS_CONFIG     = 0x0001,
150         LPROCFS_FIELDS_FLAGS_SUM        = 0x0002,
151         LPROCFS_FIELDS_FLAGS_MIN        = 0x0003,
152         LPROCFS_FIELDS_FLAGS_MAX        = 0x0004,
153         LPROCFS_FIELDS_FLAGS_AVG        = 0x0005,
154         LPROCFS_FIELDS_FLAGS_SUMSQUARE  = 0x0006,
155         LPROCFS_FIELDS_FLAGS_COUNT      = 0x0007,
156 };
157
158 struct lprocfs_stats {
159         unsigned int           ls_num;     /* # of counters */
160         unsigned int           ls_percpu_size;
161         int                    ls_flags; /* See LPROCFS_STATS_FLAG_* */
162         spinlock_t             ls_lock;  /* Lock used only when there are
163                                           * no percpu stats areas */
164         struct lprocfs_percpu *ls_percpu[0];
165 };
166
167
168 /* class_obd.c */
169 extern cfs_proc_dir_entry_t *proc_lustre_root;
170
171 struct obd_device;
172 struct file;
173 struct obd_histogram;
174
175 #ifdef LPROCFS
176
177 static inline int lprocfs_stats_lock(struct lprocfs_stats *stats, int type)
178 {
179         int rc = 0;
180
181         if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) {
182                 if (type & LPROCFS_GET_NUM_CPU)
183                         rc = 1;
184                 if (type & LPROCFS_GET_SMP_ID)
185                         rc = 0;
186                 spin_lock(&stats->ls_lock);
187         } else {
188                 if (type & LPROCFS_GET_NUM_CPU)
189                         rc = num_possible_cpus();
190                 if (type & LPROCFS_GET_SMP_ID)
191                         rc = smp_processor_id();
192         }
193         return rc;
194 }
195
196 static inline void lprocfs_stats_unlock(struct lprocfs_stats *stats)
197 {
198         if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU)
199                 spin_unlock(&stats->ls_lock);
200 }
201
202 /* Two optimized LPROCFS counter increment functions are provided:
203  *     lprocfs_counter_incr(cntr, value) - optimized for by-one counters
204  *     lprocfs_counter_add(cntr) - use for multi-valued counters
205  * Counter data layout allows config flag, counter lock and the
206  * count itself to reside within a single cache line.
207  */
208
209 static inline void lprocfs_counter_add(struct lprocfs_stats *stats, int idx,
210                                        long amount)
211 {
212         struct lprocfs_counter *percpu_cntr;
213         int smp_id;
214
215         if (stats == NULL)
216                 return;
217
218         /* With per-client stats, statistics are allocated only for
219          * single CPU area, so the smp_id should be 0 always. */
220         smp_id = lprocfs_stats_lock(stats, LPROCFS_GET_SMP_ID);
221
222         percpu_cntr = &(stats->ls_percpu[smp_id]->lp_cntr[idx]);
223         atomic_inc(&percpu_cntr->lc_cntl.la_entry);
224         percpu_cntr->lc_count++;
225
226         if (percpu_cntr->lc_config & LPROCFS_CNTR_AVGMINMAX) {
227                 percpu_cntr->lc_sum += amount;
228                 if (percpu_cntr->lc_config & LPROCFS_CNTR_STDDEV)
229                         percpu_cntr->lc_sumsquare += (__u64)amount * amount;
230                 if (amount < percpu_cntr->lc_min)
231                         percpu_cntr->lc_min = amount;
232                 if (amount > percpu_cntr->lc_max)
233                         percpu_cntr->lc_max = amount;
234         }
235         atomic_inc(&percpu_cntr->lc_cntl.la_exit);
236         lprocfs_stats_unlock(stats);
237 }
238
239 #define lprocfs_counter_incr(stats, idx) \
240         lprocfs_counter_add(stats, idx, 1)
241
242 static inline void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx,
243                                        long amount)
244 {
245         struct lprocfs_counter *percpu_cntr;
246         int smp_id;
247
248         if (stats == NULL)
249                 return;
250
251         /* With per-client stats, statistics are allocated only for
252          * single CPU area, so the smp_id should be 0 always. */
253         smp_id = lprocfs_stats_lock(stats, LPROCFS_GET_SMP_ID);
254
255         percpu_cntr = &(stats->ls_percpu[smp_id]->lp_cntr[idx]);
256         atomic_inc(&percpu_cntr->lc_cntl.la_entry);
257         if (percpu_cntr->lc_config & LPROCFS_CNTR_AVGMINMAX)
258                 percpu_cntr->lc_sum -= amount;
259         atomic_inc(&percpu_cntr->lc_cntl.la_exit);
260         lprocfs_stats_unlock(stats);
261 }
262 #define lprocfs_counter_decr(stats, idx) \
263         lprocfs_counter_sub(stats, idx, 1)
264
265 extern __s64 lprocfs_read_helper(struct lprocfs_counter *lc, 
266                                  enum lprocfs_fields_flags field);
267 static inline __u64 lprocfs_stats_collector(struct lprocfs_stats *stats, 
268                                             int idx, 
269                                             enum lprocfs_fields_flags field)
270 {
271         __u64 ret = 0;
272         int i;
273
274         LASSERT(stats != NULL);
275         for (i = 0; i < num_possible_cpus(); i++)
276                 ret += lprocfs_read_helper(&(stats->ls_percpu[i]->lp_cntr[idx]),
277                                            field);
278         return ret;
279 }
280
281 extern struct lprocfs_stats *lprocfs_alloc_stats(unsigned int num,
282                                                  enum lprocfs_stats_flags flags);
283 extern void lprocfs_clear_stats(struct lprocfs_stats *stats);
284 extern void lprocfs_free_stats(struct lprocfs_stats **stats);
285 extern void lprocfs_init_ops_stats(int num_private_stats, 
286                                    struct lprocfs_stats *stats);
287 extern int lprocfs_alloc_obd_stats(struct obd_device *obddev,
288                                    unsigned int num_private_stats);
289 extern void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
290                                  unsigned conf, const char *name,
291                                  const char *units);
292 extern void lprocfs_free_obd_stats(struct obd_device *obddev);
293 struct obd_export;
294 extern int lprocfs_exp_setup(struct obd_export *exp);
295 extern int lprocfs_exp_cleanup(struct obd_export *exp);
296 extern int lprocfs_register_stats(cfs_proc_dir_entry_t *root, const char *name,
297                                   struct lprocfs_stats *stats);
298
299 /* lprocfs_status.c */
300 extern int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
301                             struct lprocfs_vars *var,
302                             void *data);
303
304 extern cfs_proc_dir_entry_t *lprocfs_register(const char *name,
305                                                cfs_proc_dir_entry_t *parent,
306                                                struct lprocfs_vars *list,
307                                                void *data);
308
309 extern void lprocfs_remove(cfs_proc_dir_entry_t **root);
310
311 extern cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *root,
312                                            const char *name);
313
314 extern int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list);
315 extern int lprocfs_obd_cleanup(struct obd_device *obd);
316 extern struct file_operations lprocfs_evict_client_fops;
317
318 extern int lprocfs_seq_create(cfs_proc_dir_entry_t *parent, char *name, 
319                               mode_t mode, struct file_operations *seq_fops,
320                               void *data);
321 extern int lprocfs_obd_seq_create(struct obd_device *dev, char *name,
322                                   mode_t mode, struct file_operations *seq_fops,
323                                   void *data);
324
325 /* Generic callbacks */
326
327 extern int lprocfs_rd_u64(char *page, char **start, off_t off,
328                           int count, int *eof, void *data);
329 extern int lprocfs_rd_atomic(char *page, char **start, off_t off,
330                              int count, int *eof, void *data);
331 extern int lprocfs_wr_atomic(struct file *file, const char *buffer,
332                              unsigned long count, void *data);
333 extern int lprocfs_rd_uint(char *page, char **start, off_t off,
334                            int count, int *eof, void *data);
335 extern int lprocfs_wr_uint(struct file *file, const char *buffer,
336                            unsigned long count, void *data);
337 extern int lprocfs_rd_uuid(char *page, char **start, off_t off,
338                            int count, int *eof, void *data);
339 extern int lprocfs_rd_name(char *page, char **start, off_t off,
340                            int count, int *eof, void *data);
341 extern int lprocfs_rd_fstype(char *page, char **start, off_t off,
342                              int count, int *eof, void *data);
343 extern int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
344                                   int count, int *eof, void *data);
345 extern int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
346                                 int count, int *eof, void *data);
347 extern int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
348                                     int count, int *eof, void *data);
349 extern int lprocfs_rd_num_exports(char *page, char **start, off_t off,
350                                   int count, int *eof, void *data);
351 extern int lprocfs_rd_numrefs(char *page, char **start, off_t off,
352                               int count, int *eof, void *data);
353 extern int lprocfs_wr_evict_client(struct file *file, const char *buffer,
354                                    unsigned long count, void *data);
355 extern int lprocfs_wr_ping(struct file *file, const char *buffer,
356                            unsigned long count, void *data);
357
358 /* Statfs helpers */
359 extern int lprocfs_rd_blksize(char *page, char **start, off_t off,
360                               int count, int *eof, void *data);
361 extern int lprocfs_rd_kbytestotal(char *page, char **start, off_t off,
362                                   int count, int *eof, void *data);
363 extern int lprocfs_rd_kbytesfree(char *page, char **start, off_t off,
364                                  int count, int *eof, void *data);
365 extern int lprocfs_rd_kbytesavail(char *page, char **start, off_t off,
366                                  int count, int *eof, void *data);
367 extern int lprocfs_rd_filestotal(char *page, char **start, off_t off,
368                                  int count, int *eof, void *data);
369 extern int lprocfs_rd_filesfree(char *page, char **start, off_t off,
370                                 int count, int *eof, void *data);
371 extern int lprocfs_rd_filegroups(char *page, char **start, off_t off,
372                                  int count, int *eof, void *data);
373
374 extern int lprocfs_write_helper(const char *buffer, unsigned long count,
375                                 int *val);
376 extern int lprocfs_write_frac_helper(const char *buffer, unsigned long count,
377                                      int *val, int mult);
378 extern int lprocfs_read_frac_helper(char *buffer, unsigned long count, 
379                                     long val, int mult);
380 extern int lprocfs_write_u64_helper(const char *buffer, unsigned long count,
381                                     __u64 *val);
382 extern int lprocfs_write_frac_u64_helper(const char *buffer, unsigned long count,
383                                          __u64 *val, int mult);
384 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value);
385 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value);
386 void lprocfs_oh_clear(struct obd_histogram *oh);
387 unsigned long lprocfs_oh_sum(struct obd_histogram *oh);
388
389 /* lprocfs_status.c: counter read/write functions */
390 extern int lprocfs_counter_read(char *page, char **start, off_t off,
391                                 int count, int *eof, void *data);
392 extern int lprocfs_counter_write(struct file *file, const char *buffer,
393                                  unsigned long count, void *data);
394
395 /* lprocfs_status.c: recovery status */
396 int lprocfs_obd_rd_recovery_status(char *page, char **start, off_t off,
397                                    int count, int *eof, void *data);
398
399 extern int lprocfs_seq_release(struct inode *, struct file *);
400
401 /* in lprocfs_stat.c, to protect the private data for proc entries */
402 extern struct rw_semaphore _lprocfs_lock;
403 #define LPROCFS_ENTRY()           do {  \
404         down_read(&_lprocfs_lock);      \
405 } while(0)
406 #define LPROCFS_EXIT()            do {  \
407         up_read(&_lprocfs_lock);        \
408 } while(0)
409 #define LPROCFS_ENTRY_AND_CHECK(dp) do {        \
410         typecheck(struct proc_dir_entry *, dp); \
411         LPROCFS_ENTRY();                        \
412         if ((dp)->deleted) {                    \
413                 LPROCFS_EXIT();                 \
414                 return -ENODEV;                 \
415         }                                       \
416 } while(0)
417
418 /* You must use these macros when you want to refer to 
419  * the import in a client obd_device for a lprocfs entry */
420 #define LPROCFS_CLIMP_CHECK(obd) do {           \
421         typecheck(struct obd_device *, obd);    \
422         mutex_down(&(obd)->u.cli.cl_sem);       \
423         if ((obd)->u.cli.cl_import == NULL) {   \
424              mutex_up(&(obd)->u.cli.cl_sem);    \
425              return -ENODEV;                    \
426         }                                       \
427 } while(0)
428 #define LPROCFS_CLIMP_EXIT(obd)                 \
429         mutex_up(&(obd)->u.cli.cl_sem);
430
431
432 /* write the name##_seq_show function, call LPROC_SEQ_FOPS_RO for read-only 
433   proc entries; otherwise, you will define name##_seq_write function also for 
434   a read-write proc entry, and then call LPROC_SEQ_SEQ instead. Finally,
435   call lprocfs_obd_seq_create(obd, filename, 0444, &name#_fops, data); */
436 #define __LPROC_SEQ_FOPS(name, custom_seq_write)                           \
437 static int name##_seq_open(struct inode *inode, struct file *file) {       \
438         struct proc_dir_entry *dp = PDE(inode);                            \
439         int rc;                                                            \
440         LPROCFS_ENTRY_AND_CHECK(dp);                                       \
441         rc = single_open(file, name##_seq_show, dp->data);                 \
442         if (rc) {                                                          \
443                 LPROCFS_EXIT();                                            \
444                 return rc;                                                 \
445         }                                                                  \
446         return 0;                                                          \
447 }                                                                          \
448 struct file_operations name##_fops = {                                     \
449         .owner   = THIS_MODULE,                                            \
450         .open    = name##_seq_open,                                        \
451         .read    = seq_read,                                               \
452         .write   = custom_seq_write,                                       \
453         .llseek  = seq_lseek,                                              \
454         .release = lprocfs_seq_release,                                    \
455 }
456
457 #define LPROC_SEQ_FOPS_RO(name)         __LPROC_SEQ_FOPS(name, NULL)
458 #define LPROC_SEQ_FOPS(name)            __LPROC_SEQ_FOPS(name, name##_seq_write)
459
460 /* lprocfs_status.c: read recovery max time bz13079 */
461 int lprocfs_obd_rd_recovery_maxtime(char *page, char **start, off_t off,
462                                     int count, int *eof, void *data);
463
464 /* lprocfs_status.c: write recovery max time bz13079 */
465 int lprocfs_obd_wr_recovery_maxtime(struct file *file, const char *buffer,
466                                     unsigned long count, void *data);
467 #else
468 /* LPROCFS is not defined */
469 static inline void lprocfs_counter_add(struct lprocfs_stats *stats,
470                                        int index, long amount) { return; }
471 static inline void lprocfs_counter_incr(struct lprocfs_stats *stats,
472                                         int index) { return; }
473 static inline void lprocfs_counter_sub(struct lprocfs_stats *stats,
474                                        int index, long amount) { return; }
475 static inline void lprocfs_counter_init(struct lprocfs_stats *stats,
476                                         int index, unsigned conf,
477                                         const char *name, const char *units)
478 { return; }
479
480 static inline __u64 lc_read_helper(struct lprocfs_counter *lc, 
481                                    enum lprocfs_fields_flags field) 
482 { return 0; }
483
484 static inline struct lprocfs_stats* lprocfs_alloc_stats(unsigned int num,
485                                                         enum lprocfs_stats_flags flags)
486 { return NULL; }
487 static inline void lprocfs_clear_stats(struct lprocfs_stats *stats)
488 { return; }
489 static inline void lprocfs_free_stats(struct lprocfs_stats **stats)
490 { return; }
491 static inline int lprocfs_register_stats(cfs_proc_dir_entry_t *root,
492                                             const char *name,
493                                             struct lprocfs_stats *stats)
494 { return 0; }
495 static inline void lprocfs_init_ops_stats(int num_private_stats, 
496                                           struct lprocfs_stats *stats)
497 { return; }
498 static inline int lprocfs_alloc_obd_stats(struct obd_device *obddev,
499                                              unsigned int num_private_stats)
500 { return 0; }
501 static inline void lprocfs_free_obd_stats(struct obd_device *obddev)
502 { return; }
503
504 struct obd_export;
505 static inline int lprocfs_exp_setup(struct obd_export *exp)
506 { return 0; }
507 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
508 { return 0; }
509
510 static inline cfs_proc_dir_entry_t *
511 lprocfs_register(const char *name, cfs_proc_dir_entry_t *parent,
512                  struct lprocfs_vars *list, void *data) { return NULL; }
513 static inline int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
514                                    struct lprocfs_vars *var,
515                                    void *data) { return 0; }
516 static inline void lprocfs_remove(cfs_proc_dir_entry_t **root) {};
517 static inline cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *head,
518                                     const char *name) {return 0;}
519 static inline int lprocfs_obd_setup(struct obd_device *dev,
520                                     struct lprocfs_vars *list) { return 0; }
521 static inline int lprocfs_obd_cleanup(struct obd_device *dev)  { return 0; }
522 static inline int lprocfs_rd_u64(char *page, char **start, off_t off,
523                                  int count, int *eof, void *data) { return 0; }
524 static inline int lprocfs_rd_uuid(char *page, char **start, off_t off,
525                                   int count, int *eof, void *data) { return 0; }
526 static inline int lprocfs_rd_name(char *page, char **start, off_t off,
527                                   int count, int *eof, void *data) { return 0; }
528 static inline int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
529                                          int count, int *eof, void *data)
530 { return 0; }
531 static inline int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
532                                        int count, int *eof, void *data)
533 { return 0; }
534 static inline int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
535                                            int count, int *eof, void *data)
536 { return 0; }
537 static inline int lprocfs_rd_num_exports(char *page, char **start, off_t off,
538                                          int count, int *eof, void *data)
539 { return 0; }
540 static inline int lprocfs_rd_numrefs(char *page, char **start, off_t off,
541                                      int count, int *eof, void *data)
542 { return 0; }
543 static inline int lprocfs_wr_evict_client(struct file *file, const char *buffer,
544                                           unsigned long count, void *data)
545 { return 0; }
546 static inline int lprocfs_wr_ping(struct file *file, const char *buffer,
547                                   unsigned long count, void *data)
548 { return 0; }
549
550
551 /* Statfs helpers */
552 static inline
553 int lprocfs_rd_blksize(char *page, char **start, off_t off,
554                        int count, int *eof, void *data) { return 0; }
555 static inline
556 int lprocfs_rd_kbytestotal(char *page, char **start, off_t off,
557                            int count, int *eof, void *data) { return 0; }
558 static inline
559 int lprocfs_rd_kbytesfree(char *page, char **start, off_t off,
560                           int count, int *eof, void *data) { return 0; }
561 static inline
562 int lprocfs_rd_kbytesavail(char *page, char **start, off_t off,
563                            int count, int *eof, void *data) { return 0; }
564 static inline
565 int lprocfs_rd_filestotal(char *page, char **start, off_t off,
566                           int count, int *eof, void *data) { return 0; }
567 static inline
568 int lprocfs_rd_filesfree(char *page, char **start, off_t off,
569                          int count, int *eof, void *data)  { return 0; }
570 static inline
571 int lprocfs_rd_filegroups(char *page, char **start, off_t off,
572                           int count, int *eof, void *data) { return 0; }
573 static inline
574 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value) {}
575 static inline
576 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value) {}
577 static inline
578 void lprocfs_oh_clear(struct obd_histogram *oh) {}
579 static inline
580 unsigned long lprocfs_oh_sum(struct obd_histogram *oh) { return 0; }
581 static inline
582 int lprocfs_counter_read(char *page, char **start, off_t off,
583                          int count, int *eof, void *data) { return 0; }
584 static inline
585 int lprocfs_counter_write(struct file *file, const char *buffer,
586                           unsigned long count, void *data) { return 0; }
587
588 static inline
589 __u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx, 
590                                enum lprocfs_fields_flags field)
591 { return (__u64)0; }
592
593 #define LPROCFS_ENTRY()
594 #define LPROCFS_EXIT()
595 #define LPROCFS_ENTRY_AND_CHECK(dp)
596 #define LPROC_SEQ_FOPS_RO(name)
597 #define LPROC_SEQ_FOPS(name)
598
599 #endif /* LPROCFS */
600
601 #endif /* LPROCFS_SNMP_H */