Whamcloud - gitweb
LU-5275 libcfs: merge params_tree.h into lprocfs_status.h
[fs/lustre-release.git] / lustre / include / lprocfs_status.h
1 /*
2  * GPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License version 2 for more details (a copy is included
14  * in the LICENSE file that accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License
17  * version 2 along with this program; If not, see
18  * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
19  *
20  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21  * CA 95054 USA or visit www.sun.com if you need additional information or
22  * have any questions.
23  *
24  * GPL HEADER END
25  */
26 /*
27  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
28  * Use is subject to license terms.
29  *
30  * Copyright (c) 2011, 2014, Intel Corporation.
31  */
32 /*
33  * This file is part of Lustre, http://www.lustre.org/
34  * Lustre is a trademark of Sun Microsystems, Inc.
35  *
36  * lustre/include/lprocfs_status.h
37  *
38  * Top level header file for LProc SNMP
39  *
40  * Author: Hariharan Thantry thantry@users.sourceforge.net
41  */
42 #ifndef _LPROCFS_SNMP_H
43 #define _LPROCFS_SNMP_H
44
45 #include <linux/fs.h>
46 #include <linux/proc_fs.h>
47 #include <linux/rwsem.h>
48 #include <linux/spinlock.h>
49
50 #include <lustre/lustre_idl.h>
51
52 #ifndef HAVE_ONLY_PROCFS_SEQ
53 struct lprocfs_vars {
54         const char                      *name;
55         read_proc_t                     *read_fptr;
56         write_proc_t                    *write_fptr;
57         void                            *data;
58         const struct file_operations    *fops;
59         /**
60          * /proc file mode.
61          */
62         mode_t                          proc_mode;
63 };
64
65 struct lprocfs_static_vars {
66         struct lprocfs_vars *module_vars;
67         struct lprocfs_vars *obd_vars;
68 };
69
70 #endif
71
72 struct lprocfs_seq_vars {
73         const char                      *name;
74         const struct file_operations    *fops;
75         void                            *data;
76         /**
77          * /proc file mode.
78          */
79         mode_t                           proc_mode;
80 };
81
82 /* if we find more consumers this could be generalized */
83 #define OBD_HIST_MAX 32
84 struct obd_histogram {
85         spinlock_t      oh_lock;
86         unsigned long   oh_buckets[OBD_HIST_MAX];
87 };
88
89 enum {
90         BRW_R_PAGES = 0,
91         BRW_W_PAGES,
92         BRW_R_RPC_HIST,
93         BRW_W_RPC_HIST,
94         BRW_R_IO_TIME,
95         BRW_W_IO_TIME,
96         BRW_R_DISCONT_PAGES,
97         BRW_W_DISCONT_PAGES,
98         BRW_R_DISCONT_BLOCKS,
99         BRW_W_DISCONT_BLOCKS,
100         BRW_R_DISK_IOSIZE,
101         BRW_W_DISK_IOSIZE,
102         BRW_R_DIO_FRAGS,
103         BRW_W_DIO_FRAGS,
104         BRW_LAST,
105 };
106
107 struct brw_stats {
108         struct obd_histogram hist[BRW_LAST];
109 };
110
111 enum {
112         RENAME_SAMEDIR_SIZE = 0,
113         RENAME_CROSSDIR_SRC_SIZE,
114         RENAME_CROSSDIR_TGT_SIZE,
115         RENAME_LAST,
116 };
117
118 struct rename_stats {
119         struct obd_histogram hist[RENAME_LAST];
120 };
121
122 /* An lprocfs counter can be configured using the enum bit masks below.
123  *
124  * LPROCFS_CNTR_EXTERNALLOCK indicates that an external lock already
125  * protects this counter from concurrent updates. If not specified,
126  * lprocfs an internal per-counter lock variable. External locks are
127  * not used to protect counter increments, but are used to protect
128  * counter readout and resets.
129  *
130  * LPROCFS_CNTR_AVGMINMAX indicates a multi-valued counter samples,
131  * (i.e. counter can be incremented by more than "1"). When specified,
132  * the counter maintains min, max and sum in addition to a simple
133  * invocation count. This allows averages to be be computed.
134  * If not specified, the counter is an increment-by-1 counter.
135  * min, max, sum, etc. are not maintained.
136  *
137  * LPROCFS_CNTR_STDDEV indicates that the counter should track sum of
138  * squares (for multi-valued counter samples only). This allows
139  * external computation of standard deviation, but involves a 64-bit
140  * multiply per counter increment.
141  */
142
143 enum {
144         LPROCFS_CNTR_EXTERNALLOCK = 0x0001,
145         LPROCFS_CNTR_AVGMINMAX    = 0x0002,
146         LPROCFS_CNTR_STDDEV       = 0x0004,
147
148         /* counter data type */
149         LPROCFS_TYPE_REGS         = 0x0100,
150         LPROCFS_TYPE_BYTES        = 0x0200,
151         LPROCFS_TYPE_PAGES        = 0x0400,
152         LPROCFS_TYPE_CYCLE        = 0x0800,
153 };
154
155 #define LC_MIN_INIT ((~(__u64)0) >> 1)
156
157 struct lprocfs_counter_header {
158         unsigned int            lc_config;
159         const char              *lc_name;   /* must be static */
160         const char              *lc_units;  /* must be static */
161 };
162
163 struct lprocfs_counter {
164         __s64   lc_count;
165         __s64   lc_min;
166         __s64   lc_max;
167         __s64   lc_sumsquare;
168         /*
169          * Every counter has lc_array_sum[0], while lc_array_sum[1] is only
170          * for irq context counter, i.e. stats with
171          * LPROCFS_STATS_FLAG_IRQ_SAFE flag, its counter need
172          * lc_array_sum[1]
173          */
174         __s64   lc_array_sum[1];
175 };
176 #define lc_sum          lc_array_sum[0]
177 #define lc_sum_irq      lc_array_sum[1]
178
179 struct lprocfs_percpu {
180         struct lprocfs_counter lp_cntr[0];
181 };
182
183 enum lprocfs_stats_lock_ops {
184         LPROCFS_GET_NUM_CPU     = 0x0001, /* number allocated per-CPU stats */
185         LPROCFS_GET_SMP_ID      = 0x0002, /* current stat to be updated */
186 };
187
188 enum lprocfs_stats_flags {
189         LPROCFS_STATS_FLAG_NONE     = 0x0000, /* per cpu counter */
190         LPROCFS_STATS_FLAG_NOPERCPU = 0x0001, /* stats have no percpu
191                                                * area and need locking */
192         LPROCFS_STATS_FLAG_IRQ_SAFE = 0x0002, /* alloc need irq safe */
193 };
194
195 enum lprocfs_fields_flags {
196         LPROCFS_FIELDS_FLAGS_CONFIG     = 0x0001,
197         LPROCFS_FIELDS_FLAGS_SUM        = 0x0002,
198         LPROCFS_FIELDS_FLAGS_MIN        = 0x0003,
199         LPROCFS_FIELDS_FLAGS_MAX        = 0x0004,
200         LPROCFS_FIELDS_FLAGS_AVG        = 0x0005,
201         LPROCFS_FIELDS_FLAGS_SUMSQUARE  = 0x0006,
202         LPROCFS_FIELDS_FLAGS_COUNT      = 0x0007,
203 };
204
205 struct lprocfs_stats {
206         /* # of counters */
207         unsigned short                  ls_num;
208         /* 1 + the biggest cpu # whose ls_percpu slot has been allocated */
209         unsigned short                  ls_biggest_alloc_num;
210         enum lprocfs_stats_flags        ls_flags;
211         /* Lock used when there are no percpu stats areas; For percpu stats,
212          * it is used to protect ls_biggest_alloc_num change */
213         spinlock_t                      ls_lock;
214
215         /* has ls_num of counter headers */
216         struct lprocfs_counter_header   *ls_cnt_header;
217         struct lprocfs_percpu           *ls_percpu[0];
218 };
219
220 #define OPC_RANGE(seg) (seg ## _LAST_OPC - seg ## _FIRST_OPC)
221
222 /* Pack all opcodes down into a single monotonically increasing index */
223 static inline int opcode_offset(__u32 opc) {
224         if (opc < OST_LAST_OPC) {
225                  /* OST opcode */
226                 return (opc - OST_FIRST_OPC);
227         } else if (opc < MDS_LAST_OPC) {
228                 /* MDS opcode */
229                 return (opc - MDS_FIRST_OPC +
230                         OPC_RANGE(OST));
231         } else if (opc < LDLM_LAST_OPC) {
232                 /* LDLM Opcode */
233                 return (opc - LDLM_FIRST_OPC +
234                         OPC_RANGE(MDS) +
235                         OPC_RANGE(OST));
236         } else if (opc < MGS_LAST_OPC) {
237                 /* MGS Opcode */
238                 return (opc - MGS_FIRST_OPC +
239                         OPC_RANGE(LDLM) +
240                         OPC_RANGE(MDS) +
241                         OPC_RANGE(OST));
242         } else if (opc < OBD_LAST_OPC) {
243                 /* OBD Ping */
244                 return (opc - OBD_FIRST_OPC +
245                         OPC_RANGE(MGS) +
246                         OPC_RANGE(LDLM) +
247                         OPC_RANGE(MDS) +
248                         OPC_RANGE(OST));
249         } else if (opc < LLOG_LAST_OPC) {
250                 /* LLOG Opcode */
251                 return (opc - LLOG_FIRST_OPC +
252                         OPC_RANGE(OBD) +
253                         OPC_RANGE(MGS) +
254                         OPC_RANGE(LDLM) +
255                         OPC_RANGE(MDS) +
256                         OPC_RANGE(OST));
257         } else if (opc < QUOTA_LAST_OPC) {
258                 /* LQUOTA Opcode */
259                 return (opc - QUOTA_FIRST_OPC +
260                         OPC_RANGE(LLOG) +
261                         OPC_RANGE(OBD) +
262                         OPC_RANGE(MGS) +
263                         OPC_RANGE(LDLM) +
264                         OPC_RANGE(MDS) +
265                         OPC_RANGE(OST));
266         } else if (opc < SEQ_LAST_OPC) {
267                 /* SEQ opcode */
268                 return (opc - SEQ_FIRST_OPC +
269                         OPC_RANGE(QUOTA) +
270                         OPC_RANGE(LLOG) +
271                         OPC_RANGE(OBD) +
272                         OPC_RANGE(MGS) +
273                         OPC_RANGE(LDLM) +
274                         OPC_RANGE(MDS) +
275                         OPC_RANGE(OST));
276         } else if (opc < SEC_LAST_OPC) {
277                 /* SEC opcode */
278                 return (opc - SEC_FIRST_OPC +
279                         OPC_RANGE(SEQ) +
280                         OPC_RANGE(QUOTA) +
281                         OPC_RANGE(LLOG) +
282                         OPC_RANGE(OBD) +
283                         OPC_RANGE(MGS) +
284                         OPC_RANGE(LDLM) +
285                         OPC_RANGE(MDS) +
286                         OPC_RANGE(OST));
287         } else if (opc < FLD_LAST_OPC) {
288                 /* FLD opcode */
289                  return (opc - FLD_FIRST_OPC +
290                         OPC_RANGE(SEC) +
291                         OPC_RANGE(SEQ) +
292                         OPC_RANGE(QUOTA) +
293                         OPC_RANGE(LLOG) +
294                         OPC_RANGE(OBD) +
295                         OPC_RANGE(MGS) +
296                         OPC_RANGE(LDLM) +
297                         OPC_RANGE(MDS) +
298                         OPC_RANGE(OST));
299         } else if (opc < OUT_UPDATE_LAST_OPC) {
300                 /* update opcode */
301                 return (opc - OUT_UPDATE_FIRST_OPC +
302                         OPC_RANGE(FLD) +
303                         OPC_RANGE(SEC) +
304                         OPC_RANGE(SEQ) +
305                         OPC_RANGE(QUOTA) +
306                         OPC_RANGE(LLOG) +
307                         OPC_RANGE(OBD) +
308                         OPC_RANGE(MGS) +
309                         OPC_RANGE(LDLM) +
310                         OPC_RANGE(MDS) +
311                         OPC_RANGE(OST));
312         } else if (opc < LFSCK_LAST_OPC) {
313                 /* LFSCK opcode */
314                 return (opc - LFSCK_FIRST_OPC +
315                         OPC_RANGE(OUT_UPDATE) +
316                         OPC_RANGE(FLD) +
317                         OPC_RANGE(SEC) +
318                         OPC_RANGE(SEQ) +
319                         OPC_RANGE(QUOTA) +
320                         OPC_RANGE(LLOG) +
321                         OPC_RANGE(OBD) +
322                         OPC_RANGE(MGS) +
323                         OPC_RANGE(LDLM) +
324                         OPC_RANGE(MDS) +
325                         OPC_RANGE(OST));
326         } else {
327                 /* Unknown Opcode */
328                 return -1;
329         }
330 }
331
332
333 #define LUSTRE_MAX_OPCODES (OPC_RANGE(OST)  + \
334                             OPC_RANGE(MDS)  + \
335                             OPC_RANGE(LDLM) + \
336                             OPC_RANGE(MGS)  + \
337                             OPC_RANGE(OBD)  + \
338                             OPC_RANGE(LLOG) + \
339                             OPC_RANGE(SEC)  + \
340                             OPC_RANGE(SEQ)  + \
341                             OPC_RANGE(SEC)  + \
342                             OPC_RANGE(FLD)  + \
343                             OPC_RANGE(OUT_UPDATE) + \
344                             OPC_RANGE(LFSCK))
345
346 #define EXTRA_MAX_OPCODES ((PTLRPC_LAST_CNTR - PTLRPC_FIRST_CNTR)  + \
347                             OPC_RANGE(EXTRA))
348
349 enum {
350         PTLRPC_REQWAIT_CNTR = 0,
351         PTLRPC_REQQDEPTH_CNTR,
352         PTLRPC_REQACTIVE_CNTR,
353         PTLRPC_TIMEOUT,
354         PTLRPC_REQBUF_AVAIL_CNTR,
355         PTLRPC_LAST_CNTR
356 };
357
358 #define PTLRPC_FIRST_CNTR PTLRPC_REQWAIT_CNTR
359
360 enum lprocfs_extra_opc {
361         LDLM_GLIMPSE_ENQUEUE = 0,
362         LDLM_PLAIN_ENQUEUE,
363         LDLM_EXTENT_ENQUEUE,
364         LDLM_FLOCK_ENQUEUE,
365         LDLM_IBITS_ENQUEUE,
366         MDS_REINT_SETATTR,
367         MDS_REINT_CREATE,
368         MDS_REINT_LINK,
369         MDS_REINT_UNLINK,
370         MDS_REINT_RENAME,
371         MDS_REINT_OPEN,
372         MDS_REINT_SETXATTR,
373         BRW_READ_BYTES,
374         BRW_WRITE_BYTES,
375         EXTRA_LAST_OPC
376 };
377
378 #define EXTRA_FIRST_OPC LDLM_GLIMPSE_ENQUEUE
379 /* class_obd.c */
380 extern struct proc_dir_entry *proc_lustre_root;
381
382 struct obd_device;
383 struct obd_histogram;
384
385 /* Days / hours / mins / seconds format */
386 struct dhms {
387         int d,h,m,s;
388 };
389 static inline void s2dhms(struct dhms *ts, time_t secs)
390 {
391         ts->d = secs / 86400;
392         secs = secs % 86400;
393         ts->h = secs / 3600;
394         secs = secs % 3600;
395         ts->m = secs / 60;
396         ts->s = secs % 60;
397 }
398 #define DHMS_FMT "%dd%dh%02dm%02ds"
399 #define DHMS_VARS(x) (x)->d, (x)->h, (x)->m, (x)->s
400
401 #define JOBSTATS_JOBID_VAR_MAX_LEN      20
402 #define JOBSTATS_DISABLE                "disable"
403 #define JOBSTATS_PROCNAME_UID           "procname_uid"
404
405 typedef void (*cntr_init_callback)(struct lprocfs_stats *stats);
406
407 struct obd_job_stats {
408         cfs_hash_t             *ojs_hash;
409         struct list_head        ojs_list;
410         rwlock_t                ojs_lock; /* protect the obj_list */
411         cntr_init_callback      ojs_cntr_init_fn;
412         int                     ojs_cntr_num;
413         int                     ojs_cleanup_interval;
414         time_t                  ojs_last_cleanup;
415 };
416
417 #ifdef CONFIG_PROC_FS
418
419 extern int lprocfs_stats_alloc_one(struct lprocfs_stats *stats,
420                                    unsigned int cpuid);
421
422 /**
423  * Lock statistics structure for access, possibly only on this CPU.
424  *
425  * The statistics struct may be allocated with per-CPU structures for
426  * efficient concurrent update (usually only on server-wide stats), or
427  * as a single global struct (e.g. for per-client or per-job statistics),
428  * so the required locking depends on the type of structure allocated.
429  *
430  * For per-CPU statistics, pin the thread to the current cpuid so that
431  * will only access the statistics for that CPU.  If the stats structure
432  * for the current CPU has not been allocated (or previously freed),
433  * allocate it now.  The per-CPU statistics do not need locking since
434  * the thread is pinned to the CPU during update.
435  *
436  * For global statistics, lock the stats structure to prevent concurrent update.
437  *
438  * \param[in] stats     statistics structure to lock
439  * \param[in] opc       type of operation:
440  *                      LPROCFS_GET_SMP_ID: "lock" and return current CPU index
441  *                              for incrementing statistics for that CPU
442  *                      LPROCFS_GET_NUM_CPU: "lock" and return number of used
443  *                              CPU indices to iterate over all indices
444  * \param[out] flags    CPU interrupt saved state for IRQ-safe locking
445  *
446  * \retval cpuid of current thread or number of allocated structs
447  * \retval negative on error (only for opc LPROCFS_GET_SMP_ID + per-CPU stats)
448  */
449 static inline int lprocfs_stats_lock(struct lprocfs_stats *stats,
450                                      enum lprocfs_stats_lock_ops opc,
451                                      unsigned long *flags)
452 {
453         if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) {
454                 if (stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE)
455                         spin_lock_irqsave(&stats->ls_lock, *flags);
456                 else
457                         spin_lock(&stats->ls_lock);
458                 return opc == LPROCFS_GET_NUM_CPU ? 1 : 0;
459         }
460
461         switch (opc) {
462         case LPROCFS_GET_SMP_ID: {
463                 unsigned int cpuid = get_cpu();
464
465                 if (unlikely(stats->ls_percpu[cpuid] == NULL)) {
466                         int rc = lprocfs_stats_alloc_one(stats, cpuid);
467                         if (rc < 0) {
468                                 put_cpu();
469                                 return rc;
470                         }
471                 }
472                 return cpuid;
473         }
474         case LPROCFS_GET_NUM_CPU:
475                 return stats->ls_biggest_alloc_num;
476         default:
477                 LBUG();
478         }
479 }
480
481 /**
482  * Unlock statistics structure after access.
483  *
484  * Unlock the lock acquired via lprocfs_stats_lock() for global statistics,
485  * or unpin this thread from the current cpuid for per-CPU statistics.
486  *
487  * This function must be called using the same arguments as used when calling
488  * lprocfs_stats_lock() so that the correct operation can be performed.
489  *
490  * \param[in] stats     statistics structure to unlock
491  * \param[in] opc       type of operation (current cpuid or number of structs)
492  * \param[in] flags     CPU interrupt saved state for IRQ-safe locking
493  */
494 static inline void lprocfs_stats_unlock(struct lprocfs_stats *stats,
495                                         enum lprocfs_stats_lock_ops opc,
496                                         unsigned long *flags)
497 {
498         if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) {
499                 if (stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE)
500                         spin_unlock_irqrestore(&stats->ls_lock, *flags);
501                 else
502                         spin_unlock(&stats->ls_lock);
503         } else if (opc == LPROCFS_GET_SMP_ID) {
504                 put_cpu();
505         }
506 }
507
508 static inline unsigned int
509 lprocfs_stats_counter_size(struct lprocfs_stats *stats)
510 {
511         unsigned int percpusize;
512
513         percpusize = offsetof(struct lprocfs_percpu, lp_cntr[stats->ls_num]);
514
515         /* irq safe stats need lc_array_sum[1] */
516         if ((stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0)
517                 percpusize += stats->ls_num * sizeof(__s64);
518
519         if ((stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) == 0)
520                 percpusize = L1_CACHE_ALIGN(percpusize);
521
522         return percpusize;
523 }
524
525 static inline struct lprocfs_counter *
526 lprocfs_stats_counter_get(struct lprocfs_stats *stats, unsigned int cpuid,
527                           int index)
528 {
529         struct lprocfs_counter *cntr;
530
531         cntr = &stats->ls_percpu[cpuid]->lp_cntr[index];
532
533         if ((stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0)
534                 cntr = (void *)cntr + index * sizeof(__s64);
535
536         return cntr;
537 }
538
539 /* Two optimized LPROCFS counter increment functions are provided:
540  *     lprocfs_counter_incr(cntr, value) - optimized for by-one counters
541  *     lprocfs_counter_add(cntr) - use for multi-valued counters
542  * Counter data layout allows config flag, counter lock and the
543  * count itself to reside within a single cache line.
544  */
545
546 extern void lprocfs_counter_add(struct lprocfs_stats *stats, int idx,
547                                 long amount);
548 extern void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx,
549                                 long amount);
550
551 #define lprocfs_counter_incr(stats, idx) \
552         lprocfs_counter_add(stats, idx, 1)
553 #define lprocfs_counter_decr(stats, idx) \
554         lprocfs_counter_sub(stats, idx, 1)
555
556 extern __s64 lprocfs_read_helper(struct lprocfs_counter *lc,
557                                  struct lprocfs_counter_header *header,
558                                  enum lprocfs_stats_flags flags,
559                                  enum lprocfs_fields_flags field);
560 static inline __u64 lprocfs_stats_collector(struct lprocfs_stats *stats,
561                                             int idx,
562                                             enum lprocfs_fields_flags field)
563 {
564         unsigned int  i;
565         unsigned int  num_cpu;
566         unsigned long flags     = 0;
567         __u64         ret       = 0;
568
569         LASSERT(stats != NULL);
570
571         num_cpu = lprocfs_stats_lock(stats, LPROCFS_GET_NUM_CPU, &flags);
572         for (i = 0; i < num_cpu; i++) {
573                 if (stats->ls_percpu[i] == NULL)
574                         continue;
575                 ret += lprocfs_read_helper(
576                                 lprocfs_stats_counter_get(stats, i, idx),
577                                 &stats->ls_cnt_header[idx], stats->ls_flags,
578                                 field);
579         }
580         lprocfs_stats_unlock(stats, LPROCFS_GET_NUM_CPU, &flags);
581         return ret;
582 }
583
584 extern struct lprocfs_stats *
585 lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags);
586 extern void lprocfs_clear_stats(struct lprocfs_stats *stats);
587 extern void lprocfs_free_stats(struct lprocfs_stats **stats);
588 extern void lprocfs_init_ops_stats(int num_private_stats,
589                                    struct lprocfs_stats *stats);
590 extern void lprocfs_init_mps_stats(int num_private_stats,
591                                    struct lprocfs_stats *stats);
592 extern void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats);
593 extern int lprocfs_alloc_obd_stats(struct obd_device *obddev,
594                                    unsigned int num_private_stats);
595 extern int lprocfs_alloc_md_stats(struct obd_device *obddev,
596                                   unsigned int num_private_stats);
597 extern void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
598                                  unsigned conf, const char *name,
599                                  const char *units);
600 extern void lprocfs_free_obd_stats(struct obd_device *obddev);
601 extern void lprocfs_free_md_stats(struct obd_device *obddev);
602 struct obd_export;
603 struct nid_stat;
604 extern int lprocfs_add_clear_entry(struct obd_device * obd,
605                                    struct proc_dir_entry *entry);
606 #ifdef HAVE_SERVER_SUPPORT
607 extern int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *peer_nid);
608 extern int lprocfs_exp_cleanup(struct obd_export *exp);
609 #else
610 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
611 { return 0; }
612 #endif
613 extern struct proc_dir_entry *
614 lprocfs_add_simple(struct proc_dir_entry *root, char *name,
615                    void *data, const struct file_operations *fops);
616 extern struct proc_dir_entry *
617 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
618                     const char *format, ...);
619 extern void lprocfs_free_per_client_stats(struct obd_device *obd);
620 #ifdef HAVE_SERVER_SUPPORT
621 extern ssize_t
622 lprocfs_nid_stats_clear_seq_write(struct file *file, const char *buffer,
623                                         size_t count, loff_t *off);
624 extern int lprocfs_nid_stats_clear_seq_show(struct seq_file *file, void *data);
625 #endif
626 extern int lprocfs_register_stats(struct proc_dir_entry *root, const char *name,
627                                   struct lprocfs_stats *stats);
628
629 /* lprocfs_status.c */
630 #ifndef HAVE_ONLY_PROCFS_SEQ
631 extern int lprocfs_add_vars(struct proc_dir_entry *root,
632                             struct lprocfs_vars *var,
633                             void *data);
634
635 extern struct proc_dir_entry *lprocfs_register(const char *name,
636                                               struct proc_dir_entry *parent,
637                                               struct lprocfs_vars *list,
638                                               void *data);
639 #endif
640 extern int lprocfs_seq_add_vars(struct proc_dir_entry *root,
641                                 struct lprocfs_seq_vars *var,
642                                 void *data);
643
644 extern struct proc_dir_entry *
645 lprocfs_seq_register(const char *name, struct proc_dir_entry *parent,
646                      struct lprocfs_seq_vars *list, void *data);
647 extern void lprocfs_remove(struct proc_dir_entry **root);
648 extern void lprocfs_remove_proc_entry(const char *name,
649                                       struct proc_dir_entry *parent);
650 #ifndef HAVE_ONLY_PROCFS_SEQ
651 extern void lprocfs_try_remove_proc_entry(const char *name,
652                                           struct proc_dir_entry *parent);
653
654 extern struct proc_dir_entry *lprocfs_srch(struct proc_dir_entry *root,
655                                           const char *name);
656
657 #define PDE_DATA(inode)         (PDE(inode)->data)
658
659 static inline int LPROCFS_ENTRY_CHECK(struct inode *inode)
660 {
661         struct proc_dir_entry *dp = PDE(inode);
662         int deleted = 0;
663
664         spin_lock(&(dp)->pde_unload_lock);
665         if (dp->proc_fops == NULL)
666                 deleted = 1;
667         spin_unlock(&(dp)->pde_unload_lock);
668         if (deleted)
669                 return -ENODEV;
670         return 0;
671 }
672 #else
673 static inline int LPROCFS_ENTRY_CHECK(struct inode *inode)
674 { return 0; }
675 #endif
676 extern int lprocfs_obd_setup(struct obd_device *dev);
677 extern int lprocfs_obd_cleanup(struct obd_device *obd);
678 #ifdef HAVE_SERVER_SUPPORT
679 extern const struct file_operations lprocfs_evict_client_fops;
680 #endif
681 extern int lprocfs_seq_create(struct proc_dir_entry *parent, const char *name,
682                               mode_t mode,
683                               const struct file_operations *seq_fops,
684                               void *data);
685 extern int lprocfs_obd_seq_create(struct obd_device *dev, const char *name,
686                                   mode_t mode,
687                                   const struct file_operations *seq_fops,
688                                   void *data);
689
690 /* Generic callbacks */
691 extern int lprocfs_u64_seq_show(struct seq_file *m, void *data);
692 extern int lprocfs_atomic_seq_show(struct seq_file *m, void *data);
693 extern ssize_t lprocfs_atomic_seq_write(struct file *file,
694                                         const char __user *buffer,
695                                         size_t count, loff_t *off);
696 extern int lprocfs_uint_seq_show(struct seq_file *m, void *data);
697 extern ssize_t lprocfs_uint_seq_write(struct file *file,
698                                       const char __user *buffer,
699                                       size_t count, loff_t *off);
700 extern int lprocfs_wr_uint(struct file *file, const char __user *buffer,
701                            unsigned long count, void *data);
702 extern int lprocfs_uuid_seq_show(struct seq_file *m, void *data);
703 extern int lprocfs_name_seq_show(struct seq_file *m, void *data);
704 extern int lprocfs_server_uuid_seq_show(struct seq_file *m, void *data);
705 extern int lprocfs_conn_uuid_seq_show(struct seq_file *m, void *data);
706 extern int lprocfs_import_seq_show(struct seq_file *m, void *data);
707 extern int lprocfs_state_seq_show(struct seq_file *m, void *data);
708 extern int lprocfs_connect_flags_seq_show(struct seq_file *m, void *data);
709 #ifdef HAVE_SERVER_SUPPORT
710 extern int lprocfs_num_exports_seq_show(struct seq_file *m, void *data);
711 #endif
712 struct adaptive_timeout;
713 extern int lprocfs_seq_at_hist_helper(struct seq_file *m,
714                                       struct adaptive_timeout *at);
715 extern int lprocfs_timeouts_seq_show(struct seq_file *m, void *data);
716 extern ssize_t
717 lprocfs_timeouts_seq_write(struct file *file, const char *buffer,
718                            size_t count, loff_t *off);
719 #ifdef HAVE_SERVER_SUPPORT
720 #ifndef HAVE_ONLY_PROCFS_SEQ
721 extern ssize_t lprocfs_fops_read(struct file *f, char __user *buf,
722                                  size_t size, loff_t *ppos);
723 extern ssize_t lprocfs_fops_write(struct file *f, const char __user *buf,
724                                   size_t size, loff_t *ppos);
725 #endif
726 extern ssize_t
727 lprocfs_evict_client_seq_write(struct file *file, const char *buffer,
728                                 size_t count, loff_t *off);
729 #endif
730 extern ssize_t
731 lprocfs_ping_seq_write(struct file *file, const char *buffer,
732                        size_t count, loff_t *off);
733 extern ssize_t
734 lprocfs_import_seq_write(struct file *file, const char __user *buffer,
735                          size_t count, loff_t *off);
736 extern int lprocfs_pinger_recov_seq_show(struct seq_file *m, void *data);
737 extern ssize_t
738 lprocfs_pinger_recov_seq_write(struct file *file, const char *buffer,
739                                size_t count, loff_t *off);
740
741 /* Statfs helpers */
742 extern int lprocfs_blksize_seq_show(struct seq_file *m, void *data);
743 extern int lprocfs_kbytestotal_seq_show(struct seq_file *m, void *data);
744 extern int lprocfs_kbytesfree_seq_show(struct seq_file *m, void *data);
745 extern int lprocfs_kbytesavail_seq_show(struct seq_file *m, void *data);
746 extern int lprocfs_filestotal_seq_show(struct seq_file *m, void *data);
747 extern int lprocfs_filesfree_seq_show(struct seq_file *m, void *data);
748
749 extern int lprocfs_write_helper(const char __user *buffer, unsigned long count,
750                                 int *val);
751 extern int lprocfs_write_frac_helper(const char __user *buffer,
752                                      unsigned long count,
753                                      int *val, int mult);
754 extern int lprocfs_seq_read_frac_helper(struct seq_file *m, long val, int mult);
755 extern int lprocfs_read_frac_helper(char *buffer, unsigned long count,
756                                     long val, int mult);
757 extern int lprocfs_write_u64_helper(const char __user *buffer,
758                                     unsigned long count, __u64 *val);
759 extern int lprocfs_write_frac_u64_helper(const char __user *buffer,
760                                          unsigned long count,
761                                          __u64 *val, int mult);
762 char *lprocfs_find_named_value(const char *buffer, const char *name,
763                                 size_t *count);
764 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value);
765 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value);
766 void lprocfs_oh_clear(struct obd_histogram *oh);
767 unsigned long lprocfs_oh_sum(struct obd_histogram *oh);
768
769 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
770                            struct lprocfs_counter *cnt);
771
772 #ifdef HAVE_SERVER_SUPPORT
773 /* lprocfs_status.c: recovery status */
774 int lprocfs_recovery_status_seq_show(struct seq_file *m, void *data);
775
776 /* lprocfs_status.c: hash statistics */
777 int lprocfs_hash_seq_show(struct seq_file *m, void *data);
778
779 /* lprocfs_status.c: IR factor */
780 int lprocfs_ir_factor_seq_show(struct seq_file *m, void *data);
781 ssize_t
782 lprocfs_ir_factor_seq_write(struct file *file, const char *buffer,
783                                 size_t count, loff_t *off);
784 #endif
785 extern int lprocfs_single_release(struct inode *, struct file *);
786 extern int lprocfs_seq_release(struct inode *, struct file *);
787
788 /* You must use these macros when you want to refer to
789  * the import in a client obd_device for a lprocfs entry */
790 #define LPROCFS_CLIMP_CHECK(obd) do {           \
791         typecheck(struct obd_device *, obd);    \
792         down_read(&(obd)->u.cli.cl_sem);    \
793         if ((obd)->u.cli.cl_import == NULL) {   \
794              up_read(&(obd)->u.cli.cl_sem); \
795              return -ENODEV;                    \
796         }                                       \
797 } while(0)
798 #define LPROCFS_CLIMP_EXIT(obd)                 \
799         up_read(&(obd)->u.cli.cl_sem);
800
801 /* write the name##_seq_show function, call LPROC_SEQ_FOPS_RO for read-only
802   proc entries; otherwise, you will define name##_seq_write function also for
803   a read-write proc entry, and then call LPROC_SEQ_SEQ instead. Finally,
804   call lprocfs_obd_seq_create(obd, filename, 0444, &name#_fops, data); */
805 #define __LPROC_SEQ_FOPS(name, custom_seq_write)                        \
806 static int name##_single_open(struct inode *inode, struct file *file)   \
807 {                                                                       \
808         int rc;                                                         \
809                                                                         \
810         rc = LPROCFS_ENTRY_CHECK(inode);                                \
811         if (rc < 0)                                                     \
812                 return rc;                                              \
813                                                                         \
814         return single_open(file, name##_seq_show, PDE_DATA(inode));     \
815 }                                                                       \
816 static const struct file_operations name##_fops = {                     \
817         .owner   = THIS_MODULE,                                         \
818         .open    = name##_single_open,                                  \
819         .read    = seq_read,                                            \
820         .write   = custom_seq_write,                                    \
821         .llseek  = seq_lseek,                                           \
822         .release = lprocfs_single_release,                              \
823 }
824
825 #define LPROC_SEQ_FOPS_RO(name)         __LPROC_SEQ_FOPS(name, NULL)
826 #define LPROC_SEQ_FOPS(name)            __LPROC_SEQ_FOPS(name, name##_seq_write)
827
828 #define LPROC_SEQ_FOPS_RO_TYPE(name, type)                              \
829         static int name##_##type##_seq_show(struct seq_file *m, void *v)\
830         {                                                               \
831                 return lprocfs_##type##_seq_show(m, m->private);        \
832         }                                                               \
833         LPROC_SEQ_FOPS_RO(name##_##type)
834
835 #define LPROC_SEQ_FOPS_RW_TYPE(name, type)                              \
836         static int name##_##type##_seq_show(struct seq_file *m, void *v)\
837         {                                                               \
838                 return lprocfs_##type##_seq_show(m, m->private);        \
839         }                                                               \
840         static ssize_t name##_##type##_seq_write(struct file *file,     \
841                         const char __user *buffer, size_t count,        \
842                         loff_t *off)                                    \
843         {                                                               \
844                 struct seq_file *seq = file->private_data;              \
845                 return lprocfs_##type##_seq_write(file, buffer,         \
846                                                 count, seq->private);   \
847         }                                                               \
848         LPROC_SEQ_FOPS(name##_##type);
849
850 #define LPROC_SEQ_FOPS_WO_TYPE(name, type)                              \
851         static ssize_t name##_##type##_write(struct file *file,         \
852                         const char __user *buffer, size_t count,        \
853                         loff_t *off)                                    \
854         {                                                               \
855                 return lprocfs_##type##_seq_write(file, buffer, count, off);\
856         }                                                               \
857         static int name##_##type##_open(struct inode *inode, struct file *file)\
858         {                                                               \
859                 return single_open(file, NULL, PDE_DATA(inode));        \
860         }                                                               \
861         static const struct file_operations name##_##type##_fops = {    \
862                 .open    = name##_##type##_open,                        \
863                 .write   = name##_##type##_write,                       \
864                 .release = lprocfs_single_release,                      \
865         };
866
867 /* lproc_ptlrpc.c */
868 struct ptlrpc_request;
869 extern void target_print_req(void *seq_file, struct ptlrpc_request *req);
870
871 #ifdef HAVE_SERVER_SUPPORT
872 /* lprocfs_jobstats.c */
873 int lprocfs_job_stats_log(struct obd_device *obd, char *jobid,
874                           int event, long amount);
875 void lprocfs_job_stats_fini(struct obd_device *obd);
876 int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
877                            cntr_init_callback fn);
878 int lprocfs_job_interval_seq_show(struct seq_file *m, void *data);
879 ssize_t
880 lprocfs_job_interval_seq_write(struct file *file, const char *buffer,
881                                 size_t count, loff_t *off);
882 /* lproc_status.c */
883 int lprocfs_recovery_time_soft_seq_show(struct seq_file *m, void *data);
884 ssize_t lprocfs_recovery_time_soft_seq_write(struct file *file,
885                                                 const char *buffer,
886                                                 size_t count, loff_t *off);
887 int lprocfs_recovery_time_hard_seq_show(struct seq_file *m, void *data);
888 ssize_t
889 lprocfs_recovery_time_hard_seq_write(struct file *file, const char *buffer,
890                                         size_t count, loff_t *off);
891 int lprocfs_target_instance_seq_show(struct seq_file *m, void *data);
892 #endif
893 int lprocfs_obd_max_pages_per_rpc_seq_show(struct seq_file *m, void *data);
894 ssize_t
895 lprocfs_obd_max_pages_per_rpc_seq_write(struct file *file, const char *buffer,
896                                        size_t count, loff_t *off);
897
898 struct root_squash_info;
899 int lprocfs_wr_root_squash(const char __user *buffer, unsigned long count,
900                            struct root_squash_info *squash, char *name);
901 int lprocfs_wr_nosquash_nids(const char __user *buffer, unsigned long count,
902                              struct root_squash_info *squash, char *name);
903
904 /* all quota proc functions */
905 extern int lprocfs_quota_rd_bunit(char *page, char **start,
906                                   off_t off, int count,
907                                   int *eof, void *data);
908 extern int lprocfs_quota_wr_bunit(struct file *file, const char *buffer,
909                                   unsigned long count, void *data);
910 extern int lprocfs_quota_rd_btune(char *page, char **start,
911                                   off_t off, int count,
912                                   int *eof, void *data);
913 extern int lprocfs_quota_wr_btune(struct file *file, const char *buffer,
914                                   unsigned long count, void *data);
915 extern int lprocfs_quota_rd_iunit(char *page, char **start,
916                                   off_t off, int count,
917                                   int *eof, void *data);
918 extern int lprocfs_quota_wr_iunit(struct file *file, const char *buffer,
919                                   unsigned long count, void *data);
920 extern int lprocfs_quota_rd_itune(char *page, char **start,
921                                   off_t off, int count,
922                                   int *eof, void *data);
923 extern int lprocfs_quota_wr_itune(struct file *file, const char *buffer,
924                                   unsigned long count, void *data);
925 extern int lprocfs_quota_rd_type(char *page, char **start, off_t off, int count,
926                                  int *eof, void *data);
927 extern int lprocfs_quota_wr_type(struct file *file, const char *buffer,
928                                  unsigned long count, void *data);
929 extern int lprocfs_quota_rd_switch_seconds(char *page, char **start, off_t off,
930                                            int count, int *eof, void *data);
931 extern int lprocfs_quota_wr_switch_seconds(struct file *file,
932                                            const char *buffer,
933                                            unsigned long count, void *data);
934 extern int lprocfs_quota_rd_sync_blk(char *page, char **start, off_t off,
935                                      int count, int *eof, void *data);
936 extern int lprocfs_quota_wr_sync_blk(struct file *file, const char *buffer,
937                                      unsigned long count, void *data);
938 extern int lprocfs_quota_rd_switch_qs(char *page, char **start, off_t off,
939                                       int count, int *eof, void *data);
940 extern int lprocfs_quota_wr_switch_qs(struct file *file,
941                                       const char *buffer,
942                                       unsigned long count, void *data);
943 extern int lprocfs_quota_rd_boundary_factor(char *page, char **start, off_t off,
944                                             int count, int *eof, void *data);
945 extern int lprocfs_quota_wr_boundary_factor(struct file *file,
946                                             const char *buffer,
947                                             unsigned long count, void *data);
948 extern int lprocfs_quota_rd_least_bunit(char *page, char **start, off_t off,
949                                         int count, int *eof, void *data);
950 extern int lprocfs_quota_wr_least_bunit(struct file *file,
951                                         const char *buffer,
952                                         unsigned long count, void *data);
953 extern int lprocfs_quota_rd_least_iunit(char *page, char **start, off_t off,
954                                         int count, int *eof, void *data);
955 extern int lprocfs_quota_wr_least_iunit(struct file *file,
956                                         const char *buffer,
957                                         unsigned long count, void *data);
958 extern int lprocfs_quota_rd_qs_factor(char *page, char **start, off_t off,
959                                       int count, int *eof, void *data);
960 extern int lprocfs_quota_wr_qs_factor(struct file *file,
961                                       const char *buffer,
962                                       unsigned long count, void *data);
963 #else /* !CONFIG_PROC_FS */
964
965 #define proc_lustre_root NULL
966
967 static inline void lprocfs_counter_add(struct lprocfs_stats *stats,
968                                        int index, long amount)
969 { return; }
970 static inline void lprocfs_counter_incr(struct lprocfs_stats *stats,
971                                         int index)
972 { return; }
973 static inline void lprocfs_counter_sub(struct lprocfs_stats *stats,
974                                        int index, long amount)
975 { return; }
976 static inline void lprocfs_counter_decr(struct lprocfs_stats *stats,
977                                         int index)
978 { return; }
979 static inline void lprocfs_counter_init(struct lprocfs_stats *stats,
980                                         int index, unsigned conf,
981                                         const char *name, const char *units)
982 { return; }
983
984 static inline __u64 lc_read_helper(struct lprocfs_counter *lc,
985                                    enum lprocfs_fields_flags field)
986 { return 0; }
987
988 /* NB: we return !NULL to satisfy error checker */
989 static inline struct lprocfs_stats *
990 lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags)
991 { return (struct lprocfs_stats *)1; }
992 static inline void lprocfs_clear_stats(struct lprocfs_stats *stats)
993 { return; }
994 static inline void lprocfs_free_stats(struct lprocfs_stats **stats)
995 { return; }
996 static inline int lprocfs_register_stats(struct proc_dir_entry *root,
997                                          const char *name,
998                                          struct lprocfs_stats *stats)
999 { return 0; }
1000 static inline void lprocfs_init_ops_stats(int num_private_stats,
1001                                           struct lprocfs_stats *stats)
1002 { return; }
1003 static inline void lprocfs_init_mps_stats(int num_private_stats,
1004                                           struct lprocfs_stats *stats)
1005 { return; }
1006 static inline void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
1007 { return; }
1008 static inline int lprocfs_alloc_obd_stats(struct obd_device *obddev,
1009                                           unsigned int num_private_stats)
1010 { return 0; }
1011 static inline int lprocfs_alloc_md_stats(struct obd_device *obddev,
1012                                          unsigned int num_private_stats)
1013 { return 0; }
1014 static inline void lprocfs_free_obd_stats(struct obd_device *obddev)
1015 { return; }
1016 static inline void lprocfs_free_md_stats(struct obd_device *obddev)
1017 { return; }
1018
1019 struct obd_export;
1020 static inline int lprocfs_add_clear_entry(struct obd_export *exp)
1021 { return 0; }
1022 static inline void lprocfs_free_per_client_stats(struct obd_device *obd)
1023 { return; }
1024 #ifdef HAVE_SERVER_SUPPORT
1025 static inline
1026 ssize_t lprocfs_nid_stats_seq_write(struct file *file, const char *buffer,
1027                                         size_t count, loff_t *off)
1028 {return 0;}
1029 static inline
1030 int lprocfs_nid_stats_clear_seq_show(struct seq_file *m, void *data)
1031 {return 0;}
1032 static inline int lprocfs_exp_setup(struct obd_export *exp,lnet_nid_t *peer_nid)
1033 { return 0; }
1034 #endif
1035 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
1036 { return 0; }
1037 static inline struct proc_dir_entry *
1038 lprocfs_add_simple(struct proc_dir_entry *root, char *name,
1039                    void *data, const struct file_operations *fops)
1040 {return 0; }
1041 static inline struct proc_dir_entry *
1042 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
1043                     const char *format, ...)
1044 {return NULL; }
1045 #ifndef HAVE_ONLY_PROCFS_SEQ
1046 static inline struct proc_dir_entry *
1047 lprocfs_register(const char *name, struct proc_dir_entry *parent,
1048                  struct lprocfs_vars *list, void *data)
1049 { return NULL; }
1050 static inline int lprocfs_add_vars(struct proc_dir_entry *root,
1051                                    struct lprocfs_vars *var,
1052                                    void *data)
1053 { return 0; }
1054 #endif
1055 static inline int lprocfs_seq_add_vars(struct proc_dir_entry *root,
1056                                        struct lprocfs_seq_vars *var,
1057                                        void *data)
1058 { return 0; }
1059 static inline struct proc_dir_entry *
1060 lprocfs_seq_register(const char *name, struct proc_dir_entry *parent,
1061                      struct lprocfs_seq_vars *list, void *data)
1062 { return NULL; }
1063 static inline void lprocfs_remove(struct proc_dir_entry **root)
1064 { return; }
1065 static inline void lprocfs_remove_proc_entry(const char *name,
1066                                              struct proc_dir_entry *parent)
1067 { return; }
1068 #ifndef HAVE_ONLY_PROCFS_SEQ
1069 static inline void lprocfs_try_remove_proc_entry(const char *name,
1070                                                  struct proc_dir_entry *parent)
1071 { return; }
1072 static inline struct proc_dir_entry *lprocfs_srch(struct proc_dir_entry *head,
1073                                                  const char *name)
1074 { return 0; }
1075 #endif
1076 static inline int lprocfs_obd_setup(struct obd_device *dev)
1077 { return 0; }
1078 static inline int lprocfs_obd_cleanup(struct obd_device *dev)
1079 { return 0; }
1080 static inline int lprocfs_uuid_seq_show(struct seq_file *m, void *data)
1081 { return 0; }
1082 static inline int lprocfs_name_seq_show(struct seq_file *m, void *data)
1083 { return 0; }
1084 static inline int lprocfs_server_seq_show(struct seq_file *m, void *data)
1085 { return 0; }
1086 static inline int lprocfs_conn_uuid_seq_show(struct seq_file *m, void *data)
1087 { return 0; }
1088 static inline int lprocfs_import_seq_show(struct seq_file *m, void *data)
1089 { return 0; }
1090 static inline int lprocfs_state_seq_show(struct seq_file *m, void *data)
1091 { return 0; }
1092 static inline int lprocfs_connect_flags_seq_show(struct seq_file *m, void *data)
1093 { return 0; }
1094 #ifdef HAVE_SERVER_SUPPORT
1095 static inline int lprocfs_num_exports_seq_show(struct seq_file *m, void *data)
1096 { return 0; }
1097 #endif
1098 struct adaptive_timeout;
1099 static inline int lprocfs_seq_at_hist_helper(struct seq_file *m,
1100                                              struct adaptive_timeout *at)
1101 { return 0; }
1102 static inline int lprocfs_timeouts_seq_show(struct seq_file *m, void *data)
1103 { return 0; }
1104 static inline ssize_t
1105 lprocfs_timeouts_seq_write(struct file *file, const char *buffer,
1106                            size_t count, loff_t *off)
1107 { return 0; }
1108 #ifdef HAVE_SERVER_SUPPORT
1109 static inline ssize_t
1110 lprocfs_evict_client_seq_write(struct file *file, const char *buffer,
1111                                size_t count, loff_t *off)
1112 { return 0; }
1113 #endif
1114 static inline ssize_t
1115 lprocfs_ping_seq_write(struct file *file, const char __user *buffer,
1116                        size_t count, loff_t *off)
1117 { return 0; }
1118 static inline ssize_t
1119 lprocfs_import_seq_write(struct file *file, const char __user *buffer,
1120                          size_t count, loff_t *off)
1121 { return 0; }
1122 static inline int
1123 lprocfs_pinger_recov_seq_show(struct seq_file *m, void *data)
1124 { return 0; }
1125 static inline ssize_t
1126 lprocfs_pinger_recov_seq_write(struct file *file, const char __user *buffer,
1127                                size_t count, loff_t *off)
1128 { return 0; }
1129
1130 /* Statfs helpers */
1131 static inline
1132 int lprocfs_blksize_seq_show(struct seq_file *m, void *data)
1133 { return 0; }
1134 static inline
1135 int lprocfs_kbytestotal_seq_show(struct seq_file *m, void *data)
1136 { return 0; }
1137 static inline
1138 int lprocfs_kbytesfree_seq_show(struct seq_file *m, void *data)
1139 { return 0; }
1140 static inline
1141 int lprocfs_kbytesavail_seq_show(struct seq_file *m, void *data)
1142 { return 0; }
1143 static inline
1144 int lprocfs_filestotal_seq_show(struct seq_file *m, void *data)
1145 { return 0; }
1146 static inline
1147 int lprocfs_filesfree_seq_show(struct seq_file *m, void *data)
1148 { return 0; }
1149 static inline
1150 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value)
1151 { return; }
1152 static inline
1153 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value)
1154 { return; }
1155 static inline
1156 void lprocfs_oh_clear(struct obd_histogram *oh)
1157 { return; }
1158 static inline
1159 unsigned long lprocfs_oh_sum(struct obd_histogram *oh)
1160 { return 0; }
1161 static inline
1162 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
1163                            struct lprocfs_counter *cnt)
1164 { return; }
1165 static inline
1166 __u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx,
1167                                enum lprocfs_fields_flags field)
1168 { return (__u64)0; }
1169
1170 #define LPROC_SEQ_FOPS_RO(name)
1171 #define LPROC_SEQ_FOPS(name)
1172 #define LPROC_SEQ_FOPS_RO_TYPE(name, type)
1173 #define LPROC_SEQ_FOPS_RW_TYPE(name, type)
1174 #define LPROC_SEQ_FOPS_WO_TYPE(name, type)
1175
1176 /* lprocfs_jobstats.c */
1177 static inline
1178 int lprocfs_job_stats_log(struct obd_device *obd, char *jobid, int event,
1179                           long amount)
1180 { return 0; }
1181 static inline
1182 void lprocfs_job_stats_fini(struct obd_device *obd)
1183 { return; }
1184 static inline
1185 int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
1186                            cntr_init_callback fn)
1187 { return 0; }
1188
1189
1190 /* lproc_ptlrpc.c */
1191 #define target_print_req NULL
1192
1193 #endif /* CONFIG_PROC_FS */
1194
1195 #endif /* LPROCFS_SNMP_H */