Whamcloud - gitweb
Branch: b1_8
[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 #include <lustre/lustre_idl.h>
28 #if defined(__linux__)
29 #include <linux/lprocfs_status.h>
30 #elif defined(__APPLE__)
31 #include <darwin/lprocfs_status.h>
32 #elif defined(__WINNT__)
33 #include <winnt/lprocfs_status.h>
34 #else
35 #error Unsupported operating system.
36 #endif
37
38 #undef LPROCFS
39 #if (defined(__KERNEL__) && defined(CONFIG_PROC_FS))
40 # define LPROCFS
41 #endif
42
43 struct lprocfs_vars {
44         const char   *name;
45         cfs_read_proc_t *read_fptr;
46         cfs_write_proc_t *write_fptr;
47         void *data;
48         struct file_operations *fops;
49 };
50
51 struct lprocfs_static_vars {
52         struct lprocfs_vars *module_vars;
53         struct lprocfs_vars *obd_vars;
54 };
55
56 /* if we find more consumers this could be generalized */
57 #define OBD_HIST_MAX 32
58 struct obd_histogram {
59         spinlock_t      oh_lock;
60         unsigned long   oh_buckets[OBD_HIST_MAX];
61 };
62
63 enum {
64         BRW_R_PAGES = 0,
65         BRW_W_PAGES,
66         BRW_R_RPC_HIST,
67         BRW_W_RPC_HIST,
68         BRW_R_IO_TIME,
69         BRW_W_IO_TIME,
70         BRW_R_DISCONT_PAGES,
71         BRW_W_DISCONT_PAGES,
72         BRW_R_DISCONT_BLOCKS,
73         BRW_W_DISCONT_BLOCKS,
74         BRW_R_DISK_IOSIZE,
75         BRW_W_DISK_IOSIZE,
76         BRW_R_DIO_FRAGS,
77         BRW_W_DIO_FRAGS,
78         BRW_LAST,
79 };
80
81 struct brw_stats {
82         struct obd_histogram hist[BRW_LAST];
83 };
84
85
86 /* An lprocfs counter can be configured using the enum bit masks below.
87  *
88  * LPROCFS_CNTR_EXTERNALLOCK indicates that an external lock already
89  * protects this counter from concurrent updates. If not specified,
90  * lprocfs an internal per-counter lock variable. External locks are
91  * not used to protect counter increments, but are used to protect
92  * counter readout and resets.
93  *
94  * LPROCFS_CNTR_AVGMINMAX indicates a multi-valued counter samples,
95  * (i.e. counter can be incremented by more than "1"). When specified,
96  * the counter maintains min, max and sum in addition to a simple
97  * invocation count. This allows averages to be be computed.
98  * If not specified, the counter is an increment-by-1 counter.
99  * min, max, sum, etc. are not maintained.
100  *
101  * LPROCFS_CNTR_STDDEV indicates that the counter should track sum of
102  * squares (for multi-valued counter samples only). This allows
103  * external computation of standard deviation, but involves a 64-bit
104  * multiply per counter increment.
105  */
106
107 enum {
108         LPROCFS_CNTR_EXTERNALLOCK = 0x0001,
109         LPROCFS_CNTR_AVGMINMAX    = 0x0002,
110         LPROCFS_CNTR_STDDEV       = 0x0004,
111
112         /* counter data type */
113         LPROCFS_TYPE_REGS         = 0x0100,
114         LPROCFS_TYPE_BYTES        = 0x0200,
115         LPROCFS_TYPE_PAGES        = 0x0400,
116         LPROCFS_TYPE_CYCLE        = 0x0800,
117 };
118
119 struct lprocfs_atomic {
120         atomic_t               la_entry;
121         atomic_t               la_exit;
122 };
123
124 #define LC_MIN_INIT ((~(__u64)0) >> 1)
125
126 struct lprocfs_counter {
127         struct lprocfs_atomic  lc_cntl;  /* may need to move to per set */
128         unsigned int           lc_config;
129         __s64                  lc_count;
130         __s64                  lc_sum;
131         __s64                  lc_min;
132         __s64                  lc_max;
133         __s64                  lc_sumsquare;
134         const char            *lc_name;   /* must be static */
135         const char            *lc_units;  /* must be static */
136 };
137
138 struct lprocfs_percpu {
139         struct lprocfs_counter lp_cntr[0];
140 };
141
142 #define LPROCFS_GET_NUM_CPU 0x0001
143 #define LPROCFS_GET_SMP_ID  0x0002
144
145 enum lprocfs_stats_flags {
146         LPROCFS_STATS_FLAG_PERCPU   = 0x0000, /* per cpu counter */
147         LPROCFS_STATS_FLAG_NOPERCPU = 0x0001, /* stats have no percpu
148                                                * area and need locking */
149 };
150
151 enum lprocfs_fields_flags {
152         LPROCFS_FIELDS_FLAGS_CONFIG = 0x0001,
153         LPROCFS_FIELDS_FLAGS_SUM    = 0x0002,
154         LPROCFS_FIELDS_FLAGS_MIN    = 0x0003,
155         LPROCFS_FIELDS_FLAGS_MAX    = 0x0004,
156         LPROCFS_FIELDS_FLAGS_AVG    = 0x0005,
157         LPROCFS_FIELDS_FLAGS_SUMSQUARE = 0x0006,
158         LPROCFS_FIELDS_FLAGS_COUNT  = 0x0007,
159 };
160
161 struct lprocfs_stats {
162         unsigned int           ls_num;     /* # of counters */
163         int                    ls_flags; /* See LPROCFS_STATS_FLAG_* */
164         spinlock_t             ls_lock;  /* Lock used only when there are
165                                           * no percpu stats areas */
166         struct lprocfs_percpu *ls_percpu[0];
167 };
168
169 static inline int opcode_offset(__u32 opc) {
170         if (opc < OST_LAST_OPC) {
171                  /* OST opcode */
172                 return (opc - OST_FIRST_OPC);
173         } else if (opc < MDS_LAST_OPC) {
174                 /* MDS opcode */
175                 return (opc - MDS_FIRST_OPC +
176                         (OST_LAST_OPC - OST_FIRST_OPC));
177         } else if (opc < LDLM_LAST_OPC) {
178                 /* LDLM Opcode */
179                 return (opc - LDLM_FIRST_OPC +
180                         (MDS_LAST_OPC - MDS_FIRST_OPC) +
181                         (OST_LAST_OPC - OST_FIRST_OPC));
182         } else if (opc < MGS_LAST_OPC) {
183                 /* MGS Opcode */
184                 return (opc - MGS_FIRST_OPC +
185                         (LDLM_LAST_OPC - LDLM_FIRST_OPC) +
186                         (MDS_LAST_OPC - MDS_FIRST_OPC) +
187                         (OST_LAST_OPC - OST_FIRST_OPC));
188         } else if (opc < OBD_LAST_OPC) {
189                 /* OBD Ping */
190                 return (opc - OBD_FIRST_OPC +
191                         (MGS_LAST_OPC - MGS_FIRST_OPC) +
192                         (LDLM_LAST_OPC - LDLM_FIRST_OPC) +
193                         (MDS_LAST_OPC - MDS_FIRST_OPC) +
194                         (OST_LAST_OPC - OST_FIRST_OPC));
195         } else if (opc < LLOG_LAST_OPC) {
196                 /* LLOG Opcode */
197                 return (opc - LLOG_FIRST_OPC +
198                         (OBD_LAST_OPC - OBD_FIRST_OPC) +
199                         (MGS_LAST_OPC - MGS_FIRST_OPC) +
200                         (LDLM_LAST_OPC - LDLM_FIRST_OPC) +
201                         (MDS_LAST_OPC - MDS_FIRST_OPC) +
202                         (OST_LAST_OPC - OST_FIRST_OPC));
203         } else {
204                 /* Unknown Opcode */
205                 return -1;
206         }
207 }
208
209 #define LUSTRE_MAX_OPCODES ((OST_LAST_OPC - OST_FIRST_OPC)     + \
210                             (MDS_LAST_OPC - MDS_FIRST_OPC)     + \
211                             (LDLM_LAST_OPC - LDLM_FIRST_OPC)   + \
212                             (MGS_LAST_OPC - MGS_FIRST_OPC)     + \
213                             (OBD_LAST_OPC - OBD_FIRST_OPC)     + \
214                             (LLOG_LAST_OPC - LLOG_FIRST_OPC))
215
216 #define EXTRA_MAX_OPCODES ((PTLRPC_LAST_CNTR - PTLRPC_FIRST_CNTR)  + \
217                            (EXTRA_LAST_OPC - EXTRA_FIRST_OPC))
218
219 enum {
220         PTLRPC_REQWAIT_CNTR = 0,
221         PTLRPC_REQQDEPTH_CNTR,
222         PTLRPC_REQACTIVE_CNTR,
223         PTLRPC_TIMEOUT,
224         PTLRPC_REQBUF_AVAIL_CNTR,
225         PTLRPC_LAST_CNTR
226 };
227
228 #define PTLRPC_FIRST_CNTR PTLRPC_REQWAIT_CNTR
229
230 enum {
231         LDLM_GLIMPSE_ENQUEUE = 0,
232         LDLM_PLAIN_ENQUEUE,
233         LDLM_EXTENT_ENQUEUE,
234         LDLM_FLOCK_ENQUEUE,
235         LDLM_IBITS_ENQUEUE,
236         MDS_REINT_CREATE,
237         MDS_REINT_LINK,
238         MDS_REINT_OPEN,
239         MDS_REINT_SETATTR,
240         MDS_REINT_RENAME,
241         MDS_REINT_UNLINK,
242         EXTRA_LAST_OPC
243 };
244
245 #define EXTRA_FIRST_OPC LDLM_GLIMPSE_ENQUEUE
246 /* class_obd.c */
247 extern cfs_proc_dir_entry_t *proc_lustre_root;
248
249 struct obd_device;
250 struct file;
251 struct obd_histogram;
252
253 /* Days / hours / mins / seconds format */
254 struct dhms {
255         int d,h,m,s;
256 };
257 static inline void s2dhms(struct dhms *ts, time_t secs)
258 {
259         ts->d = secs / 86400;
260         secs = secs % 86400;
261         ts->h = secs / 3600;
262         secs = secs % 3600;
263         ts->m = secs / 60;
264         ts->s = secs % 60;
265 }
266 #define DHMS_FMT "%dd%dh%02dm%02ds"
267 #define DHMS_VARS(x) (x)->d, (x)->h, (x)->m, (x)->s
268
269
270 #ifdef LPROCFS
271
272 static inline int lprocfs_stats_lock(struct lprocfs_stats *stats, int type)
273 {
274         int rc = 0;
275
276         if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) {
277                 if (type & LPROCFS_GET_NUM_CPU)
278                         rc = 1;
279                 if (type & LPROCFS_GET_SMP_ID)
280                         rc = 0;
281                 spin_lock(&stats->ls_lock);
282         } else {
283                 if (type & LPROCFS_GET_NUM_CPU)
284                         rc = num_possible_cpus();
285                 if (type & LPROCFS_GET_SMP_ID)
286                         rc = smp_processor_id();
287         }
288         return rc;
289 }
290
291 static inline void lprocfs_stats_unlock(struct lprocfs_stats *stats)
292 {
293         if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU)
294                 spin_unlock(&stats->ls_lock);
295 }
296
297 /* Two optimized LPROCFS counter increment functions are provided:
298  *     lprocfs_counter_incr(cntr, value) - optimized for by-one counters
299  *     lprocfs_counter_add(cntr) - use for multi-valued counters
300  * Counter data layout allows config flag, counter lock and the
301  * count itself to reside within a single cache line.
302  */
303
304 extern void lprocfs_counter_add(struct lprocfs_stats *stats, int idx,
305                                 long amount);
306 extern void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx,
307                                 long amount);
308
309 #define lprocfs_counter_incr(stats, idx) \
310         lprocfs_counter_add(stats, idx, 1)
311 #define lprocfs_counter_decr(stats, idx) \
312         lprocfs_counter_sub(stats, idx, 1)
313
314 extern __s64 lprocfs_read_helper(struct lprocfs_counter *lc, 
315                                  enum lprocfs_fields_flags field);
316
317 static inline __u64 lprocfs_stats_collector(struct lprocfs_stats *stats, 
318                                             int idx, 
319                                             enum lprocfs_fields_flags field)
320 {
321         __u64 ret = 0;
322         int i;
323
324         LASSERT(stats != NULL);
325         for (i = 0; i < num_possible_cpus(); i++)
326                 ret += lprocfs_read_helper(&(stats->ls_percpu[i]->lp_cntr[idx]),
327                                            field);
328         return ret;
329 }
330
331 extern struct lprocfs_stats *lprocfs_alloc_stats(unsigned int num, 
332                                                  enum lprocfs_stats_flags flags);
333 extern void lprocfs_clear_stats(struct lprocfs_stats *stats);
334 extern void lprocfs_free_stats(struct lprocfs_stats **stats);
335 extern void lprocfs_init_ops_stats(int num_private_stats, 
336                                    struct lprocfs_stats *stats);
337 extern int lprocfs_alloc_obd_stats(struct obd_device *obddev,
338                                    unsigned int num_private_stats);
339 extern void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
340                                  unsigned conf, const char *name,
341                                  const char *units);
342 extern void lprocfs_free_obd_stats(struct obd_device *obddev);
343 struct obd_export;
344 extern int lprocfs_add_clear_entry(struct obd_device * obd,
345                                    cfs_proc_dir_entry_t *entry);
346 extern int lprocfs_exp_setup(struct obd_export *exp,
347                              lnet_nid_t *peer_nid, int *newnid);
348 extern int lprocfs_exp_cleanup(struct obd_export *exp);
349 extern int lprocfs_add_simple(struct proc_dir_entry *root,
350                               char *name, read_proc_t *read_proc,
351                               write_proc_t *write_proc, void *data);
352 extern int lprocfs_register_stats(cfs_proc_dir_entry_t *root, const char *name,
353                                   struct lprocfs_stats *stats);
354
355 /* lprocfs_status.c */
356 extern int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
357                             struct lprocfs_vars *var,
358                             void *data);
359
360 extern cfs_proc_dir_entry_t *lprocfs_register(const char *name,
361                                                cfs_proc_dir_entry_t *parent,
362                                                struct lprocfs_vars *list,
363                                                void *data);
364
365 extern void lprocfs_remove(cfs_proc_dir_entry_t **root);
366
367 extern cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *root,
368                                            const char *name);
369
370 extern int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list);
371 extern int lprocfs_obd_cleanup(struct obd_device *obd);
372 extern int lprocfs_add_simple(struct proc_dir_entry *root, char *name,
373                               read_proc_t *read_proc, write_proc_t *write_proc,
374                               void *data);
375 struct nid_stat;
376 extern void lprocfs_free_per_client_stats(struct obd_device *obd);
377 extern int lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
378                                          unsigned long count, void *data);
379 extern int lprocfs_nid_stats_clear_read(char *page, char **start, off_t off,
380                                         int count, int *eof,  void *data);
381
382
383 extern struct file_operations lprocfs_evict_client_fops;
384
385 extern int lprocfs_seq_create(cfs_proc_dir_entry_t *parent, char *name, 
386                               mode_t mode, struct file_operations *seq_fops,
387                               void *data);
388 extern int lprocfs_obd_seq_create(struct obd_device *dev, char *name,
389                                   mode_t mode, struct file_operations *seq_fops,
390                                   void *data);
391
392 /* Generic callbacks */
393
394 extern int lprocfs_rd_u64(char *page, char **start, off_t off,
395                           int count, int *eof, void *data);
396 extern int lprocfs_rd_atomic(char *page, char **start, off_t off,
397                              int count, int *eof, void *data);
398 extern int lprocfs_wr_atomic(struct file *file, const char *buffer,
399                              unsigned long count, void *data);
400 extern int lprocfs_rd_uint(char *page, char **start, off_t off,
401                            int count, int *eof, void *data);
402 extern int lprocfs_wr_uint(struct file *file, const char *buffer,
403                            unsigned long count, void *data);
404 extern int lprocfs_rd_uuid(char *page, char **start, off_t off,
405                            int count, int *eof, void *data);
406 extern int lprocfs_rd_name(char *page, char **start, off_t off,
407                            int count, int *eof, void *data);
408 extern int lprocfs_rd_fstype(char *page, char **start, off_t off,
409                              int count, int *eof, void *data);
410 extern int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
411                                   int count, int *eof, void *data);
412 extern int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
413                                 int count, int *eof, void *data);
414 extern int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
415                                     int count, int *eof, void *data);
416 extern int lprocfs_rd_num_exports(char *page, char **start, off_t off,
417                                   int count, int *eof, void *data);
418 extern int lprocfs_rd_numrefs(char *page, char **start, off_t off,
419                               int count, int *eof, void *data);
420 struct adaptive_timeout;
421 extern int lprocfs_at_hist_helper(char *page, int count, int rc, 
422                                   struct adaptive_timeout *at);
423 extern int lprocfs_rd_timeouts(char *page, char **start, off_t off,
424                                int count, int *eof, void *data);
425 extern int lprocfs_wr_timeouts(struct file *file, const char *buffer,
426                                unsigned long count, void *data);
427 extern int lprocfs_wr_evict_client(struct file *file, const char *buffer,
428                                    unsigned long count, void *data);
429 extern int lprocfs_wr_ping(struct file *file, const char *buffer,
430                            unsigned long count, void *data);
431
432 /* Statfs helpers */
433 extern int lprocfs_rd_blksize(char *page, char **start, off_t off,
434                               int count, int *eof, void *data);
435 extern int lprocfs_rd_kbytestotal(char *page, char **start, off_t off,
436                                   int count, int *eof, void *data);
437 extern int lprocfs_rd_kbytesfree(char *page, char **start, off_t off,
438                                  int count, int *eof, void *data);
439 extern int lprocfs_rd_kbytesavail(char *page, char **start, off_t off,
440                                  int count, int *eof, void *data);
441 extern int lprocfs_rd_filestotal(char *page, char **start, off_t off,
442                                  int count, int *eof, void *data);
443 extern int lprocfs_rd_filesfree(char *page, char **start, off_t off,
444                                 int count, int *eof, void *data);
445 extern int lprocfs_rd_filegroups(char *page, char **start, off_t off,
446                                  int count, int *eof, void *data);
447
448 extern int lprocfs_write_helper(const char *buffer, unsigned long count,
449                                 int *val);
450 extern int lprocfs_write_frac_helper(const char *buffer, unsigned long count,
451                                      int *val, int mult);
452 extern int lprocfs_read_frac_helper(char *buffer, unsigned long count, 
453                                     long val, int mult);
454 extern int lprocfs_write_u64_helper(const char *buffer, unsigned long count,
455                                     __u64 *val);
456 extern int lprocfs_write_frac_u64_helper(const char *buffer, unsigned long count,
457                                          __u64 *val, int mult);
458 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value);
459 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value);
460 void lprocfs_oh_clear(struct obd_histogram *oh);
461 unsigned long lprocfs_oh_sum(struct obd_histogram *oh);
462
463 /* lprocfs_status.c: counter read/write functions */
464 extern int lprocfs_counter_read(char *page, char **start, off_t off,
465                                 int count, int *eof, void *data);
466 extern int lprocfs_counter_write(struct file *file, const char *buffer,
467                                  unsigned long count, void *data);
468
469 /* lprocfs_status.c: recovery status */
470 int lprocfs_obd_rd_recovery_status(char *page, char **start, off_t off,
471                                    int count, int *eof, void *data);
472
473 extern int lprocfs_seq_release(struct inode *, struct file *);
474
475 /* in lprocfs_stat.c, to protect the private data for proc entries */
476 extern struct rw_semaphore _lprocfs_lock;
477 #define LPROCFS_ENTRY()           do {  \
478         down_read(&_lprocfs_lock);      \
479 } while(0)
480 #define LPROCFS_EXIT()            do {  \
481         up_read(&_lprocfs_lock);        \
482 } while(0)
483 #define LPROCFS_ENTRY_AND_CHECK(dp) do {        \
484         typecheck(struct proc_dir_entry *, dp); \
485         LPROCFS_ENTRY();                        \
486         if ((dp)->deleted) {                    \
487                 LPROCFS_EXIT();                 \
488                 return -ENODEV;                 \
489         }                                       \
490 } while(0)
491
492 /* You must use these macros when you want to refer to 
493  * the import in a client obd_device for a lprocfs entry */
494 #define LPROCFS_CLIMP_CHECK(obd) do {           \
495         typecheck(struct obd_device *, obd);    \
496         down_read(&(obd)->u.cli.cl_sem);        \
497         if ((obd)->u.cli.cl_import == NULL) {   \
498              up_read(&(obd)->u.cli.cl_sem);     \
499              return -ENODEV;                    \
500         }                                       \
501 } while(0)
502 #define LPROCFS_CLIMP_EXIT(obd)                 \
503         up_read(&(obd)->u.cli.cl_sem);
504
505
506 /* write the name##_seq_show function, call LPROC_SEQ_FOPS_RO for read-only 
507   proc entries; otherwise, you will define name##_seq_write function also for 
508   a read-write proc entry, and then call LPROC_SEQ_SEQ instead. Finally,
509   call lprocfs_obd_seq_create(obd, filename, 0444, &name#_fops, data); */
510 #define __LPROC_SEQ_FOPS(name, custom_seq_write)                           \
511 static int name##_seq_open(struct inode *inode, struct file *file) {       \
512         struct proc_dir_entry *dp = PDE(inode);                            \
513         int rc;                                                            \
514         LPROCFS_ENTRY_AND_CHECK(dp);                                       \
515         rc = single_open(file, name##_seq_show, dp->data);                 \
516         if (rc) {                                                          \
517                 LPROCFS_EXIT();                                            \
518                 return rc;                                                 \
519         }                                                                  \
520         return 0;                                                          \
521 }                                                                          \
522 struct file_operations name##_fops = {                                     \
523         .owner   = THIS_MODULE,                                            \
524         .open    = name##_seq_open,                                        \
525         .read    = seq_read,                                               \
526         .write   = custom_seq_write,                                       \
527         .llseek  = seq_lseek,                                              \
528         .release = lprocfs_seq_release,                                    \
529 }
530
531 #define LPROC_SEQ_FOPS_RO(name)         __LPROC_SEQ_FOPS(name, NULL)
532 #define LPROC_SEQ_FOPS(name)            __LPROC_SEQ_FOPS(name, name##_seq_write)
533
534 /* lproc_ptlrpc.c */
535 struct ptlrpc_request;
536 extern void target_print_req(void *seq_file, struct ptlrpc_request *req);
537
538 #ifdef CRAY_XT3
539 /* lprocfs_status.c: read recovery max time bz13079 */
540 int lprocfs_obd_rd_recovery_maxtime(char *page, char **start, off_t off,
541                                     int count, int *eof, void *data);
542
543 /* lprocfs_status.c: write recovery max time bz13079 */
544 int lprocfs_obd_wr_recovery_maxtime(struct file *file, const char *buffer,
545                                     unsigned long count, void *data);
546 #endif
547
548 #else
549 /* LPROCFS is not defined */
550 static inline void lprocfs_counter_add(struct lprocfs_stats *stats,
551                                        int index, long amount) { return; }
552 static inline void lprocfs_counter_incr(struct lprocfs_stats *stats,
553                                         int index) { return; }
554 static inline void lprocfs_counter_sub(struct lprocfs_stats *stats,
555                                        int index, long amount) { return; }
556 static inline void lprocfs_counter_init(struct lprocfs_stats *stats,
557                                         int index, unsigned conf,
558                                         const char *name, const char *units)
559 { return; }
560
561 static inline __u64 lc_read_helper(struct lprocfs_counter *lc, 
562                                    enum lprocfs_fields_flags field) 
563 { return 0; }
564
565 static inline struct lprocfs_stats* lprocfs_alloc_stats(unsigned int num,
566                                                         enum lprocfs_stats_flags flags)
567 { return NULL; }
568 static inline void lprocfs_clear_stats(struct lprocfs_stats *stats)
569 { return; }
570 static inline void lprocfs_free_stats(struct lprocfs_stats **stats)
571 { return; }
572 static inline int lprocfs_register_stats(cfs_proc_dir_entry_t *root,
573                                             const char *name,
574                                             struct lprocfs_stats *stats)
575 { return 0; }
576 static inline void lprocfs_init_ops_stats(int num_private_stats, 
577                                           struct lprocfs_stats *stats)
578 { return; }
579 static inline int lprocfs_alloc_obd_stats(struct obd_device *obddev,
580                                           unsigned int num_private_stats)
581 { return 0; }
582 static inline void lprocfs_free_obd_stats(struct obd_device *obddev)
583 { return; }
584
585 struct obd_export;
586 static inline int lprocfs_add_clear_entry(struct obd_export *exp)
587 { return 0; }
588 static inline int lprocfs_exp_setup(struct obd_export *exp,
589                                     lnet_nid_t *peer_nid, int *newnid)
590 { return 0; }
591 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
592 { return 0; }
593 static inline int lprocfs_add_simple(struct proc_dir_entry *root,
594                                      char *name,
595                                      read_proc_t *read_proc,
596                                      write_proc_t *write_proc,
597                                      void *data)
598 {return 0; }
599 struct nid_stat;
600 static inline void lprocfs_free_per_client_stats(struct obd_device *obd)
601 {}
602 static inline
603 int lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
604                                   unsigned long count, void *data)
605 {return count;}
606 static inline
607 int lprocfs_nid_stats_clear_read(char *page, char **start, off_t off,
608                                  int count, int *eof,  void *data)
609 {return count;}
610
611
612 static inline cfs_proc_dir_entry_t *
613 lprocfs_register(const char *name, cfs_proc_dir_entry_t *parent,
614                  struct lprocfs_vars *list, void *data) { return NULL; }
615 static inline int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
616                                    struct lprocfs_vars *var,
617                                    void *data) { return 0; }
618 static inline void lprocfs_remove(cfs_proc_dir_entry_t **root) {};
619 static inline cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *head,
620                                     const char *name) {return 0;}
621 static inline int lprocfs_obd_setup(struct obd_device *dev,
622                                     struct lprocfs_vars *list) { return 0; }
623 static inline int lprocfs_obd_cleanup(struct obd_device *dev)  { return 0; }
624 static inline int lprocfs_rd_u64(char *page, char **start, off_t off,
625                                  int count, int *eof, void *data) { return 0; }
626 static inline int lprocfs_rd_uuid(char *page, char **start, off_t off,
627                                   int count, int *eof, void *data) { return 0; }
628 static inline int lprocfs_rd_name(char *page, char **start, off_t off,
629                                   int count, int *eof, void *data) { return 0; }
630 static inline int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
631                                          int count, int *eof, void *data)
632 { return 0; }
633 static inline int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
634                                        int count, int *eof, void *data)
635 { return 0; }
636 static inline int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
637                                            int count, int *eof, void *data)
638 { return 0; }
639 static inline int lprocfs_rd_num_exports(char *page, char **start, off_t off,
640                                          int count, int *eof, void *data)
641 { return 0; }
642 static inline int lprocfs_rd_numrefs(char *page, char **start, off_t off,
643                                      int count, int *eof, void *data)
644 { return 0; }
645 struct adaptive_timeout;
646 static inline int lprocfs_at_hist_helper(char *page, int count, int rc, 
647                                          struct adaptive_timeout *at)
648 { return 0; }
649 static inline int lprocfs_rd_timeouts(char *page, char **start, off_t off,
650                                       int count, int *eof, void *data)
651 { return 0; }
652 static inline int lprocfs_wr_timeouts(struct file *file, const char *buffer,
653                                       unsigned long count, void *data)
654 { return 0; }
655 static inline int lprocfs_wr_evict_client(struct file *file, const char *buffer,
656                                           unsigned long count, void *data)
657 { return 0; }
658 static inline int lprocfs_wr_ping(struct file *file, const char *buffer,
659                                   unsigned long count, void *data)
660 { return 0; }
661
662
663 /* Statfs helpers */
664 static inline
665 int lprocfs_rd_blksize(char *page, char **start, off_t off,
666                        int count, int *eof, void *data) { return 0; }
667 static inline
668 int lprocfs_rd_kbytestotal(char *page, char **start, off_t off,
669                            int count, int *eof, void *data) { return 0; }
670 static inline
671 int lprocfs_rd_kbytesfree(char *page, char **start, off_t off,
672                           int count, int *eof, void *data) { return 0; }
673 static inline
674 int lprocfs_rd_kbytesavail(char *page, char **start, off_t off,
675                            int count, int *eof, void *data) { return 0; }
676 static inline
677 int lprocfs_rd_filestotal(char *page, char **start, off_t off,
678                           int count, int *eof, void *data) { return 0; }
679 static inline
680 int lprocfs_rd_filesfree(char *page, char **start, off_t off,
681                          int count, int *eof, void *data)  { return 0; }
682 static inline
683 int lprocfs_rd_filegroups(char *page, char **start, off_t off,
684                           int count, int *eof, void *data) { return 0; }
685 static inline
686 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value) {}
687 static inline
688 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value) {}
689 static inline
690 void lprocfs_oh_clear(struct obd_histogram *oh) {}
691 static inline
692 unsigned long lprocfs_oh_sum(struct obd_histogram *oh) { return 0; }
693 static inline
694 int lprocfs_counter_read(char *page, char **start, off_t off,
695                          int count, int *eof, void *data) { return 0; }
696 static inline
697 int lprocfs_counter_write(struct file *file, const char *buffer,
698                           unsigned long count, void *data) { return 0; }
699
700 static inline
701 __u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx, 
702                                enum lprocfs_fields_flags field)
703 { return (__u64)0; }
704
705 #define LPROCFS_ENTRY()
706 #define LPROCFS_EXIT()
707 #define LPROCFS_ENTRY_AND_CHECK(dp)
708 #define LPROC_SEQ_FOPS_RO(name)
709 #define LPROC_SEQ_FOPS(name)
710
711 /* lproc_ptlrpc.c */
712 #define target_print_req NULL
713
714 #endif /* LPROCFS */
715
716 #endif /* LPROCFS_SNMP_H */