*.so
*.swp
*.unsigned
+_lpb
00[0-9][0-9]-*.patch
autoMakefile
autoMakefile.in
]) # LIBCFS_KALLSYMS_LOOKUP
#
+# LIBCFS_HAVE_PROC_OPS
+#
+# v5.5-8862-gd56c0d45f0e2
+# proc: decouple proc from VFS with "struct proc_ops"
+#
+AC_DEFUN([LIBCFS_SRC_HAVE_PROC_OPS], [
+ LB2_LINUX_TEST_SRC([proc_ops], [
+ #include <linux/proc_fs.h>
+
+ static struct proc_ops *my_proc;
+ ],[
+ my_proc->proc_lseek = NULL;
+ ],[-Werror])
+])
+AC_DEFUN([LIBCFS_HAVE_PROC_OPS], [
+ AC_MSG_CHECKING([if struct proc_ops exists])
+ LB2_LINUX_TEST_RESULT([proc_ops], [
+ AC_DEFINE(HAVE_PROC_OPS, 1,
+ [struct proc_ops exists])
+ AC_MSG_RESULT(yes)
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+]) # LIBCFS_HAVE_PROC_OPS
+
+#
# LIBCFS_VMALLOC_2ARGS
#
# kernel v5.8-rc1~201^2~19
EXTRA_KCFLAGS="$tmp_flags"
]) # LIBCFS_HAVE_NR_UNSTABLE_NFS
-AC_DEFUN([LIBCFS_PROG_LINUX_SRC], [] )
-AC_DEFUN([LIBCFS_PROG_LINUX_RESULTS], [])
+AC_DEFUN([LIBCFS_PROG_LINUX_SRC], [
+ LIBCFS_SRC_HAVE_PROC_OPS
+
+ AC_MSG_CHECKING([for available kernel interfaces to libcfs])
+ LB2_LINUX_TEST_COMPILE_ALL([libcfs])
+ AC_MSG_RESULT([done])
+])
+AC_DEFUN([LIBCFS_PROG_LINUX_RESULTS], [
+ # 5.6
+ LIBCFS_HAVE_PROC_OPS
+])
#
# LIBCFS_PROG_LINUX
#define DTTOIF(dirtype) ((dirtype) << S_DT_SHIFT)
#endif
+#ifdef HAVE_PROC_OPS
+#define PROC_OWNER(_fn)
+#else
+#define proc_ops file_operations
+#define PROC_OWNER(_owner) .owner = (_owner),
+#define proc_open open
+#define proc_read read
+#define proc_write write
+#define proc_lseek llseek
+#define proc_release release
+#define proc_poll poll
+#define proc_ioctl unlocked_ioctl
+#define proc_compat_ioctl compat_ioctl
+#define proc_mmap mmap
+#define proc_get_unmapped_area get_unmapped_area
+#endif
+
#endif
#include <linux/seq_file.h>
#include <libcfs/libcfs.h>
+#include <libcfs/linux/linux-fs.h>
#include <uapi/linux/lustre/lustre_idl.h>
/*
*/
struct lprocfs_vars {
const char *name;
- const struct file_operations *fops;
+ const struct proc_ops *fops;
void *data;
/** /proc file mode. */
mode_t proc_mode;
#endif
extern struct proc_dir_entry *
lprocfs_add_simple(struct proc_dir_entry *root, char *name,
- void *data, const struct file_operations *fops);
+ void *data, const struct proc_ops *ops);
extern struct proc_dir_entry *
lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
const char *format, ...);
extern int lprocfs_obd_cleanup(struct obd_device *obd);
extern int lprocfs_seq_create(struct proc_dir_entry *parent, const char *name,
- mode_t mode,
- const struct file_operations *seq_fops,
+ mode_t mode, const struct proc_ops *seq_fops,
void *data);
extern int lprocfs_obd_seq_create(struct obd_device *obd, const char *name,
- mode_t mode,
- const struct file_operations *seq_fops,
+ mode_t mode, const struct proc_ops *seq_fops,
void *data);
/* Generic callbacks */
inode->i_private ? inode->i_private : \
PDE_DATA(inode)); \
} \
-static const 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, \
+static const struct proc_ops name##_fops = { \
+ PROC_OWNER(THIS_MODULE) \
+ .proc_open = name##_single_open, \
+ .proc_read = seq_read, \
+ .proc_write = custom_seq_write, \
+ .proc_lseek = seq_lseek, \
+ .proc_release = lprocfs_single_release, \
}
#define LPROC_SEQ_FOPS_RO(name) __LPROC_SEQ_FOPS(name, NULL)
inode->i_private ? inode->i_private : \
PDE_DATA(inode)); \
} \
- static const struct file_operations name##_##type##_fops = { \
- .open = name##_##type##_open, \
- .write = name##_##type##_write, \
- .release = lprocfs_single_release, \
+ static const struct proc_ops name##_##type##_fops = { \
+ .proc_open = name##_##type##_open, \
+ .proc_write = name##_##type##_write, \
+ .proc_release = lprocfs_single_release, \
};
struct lustre_attr {
return 0;
}
-static const struct file_operations lmv_proc_target_fops = {
- .owner = THIS_MODULE,
- .open = lmv_target_seq_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = seq_release,
+static const struct proc_ops lmv_proc_target_fops = {
+ PROC_OWNER(THIS_MODULE)
+ .proc_open = lmv_target_seq_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = seq_release,
};
#endif /* CONFIG_PROC_FS */
#include <libcfs/libcfs.h>
#include <libcfs/linux/linux-hash.h>
+#include <libcfs/linux/linux-fs.h>
#include <obd.h>
#include "lod_internal.h"
return rc;
}
-const static struct file_operations pool_proc_operations = {
+const static struct proc_ops pool_proc_operations = {
.open = pool_proc_open,
.read = seq_read,
.llseek = seq_lseek,
}
LUSTRE_RW_ATTR(mdt_hash);
-static const struct file_operations lod_proc_mdt_fops = {
- .owner = THIS_MODULE,
- .open = lod_mdts_seq_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = lprocfs_seq_release,
+static const struct proc_ops lod_proc_mdt_fops = {
+ PROC_OWNER(THIS_MODULE)
+ .proc_open = lod_mdts_seq_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = lprocfs_seq_release,
};
-static const struct file_operations lod_proc_target_fops = {
- .owner = THIS_MODULE,
- .open = lod_osts_seq_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = lprocfs_seq_release,
+static struct proc_ops lod_proc_target_fops = {
+ PROC_OWNER(THIS_MODULE)
+ .proc_open = lod_osts_seq_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = lprocfs_seq_release,
};
static struct attribute *lod_attrs[] = {
#include <libcfs/libcfs.h>
#include <libcfs/linux/linux-hash.h>
+#include <libcfs/linux/linux-fs.h>
#include <obd.h>
#include "lov_internal.h"
return rc;
}
-const static struct file_operations pool_proc_operations = {
- .open = pool_proc_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = seq_release,
+const static struct proc_ops pool_proc_operations = {
+ .proc_open = pool_proc_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = seq_release,
};
#endif /* CONFIG_PROC_FS */
return 0;
}
-static const struct file_operations lov_proc_target_fops = {
- .owner = THIS_MODULE,
- .open = lov_target_seq_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = lprocfs_seq_release,
+static const struct proc_ops lov_proc_target_fops = {
+ PROC_OWNER(THIS_MODULE)
+ .proc_open = lov_target_seq_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = lprocfs_seq_release,
};
#endif /* CONFIG_PROC_FS */
#define DEBUG_SUBSYSTEM S_MDS
+#include <linux/fs.h>
+#include <libcfs/linux/linux-fs.h>
#include "mdt_internal.h"
-static const struct file_operations mdt_open_files_seq_fops = {
- .owner = THIS_MODULE,
- .open = lprocfs_mdt_open_files_seq_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = seq_release,
+static const struct proc_ops mdt_open_files_seq_fops = {
+ PROC_OWNER(THIS_MODULE)
+ .proc_open = lprocfs_mdt_open_files_seq_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = seq_release,
};
/**
RETURN(0);
}
-LPROC_SEQ_FOPS_RO(mgs_fs);
+LDEBUGFS_SEQ_FOPS_RO(mgs_fs);
static void seq_show_srpc_rules(struct seq_file *seq, const char *tgtname,
struct sptlrpc_rule_set *rset)
return 0;
}
-LPROC_SEQ_FOPS_RO(mgsself_srpc);
+LDEBUGFS_SEQ_FOPS_RO(mgsself_srpc);
static int mgs_live_seq_show(struct seq_file *seq, void *v)
{
return lprocfs_seq_release(inode, file);
}
-static const struct file_operations lprocfs_jobstats_seq_fops = {
- .owner = THIS_MODULE,
- .open = lprocfs_jobstats_seq_open,
- .read = seq_read,
- .write = lprocfs_jobstats_seq_write,
- .llseek = seq_lseek,
- .release = lprocfs_jobstats_seq_release,
+static const struct proc_ops lprocfs_jobstats_seq_fops = {
+ PROC_OWNER(THIS_MODULE)
+ .proc_open = lprocfs_jobstats_seq_open,
+ .proc_read = seq_read,
+ .proc_write = lprocfs_jobstats_seq_write,
+ .proc_lseek = seq_lseek,
+ .proc_release = lprocfs_jobstats_seq_release,
};
int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
}
EXPORT_SYMBOL(lprocfs_seq_release);
+static umode_t default_mode(const struct proc_ops *ops)
+{
+ umode_t mode = 0;
+
+ if (ops->proc_read)
+ mode = 0444;
+ if (ops->proc_write)
+ mode |= 0200;
+
+ return mode;
+}
+
struct proc_dir_entry *
lprocfs_add_simple(struct proc_dir_entry *root, char *name,
- void *data, const struct file_operations *fops)
+ void *data, const struct proc_ops *fops)
{
struct proc_dir_entry *proc;
- mode_t mode = 0;
+ umode_t mode;
if (!root || !name || !fops)
return ERR_PTR(-EINVAL);
- if (fops->read)
- mode = 0444;
- if (fops->write)
- mode |= 0200;
+ mode = default_mode(fops);
proc = proc_create_data(name, mode, root, fops, data);
if (!proc) {
CERROR("LprocFS: No memory to create /proc entry %s\n",
}
EXPORT_SYMBOL_GPL(ldebugfs_add_vars);
-static const struct file_operations lprocfs_empty_ops = { };
+static const struct proc_ops lprocfs_empty_ops = { };
/**
* Add /proc entries.
while (list->name) {
struct proc_dir_entry *proc;
- mode_t mode = 0;
+ umode_t mode = 0;
- if (list->proc_mode != 0000) {
+ if (list->proc_mode)
mode = list->proc_mode;
- } else if (list->fops) {
- if (list->fops->read)
- mode = 0444;
- if (list->fops->write)
- mode |= 0200;
- }
+ else if (list->fops)
+ mode = default_mode(list->fops);
proc = proc_create_data(list->name, mode, root,
list->fops ?: &lprocfs_empty_ops,
list->data ?: data);
};
EXPORT_SYMBOL(ldebugfs_stats_seq_fops);
-static const struct file_operations lprocfs_stats_seq_fops = {
- .owner = THIS_MODULE,
- .open = lprocfs_stats_seq_open,
- .read = seq_read,
- .write = lprocfs_stats_seq_write,
- .llseek = seq_lseek,
- .release = lprocfs_seq_release,
+static const struct proc_ops lprocfs_stats_seq_fops = {
+ PROC_OWNER(THIS_MODULE)
+ .proc_open = lprocfs_stats_seq_open,
+ .proc_read = seq_read,
+ .proc_write = lprocfs_stats_seq_write,
+ .proc_lseek = seq_lseek,
+ .proc_release = lprocfs_seq_release,
};
int lprocfs_register_stats(struct proc_dir_entry *root, const char *name,
int lprocfs_seq_create(struct proc_dir_entry *parent,
const char *name,
mode_t mode,
- const struct file_operations *seq_fops,
+ const struct proc_ops *seq_fops,
void *data)
{
struct proc_dir_entry *entry;
ENTRY;
/* Disallow secretly (un)writable entries. */
- LASSERT((seq_fops->write == NULL) == ((mode & 0222) == 0));
+ LASSERT(!seq_fops->proc_write == !(mode & 0222));
entry = proc_create_data(name, mode, parent, seq_fops, data);
int lprocfs_obd_seq_create(struct obd_device *obd,
const char *name,
mode_t mode,
- const struct file_operations *seq_fops,
+ const struct proc_ops *seq_fops,
void *data)
{
return lprocfs_seq_create(obd->obd_proc_entry, name,
LPROC_SEQ_FOPS_RO(nodemap_audit_mode);
LPROC_SEQ_FOPS_RO(nodemap_forbid_encryption);
-static const struct file_operations nodemap_ranges_fops = {
+static const struct proc_ops nodemap_ranges_fops = {
.open = nodemap_ranges_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release
};
-static const struct file_operations nodemap_idmap_fops = {
+static const struct proc_ops nodemap_idmap_fops = {
.open = nodemap_idmap_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release
};
-static const struct file_operations nodemap_exports_fops = {
+static const struct proc_ops nodemap_exports_fops = {
.open = nodemap_exports_open,
.read = seq_read,
.llseek = seq_lseek,
return seq_release(inode, file);
}
-const struct file_operations lprocfs_quota_seq_fops = {
- .owner = THIS_MODULE,
- .open = lprocfs_quota_seq_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = lprocfs_quota_seq_release,
+const struct proc_ops lprocfs_quota_seq_fops = {
+ PROC_OWNER(THIS_MODULE)
+ .proc_open = lprocfs_quota_seq_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = lprocfs_quota_seq_release,
};
#endif /* CONFIG_PROC_FS */
void qmt_glb_fini(void);
/* lproc_quota.c */
-extern const struct file_operations lprocfs_quota_seq_fops;
+extern const struct proc_ops lprocfs_quota_seq_fops;
/* qsd_lib.c */
int qsd_glb_init(void);