Whamcloud - gitweb
bug=13099
[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         __u64                  lc_count;
127         __u64                  lc_sum;
128         __u64                  lc_min;
129         __u64                  lc_max;
130         __u64                  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_NOPERCPU = 0x0001, /* stats have no percpu
144                                                * area and need locking */
145 };
146
147 struct lprocfs_stats {
148         unsigned int           ls_num;     /* # of counters */
149         unsigned int           ls_percpu_size;
150         int                    ls_flags; /* See LPROCFS_STATS_FLAG_* */
151         spinlock_t             ls_lock;  /* Lock used only when there are
152                                           * no percpu stats areas */
153         struct lprocfs_percpu *ls_percpu[0];
154 };
155
156
157 /* class_obd.c */
158 extern cfs_proc_dir_entry_t *proc_lustre_root;
159
160 struct obd_device;
161 struct file;
162 struct obd_histogram;
163
164 /* Days / hours / mins / seconds format */
165 struct dhms {
166         int d,h,m,s;
167 };
168 static inline void s2dhms(struct dhms *ts, time_t secs)
169 {
170         ts->d = secs / 86400;
171         secs = secs % 86400;
172         ts->h = secs / 3600;
173         secs = secs % 3600;
174         ts->m = secs / 60;
175         ts->s = secs % 60;
176 }
177 #define DHMS_FMT "%dd%dh%02dm%02ds"
178 #define DHMS_VARS(x) (x)->d, (x)->h, (x)->m, (x)->s
179
180
181 #ifdef LPROCFS
182
183 static inline int lprocfs_stats_lock(struct lprocfs_stats *stats, int type)
184 {
185         int rc = 0;
186
187         if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) {
188                 if (type & LPROCFS_GET_NUM_CPU)
189                         rc = 1;
190                 if (type & LPROCFS_GET_SMP_ID)
191                         rc = 0;
192                 spin_lock(&stats->ls_lock);
193         } else {
194                 if (type & LPROCFS_GET_NUM_CPU)
195                         rc = num_possible_cpus();
196                 if (type & LPROCFS_GET_SMP_ID)
197                         rc = smp_processor_id();
198         }
199         return rc;
200 }
201
202 static inline void lprocfs_stats_unlock(struct lprocfs_stats *stats)
203 {
204         if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU)
205                 spin_unlock(&stats->ls_lock);
206 }
207
208 /* Two optimized LPROCFS counter increment functions are provided:
209  *     lprocfs_counter_incr(cntr, value) - optimized for by-one counters
210  *     lprocfs_counter_add(cntr) - use for multi-valued counters
211  * Counter data layout allows config flag, counter lock and the
212  * count itself to reside within a single cache line.
213  */
214
215 static inline void lprocfs_counter_add(struct lprocfs_stats *stats, int idx,
216                                        long amount)
217 {
218         struct lprocfs_counter *percpu_cntr;
219         int smp_id;
220
221         if (!stats)
222                 return;
223
224         /* With per-client stats, statistics are allocated only for
225          * single CPU area, so the smp_id should be 0 always. */
226         smp_id = lprocfs_stats_lock(stats, LPROCFS_GET_SMP_ID);
227
228         percpu_cntr = &(stats->ls_percpu[smp_id]->lp_cntr[idx]);
229         atomic_inc(&percpu_cntr->lc_cntl.la_entry);
230         percpu_cntr->lc_count++;
231
232         if (percpu_cntr->lc_config & LPROCFS_CNTR_AVGMINMAX) {
233                 percpu_cntr->lc_sum += amount;
234                 if (percpu_cntr->lc_config & LPROCFS_CNTR_STDDEV)
235                         percpu_cntr->lc_sumsquare += (__u64)amount * amount;
236                 if (amount < percpu_cntr->lc_min)
237                         percpu_cntr->lc_min = amount;
238                 if (amount > percpu_cntr->lc_max)
239                         percpu_cntr->lc_max = amount;
240         }
241         atomic_inc(&percpu_cntr->lc_cntl.la_exit);
242         lprocfs_stats_unlock(stats);
243 }
244
245 static inline void lprocfs_counter_incr(struct lprocfs_stats *stats, int idx)
246 {
247         struct lprocfs_counter *percpu_cntr;
248         int smp_id;
249
250         if (!stats)
251                 return;
252
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         percpu_cntr->lc_count++;
258         atomic_inc(&percpu_cntr->lc_cntl.la_exit);
259
260         lprocfs_stats_unlock(stats);
261 }
262
263 extern struct lprocfs_stats *lprocfs_alloc_stats(unsigned int num,
264                                                  enum lprocfs_stats_flags flags);
265 extern void lprocfs_clear_stats(struct lprocfs_stats *stats);
266 extern void lprocfs_free_stats(struct lprocfs_stats **stats);
267 extern void lprocfs_init_ops_stats(int num_private_stats, 
268                                    struct lprocfs_stats *stats);
269 extern int lprocfs_alloc_obd_stats(struct obd_device *obddev,
270                                    unsigned int num_private_stats);
271 extern void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
272                                  unsigned conf, const char *name,
273                                  const char *units);
274 extern void lprocfs_free_obd_stats(struct obd_device *obddev);
275 struct obd_export;
276 extern int lprocfs_exp_setup(struct obd_export *exp);
277 extern int lprocfs_exp_cleanup(struct obd_export *exp);
278 extern int lprocfs_register_stats(cfs_proc_dir_entry_t *root, const char *name,
279                                   struct lprocfs_stats *stats);
280
281 #define LPROCFS_INIT_VARS(name, vclass, vinstance)           \
282 void lprocfs_##name##_init_vars(struct lprocfs_static_vars *x)  \
283 {                                                      \
284         x->module_vars = vclass;                       \
285         x->obd_vars = vinstance;                       \
286 }                                                      \
287
288 #define lprocfs_init_vars(NAME, VAR)     \
289 do {      \
290         extern void lprocfs_##NAME##_init_vars(struct lprocfs_static_vars *);  \
291         lprocfs_##NAME##_init_vars(VAR);                                       \
292 } while (0)
293
294 /* lprocfs_status.c */
295 extern int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
296                             struct lprocfs_vars *var,
297                             void *data);
298
299 extern cfs_proc_dir_entry_t *lprocfs_register(const char *name,
300                                                cfs_proc_dir_entry_t *parent,
301                                                struct lprocfs_vars *list,
302                                                void *data);
303
304 extern void lprocfs_remove(cfs_proc_dir_entry_t **root);
305
306 extern cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *root,
307                                            const char *name);
308
309 extern int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list);
310 extern int lprocfs_obd_cleanup(struct obd_device *obd);
311 extern struct file_operations lprocfs_evict_client_fops;
312
313 extern int lprocfs_seq_create(cfs_proc_dir_entry_t *parent, char *name, 
314                               mode_t mode, struct file_operations *seq_fops,
315                               void *data);
316 extern int lprocfs_obd_seq_create(struct obd_device *dev, char *name,
317                                   mode_t mode, struct file_operations *seq_fops,
318                                   void *data);
319
320 /* Generic callbacks */
321
322 extern int lprocfs_rd_u64(char *page, char **start, off_t off,
323                           int count, int *eof, void *data);
324 extern int lprocfs_rd_atomic(char *page, char **start, off_t off,
325                              int count, int *eof, void *data);
326 extern int lprocfs_wr_atomic(struct file *file, const char *buffer,
327                              unsigned long count, void *data);
328 extern int lprocfs_rd_uint(char *page, char **start, off_t off,
329                            int count, int *eof, void *data);
330 extern int lprocfs_wr_uint(struct file *file, const char *buffer,
331                            unsigned long count, void *data);
332 extern int lprocfs_rd_uuid(char *page, char **start, off_t off,
333                            int count, int *eof, void *data);
334 extern int lprocfs_rd_name(char *page, char **start, off_t off,
335                            int count, int *eof, void *data);
336 extern int lprocfs_rd_fstype(char *page, char **start, off_t off,
337                              int count, int *eof, void *data);
338 extern int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
339                                   int count, int *eof, void *data);
340 extern int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
341                                 int count, int *eof, void *data);
342 extern int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
343                                     int count, int *eof, void *data);
344 extern int lprocfs_rd_num_exports(char *page, char **start, off_t off,
345                                   int count, int *eof, void *data);
346 extern int lprocfs_rd_numrefs(char *page, char **start, off_t off,
347                               int count, int *eof, void *data);
348 struct adaptive_timeout;
349 extern int lprocfs_at_hist_helper(char *page, int count, int rc, 
350                                   struct adaptive_timeout *at);
351 extern int lprocfs_rd_timeouts(char *page, char **start, off_t off,
352                                int count, int *eof, void *data);
353 extern int lprocfs_wr_timeouts(struct file *file, const char *buffer,
354                                unsigned long count, void *data);
355 extern int lprocfs_wr_evict_client(struct file *file, const char *buffer,
356                                    unsigned long count, void *data);
357 extern int lprocfs_wr_ping(struct file *file, const char *buffer,
358                            unsigned long count, void *data);
359
360 /* Statfs helpers */
361 extern int lprocfs_rd_blksize(char *page, char **start, off_t off,
362                               int count, int *eof, void *data);
363 extern int lprocfs_rd_kbytestotal(char *page, char **start, off_t off,
364                                   int count, int *eof, void *data);
365 extern int lprocfs_rd_kbytesfree(char *page, char **start, off_t off,
366                                  int count, int *eof, void *data);
367 extern int lprocfs_rd_kbytesavail(char *page, char **start, off_t off,
368                                  int count, int *eof, void *data);
369 extern int lprocfs_rd_filestotal(char *page, char **start, off_t off,
370                                  int count, int *eof, void *data);
371 extern int lprocfs_rd_filesfree(char *page, char **start, off_t off,
372                                 int count, int *eof, void *data);
373 extern int lprocfs_rd_filegroups(char *page, char **start, off_t off,
374                                  int count, int *eof, void *data);
375
376 extern int lprocfs_write_helper(const char *buffer, unsigned long count,
377                                 int *val);
378 extern int lprocfs_write_frac_helper(const char *buffer, unsigned long count,
379                                      int *val, int mult);
380 extern int lprocfs_read_frac_helper(char *buffer, unsigned long count, 
381                                     long val, int mult);
382 extern int lprocfs_write_u64_helper(const char *buffer, unsigned long count,
383                                     __u64 *val);
384 extern int lprocfs_write_frac_u64_helper(const char *buffer, unsigned long count,
385                                          __u64 *val, int mult);
386 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value);
387 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value);
388 void lprocfs_oh_clear(struct obd_histogram *oh);
389 unsigned long lprocfs_oh_sum(struct obd_histogram *oh);
390
391 /* lprocfs_status.c: counter read/write functions */
392 extern int lprocfs_counter_read(char *page, char **start, off_t off,
393                                 int count, int *eof, void *data);
394 extern int lprocfs_counter_write(struct file *file, const char *buffer,
395                                  unsigned long count, void *data);
396
397 /* lprocfs_status.c: recovery status */
398 int lprocfs_obd_rd_recovery_status(char *page, char **start, off_t off,
399                                    int count, int *eof, void *data);
400
401 extern int lprocfs_seq_release(struct inode *, struct file *);
402
403 /* in lprocfs_stat.c, to protect the private data for proc entries */
404 extern struct rw_semaphore _lprocfs_lock;
405 #define LPROCFS_ENTRY()           do {  \
406         down_read(&_lprocfs_lock);      \
407 } while(0)
408 #define LPROCFS_EXIT()            do {  \
409         up_read(&_lprocfs_lock);        \
410 } while(0)
411 #define LPROCFS_ENTRY_AND_CHECK(dp) do {        \
412         typecheck(struct proc_dir_entry *, dp); \
413         LPROCFS_ENTRY();                        \
414         if ((dp)->deleted) {                    \
415                 LPROCFS_EXIT();                 \
416                 return -ENODEV;                 \
417         }                                       \
418 } while(0)
419
420 /* You must use these macros when you want to refer to 
421  * the import in a client obd_device for a lprocfs entry */
422 #define LPROCFS_CLIMP_CHECK(obd) do {           \
423         typecheck(struct obd_device *, obd);    \
424         mutex_down(&(obd)->u.cli.cl_sem);       \
425         if ((obd)->u.cli.cl_import == NULL) {   \
426              mutex_up(&(obd)->u.cli.cl_sem);    \
427              return -ENODEV;                    \
428         }                                       \
429 } while(0)
430 #define LPROCFS_CLIMP_EXIT(obd)                 \
431         mutex_up(&(obd)->u.cli.cl_sem);
432
433
434 /* write the name##_seq_show function, call LPROC_SEQ_FOPS_RO for read-only 
435   proc entries; otherwise, you will define name##_seq_write function also for 
436   a read-write proc entry, and then call LPROC_SEQ_SEQ instead. Finally,
437   call lprocfs_obd_seq_create(obd, filename, 0444, &name#_fops, data); */
438 #define __LPROC_SEQ_FOPS(name, custom_seq_write)                           \
439 static int name##_seq_open(struct inode *inode, struct file *file) {       \
440         struct proc_dir_entry *dp = PDE(inode);                            \
441         int rc;                                                            \
442         LPROCFS_ENTRY_AND_CHECK(dp);                                       \
443         rc = single_open(file, name##_seq_show, dp->data);                 \
444         if (rc) {                                                          \
445                 LPROCFS_EXIT();                                            \
446                 return rc;                                                 \
447         }                                                                  \
448         return 0;                                                          \
449 }                                                                          \
450 struct file_operations name##_fops = {                                     \
451         .owner   = THIS_MODULE,                                            \
452         .open    = name##_seq_open,                                        \
453         .read    = seq_read,                                               \
454         .write   = custom_seq_write,                                       \
455         .llseek  = seq_lseek,                                              \
456         .release = lprocfs_seq_release,                                    \
457 }
458
459 #define LPROC_SEQ_FOPS_RO(name)         __LPROC_SEQ_FOPS(name, NULL)
460 #define LPROC_SEQ_FOPS(name)            __LPROC_SEQ_FOPS(name, name##_seq_write)
461
462 /* lproc_ptlrpc.c */
463 struct ptlrpc_request;
464 extern void target_print_req(void *seq_file, struct ptlrpc_request *req);
465
466 #else
467 /* LPROCFS is not defined */
468 static inline void lprocfs_counter_add(struct lprocfs_stats *stats,
469                                        int index, long amount) { return; }
470 static inline void lprocfs_counter_incr(struct lprocfs_stats *stats,
471                                         int index) { return; }
472 static inline void lprocfs_counter_init(struct lprocfs_stats *stats,
473                                         int index, unsigned conf,
474                                         const char *name, const char *units)
475 { return; }
476
477 static inline struct lprocfs_stats* lprocfs_alloc_stats(unsigned int num,
478                                                         int client_stat)
479 { return NULL; }
480 static inline void lprocfs_clear_stats(struct lprocfs_stats *stats)
481 { return; }
482 static inline void lprocfs_free_stats(struct lprocfs_stats **stats)
483 { return; }
484 static inline int lprocfs_register_stats(cfs_proc_dir_entry_t *root,
485                                             const char *name,
486                                             struct lprocfs_stats *stats)
487 { return 0; }
488 static inline void lprocfs_init_ops_stats(int num_private_stats, 
489                                           struct lprocfs_stats *stats)
490 { return; }
491 static inline int lprocfs_alloc_obd_stats(struct obd_device *obddev,
492                                           unsigned int num_private_stats)
493 { return 0; }
494 static inline void lprocfs_free_obd_stats(struct obd_device *obddev)
495 { return; }
496
497 struct obd_export;
498 static inline int lprocfs_exp_setup(struct obd_export *exp)
499 { return 0; }
500 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
501 { return 0; }
502
503 static inline cfs_proc_dir_entry_t *
504 lprocfs_register(const char *name, cfs_proc_dir_entry_t *parent,
505                  struct lprocfs_vars *list, void *data) { return NULL; }
506 #define LPROCFS_INIT_VARS(name, vclass, vinstance)
507 #define lprocfs_init_vars(...) do {} while (0)
508 static inline int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
509                                    struct lprocfs_vars *var,
510                                    void *data) { return 0; }
511 static inline void lprocfs_remove(cfs_proc_dir_entry_t **root) {};
512 static inline cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *head,
513                                     const char *name) {return 0;}
514 static inline int lprocfs_obd_setup(struct obd_device *dev,
515                                     struct lprocfs_vars *list) { return 0; }
516 static inline int lprocfs_obd_cleanup(struct obd_device *dev)  { return 0; }
517 static inline int lprocfs_rd_u64(char *page, char **start, off_t off,
518                                  int count, int *eof, void *data) { return 0; }
519 static inline int lprocfs_rd_uuid(char *page, char **start, off_t off,
520                                   int count, int *eof, void *data) { return 0; }
521 static inline int lprocfs_rd_name(char *page, char **start, off_t off,
522                                   int count, int *eof, void *data) { return 0; }
523 static inline int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
524                                          int count, int *eof, void *data)
525 { return 0; }
526 static inline int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
527                                        int count, int *eof, void *data)
528 { return 0; }
529 static inline int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
530                                            int count, int *eof, void *data)
531 { return 0; }
532 static inline int lprocfs_rd_num_exports(char *page, char **start, off_t off,
533                                          int count, int *eof, void *data)
534 { return 0; }
535 static inline int lprocfs_rd_numrefs(char *page, char **start, off_t off,
536                                      int count, int *eof, void *data)
537 { return 0; }
538 struct adaptive_timeout;
539 static inline int lprocfs_at_hist_helper(char *page, int count, int rc, 
540                                          struct adaptive_timeout *at)
541 { return 0; }
542 static inline int lprocfs_rd_timeouts(char *page, char **start, off_t off,
543                                       int count, int *eof, void *data)
544 { return 0; }
545 static inline int lprocfs_wr_timeouts(struct file *file, const char *buffer,
546                                       unsigned long count, void *data)
547 { return 0; }
548 static inline int lprocfs_wr_evict_client(struct file *file, const char *buffer,
549                                           unsigned long count, void *data)
550 { return 0; }
551 static inline int lprocfs_wr_ping(struct file *file, const char *buffer,
552                                   unsigned long count, void *data)
553 { return 0; }
554
555
556 /* Statfs helpers */
557 static inline
558 int lprocfs_rd_blksize(char *page, char **start, off_t off,
559                        int count, int *eof, void *data) { return 0; }
560 static inline
561 int lprocfs_rd_kbytestotal(char *page, char **start, off_t off,
562                            int count, int *eof, void *data) { return 0; }
563 static inline
564 int lprocfs_rd_kbytesfree(char *page, char **start, off_t off,
565                           int count, int *eof, void *data) { return 0; }
566 static inline
567 int lprocfs_rd_kbytesavail(char *page, char **start, off_t off,
568                            int count, int *eof, void *data) { return 0; }
569 static inline
570 int lprocfs_rd_filestotal(char *page, char **start, off_t off,
571                           int count, int *eof, void *data) { return 0; }
572 static inline
573 int lprocfs_rd_filesfree(char *page, char **start, off_t off,
574                          int count, int *eof, void *data)  { return 0; }
575 static inline
576 int lprocfs_rd_filegroups(char *page, char **start, off_t off,
577                           int count, int *eof, void *data) { return 0; }
578 static inline
579 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value) {}
580 static inline
581 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value) {}
582 static inline
583 void lprocfs_oh_clear(struct obd_histogram *oh) {}
584 static inline
585 unsigned long lprocfs_oh_sum(struct obd_histogram *oh) { return 0; }
586 static inline
587 int lprocfs_counter_read(char *page, char **start, off_t off,
588                          int count, int *eof, void *data) { return 0; }
589 static inline
590 int lprocfs_counter_write(struct file *file, const char *buffer,
591                           unsigned long count, void *data) { return 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 /* lproc_ptlrpc.c */
600 #define target_print_req NULL
601
602 #endif /* LPROCFS */
603
604 #endif /* LPROCFS_SNMP_H */