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