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 #if defined(__linux__)
46 #include <linux/lprocfs_status.h>
47 #elif defined(__APPLE__)
48 #include <darwin/lprocfs_status.h>
49 #elif defined(__WINNT__)
50 #include <winnt/lprocfs_status.h>
52 #error Unsupported operating system.
54 #include <lustre/lustre_idl.h>
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_NONE = 0x0000, /* per cpu counter */
169 LPROCFS_STATS_FLAG_NOPERCPU = 0x0001, /* stats have no percpu
170 * area and need locking */
171 LPROCFS_STATS_GET_SMP_ID = 0x0002, /* just record locking with
172 * LPROCFS_GET_SMP_ID flag */
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,
185 struct lprocfs_stats {
186 unsigned int ls_num; /* # of counters */
187 int ls_flags; /* See LPROCFS_STATS_FLAG_* */
188 spinlock_t ls_lock; /* Lock used only when there are
189 * no percpu stats areas */
190 struct lprocfs_percpu *ls_percpu[0];
193 static inline int opcode_offset(__u32 opc) {
194 if (opc < OST_LAST_OPC) {
196 return (opc - OST_FIRST_OPC);
197 } else if (opc < MDS_LAST_OPC) {
199 return (opc - MDS_FIRST_OPC +
200 (OST_LAST_OPC - OST_FIRST_OPC));
201 } else if (opc < LDLM_LAST_OPC) {
203 return (opc - LDLM_FIRST_OPC +
204 (MDS_LAST_OPC - MDS_FIRST_OPC) +
205 (OST_LAST_OPC - OST_FIRST_OPC));
206 } else if (opc < MGS_LAST_OPC) {
208 return (opc - MGS_FIRST_OPC +
209 (LDLM_LAST_OPC - LDLM_FIRST_OPC) +
210 (MDS_LAST_OPC - MDS_FIRST_OPC) +
211 (OST_LAST_OPC - OST_FIRST_OPC));
212 } else if (opc < OBD_LAST_OPC) {
214 return (opc - OBD_FIRST_OPC +
215 (MGS_LAST_OPC - MGS_FIRST_OPC) +
216 (LDLM_LAST_OPC - LDLM_FIRST_OPC) +
217 (MDS_LAST_OPC - MDS_FIRST_OPC) +
218 (OST_LAST_OPC - OST_FIRST_OPC));
219 } else if (opc < LLOG_LAST_OPC) {
221 return (opc - LLOG_FIRST_OPC +
222 (OBD_LAST_OPC - OBD_FIRST_OPC) +
223 (MGS_LAST_OPC - MGS_FIRST_OPC) +
224 (LDLM_LAST_OPC - LDLM_FIRST_OPC) +
225 (MDS_LAST_OPC - MDS_FIRST_OPC) +
226 (OST_LAST_OPC - OST_FIRST_OPC));
227 } else if (opc < QUOTA_LAST_OPC) {
229 return (opc - QUOTA_FIRST_OPC +
230 (LLOG_LAST_OPC - LLOG_FIRST_OPC) +
231 (OBD_LAST_OPC - OBD_FIRST_OPC) +
232 (MGS_LAST_OPC - MGS_FIRST_OPC) +
233 (LDLM_LAST_OPC - LDLM_FIRST_OPC) +
234 (MDS_LAST_OPC - MDS_FIRST_OPC) +
235 (OST_LAST_OPC - OST_FIRST_OPC));
236 } else if (opc < SEQ_LAST_OPC) {
238 return (opc - SEQ_FIRST_OPC +
239 (QUOTA_LAST_OPC- QUOTA_FIRST_OPC) +
240 (LLOG_LAST_OPC - LLOG_FIRST_OPC) +
241 (OBD_LAST_OPC - OBD_FIRST_OPC) +
242 (MGS_LAST_OPC - MGS_FIRST_OPC) +
243 (LDLM_LAST_OPC - LDLM_FIRST_OPC) +
244 (MDS_LAST_OPC - MDS_FIRST_OPC) +
245 (OST_LAST_OPC - OST_FIRST_OPC));
246 } else if (opc < SEC_LAST_OPC) {
248 return (opc - SEC_FIRST_OPC +
249 (SEQ_LAST_OPC - SEQ_FIRST_OPC) +
250 (QUOTA_LAST_OPC- QUOTA_FIRST_OPC) +
251 (LLOG_LAST_OPC - LLOG_FIRST_OPC) +
252 (OBD_LAST_OPC - OBD_FIRST_OPC) +
253 (MGS_LAST_OPC - MGS_FIRST_OPC) +
254 (LDLM_LAST_OPC - LDLM_FIRST_OPC) +
255 (MDS_LAST_OPC - MDS_FIRST_OPC) +
256 (OST_LAST_OPC - OST_FIRST_OPC));
257 } else if (opc < FLD_LAST_OPC) {
259 return (opc - FLD_FIRST_OPC +
260 (SEC_LAST_OPC - SEC_FIRST_OPC) +
261 (SEQ_LAST_OPC - SEQ_FIRST_OPC) +
262 (QUOTA_LAST_OPC- QUOTA_FIRST_OPC) +
263 (LLOG_LAST_OPC - LLOG_FIRST_OPC) +
264 (OBD_LAST_OPC - OBD_FIRST_OPC) +
265 (MGS_LAST_OPC - MGS_FIRST_OPC) +
266 (LDLM_LAST_OPC - LDLM_FIRST_OPC) +
267 (MDS_LAST_OPC - MDS_FIRST_OPC) +
268 (OST_LAST_OPC - OST_FIRST_OPC));
276 #define LUSTRE_MAX_OPCODES ((OST_LAST_OPC - OST_FIRST_OPC) + \
277 (MDS_LAST_OPC - MDS_FIRST_OPC) + \
278 (LDLM_LAST_OPC - LDLM_FIRST_OPC) + \
279 (MGS_LAST_OPC - MGS_FIRST_OPC) + \
280 (OBD_LAST_OPC - OBD_FIRST_OPC) + \
281 (LLOG_LAST_OPC - LLOG_FIRST_OPC) + \
282 (QUOTA_LAST_OPC - QUOTA_FIRST_OPC) + \
283 (SEQ_LAST_OPC - SEQ_FIRST_OPC) + \
284 (SEC_LAST_OPC - SEC_FIRST_OPC) + \
285 (FLD_LAST_OPC - FLD_FIRST_OPC))
287 #define EXTRA_MAX_OPCODES ((PTLRPC_LAST_CNTR - PTLRPC_FIRST_CNTR) + \
288 (EXTRA_LAST_OPC - EXTRA_FIRST_OPC))
291 PTLRPC_REQWAIT_CNTR = 0,
292 PTLRPC_REQQDEPTH_CNTR,
293 PTLRPC_REQACTIVE_CNTR,
295 PTLRPC_REQBUF_AVAIL_CNTR,
299 #define PTLRPC_FIRST_CNTR PTLRPC_REQWAIT_CNTR
302 LDLM_GLIMPSE_ENQUEUE = 0,
319 #define EXTRA_FIRST_OPC LDLM_GLIMPSE_ENQUEUE
321 extern cfs_proc_dir_entry_t *proc_lustre_root;
325 struct obd_histogram;
327 /* Days / hours / mins / seconds format */
331 static inline void s2dhms(struct dhms *ts, time_t secs)
333 ts->d = secs / 86400;
340 #define DHMS_FMT "%dd%dh%02dm%02ds"
341 #define DHMS_VARS(x) (x)->d, (x)->h, (x)->m, (x)->s
346 static inline int lprocfs_stats_lock(struct lprocfs_stats *stats, int type)
350 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) {
351 if (type & LPROCFS_GET_NUM_CPU)
353 if (type & LPROCFS_GET_SMP_ID)
355 spin_lock(&stats->ls_lock);
357 if (type & LPROCFS_GET_NUM_CPU)
358 rc = num_possible_cpus();
359 if (type & LPROCFS_GET_SMP_ID) {
360 stats->ls_flags |= LPROCFS_STATS_GET_SMP_ID;
367 static inline void lprocfs_stats_unlock(struct lprocfs_stats *stats)
369 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU)
370 spin_unlock(&stats->ls_lock);
371 else if (stats->ls_flags & LPROCFS_STATS_GET_SMP_ID)
375 /* Two optimized LPROCFS counter increment functions are provided:
376 * lprocfs_counter_incr(cntr, value) - optimized for by-one counters
377 * lprocfs_counter_add(cntr) - use for multi-valued counters
378 * Counter data layout allows config flag, counter lock and the
379 * count itself to reside within a single cache line.
382 extern void lprocfs_counter_add(struct lprocfs_stats *stats, int idx,
384 extern void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx,
387 #define lprocfs_counter_incr(stats, idx) \
388 lprocfs_counter_add(stats, idx, 1)
389 #define lprocfs_counter_decr(stats, idx) \
390 lprocfs_counter_sub(stats, idx, 1)
392 extern __s64 lprocfs_read_helper(struct lprocfs_counter *lc,
393 enum lprocfs_fields_flags field);
394 static inline __u64 lprocfs_stats_collector(struct lprocfs_stats *stats,
396 enum lprocfs_fields_flags field)
401 LASSERT(stats != NULL);
402 for (i = 0; i < num_possible_cpus(); i++)
403 ret += lprocfs_read_helper(&(stats->ls_percpu[i]->lp_cntr[idx]),
408 extern struct lprocfs_stats *lprocfs_alloc_stats(unsigned int num,
409 enum lprocfs_stats_flags flags);
410 extern void lprocfs_clear_stats(struct lprocfs_stats *stats);
411 extern void lprocfs_free_stats(struct lprocfs_stats **stats);
412 extern void lprocfs_init_ops_stats(int num_private_stats,
413 struct lprocfs_stats *stats);
414 extern void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats);
415 extern int lprocfs_alloc_obd_stats(struct obd_device *obddev,
416 unsigned int num_private_stats);
417 extern int lprocfs_alloc_md_stats(struct obd_device *obddev,
418 unsigned int num_private_stats);
419 extern void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
420 unsigned conf, const char *name,
422 extern void lprocfs_free_obd_stats(struct obd_device *obddev);
425 extern int lprocfs_add_clear_entry(struct obd_device * obd,
426 cfs_proc_dir_entry_t *entry);
427 extern int lprocfs_exp_setup(struct obd_export *exp,
428 lnet_nid_t *peer_nid, int *newnid);
429 extern int lprocfs_exp_cleanup(struct obd_export *exp);
430 extern cfs_proc_dir_entry_t *lprocfs_add_simple(struct proc_dir_entry *root,
432 cfs_read_proc_t *read_proc,
433 cfs_write_proc_t *write_proc,
435 struct file_operations *fops);
436 extern struct proc_dir_entry *lprocfs_add_symlink(const char *name,
437 struct proc_dir_entry *parent, const char *dest);
438 extern void lprocfs_free_per_client_stats(struct obd_device *obd);
439 extern int lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
440 unsigned long count, void *data);
441 extern int lprocfs_nid_stats_clear_read(char *page, char **start, off_t off,
442 int count, int *eof, void *data);
444 extern int lprocfs_register_stats(cfs_proc_dir_entry_t *root, const char *name,
445 struct lprocfs_stats *stats);
447 /* lprocfs_status.c */
448 extern int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
449 struct lprocfs_vars *var,
452 extern cfs_proc_dir_entry_t *lprocfs_register(const char *name,
453 cfs_proc_dir_entry_t *parent,
454 struct lprocfs_vars *list,
457 extern void lprocfs_remove(cfs_proc_dir_entry_t **root);
458 extern void lprocfs_remove_proc_entry(const char *name,
459 struct proc_dir_entry *parent);
461 extern cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *root,
464 extern int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list);
465 extern int lprocfs_obd_cleanup(struct obd_device *obd);
466 extern void lprocfs_free_per_client_stats(struct obd_device *obd);
467 extern struct file_operations lprocfs_evict_client_fops;
469 extern int lprocfs_seq_create(cfs_proc_dir_entry_t *parent, char *name,
470 mode_t mode, struct file_operations *seq_fops,
472 extern int lprocfs_obd_seq_create(struct obd_device *dev, char *name,
473 mode_t mode, struct file_operations *seq_fops,
476 /* Generic callbacks */
478 extern int lprocfs_rd_u64(char *page, char **start, off_t off,
479 int count, int *eof, void *data);
480 extern int lprocfs_rd_atomic(char *page, char **start, off_t off,
481 int count, int *eof, void *data);
482 extern int lprocfs_wr_atomic(struct file *file, const char *buffer,
483 unsigned long count, void *data);
484 extern int lprocfs_rd_uint(char *page, char **start, off_t off,
485 int count, int *eof, void *data);
486 extern int lprocfs_wr_uint(struct file *file, const char *buffer,
487 unsigned long count, void *data);
488 extern int lprocfs_rd_uuid(char *page, char **start, off_t off,
489 int count, int *eof, void *data);
490 extern int lprocfs_rd_name(char *page, char **start, off_t off,
491 int count, int *eof, void *data);
492 extern int lprocfs_rd_fstype(char *page, char **start, off_t off,
493 int count, int *eof, void *data);
494 extern int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
495 int count, int *eof, void *data);
496 extern int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
497 int count, int *eof, void *data);
498 extern int lprocfs_rd_import(char *page, char **start, off_t off, int count,
499 int *eof, void *data);
500 extern int lprocfs_rd_state(char *page, char **start, off_t off, int count,
501 int *eof, void *data);
502 extern int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
503 int count, int *eof, void *data);
504 extern int lprocfs_rd_num_exports(char *page, char **start, off_t off,
505 int count, int *eof, void *data);
506 extern int lprocfs_rd_numrefs(char *page, char **start, off_t off,
507 int count, int *eof, void *data);
508 struct adaptive_timeout;
509 extern int lprocfs_at_hist_helper(char *page, int count, int rc,
510 struct adaptive_timeout *at);
511 extern int lprocfs_rd_timeouts(char *page, char **start, off_t off,
512 int count, int *eof, void *data);
513 extern int lprocfs_wr_timeouts(struct file *file, const char *buffer,
514 unsigned long count, void *data);
515 extern int lprocfs_wr_evict_client(struct file *file, const char *buffer,
516 unsigned long count, void *data);
517 extern int lprocfs_wr_ping(struct file *file, const char *buffer,
518 unsigned long count, void *data);
521 extern int lprocfs_rd_blksize(char *page, char **start, off_t off,
522 int count, int *eof, void *data);
523 extern int lprocfs_rd_kbytestotal(char *page, char **start, off_t off,
524 int count, int *eof, void *data);
525 extern int lprocfs_rd_kbytesfree(char *page, char **start, off_t off,
526 int count, int *eof, void *data);
527 extern int lprocfs_rd_kbytesavail(char *page, char **start, off_t off,
528 int count, int *eof, void *data);
529 extern int lprocfs_rd_filestotal(char *page, char **start, off_t off,
530 int count, int *eof, void *data);
531 extern int lprocfs_rd_filesfree(char *page, char **start, off_t off,
532 int count, int *eof, void *data);
533 extern int lprocfs_rd_filegroups(char *page, char **start, off_t off,
534 int count, int *eof, void *data);
536 extern int lprocfs_write_helper(const char *buffer, unsigned long count,
538 extern int lprocfs_write_frac_helper(const char *buffer, unsigned long count,
540 extern int lprocfs_read_frac_helper(char *buffer, unsigned long count,
542 extern int lprocfs_write_u64_helper(const char *buffer, unsigned long count,
544 extern int lprocfs_write_frac_u64_helper(const char *buffer, unsigned long count,
545 __u64 *val, int mult);
546 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value);
547 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value);
548 void lprocfs_oh_clear(struct obd_histogram *oh);
549 unsigned long lprocfs_oh_sum(struct obd_histogram *oh);
551 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
552 struct lprocfs_counter *cnt);
555 /* lprocfs_status.c: recovery status */
556 int lprocfs_obd_rd_recovery_status(char *page, char **start, off_t off,
557 int count, int *eof, void *data);
559 /* lprocfs_statuc.c: hash statistics */
560 int lprocfs_obd_rd_hash(char *page, char **start, off_t off,
561 int count, int *eof, void *data);
563 extern int lprocfs_seq_release(struct inode *, struct file *);
565 /* in lprocfs_stat.c, to protect the private data for proc entries */
566 extern struct rw_semaphore _lprocfs_lock;
567 #define LPROCFS_ENTRY() do { \
568 down_read(&_lprocfs_lock); \
570 #define LPROCFS_EXIT() do { \
571 up_read(&_lprocfs_lock); \
573 #define LPROCFS_ENTRY_AND_CHECK(dp) do { \
574 typecheck(struct proc_dir_entry *, dp); \
576 if ((dp)->deleted) { \
581 #define LPROCFS_WRITE_ENTRY() do { \
582 down_write(&_lprocfs_lock); \
584 #define LPROCFS_WRITE_EXIT() do { \
585 up_write(&_lprocfs_lock); \
588 /* You must use these macros when you want to refer to
589 * the import in a client obd_device for a lprocfs entry */
590 #define LPROCFS_CLIMP_CHECK(obd) do { \
591 typecheck(struct obd_device *, obd); \
592 down_read(&(obd)->u.cli.cl_sem); \
593 if ((obd)->u.cli.cl_import == NULL) { \
594 up_read(&(obd)->u.cli.cl_sem); \
598 #define LPROCFS_CLIMP_EXIT(obd) \
599 up_read(&(obd)->u.cli.cl_sem);
602 /* write the name##_seq_show function, call LPROC_SEQ_FOPS_RO for read-only
603 proc entries; otherwise, you will define name##_seq_write function also for
604 a read-write proc entry, and then call LPROC_SEQ_SEQ instead. Finally,
605 call lprocfs_obd_seq_create(obd, filename, 0444, &name#_fops, data); */
606 #define __LPROC_SEQ_FOPS(name, custom_seq_write) \
607 static int name##_seq_open(struct inode *inode, struct file *file) { \
608 struct proc_dir_entry *dp = PDE(inode); \
610 LPROCFS_ENTRY_AND_CHECK(dp); \
611 rc = single_open(file, name##_seq_show, dp->data); \
618 struct file_operations name##_fops = { \
619 .owner = THIS_MODULE, \
620 .open = name##_seq_open, \
622 .write = custom_seq_write, \
623 .llseek = seq_lseek, \
624 .release = lprocfs_seq_release, \
627 #define LPROC_SEQ_FOPS_RO(name) __LPROC_SEQ_FOPS(name, NULL)
628 #define LPROC_SEQ_FOPS(name) __LPROC_SEQ_FOPS(name, name##_seq_write)
631 struct ptlrpc_request;
632 extern void target_print_req(void *seq_file, struct ptlrpc_request *req);
634 /* lprocfs_status.c: read recovery max time bz13079 */
635 int lprocfs_obd_rd_recovery_maxtime(char *page, char **start, off_t off,
636 int count, int *eof, void *data);
638 /* lprocfs_status.c: write recovery max time bz13079 */
639 int lprocfs_obd_wr_recovery_maxtime(struct file *file, const char *buffer,
640 unsigned long count, void *data);
642 /* all quota proc functions */
643 extern int lprocfs_quota_rd_bunit(char *page, char **start, off_t off, int count,
644 int *eof, void *data);
645 extern int lprocfs_quota_wr_bunit(struct file *file, const char *buffer,
646 unsigned long count, void *data);
647 extern int lprocfs_quota_rd_btune(char *page, char **start, off_t off, int count,
648 int *eof, void *data);
649 extern int lprocfs_quota_wr_btune(struct file *file, const char *buffer,
650 unsigned long count, void *data);
651 extern int lprocfs_quota_rd_iunit(char *page, char **start, off_t off, int count,
652 int *eof, void *data);
653 extern int lprocfs_quota_wr_iunit(struct file *file, const char *buffer,
654 unsigned long count, void *data);
655 extern int lprocfs_quota_rd_itune(char *page, char **start, off_t off, int count,
656 int *eof, void *data);
657 extern int lprocfs_quota_wr_itune(struct file *file, const char *buffer,
658 unsigned long count, void *data);
659 extern int lprocfs_quota_rd_type(char *page, char **start, off_t off, int count,
660 int *eof, void *data);
661 extern int lprocfs_quota_wr_type(struct file *file, const char *buffer,
662 unsigned long count, void *data);
663 extern int lprocfs_quota_rd_switch_seconds(char *page, char **start, off_t off,
664 int count, int *eof, void *data);
665 extern int lprocfs_quota_wr_switch_seconds(struct file *file, const char *buffer,
666 unsigned long count, void *data);
667 extern int lprocfs_quota_rd_sync_blk(char *page, char **start, off_t off,
668 int count, int *eof, void *data);
669 extern int lprocfs_quota_wr_sync_blk(struct file *file, const char *buffer,
670 unsigned long count, void *data);
671 extern int lprocfs_quota_rd_switch_qs(char *page, char **start, off_t off,
672 int count, int *eof, void *data);
673 extern int lprocfs_quota_wr_switch_qs(struct file *file, const char *buffer,
674 unsigned long count, void *data);
675 extern int lprocfs_quota_rd_boundary_factor(char *page, char **start, off_t off,
676 int count, int *eof, void *data);
677 extern int lprocfs_quota_wr_boundary_factor(struct file *file, const char *buffer,
678 unsigned long count, void *data);
679 extern int lprocfs_quota_rd_least_bunit(char *page, char **start, off_t off,
680 int count, int *eof, void *data);
681 extern int lprocfs_quota_wr_least_bunit(struct file *file, const char *buffer,
682 unsigned long count, void *data);
683 extern int lprocfs_quota_rd_least_iunit(char *page, char **start, off_t off,
684 int count, int *eof, void *data);
685 extern int lprocfs_quota_wr_least_iunit(struct file *file, const char *buffer,
686 unsigned long count, void *data);
687 extern int lprocfs_quota_rd_qs_factor(char *page, char **start, off_t off,
688 int count, int *eof, void *data);
689 extern int lprocfs_quota_wr_qs_factor(struct file *file, const char *buffer,
690 unsigned long count, void *data);
692 /** struct for holding changelog data for seq_file processing */
693 struct changelog_seq_iter {
695 struct llog_ctxt *csi_ctxt;
696 struct llog_handle *csi_llh;
706 int changelog_seq_open(struct inode *inode, struct file *file,
707 struct changelog_seq_iter **csih);
708 int changelog_seq_release(struct inode *inode, struct file *file);
709 loff_t changelog_seq_lseek(struct file *file, loff_t offset, int origin);
714 /* LPROCFS is not defined */
718 static inline void lprocfs_counter_add(struct lprocfs_stats *stats,
719 int index, long amount) { return; }
720 static inline void lprocfs_counter_incr(struct lprocfs_stats *stats,
721 int index) { return; }
722 static inline void lprocfs_counter_sub(struct lprocfs_stats *stats,
723 int index, long amount) { return; }
724 static inline void lprocfs_counter_init(struct lprocfs_stats *stats,
725 int index, unsigned conf,
726 const char *name, const char *units)
729 static inline __u64 lc_read_helper(struct lprocfs_counter *lc,
730 enum lprocfs_fields_flags field)
733 static inline struct lprocfs_stats* lprocfs_alloc_stats(unsigned int num,
734 enum lprocfs_stats_flags flags)
736 static inline void lprocfs_clear_stats(struct lprocfs_stats *stats)
738 static inline void lprocfs_free_stats(struct lprocfs_stats **stats)
740 static inline int lprocfs_register_stats(cfs_proc_dir_entry_t *root,
742 struct lprocfs_stats *stats)
744 static inline void lprocfs_init_ops_stats(int num_private_stats,
745 struct lprocfs_stats *stats)
747 static inline void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
749 static inline int lprocfs_alloc_obd_stats(struct obd_device *obddev,
750 unsigned int num_private_stats)
752 static inline int lprocfs_alloc_md_stats(struct obd_device *obddev,
753 unsigned int num_private_stats)
755 static inline void lprocfs_free_obd_stats(struct obd_device *obddev)
759 static inline int lprocfs_add_clear_entry(struct obd_export *exp)
761 static inline int lprocfs_exp_setup(struct obd_export *exp,
762 lnet_nid_t *peer_nid, int *newnid)
764 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
766 static inline cfs_proc_dir_entry_t *lprocfs_add_simple(struct proc_dir_entry *root,
768 cfs_read_proc_t *read_proc,
769 cfs_write_proc_t *write_proc,
771 struct file_operations *fops)
773 static inline struct proc_dir_entry *lprocfs_add_symlink(const char *name,
774 struct proc_dir_entry *parent, const char *dest)
776 static inline void lprocfs_free_per_client_stats(struct obd_device *obd)
779 int lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
780 unsigned long count, void *data)
783 int lprocfs_nid_stats_clear_read(char *page, char **start, off_t off,
784 int count, int *eof, void *data)
787 static inline cfs_proc_dir_entry_t *
788 lprocfs_register(const char *name, cfs_proc_dir_entry_t *parent,
789 struct lprocfs_vars *list, void *data) { return NULL; }
790 static inline int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
791 struct lprocfs_vars *var,
792 void *data) { return 0; }
793 static inline void lprocfs_remove(cfs_proc_dir_entry_t **root) {};
794 static inline void lprocfs_remove_proc_entry(const char *name,
795 struct proc_dir_entry *parent) {};
796 static inline cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *head,
797 const char *name) {return 0;}
798 static inline int lprocfs_obd_setup(struct obd_device *dev,
799 struct lprocfs_vars *list) { return 0; }
800 static inline int lprocfs_obd_cleanup(struct obd_device *dev) { return 0; }
801 static inline int lprocfs_rd_u64(char *page, char **start, off_t off,
802 int count, int *eof, void *data) { return 0; }
803 static inline int lprocfs_rd_uuid(char *page, char **start, off_t off,
804 int count, int *eof, void *data) { return 0; }
805 static inline int lprocfs_rd_name(char *page, char **start, off_t off,
806 int count, int *eof, void *data) { return 0; }
807 static inline int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
808 int count, int *eof, void *data)
810 static inline int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
811 int count, int *eof, void *data)
813 static inline int lprocfs_rd_import(char *page, char **start, off_t off,
814 int count, int *eof, void *data)
816 static inline int lprocfs_rd_state(char *page, char **start, off_t off,
817 int count, int *eof, void *data)
819 static inline int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
820 int count, int *eof, void *data)
822 static inline int lprocfs_rd_num_exports(char *page, char **start, off_t off,
823 int count, int *eof, void *data)
825 static inline int lprocfs_rd_numrefs(char *page, char **start, off_t off,
826 int count, int *eof, void *data)
828 struct adaptive_timeout;
829 static inline int lprocfs_at_hist_helper(char *page, int count, int rc,
830 struct adaptive_timeout *at)
832 static inline int lprocfs_rd_timeouts(char *page, char **start, off_t off,
833 int count, int *eof, void *data)
835 static inline int lprocfs_wr_timeouts(struct file *file, const char *buffer,
836 unsigned long count, void *data)
838 static inline int lprocfs_wr_evict_client(struct file *file, const char *buffer,
839 unsigned long count, void *data)
841 static inline int lprocfs_wr_ping(struct file *file, const char *buffer,
842 unsigned long count, void *data)
848 int lprocfs_rd_blksize(char *page, char **start, off_t off,
849 int count, int *eof, void *data) { return 0; }
851 int lprocfs_rd_kbytestotal(char *page, char **start, off_t off,
852 int count, int *eof, void *data) { return 0; }
854 int lprocfs_rd_kbytesfree(char *page, char **start, off_t off,
855 int count, int *eof, void *data) { return 0; }
857 int lprocfs_rd_kbytesavail(char *page, char **start, off_t off,
858 int count, int *eof, void *data) { return 0; }
860 int lprocfs_rd_filestotal(char *page, char **start, off_t off,
861 int count, int *eof, void *data) { return 0; }
863 int lprocfs_rd_filesfree(char *page, char **start, off_t off,
864 int count, int *eof, void *data) { return 0; }
866 int lprocfs_rd_filegroups(char *page, char **start, off_t off,
867 int count, int *eof, void *data) { return 0; }
869 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value) {}
871 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value) {}
873 void lprocfs_oh_clear(struct obd_histogram *oh) {}
875 unsigned long lprocfs_oh_sum(struct obd_histogram *oh) { return 0; }
877 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
878 struct lprocfs_counter *cnt) {}
881 __u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx,
882 enum lprocfs_fields_flags field)
885 #define LPROCFS_ENTRY()
886 #define LPROCFS_EXIT()
887 #define LPROCFS_ENTRY_AND_CHECK(dp)
888 #define LPROC_SEQ_FOPS_RO(name)
889 #define LPROC_SEQ_FOPS(name)
892 #define target_print_req NULL
896 #endif /* LPROCFS_SNMP_H */