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