Whamcloud - gitweb
LU-17504 build: fix array-index-out-of-bounds warning
[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.gnu.org/licenses/gpl-2.0.html
19  *
20  * GPL HEADER END
21  */
22 /*
23  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
24  * Use is subject to license terms.
25  *
26  * Copyright (c) 2011, 2017, Intel Corporation.
27  */
28 /*
29  * This file is part of Lustre, http://www.lustre.org/
30  *
31  * lustre/include/lprocfs_status.h
32  *
33  * Top level header file for LProc
34  *
35  * Author: Hariharan Thantry thantry@users.sourceforge.net
36  */
37 #ifndef _LPROCFS_STATUS_H
38 #define _LPROCFS_STATUS_H
39
40 #include <linux/fs.h>
41 #include <linux/proc_fs.h>
42 #include <linux/debugfs.h>
43 #include <linux/rwsem.h>
44 #include <linux/spinlock.h>
45 #include <linux/string_helpers.h>
46 #include <linux/seq_file.h>
47
48 #include <libcfs/libcfs.h>
49 #include <libcfs/linux/linux-fs.h>
50 #include <uapi/linux/lustre/lustre_idl.h>
51
52 /*
53  * Liuux 5.6 introduces proc_ops with v5.5-8862-gd56c0d45f0e2
54  * Now that proc and debugfs use separate operation vector types
55  * separate containers are also needed.
56  */
57 struct lprocfs_vars {
58         const char                      *name;
59         const struct proc_ops           *fops;
60         void                            *data;
61         /** /proc file mode. */
62         mode_t                           proc_mode;
63 };
64
65 /** Provide a debugfs container */
66 struct ldebugfs_vars {
67         const char                      *name;
68         const struct file_operations    *fops;
69         void                            *data;
70         /** debugfs file mode. */
71         mode_t                           proc_mode;
72 };
73
74 static inline unsigned int pct(unsigned long a, unsigned long b)
75 {
76         return b ? a * 100 / b : 0;
77 }
78
79 #define PAGES_TO_MiB(pages)     ((pages) >> (20 - PAGE_SHIFT))
80 #define MiB_TO_PAGES(mb)        ((mb) << (20 - PAGE_SHIFT))
81
82 /**
83  * Append a space separated list of current set flags to str.
84  */
85 #define flag2str(port, flag)                                            \
86         do {                                                            \
87                 if ((port)->port##_##flag) {                            \
88                         seq_printf(m, "%s" #flag, first ? "" : ", ");   \
89                         first = false;                                  \
90                 }                                                       \
91         } while (0)
92
93 void obd_connect_seq_flags2str(struct seq_file *m, __u64 flags, __u64 flags2,
94                                const char *sep);
95 void obd_connect_data_seqprint(struct seq_file *m,
96                                struct obd_connect_data *ocd);
97
98 /* if we find more consumers this could be generalized */
99 #define OBD_HIST_MAX 32
100 struct obd_histogram {
101         spinlock_t      oh_lock;
102         unsigned long   oh_buckets[OBD_HIST_MAX];
103 };
104
105 struct obd_hist_pcpu {
106         struct percpu_counter   oh_pc_buckets[OBD_HIST_MAX];
107         bool                    oh_initialized;
108 };
109
110 /* An lprocfs counter can be configured using the enum bit masks below.
111  *
112  * LPROCFS_CNTR_EXTERNALLOCK indicates that an external lock already
113  * protects this counter from concurrent updates. If not specified,
114  * lprocfs an internal per-counter lock variable. External locks are
115  * not used to protect counter increments, but are used to protect
116  * counter readout and resets.
117  *
118  * LPROCFS_CNTR_AVGMINMAX indicates a multi-valued counter samples,
119  * (i.e. counter can be incremented by more than "1"). When specified,
120  * the counter maintains min, max and sum in addition to a simple
121  * invocation count. This allows averages to be be computed.
122  * If not specified, the counter is an increment-by-1 counter.
123  * min, max, sum, etc. are not maintained.
124  *
125  * LPROCFS_CNTR_STDDEV indicates that the counter should track sum of
126  * squares (for multi-valued counter samples only). This allows
127  * external computation of standard deviation, but involves a 64-bit
128  * multiply per counter increment.
129  *
130  * LPROCFS_CNTR_HISTOGRAM indicates that the counter should track a
131  * exponential histogram.
132  */
133
134 enum lprocfs_counter_config {
135         LPROCFS_CNTR_EXTERNALLOCK       = 0x0001,
136         LPROCFS_CNTR_AVGMINMAX          = 0x0002,
137         LPROCFS_CNTR_STDDEV             = 0x0004,
138         LPROCFS_CNTR_HISTOGRAM          = 0x0008,
139
140         /* counter unit type */
141         LPROCFS_TYPE_REQS               = 0x0000, /* default if config = 0 */
142         LPROCFS_TYPE_BYTES              = 0x0200,
143         LPROCFS_TYPE_PAGES              = 0x0400,
144         LPROCFS_TYPE_LOCKS              = 0x0500,
145         LPROCFS_TYPE_LOCKSPS            = 0x0600,
146         LPROCFS_TYPE_SECS               = 0x0700,
147         LPROCFS_TYPE_USECS              = 0x0800,
148         LPROCFS_TYPE_MASK               = 0x0f00,
149
150         LPROCFS_TYPE_LATENCY            = LPROCFS_TYPE_USECS |
151                                           LPROCFS_CNTR_AVGMINMAX |
152                                           LPROCFS_CNTR_STDDEV,
153         LPROCFS_TYPE_BYTES_FULL         = LPROCFS_TYPE_BYTES |
154                                           LPROCFS_CNTR_AVGMINMAX |
155                                           LPROCFS_CNTR_STDDEV,
156         LPROCFS_TYPE_BYTES_FULL_HISTOGRAM       = LPROCFS_TYPE_BYTES_FULL |
157                                                   LPROCFS_CNTR_HISTOGRAM,
158 };
159 #define LC_MIN_INIT ((~(__u64)0) >> 1)
160
161 struct lprocfs_counter_header {
162         enum lprocfs_counter_config     lc_config;
163         const char                      *lc_name;   /* must be static */
164         const char                      *lc_units;  /* must be static */
165         struct obd_histogram            *lc_hist;
166 };
167
168 struct lprocfs_counter {
169         __s64   lc_count;
170         __s64   lc_min;
171         __s64   lc_max;
172         __s64   lc_sum;
173         __s64   lc_sumsquare;
174 };
175
176 struct lprocfs_percpu {
177         struct lprocfs_counter lp_cntr[0];
178 };
179
180 enum lprocfs_stats_lock_ops {
181         LPROCFS_GET_NUM_CPU     = 0x0001, /* number allocated per-CPU stats */
182         LPROCFS_GET_SMP_ID      = 0x0002, /* current stat to be updated */
183 };
184
185 enum lprocfs_stats_flags {
186         LPROCFS_STATS_FLAG_NONE     = 0x0000, /* per cpu counter */
187         LPROCFS_STATS_FLAG_NOPERCPU = 0x0001, /* need locking(no percpu area) */
188 };
189
190 enum lprocfs_fields_flags {
191         LPROCFS_FIELDS_FLAGS_CONFIG     = 0x0001,
192         LPROCFS_FIELDS_FLAGS_SUM        = 0x0002,
193         LPROCFS_FIELDS_FLAGS_MIN        = 0x0003,
194         LPROCFS_FIELDS_FLAGS_MAX        = 0x0004,
195         LPROCFS_FIELDS_FLAGS_AVG        = 0x0005,
196         LPROCFS_FIELDS_FLAGS_SUMSQUARE  = 0x0006,
197         LPROCFS_FIELDS_FLAGS_COUNT      = 0x0007,
198 };
199
200 struct lprocfs_stats {
201         /* # of counters */
202         unsigned short                  ls_num;
203         /* 1 + the biggest cpu # whose ls_percpu slot has been allocated */
204         unsigned short                  ls_biggest_alloc_num;
205         enum lprocfs_stats_flags        ls_flags;
206         ktime_t                         ls_init;
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          */
210         spinlock_t                      ls_lock;
211
212         /* has ls_num of counter headers */
213         struct lprocfs_counter_header   *ls_cnt_header;
214         struct lprocfs_percpu           *ls_percpu[0];
215 };
216
217 #define OPC_RANGE(seg) (seg ## _LAST_OPC - seg ## _FIRST_OPC)
218
219 /* Pack all opcodes down into a single monotonically increasing index */
220 static inline int opcode_offset(__u32 opc)
221 {
222         if (opc < OST_LAST_OPC) {
223                 /* OST opcode */
224                 return (opc - OST_FIRST_OPC);
225         } else if (opc < MDS_LAST_OPC) {
226                 /* MDS opcode */
227                 return (opc - MDS_FIRST_OPC +
228                         OPC_RANGE(OST));
229         } else if (opc < LDLM_LAST_OPC) {
230                 /* LDLM Opcode */
231                 return (opc - LDLM_FIRST_OPC +
232                         OPC_RANGE(MDS) +
233                         OPC_RANGE(OST));
234         } else if (opc < MGS_LAST_OPC) {
235                 /* MGS Opcode */
236                 return (opc - MGS_FIRST_OPC +
237                         OPC_RANGE(LDLM) +
238                         OPC_RANGE(MDS) +
239                         OPC_RANGE(OST));
240         } else if (opc < OBD_LAST_OPC) {
241                 /* OBD Ping */
242                 return (opc - OBD_FIRST_OPC +
243                         OPC_RANGE(MGS) +
244                         OPC_RANGE(LDLM) +
245                         OPC_RANGE(MDS) +
246                         OPC_RANGE(OST));
247         } else if (opc < LLOG_LAST_OPC) {
248                 /* LLOG Opcode */
249                 return (opc - LLOG_FIRST_OPC +
250                         OPC_RANGE(OBD) +
251                         OPC_RANGE(MGS) +
252                         OPC_RANGE(LDLM) +
253                         OPC_RANGE(MDS) +
254                         OPC_RANGE(OST));
255         } else if (opc < QUOTA_LAST_OPC) {
256                 /* LQUOTA Opcode */
257                 return (opc - QUOTA_FIRST_OPC +
258                         OPC_RANGE(LLOG) +
259                         OPC_RANGE(OBD) +
260                         OPC_RANGE(MGS) +
261                         OPC_RANGE(LDLM) +
262                         OPC_RANGE(MDS) +
263                         OPC_RANGE(OST));
264         } else if (opc < SEQ_LAST_OPC) {
265                 /* SEQ opcode */
266                 return (opc - SEQ_FIRST_OPC +
267                         OPC_RANGE(QUOTA) +
268                         OPC_RANGE(LLOG) +
269                         OPC_RANGE(OBD) +
270                         OPC_RANGE(MGS) +
271                         OPC_RANGE(LDLM) +
272                         OPC_RANGE(MDS) +
273                         OPC_RANGE(OST));
274         } else if (opc < SEC_LAST_OPC) {
275                 /* SEC opcode */
276                 return (opc - SEC_FIRST_OPC +
277                         OPC_RANGE(SEQ) +
278                         OPC_RANGE(QUOTA) +
279                         OPC_RANGE(LLOG) +
280                         OPC_RANGE(OBD) +
281                         OPC_RANGE(MGS) +
282                         OPC_RANGE(LDLM) +
283                         OPC_RANGE(MDS) +
284                         OPC_RANGE(OST));
285         } else if (opc < FLD_LAST_OPC) {
286                 /* FLD opcode */
287                 return (opc - FLD_FIRST_OPC +
288                         OPC_RANGE(SEC) +
289                         OPC_RANGE(SEQ) +
290                         OPC_RANGE(QUOTA) +
291                         OPC_RANGE(LLOG) +
292                         OPC_RANGE(OBD) +
293                         OPC_RANGE(MGS) +
294                         OPC_RANGE(LDLM) +
295                         OPC_RANGE(MDS) +
296                         OPC_RANGE(OST));
297 #ifdef HAVE_SERVER_SUPPORT
298         } else if (opc < OUT_UPDATE_LAST_OPC) {
299                 /* update opcode */
300                 return (opc - OUT_UPDATE_FIRST_OPC +
301                         OPC_RANGE(FLD) +
302                         OPC_RANGE(SEC) +
303                         OPC_RANGE(SEQ) +
304                         OPC_RANGE(QUOTA) +
305                         OPC_RANGE(LLOG) +
306                         OPC_RANGE(OBD) +
307                         OPC_RANGE(MGS) +
308                         OPC_RANGE(LDLM) +
309                         OPC_RANGE(MDS) +
310                         OPC_RANGE(OST));
311         } else if (opc < LFSCK_LAST_OPC) {
312                 /* LFSCK opcode */
313                 return (opc - LFSCK_FIRST_OPC +
314                         OPC_RANGE(OUT_UPDATE) +
315                         OPC_RANGE(FLD) +
316                         OPC_RANGE(SEC) +
317                         OPC_RANGE(SEQ) +
318                         OPC_RANGE(QUOTA) +
319                         OPC_RANGE(LLOG) +
320                         OPC_RANGE(OBD) +
321                         OPC_RANGE(MGS) +
322                         OPC_RANGE(LDLM) +
323                         OPC_RANGE(MDS) +
324                         OPC_RANGE(OST));
325 #endif /* HAVE_SERVER_SUPPORT */
326         } else {
327                 /* Unknown Opcode */
328                 return -1;
329         }
330 }
331
332 #define LUSTRE_MAX_OPCODES_CLIENT (OPC_RANGE(OST)  + \
333                                    OPC_RANGE(MDS)  + \
334                                    OPC_RANGE(LDLM) + \
335                                    OPC_RANGE(MGS)  + \
336                                    OPC_RANGE(OBD)  + \
337                                    OPC_RANGE(LLOG) + \
338                                    OPC_RANGE(SEC)  + \
339                                    OPC_RANGE(SEQ)  + \
340                                    OPC_RANGE(SEC)  + \
341                                    OPC_RANGE(FLD))
342
343 #ifdef HAVE_SERVER_SUPPORT
344 #define LUSTRE_MAX_OPCODES (LUSTRE_MAX_OPCODES_CLIENT + \
345                             OPC_RANGE(OUT_UPDATE) + \
346                             OPC_RANGE(LFSCK))
347 #else
348 #define LUSTRE_MAX_OPCODES LUSTRE_MAX_OPCODES_CLIENT
349 #endif
350
351 #define EXTRA_MAX_OPCODES ((PTLRPC_LAST_CNTR - PTLRPC_FIRST_CNTR)  + \
352                             OPC_RANGE(EXTRA))
353
354 enum {
355         PTLRPC_REQWAIT_CNTR = 0,
356         PTLRPC_REQQDEPTH_CNTR,
357         PTLRPC_REQACTIVE_CNTR,
358         PTLRPC_TIMEOUT,
359         PTLRPC_REQBUF_AVAIL_CNTR,
360         PTLRPC_LAST_CNTR
361 };
362
363 #define PTLRPC_FIRST_CNTR PTLRPC_REQWAIT_CNTR
364
365 enum lprocfs_extra_opc {
366         LDLM_GLIMPSE_ENQUEUE = 0,
367         LDLM_PLAIN_ENQUEUE,
368         LDLM_EXTENT_ENQUEUE,
369         LDLM_FLOCK_ENQUEUE,
370         LDLM_IBITS_ENQUEUE,
371         MDS_REINT_SETATTR,
372         MDS_REINT_CREATE,
373         MDS_REINT_LINK,
374         MDS_REINT_UNLINK,
375         MDS_REINT_RENAME,
376         MDS_REINT_OPEN,
377         MDS_REINT_SETXATTR,
378         MDS_REINT_RESYNC,
379         BRW_READ_BYTES,
380         BRW_WRITE_BYTES,
381         EXTRA_LAST_OPC
382 };
383
384 #ifdef HAVE_SERVER_SUPPORT
385 enum brw_rw_stats {
386         BRW_R_PAGES = 0,
387         BRW_W_PAGES,
388         BRW_R_DISCONT_PAGES,
389         BRW_W_DISCONT_PAGES,
390         BRW_R_DISCONT_BLOCKS,
391         BRW_W_DISCONT_BLOCKS,
392         BRW_R_DIO_FRAGS,
393         BRW_W_DIO_FRAGS,
394         BRW_R_RPC_HIST,
395         BRW_W_RPC_HIST,
396         BRW_R_IO_TIME,
397         BRW_W_IO_TIME,
398         BRW_R_DISK_IOSIZE,
399         BRW_W_DISK_IOSIZE,
400         BRW_MAP_TIME,
401         BRW_ALLOC_TIME,
402         BRW_RW_STATS_NUM,
403 };
404
405 struct brw_stats_props {
406         const char      *bsp_name;
407         const char      *bsp_units;
408         bool             bsp_scale;
409 };
410
411 struct brw_stats {
412         ktime_t                 bs_init;
413         struct obd_hist_pcpu    bs_hist[BRW_RW_STATS_NUM];
414         struct brw_stats_props  bs_props[BRW_RW_STATS_NUM / 2];
415 };
416
417 int lprocfs_init_brw_stats(struct brw_stats *brw_stats);
418 void lprocfs_fini_brw_stats(struct brw_stats *brw_stats);
419
420 void ldebugfs_register_osd_stats(struct dentry *parent,
421                                  struct brw_stats *brw_stats,
422                                  struct lprocfs_stats *stats);
423 #endif /* HAVE_SERVER_SUPPORT */
424
425 #define EXTRA_FIRST_OPC LDLM_GLIMPSE_ENQUEUE
426 /* class_obd.c */
427 extern struct proc_dir_entry *proc_lustre_root;
428 extern struct dentry *debugfs_lustre_root;
429 extern struct kset *lustre_kset;
430
431 struct obd_device;
432
433 #define JOBSTATS_JOBID_VAR_MAX_LEN      20
434 #define JOBSTATS_DISABLE                "disable"
435 #define JOBSTATS_PROCNAME_UID           "procname_uid"
436 #define JOBSTATS_NODELOCAL              "nodelocal"
437 #define JOBSTATS_SESSION                "session"
438
439 typedef void (*cntr_init_callback)(struct lprocfs_stats *stats,
440                                    unsigned int offset,
441                                    enum lprocfs_counter_config cntr_umask);
442 struct obd_job_stats {
443         struct cfs_hash        *ojs_hash;       /* hash of jobids */
444         struct list_head        ojs_list;       /* list of job_stat structs */
445         spinlock_t              ojs_lock;       /* protect ojs_list/js_list */
446         ktime_t                 ojs_cleanup_interval;/* 1/2 expiry seconds */
447         ktime_t                 ojs_cleanup_last;/* previous cleanup time */
448         cntr_init_callback      ojs_cntr_init_fn;/* lprocfs_stats initializer */
449         unsigned short          ojs_cntr_num;   /* number of stats in struct */
450         bool                    ojs_cleaning;   /* currently expiring stats */
451 };
452
453 #ifdef CONFIG_PROC_FS
454
455 int lprocfs_stats_alloc_one(struct lprocfs_stats *stats,
456                             unsigned int cpuid);
457 int lprocfs_stats_lock(struct lprocfs_stats *stats,
458                        enum lprocfs_stats_lock_ops opc,
459                        unsigned long *flags);
460 void lprocfs_stats_unlock(struct lprocfs_stats *stats,
461                           enum lprocfs_stats_lock_ops opc,
462                           unsigned long *flags);
463
464 static inline unsigned int
465 lprocfs_stats_counter_size(struct lprocfs_stats *stats)
466 {
467         unsigned int percpusize;
468
469         percpusize = offsetof(struct lprocfs_percpu, lp_cntr[stats->ls_num]);
470
471         if ((stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) == 0)
472                 percpusize = L1_CACHE_ALIGN(percpusize);
473
474         return percpusize;
475 }
476
477 static inline struct lprocfs_counter *
478 lprocfs_stats_counter_get(struct lprocfs_stats *stats, unsigned int cpuid,
479                           int index)
480 {
481         struct lprocfs_counter *cntr;
482
483         cntr = &stats->ls_percpu[cpuid]->lp_cntr[index];
484
485         return cntr;
486 }
487
488 /* Two optimized LPROCFS counter increment functions are provided:
489  *     lprocfs_counter_incr(cntr, value) - optimized for by-one counters
490  *     lprocfs_counter_add(cntr) - use for multi-valued counters
491  * Counter data layout allows config flag, counter lock and the
492  * count itself to reside within a single cache line.
493  */
494
495 extern void lprocfs_counter_add(struct lprocfs_stats *stats, int idx,
496                                 long amount);
497 extern void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx,
498                                 long amount);
499
500 #define lprocfs_counter_incr(stats, idx) \
501         lprocfs_counter_add(stats, idx, 1)
502 #define lprocfs_counter_decr(stats, idx) \
503         lprocfs_counter_sub(stats, idx, 1)
504
505 extern __s64 lprocfs_read_helper(struct lprocfs_counter *lc,
506                                  struct lprocfs_counter_header *header,
507                                  enum lprocfs_stats_flags flags,
508                                  enum lprocfs_fields_flags field);
509 u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx,
510                             enum lprocfs_fields_flags field);
511
512 extern struct lprocfs_stats *
513 lprocfs_stats_alloc(unsigned int num, enum lprocfs_stats_flags flags);
514 extern void lprocfs_stats_clear(struct lprocfs_stats *stats);
515 extern void lprocfs_stats_free(struct lprocfs_stats **stats);
516 extern void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats);
517 extern int lprocfs_alloc_obd_stats(struct obd_device *obd,
518                                    unsigned int num_stats);
519 extern int lprocfs_alloc_md_stats(struct obd_device *obd,
520                                   unsigned int num_private_stats);
521 extern void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
522                                  enum lprocfs_counter_config config,
523                                  const char *name);
524 extern void lprocfs_counter_init_units(struct lprocfs_stats *stats, int index,
525                                        enum lprocfs_counter_config config,
526                                        const char *name, const char *units);
527 extern void lprocfs_free_obd_stats(struct obd_device *obd);
528 extern void lprocfs_free_md_stats(struct obd_device *obd);
529 struct obd_export;
530 struct nid_stat;
531 extern int lprocfs_add_clear_entry(struct obd_device *obd,
532                                    struct proc_dir_entry *entry);
533 #ifdef HAVE_SERVER_SUPPORT
534 extern int lprocfs_exp_setup(struct obd_export *exp, struct lnet_nid *peer_nid);
535 extern int lprocfs_exp_cleanup(struct obd_export *exp);
536 struct dentry *ldebugfs_add_symlink(const char *name, const char *target,
537                                     const char *format, ...);
538 #else
539 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
540 { return 0; }
541 #endif
542 extern struct proc_dir_entry *
543 lprocfs_add_simple(struct proc_dir_entry *root, char *name,
544                    void *data, const struct proc_ops *ops);
545 extern struct proc_dir_entry *
546 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
547                     const char *format, ...);
548 extern void lprocfs_free_per_client_stats(struct obd_device *obd);
549 #ifdef HAVE_SERVER_SUPPORT
550 extern ssize_t
551 lprocfs_nid_stats_clear_seq_write(struct file *file, const char __user *buffer,
552                                         size_t count, loff_t *off);
553 extern int lprocfs_nid_stats_clear_seq_show(struct seq_file *file, void *data);
554 #endif
555 extern int lprocfs_stats_register(struct proc_dir_entry *root, const char *name,
556                                   struct lprocfs_stats *stats);
557 extern const struct file_operations ldebugfs_stats_seq_fops;
558
559 /* lprocfs_status.c */
560 extern void ldebugfs_add_vars(struct dentry *parent, struct ldebugfs_vars *var,
561                               void *data);
562 extern struct dentry *ldebugfs_register(const char *name,
563                                         struct dentry *parent,
564                                         struct ldebugfs_vars *list,
565                                         void *data);
566 extern int lprocfs_add_vars(struct proc_dir_entry *root,
567                             struct lprocfs_vars *var, void *data);
568
569 extern struct proc_dir_entry *
570 lprocfs_register(const char *name, struct proc_dir_entry *parent,
571                  struct lprocfs_vars *list, void *data);
572
573 extern void lprocfs_remove(struct proc_dir_entry **root);
574 extern void lprocfs_remove_proc_entry(const char *name,
575                                       struct proc_dir_entry *parent);
576 extern int lprocfs_obd_setup(struct obd_device *obd, bool uuid_only);
577 extern int lprocfs_obd_cleanup(struct obd_device *obd);
578
579 extern int lprocfs_seq_create(struct proc_dir_entry *parent, const char *name,
580                               mode_t mode, const struct proc_ops *seq_fops,
581                               void *data);
582 extern int lprocfs_obd_seq_create(struct obd_device *obd, const char *name,
583                                   mode_t mode, const struct proc_ops *seq_fops,
584                                   void *data);
585 extern void lprocfs_stats_header(struct seq_file *seq, ktime_t now,
586                                  ktime_t ts_init, int width, const char *colon,
587                                  bool show_units, const char *prefix);
588 extern unsigned int obd_enable_stats_header;
589
590 /* Generic callbacks */
591 extern int lprocfs_uuid_seq_show(struct seq_file *m, void *data);
592 extern int lprocfs_server_uuid_seq_show(struct seq_file *m, void *data);
593 ssize_t conn_uuid_show(struct kobject *kobj, struct attribute *attr, char *buf);
594 extern int lprocfs_import_seq_show(struct seq_file *m, void *data);
595 extern int lprocfs_state_seq_show(struct seq_file *m, void *data);
596 extern int lprocfs_connect_flags_seq_show(struct seq_file *m, void *data);
597 #ifdef HAVE_SERVER_SUPPORT
598 ssize_t num_exports_show(struct kobject *kobj, struct attribute *attr,
599                          char *buf);
600 ssize_t grant_check_threshold_show(struct kobject *kobj,
601                                    struct attribute *attr, char *buf);
602 ssize_t grant_check_threshold_store(struct kobject *kobj,
603                                     struct attribute *attr,
604                                     const char *buffer, size_t count);
605 ssize_t eviction_count_show(struct kobject *kobj, struct attribute *attr,
606                             char *buf);
607 #endif
608 struct adaptive_timeout;
609 extern int lprocfs_at_hist_helper(struct seq_file *m,
610                                   struct adaptive_timeout *at);
611 extern int lprocfs_timeouts_seq_show(struct seq_file *m, void *data);
612 extern ssize_t
613 lprocfs_timeouts_seq_write(struct file *file, const char __user *buffer,
614                            size_t count, loff_t *off);
615 #ifdef HAVE_SERVER_SUPPORT
616 extern ssize_t
617 lprocfs_evict_client_seq_write(struct file *file, const char __user *buffer,
618                                 size_t count, loff_t *off);
619 #endif
620 ssize_t ping_store(struct kobject *kobj, struct attribute *attr,
621                    const char *buffer, size_t count);
622 ssize_t ping_show(struct kobject *kobj, struct attribute *attr,
623                   char *buffer);
624
625 extern ssize_t
626 ldebugfs_import_seq_write(struct file *file, const char __user *buffer,
627                           size_t count, loff_t *off);
628 static inline ssize_t
629 lprocfs_import_seq_write(struct file *file, const char __user *buffer,
630                          size_t count, loff_t *off)
631 {
632         return ldebugfs_import_seq_write(file, buffer, count, off);
633 }
634
635 extern int lprocfs_pinger_recov_seq_show(struct seq_file *m, void *data);
636 extern ssize_t
637 lprocfs_pinger_recov_seq_write(struct file *file, const char __user *buffer,
638                                size_t count, loff_t *off);
639
640 int string_to_size(u64 *size, const char *buffer, size_t count);
641 int sysfs_memparse(const char *buffer, size_t count, u64 *val,
642                     const char *defunit);
643 char *lprocfs_strnstr(const char *s1, const char *s2, size_t len);
644 char *lprocfs_find_named_value(const char *buffer, const char *name,
645                                 size_t *count);
646 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value);
647 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value);
648 void lprocfs_oh_clear(struct obd_histogram *oh);
649 unsigned long lprocfs_oh_sum(struct obd_histogram *oh);
650
651 void lprocfs_oh_tally_pcpu(struct obd_hist_pcpu *oh, unsigned int value);
652 void lprocfs_oh_tally_log2_pcpu(struct obd_hist_pcpu *oh, unsigned int value);
653 int lprocfs_oh_alloc_pcpu(struct obd_hist_pcpu *oh);
654 void lprocfs_oh_clear_pcpu(struct obd_hist_pcpu *oh);
655 void lprocfs_oh_release_pcpu(struct obd_hist_pcpu *oh);
656 unsigned long lprocfs_oh_sum_pcpu(struct obd_hist_pcpu *oh);
657 unsigned long lprocfs_oh_counter_pcpu(struct obd_hist_pcpu *oh,
658                       unsigned int value);
659
660 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
661                            struct lprocfs_counter *cnt);
662
663 #ifdef HAVE_SERVER_SUPPORT
664 /* lprocfs_status.c: recovery status */
665 int lprocfs_recovery_status_seq_show(struct seq_file *m, void *data);
666
667 /* lprocfs: display the uuid of stale clients */
668 int lprocfs_recovery_stale_clients_seq_show(struct seq_file *m, void *data);
669
670 /* lprocfs_status.c: hash statistics */
671 int lprocfs_hash_seq_show(struct seq_file *m, void *data);
672
673 /* lprocfs_status.c: IR factor */
674 ssize_t ir_factor_show(struct kobject *kobj, struct attribute *attr,
675                        char *buf);
676 ssize_t ir_factor_store(struct kobject *kobj, struct attribute *attr,
677                         const char *buffer, size_t count);
678 #endif
679
680 /* lprocfs_status.c: dump pages on cksum error */
681 int lprocfs_checksum_dump_seq_show(struct seq_file *m, void *data);
682 ssize_t
683 lprocfs_checksum_dump_seq_write(struct file *file, const char __user *buffer,
684                                 size_t count, loff_t *off);
685
686 extern int lprocfs_single_release(struct inode *i, struct file *f);
687 extern int lprocfs_seq_release(struct inode *i, struct file *f);
688
689 /* You must use these macros when you want to refer to
690  * the import in a client obd_device for a lprocfs entry
691  * Note that it is not safe to 'goto', 'return' or 'break'
692  * out of the body of this statement.  It *IS* safe to
693  * 'goto' the a label inside the statement, or to 'continue'
694  * to get out of the statement.
695  */
696
697 #define with_imp_locked_nested(__obd, __imp, __rc, __nest)              \
698         for (down_read_nested(&(__obd)->u.cli.cl_sem, __nest),          \
699              __imp = (__obd)->u.cli.cl_import,                          \
700              __rc = __imp ? 0 : -ENODEV;                                \
701              __imp ? 1 : (up_read(&(__obd)->u.cli.cl_sem), 0);          \
702              __imp = NULL)
703
704 #define with_imp_locked(__obd, __imp, __rc)     \
705         with_imp_locked_nested(__obd, __imp, __rc, 0)
706
707 /* write the name##_seq_show function, call LDEBUGFS_SEQ_FOPS_RO for read-only
708  * debugfs entries; otherwise, you will define name##_seq_write function also
709  * for a read-write debugfs entry, and then call LDEBUGFS_SEQ_FOPS instead.
710  * Finally, call debugfs_create_file(filename, 0444, obd, data, &name#_fops);
711  */
712 #define __LDEBUGFS_SEQ_FOPS(name, custom_seq_write)                     \
713 static int name##_single_open(struct inode *inode, struct file *file)   \
714 {                                                                       \
715         return single_open(file, name##_seq_show, inode->i_private);    \
716 }                                                                       \
717 static const struct file_operations name##_fops = {                     \
718         .owner   = THIS_MODULE,                                         \
719         .open    = name##_single_open,                                  \
720         .read    = seq_read,                                            \
721         .write   = custom_seq_write,                                    \
722         .llseek  = seq_lseek,                                           \
723         .release = single_release,                                      \
724 }
725
726 #define LDEBUGFS_SEQ_FOPS_RO(name)      __LDEBUGFS_SEQ_FOPS(name, NULL)
727 #define LDEBUGFS_SEQ_FOPS(name)         __LDEBUGFS_SEQ_FOPS(name, \
728                                                             name##_seq_write)
729
730 #define LDEBUGFS_SEQ_FOPS_RO_TYPE(name, type)                           \
731         static int name##_##type##_seq_show(struct seq_file *m, void *v)\
732         {                                                               \
733                 if (!m->private)                                        \
734                         return -ENODEV;                                 \
735                 return lprocfs_##type##_seq_show(m, m->private);        \
736         }                                                               \
737         LDEBUGFS_SEQ_FOPS_RO(name##_##type)
738
739 #define LDEBUGFS_SEQ_FOPS_RW_TYPE(name, type)                           \
740         static int name##_##type##_seq_show(struct seq_file *m, void *v)\
741         {                                                               \
742                 if (!m->private)                                        \
743                         return -ENODEV;                                 \
744                 return lprocfs_##type##_seq_show(m, m->private);        \
745         }                                                               \
746         static ssize_t name##_##type##_seq_write(struct file *file,     \
747                         const char __user *buffer, size_t count,        \
748                         loff_t *off)                                    \
749         {                                                               \
750                 struct seq_file *seq = file->private_data;              \
751                                                                         \
752                 if (!seq->private)                                      \
753                         return -ENODEV;                                 \
754                 return ldebugfs_##type##_seq_write(file, buffer, count, \
755                                                    seq->private);       \
756         }                                                               \
757         LDEBUGFS_SEQ_FOPS(name##_##type);
758
759 #define LDEBUGFS_FOPS_WR_ONLY(name, type)                               \
760         static ssize_t name##_##type##_write(struct file *file,         \
761                         const char __user *buffer, size_t count,        \
762                         loff_t *off)                                    \
763         {                                                               \
764                 return ldebugfs_##type##_seq_write(file, buffer, count, \
765                                                    off);                \
766         }                                                               \
767         static int name##_##type##_open(struct inode *inode,            \
768                                         struct file *file)              \
769         {                                                               \
770                 return single_open(file, NULL, inode->i_private);       \
771         }                                                               \
772         static const struct file_operations name##_##type##_fops = {    \
773                 .open    = name##_##type##_open,                        \
774                 .write   = name##_##type##_write,                       \
775                 .release = single_release,                              \
776         };
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_FOPS instead. Finally,
781  * call ldebugfs_obd_seq_create(obd, filename, 0444, &name#_fops, data);
782  */
783 #define __LPROC_SEQ_FOPS(name, custom_seq_write)                        \
784 static int name##_single_open(struct inode *inode, struct file *file)   \
785 {                                                                       \
786         return single_open(file, name##_seq_show,                       \
787                            inode->i_private ? inode->i_private :        \
788                                               pde_data(inode));         \
789 }                                                                       \
790 static const struct proc_ops name##_fops = {                            \
791         PROC_OWNER(THIS_MODULE)                                         \
792         .proc_open              = name##_single_open,                   \
793         .proc_read              = seq_read,                             \
794         .proc_write             = custom_seq_write,                     \
795         .proc_lseek             = seq_lseek,                            \
796         .proc_release           = lprocfs_single_release,               \
797 }
798
799 #define LPROC_SEQ_FOPS_RO(name)         __LPROC_SEQ_FOPS(name, NULL)
800 #define LPROC_SEQ_FOPS(name)            __LPROC_SEQ_FOPS(name, name##_seq_write)
801
802 #define LPROC_SEQ_FOPS_RO_TYPE(name, type)                              \
803         static int name##_##type##_seq_show(struct seq_file *m, void *v)\
804         {                                                               \
805                 return lprocfs_##type##_seq_show(m, m->private);        \
806         }                                                               \
807         LPROC_SEQ_FOPS_RO(name##_##type)
808
809 #define LPROC_SEQ_FOPS_RW_TYPE(name, type)                              \
810         static int name##_##type##_seq_show(struct seq_file *m, void *v)\
811         {                                                               \
812                 return lprocfs_##type##_seq_show(m, m->private);        \
813         }                                                               \
814         static ssize_t name##_##type##_seq_write(struct file *file,     \
815                         const char __user *buffer, size_t count,        \
816                         loff_t *off)                                    \
817         {                                                               \
818                 struct seq_file *seq = file->private_data;              \
819                 return lprocfs_##type##_seq_write(file, buffer,         \
820                                                   count, seq->private); \
821         }                                                               \
822         LPROC_SEQ_FOPS(name##_##type);
823
824 #define LPROC_SEQ_FOPS_WR_ONLY(name, type)                              \
825         static ssize_t name##_##type##_write(struct file *file,         \
826                         const char __user *buffer, size_t count,        \
827                         loff_t *off)                                    \
828         {                                                               \
829                 return lprocfs_##type##_seq_write(file, buffer, count, off);\
830         }                                                               \
831         static int name##_##type##_open(struct inode *inode, struct file *file)\
832         {                                                               \
833                 return single_open(file, NULL,                          \
834                                    inode->i_private ? inode->i_private : \
835                                    pde_data(inode));                    \
836         }                                                               \
837         static const struct proc_ops name##_##type##_fops = {           \
838                 .proc_open      = name##_##type##_open,                 \
839                 .proc_write     = name##_##type##_write,                \
840                 .proc_release   = lprocfs_single_release,               \
841         };
842
843 struct lustre_attr {
844         struct attribute attr;
845         ssize_t (*show)(struct kobject *kobj, struct attribute *attr,
846                         char *buf);
847         ssize_t (*store)(struct kobject *kobj, struct attribute *attr,
848                          const char *buf, size_t len);
849 };
850
851 #define LUSTRE_ATTR(name, mode, show, store) \
852 static struct lustre_attr lustre_attr_##name = __ATTR(name, mode, show, store)
853
854 #define LUSTRE_WO_ATTR(name) LUSTRE_ATTR(name, 0200, NULL, name##_store)
855 #define LUSTRE_RO_ATTR(name) LUSTRE_ATTR(name, 0444, name##_show, NULL)
856 #define LUSTRE_RW_ATTR(name) LUSTRE_ATTR(name, 0644, name##_show, name##_store)
857
858 ssize_t lustre_attr_show(struct kobject *kobj, struct attribute *attr,
859                          char *buf);
860 ssize_t lustre_attr_store(struct kobject *kobj, struct attribute *attr,
861                           const char *buf, size_t len);
862
863 extern const struct sysfs_ops lustre_sysfs_ops;
864
865 #define LUSTRE_OBD_UINT_PARAM_ATTR(name)\
866 static ssize_t name##_show(struct kobject *kobj, struct attribute *attr,\
867                            char *buf)                                   \
868 {                                                                       \
869         int rc;                                                         \
870         struct obd_device *obd =                                        \
871                 container_of(kobj, struct obd_device, obd_kset.kobj);   \
872         rc = snprintf(buf, PAGE_SIZE, "%u\n", obd->obd_##name); \
873         return rc;                                                      \
874 }                                                                       \
875 static ssize_t name##_store(struct kobject *kobj, struct attribute *attr,\
876                             const char *buffer, size_t count)           \
877 {                                                                       \
878         int rc;                                                         \
879         unsigned int val;                                               \
880         struct obd_device *obd =                                        \
881                 container_of(kobj, struct obd_device, obd_kset.kobj);   \
882         rc = kstrtouint(buffer, 10, &val);                              \
883         if (rc)                                                         \
884                 return rc;                                              \
885         obd->obd_##name = val;                                          \
886         return count;                                                   \
887 }                                                                       \
888 LUSTRE_RW_ATTR(name)
889
890 /* lproc_ptlrpc.c */
891 struct ptlrpc_request;
892 extern void target_print_req(void *seq_file, struct ptlrpc_request *req);
893
894 #ifdef HAVE_SERVER_SUPPORT
895 /* lprocfs_jobstats.c */
896 int lprocfs_job_stats_log(struct obd_device *obd, char *jobid,
897                           int event, long amount);
898 void lprocfs_job_stats_fini(struct obd_device *obd);
899 int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
900                            cntr_init_callback fn);
901 ssize_t job_cleanup_interval_show(struct kobject *kobj, struct attribute *attr,
902                                   char *buf);
903 ssize_t job_cleanup_interval_store(struct kobject *kobj,
904                                    struct attribute *attr,
905                                    const char *buffer, size_t count);
906 /* lproc_status_server.c */
907 ssize_t recovery_time_soft_show(struct kobject *kobj, struct attribute *attr,
908                                 char *buf);
909 ssize_t recovery_time_soft_store(struct kobject *kobj,
910                                  struct attribute *attr,
911                                  const char *buffer, size_t count);
912 ssize_t recovery_time_hard_show(struct kobject *kobj, struct attribute *attr,
913                                 char *buf);
914 ssize_t recovery_time_hard_store(struct kobject *kobj,
915                                  struct attribute *attr,
916                                  const char *buffer, size_t count);
917 ssize_t instance_show(struct kobject *kobj, struct attribute *attr,
918                       char *buf);
919 #endif
920 /* lproc_status.c */
921 int lprocfs_obd_max_pages_per_rpc_seq_show(struct seq_file *m, void *data);
922 ssize_t lprocfs_obd_max_pages_per_rpc_seq_write(struct file *file,
923                                                 const char __user *buffer,
924                                                 size_t count, loff_t *off);
925 ssize_t short_io_bytes_show(struct kobject *kobj, struct attribute *attr,
926                             char *buf);
927 ssize_t short_io_bytes_store(struct kobject *kobj, struct attribute *attr,
928                              const char *buffer, size_t count);
929
930 struct root_squash_info;
931 int lprocfs_wr_root_squash(const char __user *buffer, unsigned long count,
932                            struct root_squash_info *squash, char *name);
933 int lprocfs_wr_nosquash_nids(const char __user *buffer, unsigned long count,
934                              struct root_squash_info *squash, char *name);
935
936 #else /* !CONFIG_PROC_FS */
937
938 #define proc_lustre_root NULL
939
940 static inline void lprocfs_counter_add(struct lprocfs_stats *stats,
941                                        int index, long amount)
942 {
943 }
944
945 static inline void lprocfs_counter_incr(struct lprocfs_stats *stats, int index)
946 {
947 }
948
949 static inline void lprocfs_counter_sub(struct lprocfs_stats *stats,
950                                        int index, long amount)
951 {
952 }
953
954 static inline void lprocfs_counter_decr(struct lprocfs_stats *stats, int index)
955 {
956 }
957
958 static inline void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
959                                         enum lprocfs_counter_config config,
960                                         const char *name)
961 {
962 }
963
964 static inline void lprocfs_counter_init_units(struct lprocfs_stats *stats,
965                                 int index, enum lprocfs_counter_config config,
966                                 const char *name, const char *units)
967 {
968 }
969
970 static inline __u64 lc_read_helper(struct lprocfs_counter *lc,
971                                    enum lprocfs_fields_flags field)
972 {
973         return 0;
974 }
975
976 /* NB: we return !NULL to satisfy error checker */
977 static inline struct lprocfs_stats *
978 lprocfs_stats_alloc(unsigned int num, enum lprocfs_stats_flags flags)
979 {
980         return (struct lprocfs_stats *)1;
981 }
982
983 static inline void lprocfs_stats_clear(struct lprocfs_stats *stats)
984 {
985 }
986
987 static inline void lprocfs_stats_free(struct lprocfs_stats **stats)
988 {
989 }
990
991 static inline int lprocfs_stats_register(struct proc_dir_entry *root,
992                                          const char *name,
993                                          struct lprocfs_stats *stats)
994 {
995         return 0;
996 }
997
998 static inline void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
999 {
1000 }
1001
1002 static inline int lprocfs_alloc_obd_stats(struct obd_device *obd,
1003                                           unsigned int num_stats)
1004 {
1005         return 0;
1006 }
1007
1008 static inline int lprocfs_alloc_md_stats(struct obd_device *obd,
1009                                          unsigned int num_private_stats)
1010 {
1011         return 0;
1012 }
1013
1014 static inline void lprocfs_free_obd_stats(struct obd_device *obd)
1015 {
1016 }
1017
1018 static inline void lprocfs_free_md_stats(struct obd_device *obd)
1019 {
1020 }
1021
1022 struct obd_export;
1023 static inline int lprocfs_add_clear_entry(struct obd_export *exp)
1024 {
1025         return 0;
1026 }
1027
1028 static inline void lprocfs_free_per_client_stats(struct obd_device *obd)
1029 {
1030 }
1031
1032 #ifdef HAVE_SERVER_SUPPORT
1033 static inline
1034 ssize_t lprocfs_nid_stats_seq_write(struct file *file,
1035                                     const char __user *buffer,
1036                                     size_t count, loff_t *off)
1037 {
1038         return 0;
1039 }
1040
1041 static inline int lprocfs_nid_stats_clear_seq_show(struct seq_file *m,
1042                                                    void *data)
1043 {
1044         return 0;
1045 }
1046
1047 static inline int lprocfs_exp_setup(struct obd_export *exp,
1048                                     struct lnet_nid *peer_nid)
1049 {
1050         return 0;
1051 }
1052 #endif
1053 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
1054 {
1055         return 0;
1056 }
1057
1058 static inline struct proc_dir_entry *
1059 lprocfs_add_simple(struct proc_dir_entry *root, char *name,
1060                    void *data, const struct file_operations *fops)
1061 {
1062         return 0;
1063 }
1064
1065 static inline struct proc_dir_entry *
1066 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
1067                     const char *format, ...)
1068 {
1069         return NULL;
1070 }
1071
1072 static inline int lprocfs_add_vars(struct proc_dir_entry *root,
1073                                    struct lprocfs_vars *var, void *data)
1074 {
1075         return 0;
1076 }
1077
1078 static inline struct proc_dir_entry *
1079 lprocfs_register(const char *name, struct proc_dir_entry *parent,
1080                  struct lprocfs_vars *list, void *data)
1081 {
1082         return NULL;
1083 }
1084
1085 static inline void lprocfs_remove(struct proc_dir_entry **root)
1086 {
1087 }
1088
1089 static inline void lprocfs_remove_proc_entry(const char *name,
1090                                              struct proc_dir_entry *parent)
1091 {
1092 }
1093
1094 static inline int lprocfs_obd_setup(struct obd_device *obd, bool uuid_only)
1095 {
1096         return 0;
1097 }
1098
1099 static inline int lprocfs_obd_cleanup(struct obd_device *obd)
1100 {
1101         return 0;
1102 }
1103
1104 static inline int lprocfs_uuid_seq_show(struct seq_file *m, void *data)
1105 {
1106         return 0;
1107 }
1108
1109 static inline int lprocfs_server_seq_show(struct seq_file *m, void *data)
1110 {
1111         return 0;
1112 }
1113
1114 static inline int lprocfs_import_seq_show(struct seq_file *m, void *data)
1115 {
1116         return 0;
1117 }
1118
1119 static inline int lprocfs_state_seq_show(struct seq_file *m, void *data)
1120 {
1121         return 0;
1122 }
1123
1124 static inline int lprocfs_connect_flags_seq_show(struct seq_file *m, void *data)
1125 {
1126         return 0;
1127 }
1128 #ifdef HAVE_SERVER_SUPPORT
1129 static inline int lprocfs_num_exports_seq_show(struct seq_file *m, void *data)
1130 {
1131         return 0;
1132 }
1133 #endif
1134 struct adaptive_timeout;
1135 static inline int lprocfs_at_hist_helper(struct seq_file *m,
1136                                          struct adaptive_timeout *at)
1137 {
1138         return 0;
1139 }
1140
1141 static inline int lprocfs_timeouts_seq_show(struct seq_file *m, void *data)
1142 {
1143         return 0;
1144 }
1145
1146 static inline ssize_t
1147 lprocfs_timeouts_seq_write(struct file *file, const char __user *buffer,
1148                            size_t count, loff_t *off)
1149 {
1150         return 0;
1151 }
1152 #ifdef HAVE_SERVER_SUPPORT
1153 static inline ssize_t
1154 lprocfs_evict_client_seq_write(struct file *file, const char __user *buffer,
1155                                size_t count, loff_t *off)
1156 {
1157         return 0;
1158 }
1159 #endif
1160
1161 static inline ssize_t
1162 lprocfs_ping_seq_write(struct file *file, const char __user *buffer,
1163                        size_t count, loff_t *off)
1164 {
1165         return 0;
1166 }
1167
1168 static inline ssize_t
1169 ldebugfs_import_seq_write(struct file *file, const char __user *buffer,
1170                           size_t count, loff_t *off)
1171 {
1172         return 0;
1173 }
1174
1175 static inline ssize_t
1176 lprocfs_import_seq_write(struct file *file, const char __user *buffer,
1177                          size_t count, loff_t *off)
1178 {
1179         return 0;
1180 }
1181
1182 static inline int
1183 lprocfs_pinger_recov_seq_show(struct seq_file *m, void *data)
1184 {
1185         return 0;
1186 }
1187
1188 static inline ssize_t
1189 lprocfs_pinger_recov_seq_write(struct file *file, const char __user *buffer,
1190                                size_t count, loff_t *off)
1191 {
1192         return 0;
1193 }
1194
1195 /* Statfs helpers */
1196 static inline
1197 int lprocfs_blksize_seq_show(struct seq_file *m, void *data)
1198 {
1199         return 0;
1200 }
1201
1202 static inline
1203 int lprocfs_kbytestotal_seq_show(struct seq_file *m, void *data)
1204 {
1205         return 0;
1206 }
1207
1208 static inline
1209 int lprocfs_kbytesfree_seq_show(struct seq_file *m, void *data)
1210 {
1211         return 0;
1212 }
1213
1214 static inline
1215 int lprocfs_kbytesavail_seq_show(struct seq_file *m, void *data)
1216 {
1217         return 0;
1218 }
1219
1220 static inline
1221 int lprocfs_filestotal_seq_show(struct seq_file *m, void *data)
1222 {
1223         return 0;
1224 }
1225
1226 static inline
1227 int lprocfs_filesfree_seq_show(struct seq_file *m, void *data)
1228 {
1229         return 0;
1230 }
1231
1232 static inline
1233 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value)
1234 {
1235 }
1236
1237 static inline
1238 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value)
1239 {
1240 }
1241
1242 static inline
1243 void lprocfs_oh_clear(struct obd_histogram *oh)
1244 {
1245 }
1246
1247 static inline
1248 unsigned long lprocfs_oh_sum(struct obd_histogram *oh)
1249 {
1250         return 0;
1251 }
1252
1253 static inline
1254 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
1255                            struct lprocfs_counter *cnt)
1256 {
1257 }
1258
1259 static inline
1260 u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx,
1261                             enum lprocfs_fields_flags field)
1262 {
1263         return (__u64)0;
1264 }
1265
1266 #define LPROC_SEQ_FOPS_RO(name)
1267 #define LPROC_SEQ_FOPS(name)
1268 #define LPROC_SEQ_FOPS_RO_TYPE(name, type)
1269 #define LPROC_SEQ_FOPS_RW_TYPE(name, type)
1270 #define LPROC_SEQ_FOPS_WR_ONLY(name, type)
1271
1272 /* lprocfs_jobstats.c */
1273 static inline
1274 int lprocfs_job_stats_log(struct obd_device *obd, char *jobid, int event,
1275                           long amount)
1276 {
1277         return 0;
1278 }
1279
1280 static inline
1281 void lprocfs_job_stats_fini(struct obd_device *obd)
1282 {
1283 }
1284
1285 static inline
1286 int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
1287                            cntr_init_callback fn)
1288 {
1289         return 0;
1290 }
1291
1292
1293 /* lproc_ptlrpc.c */
1294 #define target_print_req NULL
1295
1296 #endif /* CONFIG_PROC_FS */
1297
1298 #endif /* LPROCFS_STATUS_H */