1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 only,
10 * as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License version 2 for more details (a copy is included
16 * in the LICENSE file that accompanied this code).
18 * You should have received a copy of the GNU General Public License
19 * version 2 along with this program; If not, see
20 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
29 * Copyright 2008 Sun Microsystems, Inc. All rights reserved
30 * Use is subject to license terms.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
36 * lustre/include/lprocfs_status.h
38 * Top level header file for LProc SNMP
40 * Author: Hariharan Thantry thantry@users.sourceforge.net
42 #ifndef _LPROCFS_SNMP_H
43 #define _LPROCFS_SNMP_H
45 #include <lustre/lustre_idl.h>
46 #if defined(__linux__)
47 #include <linux/lprocfs_status.h>
48 #elif defined(__APPLE__)
49 #include <darwin/lprocfs_status.h>
50 #elif defined(__WINNT__)
51 #include <winnt/lprocfs_status.h>
53 #error Unsupported operating system.
57 #if (defined(__KERNEL__) && defined(CONFIG_PROC_FS))
63 cfs_read_proc_t *read_fptr;
64 cfs_write_proc_t *write_fptr;
66 struct file_operations *fops;
73 struct lprocfs_static_vars {
74 struct lprocfs_vars *module_vars;
75 struct lprocfs_vars *obd_vars;
78 /* if we find more consumers this could be generalized */
79 #define OBD_HIST_MAX 32
80 struct obd_histogram {
82 unsigned long oh_buckets[OBD_HIST_MAX];
104 struct obd_histogram hist[BRW_LAST];
108 /* An lprocfs counter can be configured using the enum bit masks below.
110 * LPROCFS_CNTR_EXTERNALLOCK indicates that an external lock already
111 * protects this counter from concurrent updates. If not specified,
112 * lprocfs an internal per-counter lock variable. External locks are
113 * not used to protect counter increments, but are used to protect
114 * counter readout and resets.
116 * LPROCFS_CNTR_AVGMINMAX indicates a multi-valued counter samples,
117 * (i.e. counter can be incremented by more than "1"). When specified,
118 * the counter maintains min, max and sum in addition to a simple
119 * invocation count. This allows averages to be be computed.
120 * If not specified, the counter is an increment-by-1 counter.
121 * min, max, sum, etc. are not maintained.
123 * LPROCFS_CNTR_STDDEV indicates that the counter should track sum of
124 * squares (for multi-valued counter samples only). This allows
125 * external computation of standard deviation, but involves a 64-bit
126 * multiply per counter increment.
130 LPROCFS_CNTR_EXTERNALLOCK = 0x0001,
131 LPROCFS_CNTR_AVGMINMAX = 0x0002,
132 LPROCFS_CNTR_STDDEV = 0x0004,
134 /* counter data type */
135 LPROCFS_TYPE_REGS = 0x0100,
136 LPROCFS_TYPE_BYTES = 0x0200,
137 LPROCFS_TYPE_PAGES = 0x0400,
138 LPROCFS_TYPE_CYCLE = 0x0800,
141 struct lprocfs_atomic {
146 #define LC_MIN_INIT ((~(__u64)0) >> 1)
148 struct lprocfs_counter {
149 struct lprocfs_atomic lc_cntl; /* may need to move to per set */
150 unsigned int lc_config;
156 const char *lc_name; /* must be static */
157 const char *lc_units; /* must be static */
160 struct lprocfs_percpu {
161 struct lprocfs_counter lp_cntr[0];
164 #define LPROCFS_GET_NUM_CPU 0x0001
165 #define LPROCFS_GET_SMP_ID 0x0002
167 enum lprocfs_stats_flags {
168 LPROCFS_STATS_FLAG_PERCPU = 0x0000, /* per cpu counter */
169 LPROCFS_STATS_FLAG_NOPERCPU = 0x0001, /* stats have no percpu
170 * area and need locking */
173 enum lprocfs_fields_flags {
174 LPROCFS_FIELDS_FLAGS_CONFIG = 0x0001,
175 LPROCFS_FIELDS_FLAGS_SUM = 0x0002,
176 LPROCFS_FIELDS_FLAGS_MIN = 0x0003,
177 LPROCFS_FIELDS_FLAGS_MAX = 0x0004,
178 LPROCFS_FIELDS_FLAGS_AVG = 0x0005,
179 LPROCFS_FIELDS_FLAGS_SUMSQUARE = 0x0006,
180 LPROCFS_FIELDS_FLAGS_COUNT = 0x0007,
183 struct lprocfs_stats {
184 unsigned int ls_num; /* # of counters */
185 int ls_flags; /* See LPROCFS_STATS_FLAG_* */
186 spinlock_t ls_lock; /* Lock used only when there are
187 * no percpu stats areas */
188 struct lprocfs_percpu *ls_percpu[0];
191 static inline int opcode_offset(__u32 opc) {
192 if (opc < OST_LAST_OPC) {
194 return (opc - OST_FIRST_OPC);
195 } else if (opc < MDS_LAST_OPC) {
197 return (opc - MDS_FIRST_OPC +
198 (OST_LAST_OPC - OST_FIRST_OPC));
199 } else if (opc < LDLM_LAST_OPC) {
201 return (opc - LDLM_FIRST_OPC +
202 (MDS_LAST_OPC - MDS_FIRST_OPC) +
203 (OST_LAST_OPC - OST_FIRST_OPC));
204 } else if (opc < MGS_LAST_OPC) {
206 return (opc - MGS_FIRST_OPC +
207 (LDLM_LAST_OPC - LDLM_FIRST_OPC) +
208 (MDS_LAST_OPC - MDS_FIRST_OPC) +
209 (OST_LAST_OPC - OST_FIRST_OPC));
210 } else if (opc < OBD_LAST_OPC) {
212 return (opc - OBD_FIRST_OPC +
213 (MGS_LAST_OPC - MGS_FIRST_OPC) +
214 (LDLM_LAST_OPC - LDLM_FIRST_OPC) +
215 (MDS_LAST_OPC - MDS_FIRST_OPC) +
216 (OST_LAST_OPC - OST_FIRST_OPC));
217 } else if (opc < LLOG_LAST_OPC) {
219 return (opc - LLOG_FIRST_OPC +
220 (OBD_LAST_OPC - OBD_FIRST_OPC) +
221 (MGS_LAST_OPC - MGS_FIRST_OPC) +
222 (LDLM_LAST_OPC - LDLM_FIRST_OPC) +
223 (MDS_LAST_OPC - MDS_FIRST_OPC) +
224 (OST_LAST_OPC - OST_FIRST_OPC));
225 } else if (opc < QUOTA_LAST_OPC) {
227 return (opc - QUOTA_FIRST_OPC +
228 (LLOG_LAST_OPC - LLOG_FIRST_OPC) +
229 (OBD_LAST_OPC - OBD_FIRST_OPC) +
230 (MGS_LAST_OPC - MGS_FIRST_OPC) +
231 (LDLM_LAST_OPC - LDLM_FIRST_OPC) +
232 (MDS_LAST_OPC - MDS_FIRST_OPC) +
233 (OST_LAST_OPC - OST_FIRST_OPC));
234 } else if (opc < SEQ_LAST_OPC) {
236 return (opc - SEQ_FIRST_OPC +
237 (QUOTA_LAST_OPC- QUOTA_FIRST_OPC) +
238 (LLOG_LAST_OPC - LLOG_FIRST_OPC) +
239 (OBD_LAST_OPC - OBD_FIRST_OPC) +
240 (MGS_LAST_OPC - MGS_FIRST_OPC) +
241 (LDLM_LAST_OPC - LDLM_FIRST_OPC) +
242 (MDS_LAST_OPC - MDS_FIRST_OPC) +
243 (OST_LAST_OPC - OST_FIRST_OPC));
244 } else if (opc < SEC_LAST_OPC) {
246 return (opc - SEC_FIRST_OPC +
247 (SEQ_LAST_OPC - SEQ_FIRST_OPC) +
248 (QUOTA_LAST_OPC- QUOTA_FIRST_OPC) +
249 (LLOG_LAST_OPC - LLOG_FIRST_OPC) +
250 (OBD_LAST_OPC - OBD_FIRST_OPC) +
251 (MGS_LAST_OPC - MGS_FIRST_OPC) +
252 (LDLM_LAST_OPC - LDLM_FIRST_OPC) +
253 (MDS_LAST_OPC - MDS_FIRST_OPC) +
254 (OST_LAST_OPC - OST_FIRST_OPC));
255 } else if (opc < FLD_LAST_OPC) {
257 return (opc - FLD_FIRST_OPC +
258 (SEC_LAST_OPC - SEC_FIRST_OPC) +
259 (SEQ_LAST_OPC - SEQ_FIRST_OPC) +
260 (QUOTA_LAST_OPC- QUOTA_FIRST_OPC) +
261 (LLOG_LAST_OPC - LLOG_FIRST_OPC) +
262 (OBD_LAST_OPC - OBD_FIRST_OPC) +
263 (MGS_LAST_OPC - MGS_FIRST_OPC) +
264 (LDLM_LAST_OPC - LDLM_FIRST_OPC) +
265 (MDS_LAST_OPC - MDS_FIRST_OPC) +
266 (OST_LAST_OPC - OST_FIRST_OPC));
274 #define LUSTRE_MAX_OPCODES ((OST_LAST_OPC - OST_FIRST_OPC) + \
275 (MDS_LAST_OPC - MDS_FIRST_OPC) + \
276 (LDLM_LAST_OPC - LDLM_FIRST_OPC) + \
277 (MGS_LAST_OPC - MGS_FIRST_OPC) + \
278 (OBD_LAST_OPC - OBD_FIRST_OPC) + \
279 (LLOG_LAST_OPC - LLOG_FIRST_OPC) + \
280 (QUOTA_LAST_OPC - QUOTA_FIRST_OPC) + \
281 (SEQ_LAST_OPC - SEQ_FIRST_OPC) + \
282 (SEC_LAST_OPC - SEC_FIRST_OPC) + \
283 (FLD_LAST_OPC - FLD_FIRST_OPC))
285 #define EXTRA_MAX_OPCODES ((PTLRPC_LAST_CNTR - PTLRPC_FIRST_CNTR) + \
286 (EXTRA_LAST_OPC - EXTRA_FIRST_OPC))
289 PTLRPC_REQWAIT_CNTR = 0,
290 PTLRPC_REQQDEPTH_CNTR,
291 PTLRPC_REQACTIVE_CNTR,
293 PTLRPC_REQBUF_AVAIL_CNTR,
297 #define PTLRPC_FIRST_CNTR PTLRPC_REQWAIT_CNTR
300 LDLM_GLIMPSE_ENQUEUE = 0,
317 #define EXTRA_FIRST_OPC LDLM_GLIMPSE_ENQUEUE
319 extern cfs_proc_dir_entry_t *proc_lustre_root;
323 struct obd_histogram;
325 /* Days / hours / mins / seconds format */
329 static inline void s2dhms(struct dhms *ts, time_t secs)
331 ts->d = secs / 86400;
338 #define DHMS_FMT "%dd%dh%02dm%02ds"
339 #define DHMS_VARS(x) (x)->d, (x)->h, (x)->m, (x)->s
344 static inline int lprocfs_stats_lock(struct lprocfs_stats *stats, int type)
348 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) {
349 if (type & LPROCFS_GET_NUM_CPU)
351 if (type & LPROCFS_GET_SMP_ID)
353 spin_lock(&stats->ls_lock);
355 if (type & LPROCFS_GET_NUM_CPU)
356 rc = num_possible_cpus();
357 if (type & LPROCFS_GET_SMP_ID)
358 rc = smp_processor_id();
363 static inline void lprocfs_stats_unlock(struct lprocfs_stats *stats)
365 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU)
366 spin_unlock(&stats->ls_lock);
369 /* Two optimized LPROCFS counter increment functions are provided:
370 * lprocfs_counter_incr(cntr, value) - optimized for by-one counters
371 * lprocfs_counter_add(cntr) - use for multi-valued counters
372 * Counter data layout allows config flag, counter lock and the
373 * count itself to reside within a single cache line.
376 extern void lprocfs_counter_add(struct lprocfs_stats *stats, int idx,
378 extern void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx,
381 #define lprocfs_counter_incr(stats, idx) \
382 lprocfs_counter_add(stats, idx, 1)
383 #define lprocfs_counter_decr(stats, idx) \
384 lprocfs_counter_sub(stats, idx, 1)
386 extern __s64 lprocfs_read_helper(struct lprocfs_counter *lc,
387 enum lprocfs_fields_flags field);
388 static inline __u64 lprocfs_stats_collector(struct lprocfs_stats *stats,
390 enum lprocfs_fields_flags field)
395 LASSERT(stats != NULL);
396 for (i = 0; i < num_possible_cpus(); i++)
397 ret += lprocfs_read_helper(&(stats->ls_percpu[i]->lp_cntr[idx]),
402 extern struct lprocfs_stats *lprocfs_alloc_stats(unsigned int num,
403 enum lprocfs_stats_flags flags);
404 extern void lprocfs_clear_stats(struct lprocfs_stats *stats);
405 extern void lprocfs_free_stats(struct lprocfs_stats **stats);
406 extern void lprocfs_init_ops_stats(int num_private_stats,
407 struct lprocfs_stats *stats);
408 extern void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats);
409 extern int lprocfs_alloc_obd_stats(struct obd_device *obddev,
410 unsigned int num_private_stats);
411 extern int lprocfs_alloc_md_stats(struct obd_device *obddev,
412 unsigned int num_private_stats);
413 extern void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
414 unsigned conf, const char *name,
416 extern void lprocfs_free_obd_stats(struct obd_device *obddev);
419 extern int lprocfs_add_clear_entry(struct obd_device * obd,
420 cfs_proc_dir_entry_t *entry);
421 extern int lprocfs_exp_setup(struct obd_export *exp,
422 lnet_nid_t *peer_nid, int *newnid);
423 extern int lprocfs_exp_cleanup(struct obd_export *exp);
424 extern cfs_proc_dir_entry_t *lprocfs_add_simple(struct proc_dir_entry *root,
426 cfs_read_proc_t *read_proc,
427 cfs_write_proc_t *write_proc,
429 struct file_operations *fops);
430 extern struct proc_dir_entry *lprocfs_add_symlink(const char *name,
431 struct proc_dir_entry *parent, const char *dest);
432 extern void lprocfs_free_per_client_stats(struct obd_device *obd);
433 extern int lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
434 unsigned long count, void *data);
435 extern int lprocfs_nid_stats_clear_read(char *page, char **start, off_t off,
436 int count, int *eof, void *data);
438 extern int lprocfs_register_stats(cfs_proc_dir_entry_t *root, const char *name,
439 struct lprocfs_stats *stats);
441 /* lprocfs_status.c */
442 extern int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
443 struct lprocfs_vars *var,
446 extern cfs_proc_dir_entry_t *lprocfs_register(const char *name,
447 cfs_proc_dir_entry_t *parent,
448 struct lprocfs_vars *list,
451 extern void lprocfs_remove(cfs_proc_dir_entry_t **root);
452 extern void lprocfs_remove_proc_entry(const char *name,
453 struct proc_dir_entry *parent);
455 extern cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *root,
458 extern int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list);
459 extern int lprocfs_obd_cleanup(struct obd_device *obd);
460 extern void lprocfs_free_per_client_stats(struct obd_device *obd);
461 extern struct file_operations lprocfs_evict_client_fops;
463 extern int lprocfs_seq_create(cfs_proc_dir_entry_t *parent, char *name,
464 mode_t mode, struct file_operations *seq_fops,
466 extern int lprocfs_obd_seq_create(struct obd_device *dev, char *name,
467 mode_t mode, struct file_operations *seq_fops,
470 /* Generic callbacks */
472 extern int lprocfs_rd_u64(char *page, char **start, off_t off,
473 int count, int *eof, void *data);
474 extern int lprocfs_rd_atomic(char *page, char **start, off_t off,
475 int count, int *eof, void *data);
476 extern int lprocfs_wr_atomic(struct file *file, const char *buffer,
477 unsigned long count, void *data);
478 extern int lprocfs_rd_uint(char *page, char **start, off_t off,
479 int count, int *eof, void *data);
480 extern int lprocfs_wr_uint(struct file *file, const char *buffer,
481 unsigned long count, void *data);
482 extern int lprocfs_rd_uuid(char *page, char **start, off_t off,
483 int count, int *eof, void *data);
484 extern int lprocfs_rd_name(char *page, char **start, off_t off,
485 int count, int *eof, void *data);
486 extern int lprocfs_rd_fstype(char *page, char **start, off_t off,
487 int count, int *eof, void *data);
488 extern int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
489 int count, int *eof, void *data);
490 extern int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
491 int count, int *eof, void *data);
492 extern int lprocfs_rd_import(char *page, char **start, off_t off, int count,
493 int *eof, void *data);
494 extern int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
495 int count, int *eof, void *data);
496 extern int lprocfs_rd_num_exports(char *page, char **start, off_t off,
497 int count, int *eof, void *data);
498 extern int lprocfs_rd_numrefs(char *page, char **start, off_t off,
499 int count, int *eof, void *data);
500 struct adaptive_timeout;
501 extern int lprocfs_at_hist_helper(char *page, int count, int rc,
502 struct adaptive_timeout *at);
503 extern int lprocfs_rd_timeouts(char *page, char **start, off_t off,
504 int count, int *eof, void *data);
505 extern int lprocfs_wr_timeouts(struct file *file, const char *buffer,
506 unsigned long count, void *data);
507 extern int lprocfs_wr_evict_client(struct file *file, const char *buffer,
508 unsigned long count, void *data);
509 extern int lprocfs_wr_ping(struct file *file, const char *buffer,
510 unsigned long count, void *data);
513 extern int lprocfs_rd_blksize(char *page, char **start, off_t off,
514 int count, int *eof, void *data);
515 extern int lprocfs_rd_kbytestotal(char *page, char **start, off_t off,
516 int count, int *eof, void *data);
517 extern int lprocfs_rd_kbytesfree(char *page, char **start, off_t off,
518 int count, int *eof, void *data);
519 extern int lprocfs_rd_kbytesavail(char *page, char **start, off_t off,
520 int count, int *eof, void *data);
521 extern int lprocfs_rd_filestotal(char *page, char **start, off_t off,
522 int count, int *eof, void *data);
523 extern int lprocfs_rd_filesfree(char *page, char **start, off_t off,
524 int count, int *eof, void *data);
525 extern int lprocfs_rd_filegroups(char *page, char **start, off_t off,
526 int count, int *eof, void *data);
528 extern int lprocfs_write_helper(const char *buffer, unsigned long count,
530 extern int lprocfs_write_frac_helper(const char *buffer, unsigned long count,
532 extern int lprocfs_read_frac_helper(char *buffer, unsigned long count,
534 extern int lprocfs_write_u64_helper(const char *buffer, unsigned long count,
536 extern int lprocfs_write_frac_u64_helper(const char *buffer, unsigned long count,
537 __u64 *val, int mult);
538 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value);
539 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value);
540 void lprocfs_oh_clear(struct obd_histogram *oh);
541 unsigned long lprocfs_oh_sum(struct obd_histogram *oh);
543 /* lprocfs_status.c: counter read/write functions */
544 extern int lprocfs_counter_read(char *page, char **start, off_t off,
545 int count, int *eof, void *data);
546 extern int lprocfs_counter_write(struct file *file, const char *buffer,
547 unsigned long count, void *data);
549 /* lprocfs_status.c: recovery status */
550 int lprocfs_obd_rd_recovery_status(char *page, char **start, off_t off,
551 int count, int *eof, void *data);
553 /* lprocfs_statuc.c: hash statistics */
554 int lprocfs_obd_rd_hash(char *page, char **start, off_t off,
555 int count, int *eof, void *data);
557 extern int lprocfs_seq_release(struct inode *, struct file *);
559 /* in lprocfs_stat.c, to protect the private data for proc entries */
560 extern struct rw_semaphore _lprocfs_lock;
561 #define LPROCFS_ENTRY() do { \
562 down_read(&_lprocfs_lock); \
564 #define LPROCFS_EXIT() do { \
565 up_read(&_lprocfs_lock); \
567 #define LPROCFS_ENTRY_AND_CHECK(dp) do { \
568 typecheck(struct proc_dir_entry *, dp); \
570 if ((dp)->deleted) { \
575 #define LPROCFS_WRITE_ENTRY() do { \
576 down_write(&_lprocfs_lock); \
578 #define LPROCFS_WRITE_EXIT() do { \
579 up_write(&_lprocfs_lock); \
582 /* You must use these macros when you want to refer to
583 * the import in a client obd_device for a lprocfs entry */
584 #define LPROCFS_CLIMP_CHECK(obd) do { \
585 typecheck(struct obd_device *, obd); \
586 down_read(&(obd)->u.cli.cl_sem); \
587 if ((obd)->u.cli.cl_import == NULL) { \
588 up_read(&(obd)->u.cli.cl_sem); \
592 #define LPROCFS_CLIMP_EXIT(obd) \
593 up_read(&(obd)->u.cli.cl_sem);
596 /* write the name##_seq_show function, call LPROC_SEQ_FOPS_RO for read-only
597 proc entries; otherwise, you will define name##_seq_write function also for
598 a read-write proc entry, and then call LPROC_SEQ_SEQ instead. Finally,
599 call lprocfs_obd_seq_create(obd, filename, 0444, &name#_fops, data); */
600 #define __LPROC_SEQ_FOPS(name, custom_seq_write) \
601 static int name##_seq_open(struct inode *inode, struct file *file) { \
602 struct proc_dir_entry *dp = PDE(inode); \
604 LPROCFS_ENTRY_AND_CHECK(dp); \
605 rc = single_open(file, name##_seq_show, dp->data); \
612 struct file_operations name##_fops = { \
613 .owner = THIS_MODULE, \
614 .open = name##_seq_open, \
616 .write = custom_seq_write, \
617 .llseek = seq_lseek, \
618 .release = lprocfs_seq_release, \
621 #define LPROC_SEQ_FOPS_RO(name) __LPROC_SEQ_FOPS(name, NULL)
622 #define LPROC_SEQ_FOPS(name) __LPROC_SEQ_FOPS(name, name##_seq_write)
625 struct ptlrpc_request;
626 extern void target_print_req(void *seq_file, struct ptlrpc_request *req);
628 /* lprocfs_status.c: read recovery max time bz13079 */
629 int lprocfs_obd_rd_recovery_maxtime(char *page, char **start, off_t off,
630 int count, int *eof, void *data);
632 /* lprocfs_status.c: write recovery max time bz13079 */
633 int lprocfs_obd_wr_recovery_maxtime(struct file *file, const char *buffer,
634 unsigned long count, void *data);
636 /* all quota proc functions */
637 extern int lprocfs_quota_rd_bunit(char *page, char **start, off_t off, int count,
638 int *eof, void *data);
639 extern int lprocfs_quota_wr_bunit(struct file *file, const char *buffer,
640 unsigned long count, void *data);
641 extern int lprocfs_quota_rd_btune(char *page, char **start, off_t off, int count,
642 int *eof, void *data);
643 extern int lprocfs_quota_wr_btune(struct file *file, const char *buffer,
644 unsigned long count, void *data);
645 extern int lprocfs_quota_rd_iunit(char *page, char **start, off_t off, int count,
646 int *eof, void *data);
647 extern int lprocfs_quota_wr_iunit(struct file *file, const char *buffer,
648 unsigned long count, void *data);
649 extern int lprocfs_quota_rd_itune(char *page, char **start, off_t off, int count,
650 int *eof, void *data);
651 extern int lprocfs_quota_wr_itune(struct file *file, const char *buffer,
652 unsigned long count, void *data);
653 extern int lprocfs_quota_rd_type(char *page, char **start, off_t off, int count,
654 int *eof, void *data);
655 extern int lprocfs_quota_wr_type(struct file *file, const char *buffer,
656 unsigned long count, void *data);
657 extern int lprocfs_quota_rd_switch_seconds(char *page, char **start, off_t off,
658 int count, int *eof, void *data);
659 extern int lprocfs_quota_wr_switch_seconds(struct file *file, const char *buffer,
660 unsigned long count, void *data);
661 extern int lprocfs_quota_rd_sync_blk(char *page, char **start, off_t off,
662 int count, int *eof, void *data);
663 extern int lprocfs_quota_wr_sync_blk(struct file *file, const char *buffer,
664 unsigned long count, void *data);
665 extern int lprocfs_quota_rd_switch_qs(char *page, char **start, off_t off,
666 int count, int *eof, void *data);
667 extern int lprocfs_quota_wr_switch_qs(struct file *file, const char *buffer,
668 unsigned long count, void *data);
669 extern int lprocfs_quota_rd_boundary_factor(char *page, char **start, off_t off,
670 int count, int *eof, void *data);
671 extern int lprocfs_quota_wr_boundary_factor(struct file *file, const char *buffer,
672 unsigned long count, void *data);
673 extern int lprocfs_quota_rd_least_bunit(char *page, char **start, off_t off,
674 int count, int *eof, void *data);
675 extern int lprocfs_quota_wr_least_bunit(struct file *file, const char *buffer,
676 unsigned long count, void *data);
677 extern int lprocfs_quota_rd_least_iunit(char *page, char **start, off_t off,
678 int count, int *eof, void *data);
679 extern int lprocfs_quota_wr_least_iunit(struct file *file, const char *buffer,
680 unsigned long count, void *data);
681 extern int lprocfs_quota_rd_qs_factor(char *page, char **start, off_t off,
682 int count, int *eof, void *data);
683 extern int lprocfs_quota_wr_qs_factor(struct file *file, const char *buffer,
684 unsigned long count, void *data);
686 /** struct for holding changelog data for seq_file processing */
687 struct changelog_seq_iter {
689 struct llog_ctxt *csi_ctxt;
690 struct llog_handle *csi_llh;
700 int changelog_seq_open(struct inode *inode, struct file *file,
701 struct changelog_seq_iter **csih);
702 int changelog_seq_release(struct inode *inode, struct file *file);
703 loff_t changelog_seq_lseek(struct file *file, loff_t offset, int origin);
708 /* LPROCFS is not defined */
712 static inline void lprocfs_counter_add(struct lprocfs_stats *stats,
713 int index, long amount) { return; }
714 static inline void lprocfs_counter_incr(struct lprocfs_stats *stats,
715 int index) { return; }
716 static inline void lprocfs_counter_sub(struct lprocfs_stats *stats,
717 int index, long amount) { return; }
718 static inline void lprocfs_counter_init(struct lprocfs_stats *stats,
719 int index, unsigned conf,
720 const char *name, const char *units)
723 static inline __u64 lc_read_helper(struct lprocfs_counter *lc,
724 enum lprocfs_fields_flags field)
727 static inline struct lprocfs_stats* lprocfs_alloc_stats(unsigned int num,
728 enum lprocfs_stats_flags flags)
730 static inline void lprocfs_clear_stats(struct lprocfs_stats *stats)
732 static inline void lprocfs_free_stats(struct lprocfs_stats **stats)
734 static inline int lprocfs_register_stats(cfs_proc_dir_entry_t *root,
736 struct lprocfs_stats *stats)
738 static inline void lprocfs_init_ops_stats(int num_private_stats,
739 struct lprocfs_stats *stats)
741 static inline void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
743 static inline int lprocfs_alloc_obd_stats(struct obd_device *obddev,
744 unsigned int num_private_stats)
746 static inline int lprocfs_alloc_md_stats(struct obd_device *obddev,
747 unsigned int num_private_stats)
749 static inline void lprocfs_free_obd_stats(struct obd_device *obddev)
753 static inline int lprocfs_add_clear_entry(struct obd_export *exp)
755 static inline int lprocfs_exp_setup(struct obd_export *exp,
756 lnet_nid_t *peer_nid, int *newnid)
758 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
760 static inline cfs_proc_dir_entry_t *lprocfs_add_simple(struct proc_dir_entry *root,
762 cfs_read_proc_t *read_proc,
763 cfs_write_proc_t *write_proc,
765 struct file_operations *fops)
767 static inline struct proc_dir_entry *lprocfs_add_symlink(const char *name,
768 struct proc_dir_entry *parent, const char *dest)
770 static inline void lprocfs_free_per_client_stats(struct obd_device *obd)
773 int lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
774 unsigned long count, void *data)
777 int lprocfs_nid_stats_clear_read(char *page, char **start, off_t off,
778 int count, int *eof, void *data)
781 static inline cfs_proc_dir_entry_t *
782 lprocfs_register(const char *name, cfs_proc_dir_entry_t *parent,
783 struct lprocfs_vars *list, void *data) { return NULL; }
784 static inline int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
785 struct lprocfs_vars *var,
786 void *data) { return 0; }
787 static inline void lprocfs_remove(cfs_proc_dir_entry_t **root) {};
788 static inline void lprocfs_remove_proc_entry(const char *name,
789 struct proc_dir_entry *parent) {};
790 static inline cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *head,
791 const char *name) {return 0;}
792 static inline int lprocfs_obd_setup(struct obd_device *dev,
793 struct lprocfs_vars *list) { return 0; }
794 static inline int lprocfs_obd_cleanup(struct obd_device *dev) { return 0; }
795 static inline int lprocfs_rd_u64(char *page, char **start, off_t off,
796 int count, int *eof, void *data) { return 0; }
797 static inline int lprocfs_rd_uuid(char *page, char **start, off_t off,
798 int count, int *eof, void *data) { return 0; }
799 static inline int lprocfs_rd_name(char *page, char **start, off_t off,
800 int count, int *eof, void *data) { return 0; }
801 static inline int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
802 int count, int *eof, void *data)
804 static inline int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
805 int count, int *eof, void *data)
807 static inline int lprocfs_rd_import(char *page, char **start, off_t off, int count,
808 int *eof, void *data) { return 0; }
809 static inline int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
810 int count, int *eof, void *data)
812 static inline int lprocfs_rd_num_exports(char *page, char **start, off_t off,
813 int count, int *eof, void *data)
815 static inline int lprocfs_rd_numrefs(char *page, char **start, off_t off,
816 int count, int *eof, void *data)
818 struct adaptive_timeout;
819 static inline int lprocfs_at_hist_helper(char *page, int count, int rc,
820 struct adaptive_timeout *at)
822 static inline int lprocfs_rd_timeouts(char *page, char **start, off_t off,
823 int count, int *eof, void *data)
825 static inline int lprocfs_wr_timeouts(struct file *file, const char *buffer,
826 unsigned long count, void *data)
828 static inline int lprocfs_wr_evict_client(struct file *file, const char *buffer,
829 unsigned long count, void *data)
831 static inline int lprocfs_wr_ping(struct file *file, const char *buffer,
832 unsigned long count, void *data)
838 int lprocfs_rd_blksize(char *page, char **start, off_t off,
839 int count, int *eof, void *data) { return 0; }
841 int lprocfs_rd_kbytestotal(char *page, char **start, off_t off,
842 int count, int *eof, void *data) { return 0; }
844 int lprocfs_rd_kbytesfree(char *page, char **start, off_t off,
845 int count, int *eof, void *data) { return 0; }
847 int lprocfs_rd_kbytesavail(char *page, char **start, off_t off,
848 int count, int *eof, void *data) { return 0; }
850 int lprocfs_rd_filestotal(char *page, char **start, off_t off,
851 int count, int *eof, void *data) { return 0; }
853 int lprocfs_rd_filesfree(char *page, char **start, off_t off,
854 int count, int *eof, void *data) { return 0; }
856 int lprocfs_rd_filegroups(char *page, char **start, off_t off,
857 int count, int *eof, void *data) { return 0; }
859 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value) {}
861 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value) {}
863 void lprocfs_oh_clear(struct obd_histogram *oh) {}
865 unsigned long lprocfs_oh_sum(struct obd_histogram *oh) { return 0; }
867 int lprocfs_counter_read(char *page, char **start, off_t off,
868 int count, int *eof, void *data) { return 0; }
870 int lprocfs_counter_write(struct file *file, const char *buffer,
871 unsigned long count, void *data) { return 0; }
874 __u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx,
875 enum lprocfs_fields_flags field)
878 #define LPROCFS_ENTRY()
879 #define LPROCFS_EXIT()
880 #define LPROCFS_ENTRY_AND_CHECK(dp)
881 #define LPROC_SEQ_FOPS_RO(name)
882 #define LPROC_SEQ_FOPS(name)
885 #define target_print_req NULL
889 #endif /* LPROCFS_SNMP_H */