void cfs_free_proc_entry(cfs_proc_dir_entry_t *de);
void cfs_remove_proc_entry(char *name, cfs_proc_dir_entry_t *entry);
-typedef int (cfs_read_proc_t)(char *page, char **start, off_t off,
+typedef int (read_proc_t)(char *page, char **start, off_t off,
int count, int *eof, void *data);
-typedef int (cfs_write_proc_t)(struct file *file, const char *buffer,
+typedef int (write_proc_t)(struct file *file, const char *buffer,
unsigned long count, void *data);
/*
/*
* Proc file system APIs
*/
-typedef read_proc_t cfs_read_proc_t;
-typedef write_proc_t cfs_write_proc_t;
typedef struct proc_dir_entry cfs_proc_dir_entry_t;
#define cfs_create_proc_entry(n, m, p) create_proc_entry(n, m, p)
#define cfs_free_proc_entry(e) free_proc_entry(e)
#endif
#ifdef LPROCFS
-typedef struct file cfs_param_file_t;
typedef struct inode cfs_inode_t;
-typedef struct proc_inode cfs_proc_inode_t;
-typedef struct seq_file cfs_seq_file_t;
-typedef struct seq_operations cfs_seq_ops_t;
typedef struct file_operations cfs_param_file_ops_t;
typedef struct proc_dir_entry cfs_param_dentry_t;
typedef struct poll_table_struct cfs_poll_table_t;
#define CFS_PARAM_MODULE THIS_MODULE
-#define CFS_PDE(value) PDE(value)
#define cfs_file_private(file) (file->private_data)
-#define cfs_dentry_data(dentry) (dentry->data)
-#define cfs_proc_inode_pde(proc_inode) (proc_inode->pde)
-#define cfs_proc_inode(proc_inode) (proc_inode->vfs_inode)
-#define cfs_seq_read_common seq_read
-#define cfs_seq_lseek_common seq_lseek
-#define cfs_seq_private(seq) (seq->private)
-#define cfs_seq_printf(seq, format, ...) seq_printf(seq, format, \
- ## __VA_ARGS__)
-#define cfs_seq_release(inode, file) seq_release(inode, file)
-#define cfs_seq_puts(seq, s) seq_puts(seq, s)
-#define cfs_seq_putc(seq, s) seq_putc(seq, s)
-#define cfs_seq_read(file, buf, count, ppos, rc) (rc = seq_read(file, buf, \
- count, ppos))
-#define cfs_seq_open(file, ops, rc) (rc = seq_open(file, ops))
+#ifndef HAVE_ONLY_PROCFS_SEQ
/* in lprocfs_stat.c, to protect the private data for proc entries */
extern struct rw_semaphore _lprocfs_lock;
do { \
up_write(&_lprocfs_lock); \
} while(0)
+
+#define PDE_DATA(inode) PDE(inode)->data
+
+#else /* New proc api */
+
+static inline cfs_param_dentry_t* PDE(struct inode *inode)
+{
+ return NULL;
+}
+
+static inline
+int LPROCFS_ENTRY_CHECK(cfs_param_dentry_t *dp)
+{
+ return 0;
+}
+
+#define LPROCFS_WRITE_ENTRY() do {} while(0)
+#define LPROCFS_WRITE_EXIT() do {} while(0)
+
+#endif
+
#else /* !LPROCFS */
-typedef struct cfs_params_file {
- void *param_private;
- loff_t param_pos;
- unsigned int param_flags;
-} cfs_param_file_t;
+struct file {
+ void *param_private;
+ loff_t param_pos;
+ unsigned int param_flags;
+};
typedef struct cfs_param_inode {
- void *param_private;
+ void *param_private;
} cfs_inode_t;
typedef struct cfs_param_dentry {
- void *param_data;
+ void *param_data;
} cfs_param_dentry_t;
typedef struct cfs_proc_inode {
- cfs_param_dentry_t *param_pde;
- cfs_inode_t param_inode;
+ cfs_param_dentry_t *param_pde;
+ cfs_inode_t param_inode;
} cfs_proc_inode_t;
-struct cfs_seq_operations;
-typedef struct cfs_seq_file {
- char *buf;
- size_t size;
- size_t from;
- size_t count;
- loff_t index;
- loff_t version;
+struct seq_operations;
+struct seq_file {
+ char *buf;
+ size_t size;
+ size_t from;
+ size_t count;
+ loff_t index;
+ loff_t version;
struct mutex lock;
- struct cfs_seq_operations *op;
- void *private;
-} cfs_seq_file_t;
+ const struct seq_operations *op;
+ void *private;
+};
-typedef struct cfs_seq_operations {
- void *(*start) (cfs_seq_file_t *m, loff_t *pos);
- void (*stop) (cfs_seq_file_t *m, void *v);
- void *(*next) (cfs_seq_file_t *m, void *v, loff_t *pos);
- int (*show) (cfs_seq_file_t *m, void *v);
-} cfs_seq_ops_t;
+struct seq_operations {
+ void *(*start) (struct seq_file *m, loff_t *pos);
+ void (*stop) (struct seq_file *m, void *v);
+ void *(*next) (struct seq_file *m, void *v, loff_t *pos);
+ int (*show) (struct seq_file *m, void *v);
+};
typedef void *cfs_poll_table_t;
-typedef struct cfs_param_file_ops{
+typedef struct cfs_param_file_ops {
struct module *owner;
int (*open) (cfs_inode_t *, struct file *);
loff_t (*llseek)(struct file *, loff_t, int);
- int (*release) (cfs_inode_t *, cfs_param_file_t *);
+ int (*release) (cfs_inode_t *, struct file *);
unsigned int (*poll) (struct file *, cfs_poll_table_t *);
ssize_t (*write) (struct file *, const char *, size_t, loff_t *);
ssize_t (*read)(struct file *, char *, size_t, loff_t *);
} cfs_param_file_ops_t;
typedef cfs_param_file_ops_t *cfs_lproc_filep_t;
-static inline cfs_proc_inode_t *FAKE_PROC_I(const cfs_inode_t *inode)
+#define CFS_PARAM_MODULE NULL
+#define seq_lseek NULL
+
+static inline int seq_read(char *buf, size_t count, loff_t *ppos)
{
- return container_of(inode, cfs_proc_inode_t, param_inode);
+ return 0;
}
-static inline cfs_param_dentry_t *FAKE_PDE(cfs_inode_t *inode)
+static inline int
+seq_open(struct file *file, const struct seq_operations *fops)
{
- return FAKE_PROC_I(inode)->param_pde;
+ struct seq_file *p = file->param_private;
+
+ if (!p) {
+ LIBCFS_ALLOC(p, sizeof(*p));
+ if (!p)
+ return -ENOMEM;
+ file->param_private = p;
+ }
+ memset(p, 0, sizeof(*p));
+ p->op = fops;
+ return 0;
}
-#define CFS_PARAM_MODULE NULL
-#define CFS_PDE(value) FAKE_PDE(value)
-#define cfs_file_private(file) (file->param_private)
-#define cfs_dentry_data(dentry) (dentry->param_data)
-#define cfs_proc_inode(proc_inode) (proc_inode->param_inode)
-#define cfs_proc_inode_pde(proc_inode) (proc_inode->param_pde)
-#define cfs_seq_read_common NULL
-#define cfs_seq_lseek_common NULL
-#define cfs_seq_private(seq) (seq->private)
-#define cfs_seq_read(file, buf, count, ppos, rc) do {} while(0)
-#define cfs_seq_open(file, ops, rc) \
-do { \
- cfs_seq_file_t *p = cfs_file_private(file); \
- if (!p) { \
- LIBCFS_ALLOC(p, sizeof(*p)); \
- if (!p) { \
- rc = -ENOMEM; \
- break; \
- } \
- cfs_file_private(file) = p; \
- } \
- memset(p, 0, sizeof(*p)); \
- p->op = ops; \
- rc = 0; \
-} while(0)
+static inline cfs_proc_inode_t *FAKE_PROC_I(const cfs_inode_t *inode)
+{
+ return container_of(inode, cfs_proc_inode_t, param_inode);
+}
+
+static inline cfs_param_dentry_t *PDE(cfs_inode_t *inode)
+{
+ return FAKE_PROC_I(inode)->param_pde;
+}
static inline
int LPROCFS_ENTRY_CHECK(cfs_param_dentry_t *dp)
{
- return 0;
+ return 0;
}
#define LPROCFS_WRITE_ENTRY() do {} while(0)
#define LPROCFS_WRITE_EXIT() do {} while(0)
+int seq_printf(struct seq_file *, const char *, ...)
+ __attribute__ ((format (printf,2,3)));
+
#endif /* LPROCFS */
/* XXX: params_tree APIs */
/*
* Lproc
*/
-typedef int (cfs_read_proc_t)(char *page, char **start, off_t off,
- int count, int *eof, void *data);
+typedef int (read_proc_t)(char *page, char **start, off_t off,
+ int count, int *eof, void *data);
struct file; /* forward ref */
-typedef int (cfs_write_proc_t)(struct file *file, const char *buffer,
+typedef int (write_proc_t)(struct file *file, const char *buffer,
unsigned long count, void *data);
/*
* Proc emulator file system APIs
*/
-typedef int cfs_read_proc_t(char *page, char **start, off_t off,
+typedef int read_proc_t(char *page, char **start, off_t off,
int count, int *eof, void *data);
-typedef int cfs_write_proc_t(struct file *file, const char *buffer,
+typedef int write_proc_t(struct file *file, const char *buffer,
unsigned long count, void *data);
#define CFS_PROC_ENTRY_MAGIC 'CPEM'
struct cfs_proc_entry *parent;
struct _file_entry { // proc file / leaf entry
- cfs_read_proc_t * read_proc;
- cfs_write_proc_t * write_proc;
+ read_proc_t * read_proc;
+ write_proc_t * write_proc;
};
mode_t mode;
int seq_putc(struct seq_file *m, char c);
int seq_puts(struct seq_file *m, const char *s);
-int seq_printf(struct seq_file *, const char *, ...)
- __attribute__ ((format (printf,2,3)));
-
int seq_path(struct seq_file *, struct path *, char *);
int single_open(struct file *, int (*)(struct seq_file *, void *), void *);
prng.c user-bitops.c user-mem.c hash.c kernel_user_comm.c \
workitem.c fail.c libcfs_cpu.c libcfs_mem.c libcfs_lock.c \
posix/rbtree.c user-crypto.c posix/posix-crc32.c \
- posix/posix-adler.c heap.c
+ posix/posix-adler.c posix/posix-proc.c heap.c
if HAVE_PCLMULQDQ
if NEED_PCLMULQDQ_CRC32
nodist_libcfs_SOURCES = darwin/darwin-sync.c darwin/darwin-mem.c \
darwin/darwin-prim.c darwin/darwin-fs.c darwin/darwin-curproc.c \
- darwin/darwin-tcpip.c darwin/darwin-utils.c \
- darwin/darwin-debug.c darwin/darwin-proc.c \
- darwin/darwin-tracefile.c darwin/darwin-module.c \
+ darwin/darwin-tcpip.c darwin/darwin-utils.c \
+ darwin/darwin-debug.c darwin/darwin-proc.c \
+ darwin/darwin-tracefile.c darwin/darwin-module.c \
posix/posix-debug.c module.c tracefile.c nidstrings.c watchdog.c \
kernel_user_comm.c hash.c posix/rbtree.c heap.c
--- /dev/null
+/*
+ * GPL HEADER START
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; If not, see
+ * http://www.gnu.org/licenses/gpl-2.0.html
+ *
+ * GPL HEADER END
+ */
+/*
+ * Authors: James Simmons <jsimmons@infradead.org>
+ */
+#include <libcfs/params_tree.h>
+
+int seq_printf(struct seq_file *m, const char *f, ...)
+{
+ va_list args;
+ int len;
+
+ if (m->count < m->size) {
+ va_start(args, f);
+ len = vsnprintf(m->buf + m->count, m->size - m->count, f, args);
+ va_end(args);
+ if (m->count + len < m->size) {
+ m->count += len;
+ return 0;
+ }
+ }
+ m->count = m->size;
+ return -1;
+}
+EXPORT_SYMBOL(seq_printf);
])
#
+# 3.10+ only supports procfs seq_files handling
+#
+AC_DEFUN([LC_HAVE_ONLY_PROCFS_SEQ],
+[AC_MSG_CHECKING([if procfs only supports using seq_files])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/proc_fs.h>
+],[
+ struct inode *inode = NULL;
+ PDE_DATA(inode);
+],[
+ AC_DEFINE(HAVE_ONLY_PROCFS_SEQ, 1, [only seq_files supported])
+ AC_MSG_RESULT([yes])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+#
# LC_PROG_LINUX
#
# Lustre linux kernel checks
LC_HAVE_HLIST_FOR_EACH_3ARG
LC_HAVE_F_PATH_MNT
+ # 3.10
+ LC_HAVE_ONLY_PROCFS_SEQ
+
#
if test x$enable_server != xno ; then
LC_FUNC_DEV_SET_RDONLY
#include <lustre/lustre_idl.h>
#include <libcfs/params_tree.h>
+#ifndef HAVE_ONLY_PROCFS_SEQ
struct lprocfs_vars {
const char *name;
- cfs_read_proc_t *read_fptr;
- cfs_write_proc_t *write_fptr;
+ read_proc_t *read_fptr;
+ write_proc_t *write_fptr;
void *data;
const struct file_operations *fops;
/**
* /proc file mode.
- */
- mode_t proc_mode;
+ */
+ mode_t proc_mode;
};
struct lprocfs_static_vars {
- struct lprocfs_vars *module_vars;
- struct lprocfs_vars *obd_vars;
+ struct lprocfs_vars *module_vars;
+ struct lprocfs_vars *obd_vars;
+};
+
+#endif
+
+struct lprocfs_seq_vars {
+ const char *name;
+ const struct file_operations *fops;
+ void *data;
+ /**
+ * /proc file mode.
+ */
+ mode_t proc_mode;
};
/* if we find more consumers this could be generalized */
struct nid_stat;
extern int lprocfs_add_clear_entry(struct obd_device * obd,
cfs_proc_dir_entry_t *entry);
+#ifdef HAVE_SERVER_SUPPORT
extern int lprocfs_exp_setup(struct obd_export *exp,
lnet_nid_t *peer_nid, int *newnid);
+#endif
extern int lprocfs_exp_cleanup(struct obd_export *exp);
extern cfs_proc_dir_entry_t *lprocfs_add_simple(struct proc_dir_entry *root,
char *name,
- cfs_read_proc_t *read_proc,
- cfs_write_proc_t *write_proc,
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ read_proc_t *read_proc,
+ write_proc_t *write_proc,
+#endif
void *data,
struct file_operations *fops);
extern struct proc_dir_entry *
struct lprocfs_stats *stats);
/* lprocfs_status.c */
+#ifndef HAVE_ONLY_PROCFS_SEQ
extern int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
struct lprocfs_vars *var,
void *data);
extern cfs_proc_dir_entry_t *lprocfs_register(const char *name,
- cfs_proc_dir_entry_t *parent,
- struct lprocfs_vars *list,
- void *data);
+ cfs_proc_dir_entry_t *parent,
+ struct lprocfs_vars *list,
+ void *data);
+#endif
+extern int lprocfs_seq_add_vars(cfs_proc_dir_entry_t *root,
+ struct lprocfs_seq_vars *var,
+ void *data);
+extern cfs_proc_dir_entry_t *
+lprocfs_seq_register(const char *name, cfs_proc_dir_entry_t *parent,
+ struct lprocfs_seq_vars *list, void *data);
extern void lprocfs_remove(cfs_proc_dir_entry_t **root);
extern void lprocfs_remove_proc_entry(const char *name,
struct proc_dir_entry *parent);
+#ifndef HAVE_ONLY_PROCFS_SEQ
extern void lprocfs_try_remove_proc_entry(const char *name,
struct proc_dir_entry *parent);
extern cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *root,
const char *name);
-
extern int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list);
+#endif
+extern int lprocfs_seq_obd_setup(struct obd_device *dev);
extern int lprocfs_obd_cleanup(struct obd_device *obd);
+#ifdef HAVE_SERVER_SUPPORT
extern struct file_operations lprocfs_evict_client_fops;
-
+#endif
extern int lprocfs_seq_create(cfs_proc_dir_entry_t *parent, const char *name,
mode_t mode,
const struct file_operations *seq_fops,
void *data);
/* Generic callbacks */
-
+#ifndef HAVE_ONLY_PROCFS_SEQ
extern int lprocfs_rd_u64(char *page, char **start, off_t off,
int count, int *eof, void *data);
extern int lprocfs_rd_atomic(char *page, char **start, off_t off,
unsigned long count, void *data);
extern int lprocfs_rd_uint(char *page, char **start, off_t off,
int count, int *eof, void *data);
-extern int lprocfs_wr_uint(struct file *file, const char *buffer,
- unsigned long count, void *data);
extern int lprocfs_rd_uuid(char *page, char **start, off_t off,
int count, int *eof, void *data);
extern int lprocfs_rd_name(char *page, char **start, off_t off,
int count, int *eof, void *data);
extern int lprocfs_rd_numrefs(char *page, char **start, off_t off,
int count, int *eof, void *data);
+#endif
+extern int lprocfs_u64_seq_show(struct seq_file *m, void *data);
+extern int lprocfs_atomic_seq_show(struct seq_file *m, void *data);
+extern ssize_t lprocfs_atomic_seq_write(struct file *file, const char *buffer,
+ size_t count, loff_t *off);
+extern int lprocfs_uint_seq_show(struct seq_file *m, void *data);
+extern ssize_t lprocfs_uint_seq_write(struct file *file, const char *buffer,
+ size_t count, loff_t *off);
+extern int lprocfs_wr_uint(struct file *file, const char *buffer,
+ unsigned long count, void *data);
+extern int lprocfs_uuid_seq_show(struct seq_file *m, void *data);
+extern int lprocfs_name_seq_show(struct seq_file *m, void *data);
+extern int lprocfs_server_uuid_seq_show(struct seq_file *m, void *data);
+extern int lprocfs_conn_uuid_seq_show(struct seq_file *m, void *data);
+extern int lprocfs_import_seq_show(struct seq_file *m, void *data);
+extern int lprocfs_state_seq_show(struct seq_file *m, void *data);
+extern int lprocfs_connect_flags_seq_show(struct seq_file *m, void *data);
struct adaptive_timeout;
+#ifndef HAVE_ONLY_PROCFS_SEQ
extern int lprocfs_at_hist_helper(char *page, int count, int rc,
struct adaptive_timeout *at);
extern int lprocfs_rd_timeouts(char *page, char **start, off_t off,
int count, int *eof, void *data);
extern int lprocfs_wr_timeouts(struct file *file, const char *buffer,
unsigned long count, void *data);
+#endif
+extern int lprocfs_seq_at_hist_helper(struct seq_file *m,
+ struct adaptive_timeout *at);
+extern int lprocfs_timeouts_seq_show(struct seq_file *m, void *data);
+extern ssize_t
+lprocfs_timeouts_seq_write(struct file *file, const char *buffer,
+ size_t count, loff_t *off);
extern int lprocfs_wr_evict_client(struct file *file, const char *buffer,
unsigned long count, void *data);
+#ifndef HAVE_ONLY_PROCFS_SEQ
extern int lprocfs_wr_ping(struct file *file, const char *buffer,
unsigned long count, void *data);
extern int lprocfs_wr_import(struct file *file, const char *buffer,
int count, int *eof, void *data);
extern int lprocfs_wr_pinger_recov(struct file *file, const char *buffer,
unsigned long count, void *data);
+#endif
+extern ssize_t
+lprocfs_ping_seq_write(struct file *file, const char *buffer,
+ size_t count, loff_t *off);
+extern ssize_t
+lprocfs_import_seq_write(struct file *file, const char *buffer,
+ size_t count, loff_t *off);
+extern int lprocfs_pinger_recov_seq_show(struct seq_file *m, void *data);
+extern ssize_t
+lprocfs_pinger_recov_seq_write(struct file *file, const char *buffer,
+ size_t count, loff_t *off);
/* Statfs helpers */
+#ifndef HAVE_ONLY_PROCFS_SEQ
extern int lprocfs_rd_blksize(char *page, char **start, off_t off,
int count, int *eof, void *data);
extern int lprocfs_rd_kbytestotal(char *page, char **start, off_t off,
int count, int *eof, void *data);
extern int lprocfs_rd_filegroups(char *page, char **start, off_t off,
int count, int *eof, void *data);
+#endif
+extern int lprocfs_blksize_seq_show(struct seq_file *m, void *data);
+extern int lprocfs_kbytestotal_seq_show(struct seq_file *m, void *data);
+extern int lprocfs_kbytesfree_seq_show(struct seq_file *m, void *data);
+extern int lprocfs_kbytesavail_seq_show(struct seq_file *m, void *data);
+extern int lprocfs_filestotal_seq_show(struct seq_file *m, void *data);
+extern int lprocfs_filesfree_seq_show(struct seq_file *m, void *data);
extern int lprocfs_write_helper(const char *buffer, unsigned long count,
int *val);
extern int lprocfs_write_frac_helper(const char *buffer, unsigned long count,
int *val, int mult);
+extern int lprocfs_seq_read_frac_helper(struct seq_file *m, long val, int mult);
extern int lprocfs_read_frac_helper(char *buffer, unsigned long count,
long val, int mult);
extern int lprocfs_write_u64_helper(const char *buffer, unsigned long count,
unsigned long count,
__u64 *val, int mult);
char *lprocfs_find_named_value(const char *buffer, const char *name,
- unsigned long *count);
+ size_t *count);
void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value);
void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value);
void lprocfs_oh_clear(struct obd_histogram *oh);
void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
struct lprocfs_counter *cnt);
+#ifdef HAVE_SERVER_SUPPORT
/* lprocfs_status.c: recovery status */
int lprocfs_obd_rd_recovery_status(char *page, char **start, off_t off,
int count, int *eof, void *data);
-
+#endif
/* lprocfs_statuc.c: hash statistics */
int lprocfs_obd_rd_hash(char *page, char **start, off_t off,
int count, int *eof, void *data);
#define LPROCFS_CLIMP_EXIT(obd) \
up_read(&(obd)->u.cli.cl_sem);
-
/* write the name##_seq_show function, call LPROC_SEQ_FOPS_RO for read-only
proc entries; otherwise, you will define name##_seq_write function also for
a read-write proc entry, and then call LPROC_SEQ_SEQ instead. Finally,
call lprocfs_obd_seq_create(obd, filename, 0444, &name#_fops, data); */
-#define __LPROC_SEQ_FOPS(name, custom_seq_write) \
-static int name##_single_open(cfs_inode_t *inode, struct file *file) { \
- struct proc_dir_entry *dp = PDE(inode); \
- LPROCFS_ENTRY_CHECK(dp); \
- return single_open(file, name##_seq_show, dp->data); \
-} \
-struct file_operations name##_fops = { \
- .owner = THIS_MODULE, \
- .open = name##_single_open, \
- .read = seq_read, \
- .write = custom_seq_write, \
- .llseek = seq_lseek, \
- .release = lprocfs_single_release, \
+#define __LPROC_SEQ_FOPS(name, custom_seq_write) \
+static int name##_single_open(cfs_inode_t *inode, struct file *file) \
+{ \
+ LPROCFS_ENTRY_CHECK(PDE(inode)); \
+ return single_open(file, name##_seq_show, PDE_DATA(inode)); \
+} \
+struct file_operations name##_fops = { \
+ .owner = THIS_MODULE, \
+ .open = name##_single_open, \
+ .read = seq_read, \
+ .write = custom_seq_write, \
+ .llseek = seq_lseek, \
+ .release = lprocfs_single_release, \
}
-#define LPROC_SEQ_FOPS_RO(name) __LPROC_SEQ_FOPS(name, NULL)
-#define LPROC_SEQ_FOPS(name) __LPROC_SEQ_FOPS(name, name##_seq_write)
+#define LPROC_SEQ_FOPS_RO(name) __LPROC_SEQ_FOPS(name, NULL)
+#define LPROC_SEQ_FOPS(name) __LPROC_SEQ_FOPS(name, name##_seq_write)
+
+#define LPROC_SEQ_FOPS_RO_TYPE(name, type) \
+ static int name##_##type##_seq_show(struct seq_file *m, void *v)\
+ { \
+ return lprocfs_##type##_seq_show(m, m->private); \
+ } \
+ LPROC_SEQ_FOPS_RO(name##_##type)
+
+#define LPROC_SEQ_FOPS_RW_TYPE(name, type) \
+ static int name##_##type##_seq_show(struct seq_file *m, void *v)\
+ { \
+ return lprocfs_##type##_seq_show(m, m->private); \
+ } \
+ static ssize_t name##_##type##_seq_write(struct file *file, \
+ const char *buffer, size_t count, loff_t *off) \
+ { \
+ struct seq_file *seq = file->private_data; \
+ return lprocfs_##type##_seq_write(file, buffer, \
+ count, seq->private); \
+ } \
+ LPROC_SEQ_FOPS(name##_##type);
+
+#define LPROC_SEQ_FOPS_WO_TYPE(name, type) \
+ static ssize_t name##_##type##_write(struct file *file, \
+ const char *buffer, size_t count, loff_t *off) \
+ { \
+ return lprocfs_##type##_seq_write(file, buffer, count, off); \
+ } \
+ static int name##_##type##_open(cfs_inode_t *inode, struct file *file) \
+ { \
+ return single_open(file, NULL, PDE_DATA(inode)); \
+ } \
+ struct file_operations name##_##type##_fops = { \
+ .open = name##_##type##_open, \
+ .write = name##_##type##_write, \
+ .release = lprocfs_single_release, \
+ };
/* lprocfs_jobstats.c */
int lprocfs_job_stats_log(struct obd_device *obd, char *jobid,
int lprocfs_obd_wr_recovery_time_hard(struct file *file,
const char *buffer,
unsigned long count, void *data);
+#ifndef HAVE_ONLY_PROCFS_SEQ
int lprocfs_obd_rd_max_pages_per_rpc(char *page, char **start, off_t off,
int count, int *eof, void *data);
int lprocfs_obd_wr_max_pages_per_rpc(struct file *file, const char *buffer,
unsigned long count, void *data);
+#endif
+int lprocfs_obd_max_pages_per_rpc_seq_show(struct seq_file *m, void *data);
+ssize_t
+lprocfs_obd_max_pages_per_rpc_seq_write(struct file *file, const char *buffer,
+ size_t count, loff_t *off);
int lprocfs_target_rd_instance(char *page, char **start, off_t off,
int count, int *eof, void *data);
struct obd_export;
static inline int lprocfs_add_clear_entry(struct obd_export *exp)
{ return 0; }
+#ifdef HAVE_SERVER_SUPPORT
static inline int lprocfs_exp_setup(struct obd_export *exp,lnet_nid_t *peer_nid,
int *newnid)
{ return 0; }
+#endif
static inline int lprocfs_exp_cleanup(struct obd_export *exp)
{ return 0; }
static inline cfs_proc_dir_entry_t *
lprocfs_add_simple(struct proc_dir_entry *root, char *name,
- cfs_read_proc_t *read_proc, cfs_write_proc_t *write_proc,
- void *data, struct file_operations *fops)
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ read_proc_t *read_proc, write_proc_t *write_proc,
+#endif
+ void *data, struct file_operations *fops)
{return 0; }
static inline struct proc_dir_entry *
lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
int count, int *eof, void *data)
{return count;}
+#ifndef HAVE_ONLY_PROCFS_SEQ
static inline cfs_proc_dir_entry_t *
lprocfs_register(const char *name, cfs_proc_dir_entry_t *parent,
- struct lprocfs_vars *list, void *data)
+ struct lprocfs_vars *list, void *data)
{ return NULL; }
static inline int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
struct lprocfs_vars *var,
void *data)
{ return 0; }
+#endif
+static inline int lprocfs_seq_add_vars(cfs_proc_dir_entry_t *root,
+ struct lprocfs_seq_vars *var,
+ void *data)
+{ return 0; }
+#ifndef HAVE_ONLY_PROCFS_SEQ
+static inline cfs_proc_dir_entry_t *
+lprocfs_seq_register(const char *name, cfs_proc_dir_entry_t *parent,
+ struct lprocfs_vars *list, void *data)
+{ return NULL; }
+#endif
static inline void lprocfs_remove(cfs_proc_dir_entry_t **root)
{ return; }
static inline void lprocfs_remove_proc_entry(const char *name,
struct proc_dir_entry *parent)
{ return; }
+#ifndef HAVE_ONLY_PROCFS_SEQ
static inline void lprocfs_try_remove_proc_entry(const char *name,
struct proc_dir_entry *parent)
{ return; }
const char *name)
{ return 0; }
static inline int lprocfs_obd_setup(struct obd_device *dev,
- struct lprocfs_vars *list)
+ struct lprocfs_vars *list)
+{ return 0; }
+#endif
+static inline int lprocfs_seq_obd_setup(struct obd_device *dev)
{ return 0; }
static inline int lprocfs_obd_cleanup(struct obd_device *dev)
{ return 0; }
static inline int lprocfs_rd_u64(char *page, char **start, off_t off,
int count, int *eof, void *data)
{ return 0; }
+#ifndef HAVE_ONLY_PROCFS_SEQ
static inline int lprocfs_rd_uuid(char *page, char **start, off_t off,
int count, int *eof, void *data)
{ return 0; }
static inline int lprocfs_rd_num_exports(char *page, char **start, off_t off,
int count, int *eof, void *data)
{ return 0; }
-static inline int lprocfs_rd_numrefs(char *page, char **start, off_t off,
- int count, int *eof, void *data)
+static inline int lprocfs_rd_numrefs(struct seq_file *m, void *data)
{ return 0; }
struct adaptive_timeout;
static inline int lprocfs_at_hist_helper(char *page, int count, int rc,
static inline int lprocfs_wr_pinger_recov(struct file *file, const char *buffer,
unsigned long count, void *data)
{ return 0; }
+#endif
+static inline int lprocfs_uuid_seq_show(struct seq_file *m, void *data)
+{ return 0; }
+static inline int lprocfs_name_seq_show(struct seq_file *m, void *data)
+{ return 0; }
+static inline int lprocfs_server_seq_show(struct seq_file *m, void *data)
+{ return 0; }
+static inline int lprocfs_conn_uuid_seq_show(struct seq_file *m, void *data)
+{ return 0; }
+static inline int lprocfs_import_seq_show(struct seq_file *m, void *data)
+{ return 0; }
+static inline int lprocfs_state_seq_show(struct seq_file *m, void *data)
+{ return 0; }
+static inline int lprocfs_connect_flags_seq_show(struct seq_file *m, void *data)
+{ return 0; }
+static inline int lprocfs_num_exports_seq_show(struct seq_file *m, void *data)
+{ return 0; }
+struct adaptive_timeout;
+static inline int lprocfs_seq_at_hist_helper(struct seq_file *m,
+ struct adaptive_timeout *at)
+{ return 0; }
+static inline int lprocfs_timeouts_seq_show(struct seq_file *m, void *data)
+{ return 0; }
+static inline ssize_t
+lprocfs_timeouts_seq_write(struct file *file, const char *buffer,
+ size_t count, loff_t *off)
+{ return 0; }
+static inline ssize_t
+lprocfs_evict_client_seq_write(struct file *file, const char *buffer,
+ size_t count, loff_t *off)
+{ return 0; }
+static inline ssize_t
+lprocfs_ping_seq_write(struct file *file, const char *buffer,
+ size_t count, loff_t *off)
+{ return 0; }
+static inline ssize_t
+lprocfs_import_seq_write(struct file *file, const char *buffer,
+ size_t count, loff_t *off)
+{ return 0; }
+static inline int
+lprocfs_pinger_recov_seq_show(struct seq_file *m, void *data)
+{ return 0; }
+static inline ssize_t
+lprocfs_pinger_recov_seq_write(struct file *file, const char *buffer,
+ size_t count, loff_t *off)
+{ return 0; }
/* Statfs helpers */
+#ifndef HAVE_ONLY_PROCFS_SEQ
static inline
int lprocfs_rd_blksize(char *page, char **start, off_t off,
int count, int *eof, void *data)
int lprocfs_rd_filesfree(char *page, char **start, off_t off,
int count, int *eof, void *data)
{ return 0; }
+#endif
static inline
-int lprocfs_rd_filegroups(char *page, char **start, off_t off,
- int count, int *eof, void *data)
+int lprocfs_blksize_seq_show(struct seq_file *m, void *data)
+{ return 0; }
+static inline
+int lprocfs_kbytestotal_seq_show(struct seq_file *m, void *data)
+{ return 0; }
+static inline
+int lprocfs_kbytesfree_seq_show(struct seq_file *m, void *data)
+{ return 0; }
+static inline
+int lprocfs_kbytesavail_seq_show(struct seq_file *m, void *data)
+{ return 0; }
+static inline
+int lprocfs_filestotal_seq_show(struct seq_file *m, void *data)
+{ return 0; }
+static inline
+int lprocfs_filesfree_seq_show(struct seq_file *m, void *data)
{ return 0; }
static inline
void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value)
#define LPROC_SEQ_FOPS_RO(name)
#define LPROC_SEQ_FOPS(name)
+#define LPROC_SEQ_FOPS_RO_TYPE(name, type)
+#define LPROC_SEQ_FOPS_RW_TYPE(name, type)
+#define LPROC_SEQ_FOPS_WO_TYPE(name, type)
/* lprocfs_jobstats.c */
static inline
unsigned int obd_md_cntr_base;
struct lprocfs_stats *obd_md_stats;
- cfs_proc_dir_entry_t *obd_proc_entry;
- cfs_proc_dir_entry_t *obd_proc_exports_entry;
- cfs_proc_dir_entry_t *obd_svc_procroot;
- struct lprocfs_stats *obd_svc_stats;
+ struct proc_dir_entry *obd_proc_entry;
+ struct proc_dir_entry *obd_proc_exports_entry;
+ void *obd_proc_private; /* type private PDEs */
+ struct proc_dir_entry *obd_svc_procroot;
+ struct lprocfs_stats *obd_svc_stats;
+ struct lprocfs_seq_vars *obd_vars;
cfs_atomic_t obd_evict_inprogress;
wait_queue_head_t obd_evict_inprogress_waitq;
cfs_list_t obd_evict_list; /* protected with pet_lock */
/* genops.c */
struct obd_export *class_conn2export(struct lustre_handle *);
int class_register_type(struct obd_ops *, struct md_ops *,
- struct lprocfs_vars *, const char *nm,
- struct lu_device_type *ldt);
+ struct lprocfs_seq_vars *module_vars,
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ struct lprocfs_vars *,
+#endif
+ const char *nm,
+ struct lu_device_type *ldt);
int class_unregister_type(const char *nm);
struct obd_device *class_newdev(const char *type_name, const char *name);
struct lustre_cfg *lustre_cfg_rename(struct lustre_cfg *cfg,
const char *new_name);
int class_process_config(struct lustre_cfg *lcfg);
+#ifndef HAVE_ONLY_PROCFS_SEQ
int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars,
struct lustre_cfg *lcfg, void *data);
+#endif
+int class_process_proc_seq_param(char *prefix, struct lprocfs_seq_vars *lvars,
+ struct lustre_cfg *lcfg, void *data);
int class_attach(struct lustre_cfg *lcfg);
int class_setup(struct obd_device *obd, struct lustre_cfg *lcfg);
int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg);
int class_add_uuid(const char *uuid, __u64 nid);
/*obdecho*/
+#ifndef HAVE_ONLY_PROCFS_SEQ
#ifdef LPROCFS
extern void lprocfs_echo_init_vars(struct lprocfs_static_vars *lvars);
#else
memset(lvars, 0, sizeof(*lvars));
}
#endif
+#endif
#define CFG_F_START 0x01 /* Set when we start updating from a log */
#define CFG_F_MARKER 0x02 /* We are within a maker */
}
static int ll_wr_max_cached_mb(struct file *file, const char *buffer,
- unsigned long count, void *data)
+ unsigned long nob, void *data)
{
struct super_block *sb = data;
struct ll_sb_info *sbi = ll_s2sbi(sb);
struct lu_env *env;
int refcheck;
int mult, rc, pages_number;
+ size_t count = nob;
int diff = 0;
int nrpages = 0;
ENTRY;
int __init lmv_init(void)
{
struct lprocfs_static_vars lvars;
- int rc;
lprocfs_lmv_init_vars(&lvars);
- rc = class_register_type(&lmv_obd_ops, &lmv_md_ops,
- lvars.module_vars, LUSTRE_LMV_NAME, NULL);
- return rc;
+ return class_register_type(&lmv_obd_ops, &lmv_md_ops, NULL,
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ lvars.module_vars,
+#endif
+ LUSTRE_LMV_NAME, NULL);
}
#ifdef __KERNEL__
lprocfs_lod_init_vars(&lvars);
- rc = class_register_type(&lod_obd_device_ops, NULL, lvars.module_vars,
- LUSTRE_LOD_NAME, &lod_device_type);
+ rc = class_register_type(&lod_obd_device_ops, NULL, NULL,
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ lvars.module_vars,
+#endif
+ LUSTRE_LOD_NAME, &lod_device_type);
if (rc) {
lu_kmem_fini(lod_caches);
return rc;
}
lprocfs_lov_init_vars(&lvars);
- rc = class_register_type(&lov_obd_ops, NULL, lvars.module_vars,
- LUSTRE_LOV_NAME, &lov_device_type);
+ rc = class_register_type(&lov_obd_ops, NULL, NULL,
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ lvars.module_vars,
+#endif
+ LUSTRE_LOV_NAME, &lov_device_type);
if (rc) {
kmem_cache_destroy(lov_oinfo_slab);
int __init mdc_init(void)
{
- int rc;
struct lprocfs_static_vars lvars = { 0 };
lprocfs_mdc_init_vars(&lvars);
- rc = class_register_type(&mdc_obd_ops, &mdc_md_ops, lvars.module_vars,
- LUSTRE_MDC_NAME, NULL);
- RETURN(rc);
+ return class_register_type(&mdc_obd_ops, &mdc_md_ops, NULL,
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ lvars.module_vars,
+#endif
+ LUSTRE_MDC_NAME, NULL);
}
#ifdef __KERNEL__
hsm_actions_logops.lop_add = llog_cat_add_rec;
hsm_actions_logops.lop_declare_add = llog_cat_declare_add_rec;
- rc = class_register_type(&mdd_obd_device_ops, NULL, lvars.module_vars,
- LUSTRE_MDD_NAME, &mdd_device_type);
+ rc = class_register_type(&mdd_obd_device_ops, NULL, NULL,
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ lvars.module_vars,
+#endif
+ LUSTRE_MDD_NAME, &mdd_device_type);
if (rc)
lu_kmem_fini(mdd_caches);
return rc;
GOTO(lu_fini, rc);
lprocfs_mdt_init_vars(&lvars);
- rc = class_register_type(&mdt_obd_device_ops, NULL,
- lvars.module_vars, LUSTRE_MDT_NAME,
- &mdt_device_type);
+ rc = class_register_type(&mdt_obd_device_ops, NULL, NULL,
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ lvars.module_vars,
+#endif
+ LUSTRE_MDT_NAME, &mdt_device_type);
if (rc)
GOTO(mds_fini, rc);
lu_fini:
int mds_mod_init(void)
{
- int rc;
-
if (mdt_num_threads != 0 && mds_num_threads == 0) {
LCONSOLE_INFO("mdt_num_threads module parameter is deprecated, "
"use mds_num_threads instead or unset both for "
mds_num_threads = mdt_num_threads;
}
- rc = class_register_type(&mds_obd_device_ops, NULL,
- lprocfs_mds_module_vars, LUSTRE_MDS_NAME,
- &mds_device_type);
- return rc;
+ return class_register_type(&mds_obd_device_ops, NULL, NULL,
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ lprocfs_mds_module_vars,
+#endif
+ LUSTRE_MDS_NAME, &mds_device_type);
}
void mds_mod_exit(void)
int __init mgc_init(void)
{
- return class_register_type(&mgc_obd_ops, NULL,
- NULL, LUSTRE_MGC_NAME, NULL);
+ return class_register_type(&mgc_obd_ops, NULL, NULL,
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ NULL,
+#endif
+ LUSTRE_MGC_NAME, NULL);
}
int __init mgc_init(void)
{
return class_register_type(&mgc_obd_ops, NULL, NULL,
- LUSTRE_MGC_NAME, NULL);
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ NULL,
+#endif
+ LUSTRE_MGC_NAME, NULL);
}
#ifdef __KERNEL__
struct lprocfs_static_vars lvars;
lprocfs_mgs_init_vars(&lvars);
- class_register_type(&mgs_obd_device_ops, NULL, lvars.module_vars,
- LUSTRE_MGS_NAME, &mgs_device_type);
-
- return 0;
+ return class_register_type(&mgs_obd_device_ops, NULL, NULL,
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ lvars.module_vars,
+#endif
+ LUSTRE_MGS_NAME, &mgs_device_type);
}
static void /*__exit*/ mgs_exit(void)
#define CLASS_MAX_NAME 1024
int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops,
- struct lprocfs_vars *vars, const char *name,
- struct lu_device_type *ldt)
+ struct lprocfs_seq_vars *module_vars,
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ struct lprocfs_vars *vars,
+#endif
+ const char *name, struct lu_device_type *ldt)
{
struct obd_type *type;
int rc = 0;
spin_lock_init(&type->obd_type_lock);
#ifdef LPROCFS
- type->typ_procroot = lprocfs_register(type->typ_name, proc_lustre_root,
- vars, type);
- if (IS_ERR(type->typ_procroot)) {
- rc = PTR_ERR(type->typ_procroot);
- type->typ_procroot = NULL;
- GOTO (failed, rc);
- }
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ if (vars) {
+ type->typ_procroot = lprocfs_register(type->typ_name,
+ proc_lustre_root,
+ vars, type);
+ } else
+#endif
+ {
+ type->typ_procroot = lprocfs_seq_register(type->typ_name,
+ proc_lustre_root,
+ module_vars, type);
+ }
+ if (IS_ERR(type->typ_procroot)) {
+ rc = PTR_ERR(type->typ_procroot);
+ type->typ_procroot = NULL;
+ GOTO (failed, rc);
+ }
#endif
if (ldt != NULL) {
type->typ_lu = ldt;
OBD_FREE_PTR(type->typ_md_ops);
if (type->typ_dt_ops != NULL)
OBD_FREE_PTR(type->typ_dt_ops);
+#ifdef LPROCFS
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ lprocfs_try_remove_proc_entry(type->typ_name, proc_lustre_root);
+#else
+ remove_proc_subtree(type->typ_name, proc_lustre_root);
+#endif
+#endif
OBD_FREE(type, sizeof(*type));
RETURN(rc);
}
* other modules can share names (i.e. lod can use lov entry). so
* we can't reference pointer as it can get invalided when another
* module removes the entry */
+#ifdef LPROCFS
+#ifndef HAVE_ONLY_PROCFS_SEQ
lprocfs_try_remove_proc_entry(type->typ_name, proc_lustre_root);
-
+#else
+ remove_proc_subtree(type->typ_name, proc_lustre_root);
+#endif
+#endif
if (type->typ_lu)
lu_device_type_fini(type->typ_lu);
struct lprocfs_static_vars lvars;
lprocfs_llog_test_init_vars(&lvars);
- return class_register_type(&llog_obd_ops, NULL,
- lvars.module_vars, "llog_test", NULL);
+ return class_register_type(&llog_obd_ops, NULL, NULL,
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ lvars.module_vars,
+#endif
+ "llog_test", NULL);
}
static void __exit llog_test_exit(void)
#define DEBUG_SUBSYSTEM S_CLASS
#ifndef __KERNEL__
-# include <liblustre.h>
+#include <liblustre.h>
#endif
#include <obd_class.h>
#define MAX_STRING_SIZE 128
-/* for bug 10866, global variable */
-DECLARE_RWSEM(_lprocfs_lock);
-EXPORT_SYMBOL(_lprocfs_lock);
-
int lprocfs_single_release(struct inode *inode, struct file *file)
{
return single_release(inode, file);
}
EXPORT_SYMBOL(lprocfs_seq_release);
+#ifndef HAVE_ONLY_PROCFS_SEQ
+/* for b=10866, global variable */
+DECLARE_RWSEM(_lprocfs_lock);
+EXPORT_SYMBOL(_lprocfs_lock);
+
static struct proc_dir_entry *__lprocfs_srch(struct proc_dir_entry *head,
const char *name)
{
the page pointer for the next write into the buffer, incrementing the total
length written to the buffer, and decrementing the size left in the
buffer. */
+#ifdef HAVE_SERVER_SUPPORT
static int lprocfs_obd_snprintf(char **page, int end, int *len,
const char *format, ...)
{
*page += n; *len += n;
return n;
}
+#endif /* HAVE_SERVER_SUPPORT */
+#endif /* HAVE_ONLY_PROCFS_SEQ */
cfs_proc_dir_entry_t *lprocfs_add_simple(struct proc_dir_entry *root,
char *name,
- read_proc_t *read_proc,
- write_proc_t *write_proc,
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ read_proc_t *read_proc,
+ write_proc_t *write_proc,
+#endif
void *data,
struct file_operations *fops)
{
if (root == NULL || name == NULL)
return ERR_PTR(-EINVAL);
- if (read_proc)
- mode = 0444;
- if (write_proc)
- mode |= 0200;
- if (fops)
- mode = 0644;
- LPROCFS_WRITE_ENTRY();
- proc = create_proc_entry(name, mode, root);
- if (!proc) {
- CERROR("LprocFS: No memory to create /proc entry %s", name);
- LPROCFS_WRITE_EXIT();
- return ERR_PTR(-ENOMEM);
- }
- proc->read_proc = read_proc;
- proc->write_proc = write_proc;
- proc->data = data;
- if (fops)
- proc->proc_fops = fops;
- LPROCFS_WRITE_EXIT();
+
+ if (!fops) {
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ if (read_proc)
+ mode = 0444;
+ if (write_proc)
+ mode |= 0200;
+
+ LPROCFS_WRITE_ENTRY();
+ proc = create_proc_entry(name, mode, root);
+ if (!proc) {
+ CERROR("LprocFS: No memory to create /proc entry %s", name);
+ LPROCFS_WRITE_EXIT();
+ return ERR_PTR(-ENOMEM);
+ }
+ proc->read_proc = read_proc;
+ proc->write_proc = write_proc;
+ proc->data = data;
+ LPROCFS_WRITE_EXIT();
+#else
+ return ERR_PTR(-EINVAL);
+#endif
+ } else {
+ if (fops->read)
+ mode = 0444;
+ if (fops->write)
+ mode |= 0200;
+ proc = proc_create_data(name, mode, root, fops, data);
+ if (!proc) {
+ CERROR("LprocFS: No memory to create /proc entry %s",
+ name);
+ return ERR_PTR(-ENOMEM);
+ }
+ }
return proc;
}
EXPORT_SYMBOL(lprocfs_add_simple);
}
EXPORT_SYMBOL(lprocfs_add_symlink);
+#ifndef HAVE_ONLY_PROCFS_SEQ
static ssize_t lprocfs_fops_read(struct file *f, char __user *buf,
size_t size, loff_t *ppos)
{
.read = lprocfs_fops_read,
.write = lprocfs_fops_write,
};
+#else
+static struct file_operations lprocfs_generic_fops = { };
+#endif
+#ifdef HAVE_SERVER_SUPPORT
int lprocfs_evict_client_open(struct inode *inode, struct file *f)
{
struct proc_dir_entry *dp = PDE(f->f_dentry->d_inode);
.release = lprocfs_evict_client_release,
};
EXPORT_SYMBOL(lprocfs_evict_client_fops);
+#endif
+#ifndef HAVE_ONLY_PROCFS_SEQ
static int __lprocfs_add_vars(struct proc_dir_entry *root,
struct lprocfs_vars *list,
void *data)
return rc;
}
+int lprocfs_add_vars(struct proc_dir_entry *root, struct lprocfs_vars *list,
+ void *data)
+{
+ int rc = 0;
+
+ LPROCFS_WRITE_ENTRY();
+ rc = __lprocfs_add_vars(root, list, data);
+ LPROCFS_WRITE_EXIT();
+
+ return rc;
+}
+EXPORT_SYMBOL(lprocfs_add_vars);
+
+#endif
+
/**
* Add /proc entries.
*
* \retval 0 on success
* < 0 on error
*/
-int lprocfs_add_vars(struct proc_dir_entry *root, struct lprocfs_vars *list,
+int
+lprocfs_seq_add_vars(struct proc_dir_entry *root, struct lprocfs_seq_vars *list,
void *data)
{
- int rc;
+ if (root == NULL || list == NULL)
+ return -EINVAL;
- LPROCFS_WRITE_ENTRY();
- rc = __lprocfs_add_vars(root, list, data);
- LPROCFS_WRITE_EXIT();
+ while (list->name != NULL) {
+ struct proc_dir_entry *proc;
+ mode_t mode = 0;
- return rc;
+ if (list->proc_mode != 0000) {
+ mode = list->proc_mode;
+ } else if (list->fops) {
+ if (list->fops->read)
+ mode = 0444;
+ if (list->fops->write)
+ mode |= 0200;
+ }
+ proc = proc_create_data(list->name, mode, root,
+ list->fops ?: &lprocfs_generic_fops,
+ list->data ?: data);
+ if (proc == NULL)
+ return -ENOMEM;
+ list++;
+ }
+ return 0;
}
-EXPORT_SYMBOL(lprocfs_add_vars);
+EXPORT_SYMBOL(lprocfs_seq_add_vars);
+#ifndef HAVE_ONLY_PROCFS_SEQ
void lprocfs_remove_nolock(struct proc_dir_entry **proot)
{
struct proc_dir_entry *root = *proot;
break;
}
}
+#endif
void lprocfs_remove(struct proc_dir_entry **rooth)
{
+#ifndef HAVE_ONLY_PROCFS_SEQ
LPROCFS_WRITE_ENTRY(); /* search vs remove race */
lprocfs_remove_nolock(rooth);
LPROCFS_WRITE_EXIT();
+#else
+ proc_remove(*rooth);
+ *rooth = NULL;
+#endif
}
EXPORT_SYMBOL(lprocfs_remove);
}
EXPORT_SYMBOL(lprocfs_remove_proc_entry);
+#ifndef HAVE_ONLY_PROCFS_SEQ
void lprocfs_try_remove_proc_entry(const char *name,
struct proc_dir_entry *parent)
{
}
out:
LPROCFS_WRITE_EXIT();
-
return entry;
}
EXPORT_SYMBOL(lprocfs_register);
+#endif
+
+struct proc_dir_entry *
+lprocfs_seq_register(const char *name, struct proc_dir_entry *parent,
+ struct lprocfs_seq_vars *list, void *data)
+{
+ struct proc_dir_entry *newchild;
+
+ newchild = proc_mkdir(name, parent);
+ if (newchild != NULL && list != NULL) {
+ int rc = lprocfs_seq_add_vars(newchild, list, data);
+ if (rc) {
+ lprocfs_remove(&newchild);
+ return ERR_PTR(rc);
+ }
+ }
+ return newchild;
+}
+EXPORT_SYMBOL(lprocfs_seq_register);
/* Generic callbacks */
-int lprocfs_rd_uint(char *page, char **start, off_t off,
- int count, int *eof, void *data)
+int lprocfs_uint_seq_show(struct seq_file *m, void *data)
{
- unsigned int *temp = data;
- return snprintf(page, count, "%u\n", *temp);
+ return seq_printf(m, "%u\n", *(unsigned int *)data);
}
-EXPORT_SYMBOL(lprocfs_rd_uint);
+EXPORT_SYMBOL(lprocfs_uint_seq_show);
int lprocfs_wr_uint(struct file *file, const char *buffer,
unsigned long count, void *data)
}
EXPORT_SYMBOL(lprocfs_wr_uint);
+ssize_t lprocfs_uint_seq_write(struct file *file, const char *buffer,
+ size_t count, loff_t *off)
+{
+ int *data = ((struct seq_file *)file->private_data)->private;
+ int val = 0, rc;
+
+ rc = lprocfs_write_helper(buffer, count, &val);
+ if (rc < 0)
+ return rc;
+
+ return lprocfs_wr_uint(file, buffer, count, data);
+}
+EXPORT_SYMBOL(lprocfs_uint_seq_write);
+
+int lprocfs_u64_seq_show(struct seq_file *m, void *data)
+{
+ LASSERT(data != NULL);
+ return seq_printf(m, LPU64"\n", *(__u64 *)data);
+}
+EXPORT_SYMBOL(lprocfs_u64_seq_show);
+
+int lprocfs_atomic_seq_show(struct seq_file *m, void *data)
+{
+ cfs_atomic_t *atom = data;
+ LASSERT(atom != NULL);
+ return seq_printf(m, "%d\n", atomic_read(atom));
+}
+EXPORT_SYMBOL(lprocfs_atomic_seq_show);
+
+ssize_t
+lprocfs_atomic_seq_write(struct file *file, const char *buffer,
+ size_t count, loff_t *off)
+{
+ cfs_atomic_t *atm = ((struct seq_file *)file->private_data)->private;
+ int val = 0;
+ int rc;
+
+ rc = lprocfs_write_helper(buffer, count, &val);
+ if (rc < 0)
+ return rc;
+
+ if (val <= 0)
+ return -ERANGE;
+
+ cfs_atomic_set(atm, val);
+ return count;
+}
+EXPORT_SYMBOL(lprocfs_atomic_seq_write);
+
+int lprocfs_uuid_seq_show(struct seq_file *m, void *data)
+{
+ struct obd_device *obd = data;
+
+ LASSERT(obd != NULL);
+ return seq_printf(m, "%s\n", obd->obd_uuid.uuid);
+}
+EXPORT_SYMBOL(lprocfs_uuid_seq_show);
+
+int lprocfs_name_seq_show(struct seq_file *m, void *data)
+{
+ struct obd_device *dev = data;
+
+ LASSERT(dev != NULL);
+ return seq_printf(m, "%s\n", dev->obd_name);
+}
+EXPORT_SYMBOL(lprocfs_name_seq_show);
+
+int lprocfs_blksize_seq_show(struct seq_file *m, void *data)
+{
+ struct obd_device *obd = data;
+ struct obd_statfs osfs;
+ int rc = obd_statfs(NULL, obd->obd_self_export, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
+ OBD_STATFS_NODELAY);
+ if (!rc)
+ rc = seq_printf(m, "%u\n", osfs.os_bsize);
+ return rc;
+}
+EXPORT_SYMBOL(lprocfs_blksize_seq_show);
+
+int lprocfs_kbytestotal_seq_show(struct seq_file *m, void *data)
+{
+ struct obd_device *obd = data;
+ struct obd_statfs osfs;
+ int rc = obd_statfs(NULL, obd->obd_self_export, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
+ OBD_STATFS_NODELAY);
+ if (!rc) {
+ __u32 blk_size = osfs.os_bsize >> 10;
+ __u64 result = osfs.os_blocks;
+
+ while (blk_size >>= 1)
+ result <<= 1;
+
+ rc = seq_printf(m, LPU64"\n", result);
+ }
+ return rc;
+}
+EXPORT_SYMBOL(lprocfs_kbytestotal_seq_show);
+
+int lprocfs_kbytesfree_seq_show(struct seq_file *m, void *data)
+{
+ struct obd_device *obd = data;
+ struct obd_statfs osfs;
+ int rc = obd_statfs(NULL, obd->obd_self_export, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
+ OBD_STATFS_NODELAY);
+ if (!rc) {
+ __u32 blk_size = osfs.os_bsize >> 10;
+ __u64 result = osfs.os_bfree;
+
+ while (blk_size >>= 1)
+ result <<= 1;
+
+ rc = seq_printf(m, LPU64"\n", result);
+ }
+ return rc;
+}
+EXPORT_SYMBOL(lprocfs_kbytesfree_seq_show);
+
+int lprocfs_kbytesavail_seq_show(struct seq_file *m, void *data)
+{
+ struct obd_device *obd = data;
+ struct obd_statfs osfs;
+ int rc = obd_statfs(NULL, obd->obd_self_export, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
+ OBD_STATFS_NODELAY);
+ if (!rc) {
+ __u32 blk_size = osfs.os_bsize >> 10;
+ __u64 result = osfs.os_bavail;
+
+ while (blk_size >>= 1)
+ result <<= 1;
+
+ rc = seq_printf(m, LPU64"\n", result);
+ }
+ return rc;
+}
+EXPORT_SYMBOL(lprocfs_kbytesavail_seq_show);
+
+int lprocfs_filestotal_seq_show(struct seq_file *m, void *data)
+{
+ struct obd_device *obd = data;
+ struct obd_statfs osfs;
+ int rc = obd_statfs(NULL, obd->obd_self_export, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
+ OBD_STATFS_NODELAY);
+ if (!rc)
+ rc = seq_printf(m, LPU64"\n", osfs.os_files);
+ return rc;
+}
+EXPORT_SYMBOL(lprocfs_filestotal_seq_show);
+
+int lprocfs_filesfree_seq_show(struct seq_file *m, void *data)
+{
+ struct obd_device *obd = data;
+ struct obd_statfs osfs;
+ int rc = obd_statfs(NULL, obd->obd_self_export, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
+ OBD_STATFS_NODELAY);
+ if (!rc)
+ rc = seq_printf(m, LPU64"\n", osfs.os_ffree);
+ return rc;
+}
+EXPORT_SYMBOL(lprocfs_filesfree_seq_show);
+
+int lprocfs_server_uuid_seq_show(struct seq_file *m, void *data)
+{
+ struct obd_device *obd = data;
+ struct obd_import *imp;
+ char *imp_state_name = NULL;
+ int rc = 0;
+
+ LASSERT(obd != NULL);
+ LPROCFS_CLIMP_CHECK(obd);
+ imp = obd->u.cli.cl_import;
+ imp_state_name = ptlrpc_import_state_name(imp->imp_state);
+ rc = seq_printf(m, "%s\t%s%s\n", obd2cli_tgt(obd), imp_state_name,
+ imp->imp_deactive ? "\tDEACTIVATED" : "");
+
+ LPROCFS_CLIMP_EXIT(obd);
+ return rc;
+}
+EXPORT_SYMBOL(lprocfs_server_uuid_seq_show);
+
+int lprocfs_conn_uuid_seq_show(struct seq_file *m, void *data)
+{
+ struct obd_device *obd = data;
+ struct ptlrpc_connection *conn;
+ int rc = 0;
+
+ LASSERT(obd != NULL);
+
+ LPROCFS_CLIMP_CHECK(obd);
+ conn = obd->u.cli.cl_import->imp_connection;
+ if (conn && obd->u.cli.cl_import)
+ rc = seq_printf(m, "%s\n", conn->c_remote_uuid.uuid);
+ else
+ rc = seq_printf(m, "%s\n", "<none>");
+
+ LPROCFS_CLIMP_EXIT(obd);
+ return rc;
+}
+EXPORT_SYMBOL(lprocfs_conn_uuid_seq_show);
+
+/** add up per-cpu counters */
+void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
+ struct lprocfs_counter *cnt)
+{
+ unsigned int num_entry;
+ struct lprocfs_counter *percpu_cntr;
+ int i;
+ unsigned long flags = 0;
+
+ memset(cnt, 0, sizeof(*cnt));
+
+ if (stats == NULL) {
+ /* set count to 1 to avoid divide-by-zero errs in callers */
+ cnt->lc_count = 1;
+ return;
+ }
+
+ cnt->lc_min = LC_MIN_INIT;
+
+ num_entry = lprocfs_stats_lock(stats, LPROCFS_GET_NUM_CPU, &flags);
+
+ for (i = 0; i < num_entry; i++) {
+ if (stats->ls_percpu[i] == NULL)
+ continue;
+ percpu_cntr = lprocfs_stats_counter_get(stats, i, idx);
+
+ cnt->lc_count += percpu_cntr->lc_count;
+ cnt->lc_sum += percpu_cntr->lc_sum;
+ if (percpu_cntr->lc_min < cnt->lc_min)
+ cnt->lc_min = percpu_cntr->lc_min;
+ if (percpu_cntr->lc_max > cnt->lc_max)
+ cnt->lc_max = percpu_cntr->lc_max;
+ cnt->lc_sumsquare += percpu_cntr->lc_sumsquare;
+ }
+
+ lprocfs_stats_unlock(stats, LPROCFS_GET_NUM_CPU, &flags);
+}
+EXPORT_SYMBOL(lprocfs_stats_collect);
+
+/**
+ * Append a space separated list of current set flags to str.
+ */
+#define flag2seqstr(flag) \
+ do { \
+ if (imp->imp_##flag) \
+ seq_printf(m, "%s" #flag, first ? "" : ", "); \
+ } while (0)
+static int obd_import_flags2seqstr(struct obd_import *imp, struct seq_file *m)
+{
+ bool first = true;
+
+ if (imp->imp_obd->obd_no_recov) {
+ seq_printf(m, "no_recov");
+ first = false;
+ }
+
+ flag2seqstr(invalid);
+ flag2seqstr(deactive);
+ flag2seqstr(replayable);
+ flag2seqstr(pingable);
+ return 0;
+}
+#undef flags2seqstr
+
+static const char *obd_connect_names[] = {
+ "read_only",
+ "lov_index",
+ "unused",
+ "write_grant",
+ "server_lock",
+ "version",
+ "request_portal",
+ "acl",
+ "xattr",
+ "create_on_write",
+ "truncate_lock",
+ "initial_transno",
+ "inode_bit_locks",
+ "join_file(obsolete)",
+ "getattr_by_fid",
+ "no_oh_for_devices",
+ "remote_client",
+ "remote_client_by_force",
+ "max_byte_per_rpc",
+ "64bit_qdata",
+ "mds_capability",
+ "oss_capability",
+ "early_lock_cancel",
+ "som",
+ "adaptive_timeouts",
+ "lru_resize",
+ "mds_mds_connection",
+ "real_conn",
+ "change_qunit_size",
+ "alt_checksum_algorithm",
+ "fid_is_enabled",
+ "version_recovery",
+ "pools",
+ "grant_shrink",
+ "skip_orphan",
+ "large_ea",
+ "full20",
+ "layout_lock",
+ "64bithash",
+ "object_max_bytes",
+ "imp_recov",
+ "jobstats",
+ "umask",
+ "einprogress",
+ "grant_param",
+ "flock_owner",
+ "lvb_type",
+ "nanoseconds_times",
+ "lightweight_conn",
+ "short_io",
+ "pingless",
+ "flock_deadlock",
+ "disp_stripe",
+ "unknown",
+ NULL
+};
+
+static void obd_connect_seq_flags2str(struct seq_file *m, __u64 flags, char *sep)
+{
+ bool first = true;
+ __u64 mask = 1;
+ int i;
+
+ for (i = 0; obd_connect_names[i] != NULL; i++, mask <<= 1) {
+ if (flags & mask) {
+ seq_printf(m, "%s%s",
+ first ? "" : sep, obd_connect_names[i]);
+ first = false;
+ }
+ }
+ if (flags & ~(mask - 1))
+ seq_printf(m, "%sunknown flags "LPX64,
+ first ? "" : sep, flags & ~(mask - 1));
+}
+
+int obd_connect_flags2str(char *page, int count, __u64 flags, char *sep)
+{
+ __u64 mask = 1;
+ int i, ret = 0;
+
+ for (i = 0; obd_connect_names[i] != NULL; i++, mask <<= 1) {
+ if (flags & mask)
+ ret += snprintf(page + ret, count - ret, "%s%s",
+ ret ? sep : "", obd_connect_names[i]);
+ }
+ if (flags & ~(mask - 1))
+ ret += snprintf(page + ret, count - ret,
+ "%sunknown flags "LPX64,
+ ret ? sep : "", flags & ~(mask - 1));
+ return ret;
+}
+EXPORT_SYMBOL(obd_connect_flags2str);
+
+int lprocfs_import_seq_show(struct seq_file *m, void *data)
+{
+ struct lprocfs_counter ret;
+ struct lprocfs_counter_header *header;
+ struct obd_device *obd = (struct obd_device *)data;
+ struct obd_import *imp;
+ struct obd_import_conn *conn;
+ int j;
+ int k;
+ int rw = 0;
+
+ LASSERT(obd != NULL);
+ LPROCFS_CLIMP_CHECK(obd);
+ imp = obd->u.cli.cl_import;
+
+ seq_printf(m,"import:\n"
+ " name: %s\n"
+ " target: %s\n"
+ " state: %s\n"
+ " instance: %u\n"
+ " connect_flags: [",
+ obd->obd_name,
+ obd2cli_tgt(obd),
+ ptlrpc_import_state_name(imp->imp_state),
+ imp->imp_connect_data.ocd_instance);
+ obd_connect_seq_flags2str(m, imp->imp_connect_data.ocd_connect_flags,
+ ", ");
+ seq_printf(m, "]\n"
+ " import_flags: [");
+ obd_import_flags2seqstr(imp, m);
+
+ seq_printf(m, "]\n"
+ " connection:\n"
+ " failover_nids: [");
+ spin_lock(&imp->imp_lock);
+ j = 0;
+ list_for_each_entry(conn, &imp->imp_conn_list, oic_item) {
+ seq_printf(m, "%s%s", j ? ", " : "",
+ libcfs_nid2str(conn->oic_conn->c_peer.nid));
+ j++;
+ }
+ seq_printf(m, "]\n"
+ " current_connection: %s\n"
+ " connection_attempts: %u\n"
+ " generation: %u\n"
+ " in-progress_invalidations: %u\n",
+ imp->imp_connection == NULL ? "<none>" :
+ libcfs_nid2str(imp->imp_connection->c_peer.nid),
+ imp->imp_conn_cnt,
+ imp->imp_generation,
+ atomic_read(&imp->imp_inval_count));
+ spin_unlock(&imp->imp_lock);
+
+ if (obd->obd_svc_stats == NULL)
+ goto out_climp;
+
+ header = &obd->obd_svc_stats->ls_cnt_header[PTLRPC_REQWAIT_CNTR];
+ lprocfs_stats_collect(obd->obd_svc_stats, PTLRPC_REQWAIT_CNTR, &ret);
+ if (ret.lc_count != 0) {
+ /* first argument to do_div MUST be __u64 */
+ __u64 sum = ret.lc_sum;
+ do_div(sum, ret.lc_count);
+ ret.lc_sum = sum;
+ } else
+ ret.lc_sum = 0;
+ seq_printf(m, " rpcs:\n"
+ " inflight: %u\n"
+ " unregistering: %u\n"
+ " timeouts: %u\n"
+ " avg_waittime: "LPU64" %s\n",
+ atomic_read(&imp->imp_inflight),
+ atomic_read(&imp->imp_unregistering),
+ atomic_read(&imp->imp_timeouts),
+ ret.lc_sum, header->lc_units);
+
+ k = 0;
+ for(j = 0; j < IMP_AT_MAX_PORTALS; j++) {
+ if (imp->imp_at.iat_portal[j] == 0)
+ break;
+ k = max_t(unsigned int, k,
+ at_get(&imp->imp_at.iat_service_estimate[j]));
+ }
+ seq_printf(m, " service_estimates:\n"
+ " services: %u sec\n"
+ " network: %u sec\n",
+ k,
+ at_get(&imp->imp_at.iat_net_latency));
+
+ seq_printf(m, " transactions:\n"
+ " last_replay: "LPU64"\n"
+ " peer_committed: "LPU64"\n"
+ " last_checked: "LPU64"\n",
+ imp->imp_last_replay_transno,
+ imp->imp_peer_committed_transno,
+ imp->imp_last_transno_checked);
+
+ /* avg data rates */
+ for (rw = 0; rw <= 1; rw++) {
+ lprocfs_stats_collect(obd->obd_svc_stats,
+ PTLRPC_LAST_CNTR + BRW_READ_BYTES + rw,
+ &ret);
+ if (ret.lc_sum > 0 && ret.lc_count > 0) {
+ /* first argument to do_div MUST be __u64 */
+ __u64 sum = ret.lc_sum;
+ do_div(sum, ret.lc_count);
+ ret.lc_sum = sum;
+ seq_printf(m, " %s_data_averages:\n"
+ " bytes_per_rpc: "LPU64"\n",
+ rw ? "write" : "read",
+ ret.lc_sum);
+ }
+ k = (int)ret.lc_sum;
+ j = opcode_offset(OST_READ + rw) + EXTRA_MAX_OPCODES;
+ header = &obd->obd_svc_stats->ls_cnt_header[j];
+ lprocfs_stats_collect(obd->obd_svc_stats, j, &ret);
+ if (ret.lc_sum > 0 && ret.lc_count != 0) {
+ /* first argument to do_div MUST be __u64 */
+ __u64 sum = ret.lc_sum;
+ do_div(sum, ret.lc_count);
+ ret.lc_sum = sum;
+ seq_printf(m, " %s_per_rpc: "LPU64"\n",
+ header->lc_units, ret.lc_sum);
+ j = (int)ret.lc_sum;
+ if (j > 0)
+ seq_printf(m, " MB_per_sec: %u.%.02u\n",
+ k / j, (100 * k / j) % 100);
+ }
+ }
+
+out_climp:
+ LPROCFS_CLIMP_EXIT(obd);
+ return 0;
+}
+EXPORT_SYMBOL(lprocfs_import_seq_show);
+
+int lprocfs_state_seq_show(struct seq_file *m, void *data)
+{
+ struct obd_device *obd = (struct obd_device *)data;
+ struct obd_import *imp;
+ int j, k;
+
+ LASSERT(obd != NULL);
+ LPROCFS_CLIMP_CHECK(obd);
+ imp = obd->u.cli.cl_import;
+
+ seq_printf(m, "current_state: %s\n",
+ ptlrpc_import_state_name(imp->imp_state));
+ seq_printf(m, "state_history:\n");
+ k = imp->imp_state_hist_idx;
+ for (j = 0; j < IMP_STATE_HIST_LEN; j++) {
+ struct import_state_hist *ish =
+ &imp->imp_state_hist[(k + j) % IMP_STATE_HIST_LEN];
+ if (ish->ish_state == 0)
+ continue;
+ seq_printf(m, " - ["CFS_TIME_T", %s]\n",
+ ish->ish_time,
+ ptlrpc_import_state_name(ish->ish_state));
+ }
+
+ LPROCFS_CLIMP_EXIT(obd);
+ return 0;
+}
+EXPORT_SYMBOL(lprocfs_state_seq_show);
+
+int lprocfs_seq_at_hist_helper(struct seq_file *m, struct adaptive_timeout *at)
+{
+ int i;
+ for (i = 0; i < AT_BINS; i++)
+ seq_printf(m, "%3u ", at->at_hist[i]);
+ seq_printf(m, "\n");
+ return 0;
+}
+EXPORT_SYMBOL(lprocfs_seq_at_hist_helper);
+
+/* See also ptlrpc_lprocfs_timeouts_show_seq */
+int lprocfs_timeouts_seq_show(struct seq_file *m, void *data)
+{
+ struct obd_device *obd = (struct obd_device *)data;
+ struct obd_import *imp;
+ unsigned int cur, worst;
+ time_t now, worstt;
+ struct dhms ts;
+ int i;
+
+ LASSERT(obd != NULL);
+ LPROCFS_CLIMP_CHECK(obd);
+ imp = obd->u.cli.cl_import;
+
+ now = cfs_time_current_sec();
+
+ /* Some network health info for kicks */
+ s2dhms(&ts, now - imp->imp_last_reply_time);
+ seq_printf(m, "%-10s : %ld, "DHMS_FMT" ago\n",
+ "last reply", imp->imp_last_reply_time, DHMS_VARS(&ts));
+
+ cur = at_get(&imp->imp_at.iat_net_latency);
+ worst = imp->imp_at.iat_net_latency.at_worst_ever;
+ worstt = imp->imp_at.iat_net_latency.at_worst_time;
+ s2dhms(&ts, now - worstt);
+ seq_printf(m, "%-10s : cur %3u worst %3u (at %ld, "DHMS_FMT" ago) ",
+ "network", cur, worst, worstt, DHMS_VARS(&ts));
+ lprocfs_seq_at_hist_helper(m, &imp->imp_at.iat_net_latency);
+
+ for(i = 0; i < IMP_AT_MAX_PORTALS; i++) {
+ if (imp->imp_at.iat_portal[i] == 0)
+ break;
+ cur = at_get(&imp->imp_at.iat_service_estimate[i]);
+ worst = imp->imp_at.iat_service_estimate[i].at_worst_ever;
+ worstt = imp->imp_at.iat_service_estimate[i].at_worst_time;
+ s2dhms(&ts, now - worstt);
+ seq_printf(m, "portal %-2d : cur %3u worst %3u (at %ld, "
+ DHMS_FMT" ago) ", imp->imp_at.iat_portal[i],
+ cur, worst, worstt, DHMS_VARS(&ts));
+ lprocfs_seq_at_hist_helper(m, &imp->imp_at.iat_service_estimate[i]);
+ }
+
+ LPROCFS_CLIMP_EXIT(obd);
+ return 0;
+}
+EXPORT_SYMBOL(lprocfs_timeouts_seq_show);
+
+int lprocfs_connect_flags_seq_show(struct seq_file *m, void *data)
+{
+ struct obd_device *obd = data;
+ __u64 flags;
+
+ LPROCFS_CLIMP_CHECK(obd);
+ flags = obd->u.cli.cl_import->imp_connect_data.ocd_connect_flags;
+ seq_printf(m, "flags="LPX64"\n", flags);
+ obd_connect_seq_flags2str(m, flags, "\n");
+ seq_printf(m, "\n");
+ LPROCFS_CLIMP_EXIT(obd);
+ return 0;
+}
+EXPORT_SYMBOL(lprocfs_connect_flags_seq_show);
+
+#ifndef HAVE_ONLY_PROCFS_SEQ
+
+int lprocfs_rd_uint(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ unsigned int *temp = data;
+ return snprintf(page, count, "%u\n", *temp);
+}
+EXPORT_SYMBOL(lprocfs_rd_uint);
+
int lprocfs_rd_u64(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
}
EXPORT_SYMBOL(lprocfs_rd_conn_uuid);
-/** add up per-cpu counters */
-void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
- struct lprocfs_counter *cnt)
-{
- unsigned int num_entry;
- struct lprocfs_counter *percpu_cntr;
- int i;
- unsigned long flags = 0;
-
- memset(cnt, 0, sizeof(*cnt));
-
- if (stats == NULL) {
- /* set count to 1 to avoid divide-by-zero errs in callers */
- cnt->lc_count = 1;
- return;
- }
-
- cnt->lc_min = LC_MIN_INIT;
-
- num_entry = lprocfs_stats_lock(stats, LPROCFS_GET_NUM_CPU, &flags);
-
- for (i = 0; i < num_entry; i++) {
- if (stats->ls_percpu[i] == NULL)
- continue;
- percpu_cntr = lprocfs_stats_counter_get(stats, i, idx);
-
- cnt->lc_count += percpu_cntr->lc_count;
- cnt->lc_sum += percpu_cntr->lc_sum;
- if (percpu_cntr->lc_min < cnt->lc_min)
- cnt->lc_min = percpu_cntr->lc_min;
- if (percpu_cntr->lc_max > cnt->lc_max)
- cnt->lc_max = percpu_cntr->lc_max;
- cnt->lc_sumsquare += percpu_cntr->lc_sumsquare;
- }
-
- lprocfs_stats_unlock(stats, LPROCFS_GET_NUM_CPU, &flags);
-}
-EXPORT_SYMBOL(lprocfs_stats_collect);
-
/**
* Append a space separated list of current set flags to str.
*/
}
#undef flags2str
-static const char *obd_connect_names[] = {
- "read_only",
- "lov_index",
- "unused",
- "write_grant",
- "server_lock",
- "version",
- "request_portal",
- "acl",
- "xattr",
- "create_on_write",
- "truncate_lock",
- "initial_transno",
- "inode_bit_locks",
- "join_file(obsolete)",
- "getattr_by_fid",
- "no_oh_for_devices",
- "remote_client",
- "remote_client_by_force",
- "max_byte_per_rpc",
- "64bit_qdata",
- "mds_capability",
- "oss_capability",
- "early_lock_cancel",
- "som",
- "adaptive_timeouts",
- "lru_resize",
- "mds_mds_connection",
- "real_conn",
- "change_qunit_size",
- "alt_checksum_algorithm",
- "fid_is_enabled",
- "version_recovery",
- "pools",
- "grant_shrink",
- "skip_orphan",
- "large_ea",
- "full20",
- "layout_lock",
- "64bithash",
- "object_max_bytes",
- "imp_recov",
- "jobstats",
- "umask",
- "einprogress",
- "grant_param",
- "flock_owner",
- "lvb_type",
- "nanoseconds_times",
- "lightweight_conn",
- "short_io",
- "pingless",
- "flock_deadlock",
- "disp_stripe",
- "unknown",
- NULL
-};
-
-int obd_connect_flags2str(char *page, int count, __u64 flags, char *sep)
-{
- __u64 mask = 1;
- int i, ret = 0;
-
- for (i = 0; obd_connect_names[i] != NULL; i++, mask <<= 1) {
- if (flags & mask)
- ret += snprintf(page + ret, count - ret, "%s%s",
- ret ? sep : "", obd_connect_names[i]);
- }
- if (flags & ~(mask - 1))
- ret += snprintf(page + ret, count - ret,
- "%sunknown flags "LPX64,
- ret ? sep : "", flags & ~(mask - 1));
- return ret;
-}
-EXPORT_SYMBOL(obd_connect_flags2str);
-
int lprocfs_rd_import(char *page, char **start, off_t off, int count,
int *eof, void *data)
{
int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list)
{
- int rc = 0;
+ int rc = 0;
- LASSERT(obd != NULL);
- LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
- LASSERT(obd->obd_type->typ_procroot != NULL);
-
- obd->obd_proc_entry = lprocfs_register(obd->obd_name,
- obd->obd_type->typ_procroot,
- list, obd);
- if (IS_ERR(obd->obd_proc_entry)) {
- rc = PTR_ERR(obd->obd_proc_entry);
- CERROR("error %d setting up lprocfs for %s\n",rc,obd->obd_name);
- obd->obd_proc_entry = NULL;
- }
- return rc;
+ LASSERT(obd != NULL);
+ LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
+ LASSERT(obd->obd_type->typ_procroot != NULL);
+
+ obd->obd_proc_entry = lprocfs_register(obd->obd_name,
+ obd->obd_type->typ_procroot,
+ list, obd);
+ if (IS_ERR(obd->obd_proc_entry)) {
+ rc = PTR_ERR(obd->obd_proc_entry);
+ CERROR("error %d setting up lprocfs for %s\n",rc,obd->obd_name);
+ obd->obd_proc_entry = NULL;
+ }
+ return rc;
}
EXPORT_SYMBOL(lprocfs_obd_setup);
+#endif
+
+int
+lprocfs_seq_obd_setup(struct obd_device *obd)
+{
+ int rc = 0;
+
+ LASSERT(obd != NULL);
+ LASSERT(obd->obd_vars != NULL);
+ LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
+ LASSERT(obd->obd_type->typ_procroot != NULL);
+
+ obd->obd_proc_entry = lprocfs_seq_register(obd->obd_name,
+ obd->obd_type->typ_procroot,
+ obd->obd_vars, obd);
+ if (IS_ERR(obd->obd_proc_entry)) {
+ rc = PTR_ERR(obd->obd_proc_entry);
+ CERROR("error %d setting up lprocfs for %s\n",rc,obd->obd_name);
+ obd->obd_proc_entry = NULL;
+ }
+ return rc;
+}
+EXPORT_SYMBOL(lprocfs_seq_obd_setup);
int lprocfs_obd_cleanup(struct obd_device *obd)
{
return -EINVAL;
if (obd->obd_proc_exports_entry) {
/* Should be no exports left */
- LASSERT(obd->obd_proc_exports_entry->subdir == NULL);
lprocfs_remove(&obd->obd_proc_exports_entry);
obd->obd_proc_exports_entry = NULL;
}
static int lprocfs_stats_seq_open(struct inode *inode, struct file *file)
{
- struct proc_dir_entry *dp = PDE(inode);
- struct seq_file *seq;
- int rc;
-
- if (LPROCFS_ENTRY_CHECK(dp))
- return -ENOENT;
+ struct seq_file *seq;
+ int rc;
- rc = seq_open(file, &lprocfs_stats_seq_sops);
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ if (LPROCFS_ENTRY_CHECK(PDE(inode)))
+ return -ENOENT;
+#endif
+ rc = seq_open(file, &lprocfs_stats_seq_sops);
if (rc)
- return rc;
- seq = file->private_data;
- seq->private = dp->data;
- return 0;
+ return rc;
+ seq = file->private_data;
+ seq->private = PDE_DATA(inode);
+ return 0;
}
struct file_operations lprocfs_stats_seq_fops = {
int lprocfs_register_stats(struct proc_dir_entry *root, const char *name,
struct lprocfs_stats *stats)
{
- struct proc_dir_entry *entry;
- LASSERT(root != NULL);
-
- LPROCFS_WRITE_ENTRY();
- entry = create_proc_entry(name, 0644, root);
- if (entry) {
- entry->proc_fops = &lprocfs_stats_seq_fops;
- entry->data = stats;
- }
-
- LPROCFS_WRITE_EXIT();
-
- if (entry == NULL)
- return -ENOMEM;
+ struct proc_dir_entry *entry;
+ LASSERT(root != NULL);
- return 0;
+ entry = proc_create_data(name, 0644, root,
+ &lprocfs_stats_seq_fops, stats);
+ if (entry == NULL)
+ return -ENOMEM;
+ return 0;
}
EXPORT_SYMBOL(lprocfs_register_stats);
}
EXPORT_SYMBOL(lprocfs_nid_stats_clear_write);
+#ifdef HAVE_SERVER_SUPPORT
int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *nid, int *newnid)
{
struct nid_stat *new_stat, *old_stat;
RETURN(rc);
}
EXPORT_SYMBOL(lprocfs_exp_setup);
+#endif
int lprocfs_exp_cleanup(struct obd_export *exp)
{
}
EXPORT_SYMBOL(lprocfs_read_frac_helper);
+int lprocfs_seq_read_frac_helper(struct seq_file *m, long val, int mult)
+{
+ long decimal_val, frac_val;
+
+ decimal_val = val / mult;
+ seq_printf(m, "%ld", decimal_val);
+ frac_val = val % mult;
+
+ if (frac_val > 0) {
+ frac_val *= 100;
+ frac_val /= mult;
+ }
+ if (frac_val > 0) {
+ /* Three cases: x0, xx, 0x */
+ if ((frac_val % 10) != 0)
+ seq_printf(m, ".%ld", frac_val);
+ else
+ seq_printf(m, ".%ld", frac_val / 10);
+ }
+
+ seq_printf(m, "\n");
+ return 0;
+}
+EXPORT_SYMBOL(lprocfs_seq_read_frac_helper);
+
int lprocfs_write_u64_helper(const char *buffer, unsigned long count,__u64 *val)
{
return lprocfs_write_frac_u64_helper(buffer, count, val, 1);
* If \a name is not found the original \a buffer is returned.
*/
char *lprocfs_find_named_value(const char *buffer, const char *name,
- unsigned long *count)
+ size_t *count)
{
char *val;
size_t buflen = *count;
const struct file_operations *seq_fops,
void *data)
{
- struct proc_dir_entry *entry;
- ENTRY;
+ struct proc_dir_entry *entry;
+ ENTRY;
/* Disallow secretly (un)writable entries. */
LASSERT((seq_fops->write == NULL) == ((mode & 0222) == 0));
- LPROCFS_WRITE_ENTRY();
- entry = create_proc_entry(name, mode, parent);
- if (entry) {
- entry->proc_fops = seq_fops;
- entry->data = data;
- }
- LPROCFS_WRITE_EXIT();
+ entry = proc_create_data(name, mode, parent, seq_fops, data);
- if (entry == NULL)
- RETURN(-ENOMEM);
+ if (entry == NULL)
+ RETURN(-ENOMEM);
- RETURN(0);
+ RETURN(0);
}
EXPORT_SYMBOL(lprocfs_seq_create);
}
EXPORT_SYMBOL(lprocfs_obd_rd_hash);
+#ifdef HAVE_SERVER_SUPPORT
int lprocfs_obd_rd_recovery_status(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
return min(count, len - (int)off);
}
EXPORT_SYMBOL(lprocfs_obd_rd_recovery_status);
+#endif
int lprocfs_obd_rd_ir_factor(char *page, char **start, off_t off,
int count, int *eof, void *data)
}
EXPORT_SYMBOL(lprocfs_obd_rd_max_pages_per_rpc);
+int lprocfs_obd_max_pages_per_rpc_seq_show(struct seq_file *m, void *data)
+{
+ struct obd_device *dev = data;
+ struct client_obd *cli = &dev->u.cli;
+ int rc;
+
+ client_obd_list_lock(&cli->cl_loi_list_lock);
+ rc = seq_printf(m, "%d\n", cli->cl_max_pages_per_rpc);
+ client_obd_list_unlock(&cli->cl_loi_list_lock);
+ return rc;
+}
+EXPORT_SYMBOL(lprocfs_obd_max_pages_per_rpc_seq_show);
+
#ifdef HAVE_SERVER_SUPPORT
int lprocfs_target_rd_instance(char *page, char **start, off_t off,
int count, int *eof, void *data)
}
EXPORT_SYMBOL(class_process_config);
+#ifndef HAVE_ONLY_PROCFS_SEQ
int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars,
struct lustre_cfg *lcfg, void *data)
{
keylen == strlen(var->name)) {
matched++;
rc = -EROFS;
- if (var->write_fptr) {
- mm_segment_t oldfs;
- oldfs = get_fs();
- set_fs(KERNEL_DS);
- rc = (var->write_fptr)(NULL, sval,
- vallen, data);
- set_fs(oldfs);
- }
- break;
+
+ if (var->write_fptr) {
+ mm_segment_t oldfs;
+ oldfs = get_fs();
+ set_fs(KERNEL_DS);
+ rc = (var->write_fptr)(NULL, sval,
+ vallen, data);
+ set_fs(oldfs);
+ }
+ break;
}
j++;
}
#endif
}
EXPORT_SYMBOL(class_process_proc_param);
+#endif
+
+int class_process_proc_seq_param(char *prefix, struct lprocfs_seq_vars *lvars,
+ struct lustre_cfg *lcfg, void *data)
+{
+#ifdef __KERNEL__
+ struct lprocfs_seq_vars *var;
+ struct file fakefile;
+ struct seq_file fake_seqfile;
+ char *key, *sval;
+ int i, keylen, vallen;
+ int matched = 0, j = 0;
+ int rc = 0;
+ int skip = 0;
+ ENTRY;
+
+ if (lcfg->lcfg_command != LCFG_PARAM) {
+ CERROR("Unknown command: %d\n", lcfg->lcfg_command);
+ RETURN(-EINVAL);
+ }
+
+ /* fake a seq file so that var->fops->write can work... */
+ fakefile.private_data = &fake_seqfile;
+ fake_seqfile.private = data;
+ /* e.g. tunefs.lustre --param mdt.group_upcall=foo /r/tmp/lustre-mdt
+ or lctl conf_param lustre-MDT0000.mdt.group_upcall=bar
+ or lctl conf_param lustre-OST0000.osc.max_dirty_mb=36 */
+ for (i = 1; i < lcfg->lcfg_bufcount; i++) {
+ key = lustre_cfg_buf(lcfg, i);
+ /* Strip off prefix */
+ class_match_param(key, prefix, &key);
+ sval = strchr(key, '=');
+ if (!sval || (*(sval + 1) == 0)) {
+ CERROR("Can't parse param %s (missing '=')\n", key);
+ /* rc = -EINVAL; continue parsing other params */
+ continue;
+ }
+ keylen = sval - key;
+ sval++;
+ vallen = strlen(sval);
+ matched = 0;
+ j = 0;
+ /* Search proc entries */
+ while (lvars[j].name) {
+ var = &lvars[j];
+ if (class_match_param(key, (char *)var->name, 0) == 0 &&
+ keylen == strlen(var->name)) {
+ matched++;
+ rc = -EROFS;
+
+ if (var->fops && var->fops->write) {
+ mm_segment_t oldfs;
+ oldfs = get_fs();
+ set_fs(KERNEL_DS);
+ rc = (var->fops->write)(&fakefile, sval,
+ vallen, NULL);
+ set_fs(oldfs);
+ }
+ break;
+ }
+ j++;
+ }
+ if (!matched) {
+ /* If the prefix doesn't match, return error so we
+ can pass it down the stack */
+ if (strnchr(key, keylen, '.'))
+ RETURN(-ENOSYS);
+ CERROR("%s: unknown param %s\n",
+ (char *)lustre_cfg_string(lcfg, 0), key);
+ /* rc = -EINVAL; continue parsing other params */
+ skip++;
+ } else if (rc < 0) {
+ CERROR("writing proc entry %s err %d\n",
+ var->name, rc);
+ rc = 0;
+ } else {
+ CDEBUG(D_CONFIG, "%s.%.*s: Set parameter %.*s=%s\n",
+ lustre_cfg_string(lcfg, 0),
+ (int)strlen(prefix) - 1, prefix,
+ (int)(sval - key - 1), key, sval);
+ }
+ }
+
+ if (rc > 0)
+ rc = 0;
+ if (!rc && skip)
+ rc = skip;
+ RETURN(rc);
+#else
+ CDEBUG(D_CONFIG, "liblustre can't process params.\n");
+ /* Don't throw config error */
+ RETURN(0);
+#endif
+}
+EXPORT_SYMBOL(class_process_proc_seq_param);
#ifdef __KERNEL__
extern int lustre_check_exclusion(struct super_block *sb, char *svname);
lprocfs_echo_init_vars(&lvars);
- rc = lu_kmem_init(echo_caches);
- if (rc == 0) {
- rc = class_register_type(&echo_client_obd_ops, NULL,
- lvars.module_vars,
- LUSTRE_ECHO_CLIENT_NAME,
- &echo_device_type);
- if (rc)
- lu_kmem_fini(echo_caches);
- }
- return rc;
+ rc = lu_kmem_init(echo_caches);
+ if (rc == 0) {
+ rc = class_register_type(&echo_client_obd_ops, NULL, NULL,
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ lvars.module_vars,
+#endif
+ LUSTRE_ECHO_CLIENT_NAME,
+ &echo_device_type);
+ if (rc)
+ lu_kmem_fini(echo_caches);
+ }
+ return rc;
}
void echo_client_exit(void)
if (rc != 0)
goto failed_0;
- rc = class_register_type(&echo_obd_ops, NULL, lvars.module_vars,
- LUSTRE_ECHO_NAME, NULL);
- if (rc != 0)
- goto failed_1;
+ rc = class_register_type(&echo_obd_ops, NULL, NULL,
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ lvars.module_vars,
+#endif
+ LUSTRE_ECHO_NAME, NULL);
+ if (rc != 0)
+ goto failed_1;
# endif
rc = echo_client_init();
lprocfs_ofd_init_vars(&lvars);
- rc = class_register_type(&ofd_obd_ops, NULL, lvars.module_vars,
- LUSTRE_OST_NAME, &ofd_device_type);
+ rc = class_register_type(&ofd_obd_ops, NULL, NULL,
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ lvars.module_vars,
+#endif
+ LUSTRE_OST_NAME, &ofd_device_type);
return rc;
}
/* shrink the number of caching pages to a specific number */
static int osc_wr_cached_mb(struct file *file, const char *buffer,
- unsigned long count, void *data)
+ unsigned long nob, void *data)
{
struct obd_device *dev = data;
struct client_obd *cli = &dev->u.cli;
int pages_number, mult, rc;
+ size_t count = nob;
mult = 1 << (20 - PAGE_CACHE_SHIFT);
buffer = lprocfs_find_named_value(buffer, "used_mb:", &count);
lprocfs_osc_init_vars(&lvars);
- rc = class_register_type(&osc_obd_ops, NULL, lvars.module_vars,
- LUSTRE_OSC_NAME, &osc_device_type);
+ rc = class_register_type(&osc_obd_ops, NULL, NULL,
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ lvars.module_vars,
+#endif
+ LUSTRE_OSC_NAME, &osc_device_type);
if (rc) {
lu_kmem_fini(osc_caches);
RETURN(rc);
if (rc)
return rc;
- rc = class_register_type(&osd_obd_device_ops, NULL, lvars.module_vars,
- LUSTRE_OSD_LDISKFS_NAME, &osd_device_type);
+ rc = class_register_type(&osd_obd_device_ops, NULL, NULL,
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ lvars.module_vars,
+#endif
+ LUSTRE_OSD_LDISKFS_NAME, &osd_device_type);
if (rc)
lu_kmem_fini(ldiskfs_caches);
return rc;
if (rc)
return rc;
- rc = class_register_type(&osd_obd_device_ops, NULL,
- lprocfs_osd_module_vars,
- LUSTRE_OSD_ZFS_NAME, &osd_device_type);
+ rc = class_register_type(&osd_obd_device_ops, NULL, NULL,
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ lprocfs_osd_module_vars,
+#endif
+ LUSTRE_OSD_ZFS_NAME, &osd_device_type);
if (rc)
lu_kmem_fini(osd_caches);
return rc;
lprocfs_osp_init_vars(&lvars);
- rc = class_register_type(&osp_obd_device_ops, NULL, lvars.module_vars,
- LUSTRE_OSP_NAME, &osp_device_type);
+ rc = class_register_type(&osp_obd_device_ops, NULL, NULL,
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ lvars.module_vars,
+#endif
+ LUSTRE_OSP_NAME, &osp_device_type);
/* create "osc" entry in procfs for compatibility purposes */
if (rc != 0) {
lprocfs_lwp_init_vars(&lvars);
- rc = class_register_type(&lwp_obd_device_ops, NULL, lvars.module_vars,
- LUSTRE_LWP_NAME, &lwp_device_type);
+ rc = class_register_type(&lwp_obd_device_ops, NULL, NULL,
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ lvars.module_vars,
+#endif
+ LUSTRE_LWP_NAME, &lwp_device_type);
if (rc != 0) {
class_unregister_type(LUSTRE_OSP_NAME);
lu_kmem_fini(osp_caches);
ENTRY;
lprocfs_ost_init_vars(&lvars);
- rc = class_register_type(&ost_obd_ops, NULL, lvars.module_vars,
- LUSTRE_OSS_NAME, NULL);
+ rc = class_register_type(&ost_obd_ops, NULL, NULL,
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ lvars.module_vars,
+#endif
+ LUSTRE_OSS_NAME, NULL);
if (ost_num_threads != 0 && oss_num_threads == 0) {
LCONSOLE_INFO("ost_num_threads module parameter is deprecated, "
long quantum_reg;
long quantum_hp;
/** lprocfs_find_named_value() modifies its argument, so keep a copy */
- unsigned long count_copy;
+ size_t count_copy;
int rc = 0;
int rc2 = 0;
long quantum_reg;
long quantum_hp;
/** lprocfs_find_named_value() modifies its argument, so keep a copy */
- unsigned long count_copy;
+ size_t count_copy;
int rc = 0;
int rc2 = 0;
char *val_hp;
bool physical_reg;
bool physical_hp;
- unsigned long count_copy;
+ size_t count_copy;
int rc = 0;
int rc2 = 0;
char *val_hp;
enum nrs_orr_supp supp_reg;
enum nrs_orr_supp supp_hp;
- unsigned long count_copy;
+ size_t count_copy;
int rc = 0;
int rc2 = 0;
int rc;
ENTRY;
- rc = class_register_type(&qmt_obd_ops, NULL, NULL, LUSTRE_QMT_NAME,
- &qmt_device_type);
+ rc = class_register_type(&qmt_obd_ops, NULL, NULL,
+#ifndef HAVE_ONLY_PROCFS_SEQ
+ NULL,
+#endif
+ LUSTRE_QMT_NAME, &qmt_device_type);
RETURN(rc);
}