File 0023-LU-13344-libcfs-Abstract-proc_fs-with-proc_ops.patch of Package lustre_2_12

From 4a74dbf4a04f4df9f366a3b6ba6e254a2065982f Mon Sep 17 00:00:00 2001
From: Shaun Tancheff <shaun.tancheff@hpe.com>
Date: Thu, 15 Apr 2021 08:07:50 -0400
Subject: [PATCH 23/35] LU-13344 libcfs: Abstract proc_fs with proc_ops

Linux 5.6 introduces proc_ops with v5.5-8862-gd56c0d45f0e2
proc: decouple proc from VFS with "struct proc_ops"

Map proc_ops and it's members to file_operations and
the appropriate members for older kernels.

One remaining 'PROC_OWNER()' macro is left to deal with
proc_ops being unable to sensibly map the owner member.

Test-Parameters: trivial
HPE-bug-id: LUS-8589
Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Change-Id: I3d8940a91b331c4f6bb31a9432194cc082c9cecd
Reviewed-on: https://review.whamcloud.com/37873
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
---
 .gitignore                             |  1 +
 libcfs/autoconf/lustre-libcfs.m4       | 24 +++++++++++
 libcfs/include/libcfs/linux/linux-fs.h | 17 ++++++++
 lustre/include/lprocfs_status.h        | 34 ++++++++-------
 lustre/lmv/lproc_lmv.c                 | 12 +++---
 lustre/lod/lod_pool.c                  |  3 +-
 lustre/lod/lproc_lod.c                 | 12 +++---
 lustre/lov/lov_pool.c                  | 11 ++---
 lustre/lov/lproc_lov.c                 | 12 +++---
 lustre/mdt/mdt_fs.c                    | 14 ++++---
 lustre/mgs/lproc_mgs.c                 |  4 +-
 lustre/obdclass/genops.c               |  4 +-
 lustre/obdclass/lprocfs_jobstats.c     | 14 +++----
 lustre/obdclass/lprocfs_status.c       | 57 ++++++++++++++------------
 lustre/ptlrpc/gss/lproc_gss.c          | 12 +++---
 lustre/ptlrpc/nodemap_lproc.c          |  6 +--
 lustre/ptlrpc/sec_lproc.c              |  8 ++--
 lustre/quota/lproc_quota.c             | 12 +++---
 lustre/quota/lquota_internal.h         |  2 +-
 19 files changed, 154 insertions(+), 105 deletions(-)

diff --git a/.gitignore b/.gitignore
index b33e8fd9c429..4625811fd276 100644
--- a/.gitignore
+++ b/.gitignore
@@ -43,6 +43,7 @@
 *.so
 *.swp
 *.unsigned
+_lpb
 00[0-9][0-9]-*.patch
 autoMakefile
 autoMakefile.in
diff --git a/libcfs/autoconf/lustre-libcfs.m4 b/libcfs/autoconf/lustre-libcfs.m4
index a7eae74218ef..7d380635278f 100644
--- a/libcfs/autoconf/lustre-libcfs.m4
+++ b/libcfs/autoconf/lustre-libcfs.m4
@@ -1255,6 +1255,29 @@ cache_detail_writers_atomic, [
 EXTRA_KCFLAGS="$tmp_flags"
 ]) # LIBCFS_CACHE_DETAIL_WRITERS
 
+#
+# LIBCFS_HAVE_PROC_OPS
+#
+# v5.5-8862-gd56c0d45f0e2
+# proc: decouple proc from VFS with "struct proc_ops"
+#
+AC_DEFUN([LIBCFS_HAVE_PROC_OPS], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if struct proc_ops exists],
+proc_ops_exists, [
+	#include <linux/proc_fs.h>
+
+	static struct proc_ops *my_proc;
+],[
+	my_proc->proc_lseek = NULL;
+],[
+	AC_DEFINE(HAVE_PROC_OPS, 1,
+		[struct proc_ops exists])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LIBCFS_HAVE_PROC_OPS
+
 #
 # LIBCFS_VMALLOC_2ARGS
 #
@@ -1466,6 +1489,7 @@ LIBCFS_GET_REQUEST_KEY_AUTH
 LIBCFS_LOOKUP_USER_KEY
 LIBCFS_CACHE_DETAIL_WRITERS
 LIBCFS_HAVE_NR_UNSTABLE_NFS
+LIBCFS_HAVE_PROC_OPS
 # 5.8
 LIBCFS_HAVE_MMAP_LOCK
 LIBCFS_KERNEL_SETSOCKOPT
diff --git a/libcfs/include/libcfs/linux/linux-fs.h b/libcfs/include/libcfs/linux/linux-fs.h
index ce360111d0a9..d289357d9af4 100644
--- a/libcfs/include/libcfs/linux/linux-fs.h
+++ b/libcfs/include/libcfs/linux/linux-fs.h
@@ -86,4 +86,21 @@ static inline struct dentry *file_dentry(const struct file *file)
 #ifndef HAVE_POSIX_ACL_VALID_USER_NS
 #define posix_acl_valid(a,b) posix_acl_valid(b)
 #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
diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h
index f60bb9df11a5..3352cdbf23db 100644
--- a/lustre/include/lprocfs_status.h
+++ b/lustre/include/lprocfs_status.h
@@ -46,6 +46,7 @@
 #include <linux/seq_file.h>
 
 #include <libcfs/libcfs.h>
+#include <libcfs/linux/linux-fs.h>
 #include <uapi/linux/lustre/lustre_idl.h>
 
 /*
@@ -55,7 +56,7 @@
  */
 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;
@@ -515,7 +516,7 @@ struct dentry *ldebugfs_add_simple(struct dentry *root, char *name, void *data,
 				   const struct file_operations *fops);
 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, ...);
@@ -530,7 +531,6 @@ extern int ldebugfs_register_stats(struct dentry *parent, const char *name,
 				   struct lprocfs_stats *stats);
 extern int lprocfs_register_stats(struct proc_dir_entry *root, const char *name,
 				  struct lprocfs_stats *stats);
-extern const struct file_operations ldebugfs_stats_seq_fops;
 
 /* lprocfs_status.c */
 extern int ldebugfs_add_vars(struct dentry *parent, struct ldebugfs_vars *var,
@@ -582,12 +582,10 @@ extern const struct file_operations lprocfs_evict_client_fops;
 int ldebugfs_seq_create(struct dentry *parent, const char *name, umode_t mode,
 			const struct file_operations *seq_fops, void *data);
 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 *dev, 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 */
@@ -765,13 +763,13 @@ static int name##_single_open(struct inode *inode, struct file *file)	\
 			   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)
@@ -812,10 +810,10 @@ static const struct file_operations name##_fops = {			\
 				   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 {
diff --git a/lustre/lmv/lproc_lmv.c b/lustre/lmv/lproc_lmv.c
index 95fe927d839a..dc35e7d9d9e6 100644
--- a/lustre/lmv/lproc_lmv.c
+++ b/lustre/lmv/lproc_lmv.c
@@ -143,12 +143,12 @@ static int lmv_target_seq_open(struct inode *inode, struct file *file)
 	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 */
 
diff --git a/lustre/lod/lod_pool.c b/lustre/lod/lod_pool.c
index 032d094dc0ad..8b6466208382 100644
--- a/lustre/lod/lod_pool.c
+++ b/lustre/lod/lod_pool.c
@@ -58,6 +58,7 @@
 #define DEBUG_SUBSYSTEM S_LOV
 
 #include <libcfs/libcfs.h>
+#include <libcfs/linux/linux-fs.h>
 #include <obd.h>
 #include "lod_internal.h"
 
@@ -407,7 +408,7 @@ static int pool_proc_open(struct inode *inode, struct file *file)
 	return rc;
 }
 
-static struct file_operations pool_proc_operations = {
+static struct proc_ops pool_proc_operations = {
 	.open		= pool_proc_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
diff --git a/lustre/lod/lproc_lod.c b/lustre/lod/lproc_lod.c
index 80c6d445d288..ea580a4c69ad 100644
--- a/lustre/lod/lproc_lod.c
+++ b/lustre/lod/lproc_lod.c
@@ -777,12 +777,12 @@ static struct lprocfs_vars lprocfs_lod_obd_vars[] = {
 	{ NULL }
 };
 
-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[] = {
diff --git a/lustre/lov/lov_pool.c b/lustre/lov/lov_pool.c
index 466c394ab805..269a7955c7d1 100644
--- a/lustre/lov/lov_pool.c
+++ b/lustre/lov/lov_pool.c
@@ -41,6 +41,7 @@
 #define DEBUG_SUBSYSTEM S_LOV
 
 #include <libcfs/libcfs.h>
+#include <libcfs/linux/linux-fs.h>
 
 #include <obd.h>
 #include "lov_internal.h"
@@ -282,11 +283,11 @@ static int pool_proc_open(struct inode *inode, struct file *file)
         return rc;
 }
 
-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 */
 
diff --git a/lustre/lov/lproc_lov.c b/lustre/lov/lproc_lov.c
index fca6a8c6feec..8865b8ac179a 100644
--- a/lustre/lov/lproc_lov.c
+++ b/lustre/lov/lproc_lov.c
@@ -269,12 +269,12 @@ struct lprocfs_vars lprocfs_lov_obd_vars[] = {
 	{ NULL }
 };
 
-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,
+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 */
 
diff --git a/lustre/mdt/mdt_fs.c b/lustre/mdt/mdt_fs.c
index 862d19ad202a..87645dec9130 100644
--- a/lustre/mdt/mdt_fs.c
+++ b/lustre/mdt/mdt_fs.c
@@ -36,14 +36,16 @@
 
 #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,
 };
 
 /**
diff --git a/lustre/mgs/lproc_mgs.c b/lustre/mgs/lproc_mgs.c
index 4a95b02ea601..f140d15111af 100644
--- a/lustre/mgs/lproc_mgs.c
+++ b/lustre/mgs/lproc_mgs.c
@@ -78,7 +78,7 @@ out:
 	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)
@@ -124,7 +124,7 @@ static int mgsself_srpc_seq_show(struct seq_file *seq, void *v)
 
         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)
 {
diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c
index 320e9dfb9f1d..e3967415ac2e 100644
--- a/lustre/obdclass/genops.c
+++ b/lustre/obdclass/genops.c
@@ -239,7 +239,7 @@ int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops,
 	if (enable_proc) {
 		type->typ_procroot = lprocfs_register(type->typ_name,
 						      proc_lustre_root,
-						      vars, type);
+						      NULL, type);
 		if (IS_ERR(type->typ_procroot)) {
 			rc = PTR_ERR(type->typ_procroot);
 			type->typ_procroot = NULL;
@@ -262,7 +262,7 @@ int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops,
 
 	type->typ_debugfs_entry = ldebugfs_register(type->typ_name,
 						    debugfs_lustre_root,
-						    NULL, type);
+						    vars, type);
 	if (IS_ERR_OR_NULL(type->typ_debugfs_entry)) {
 		rc = type->typ_debugfs_entry ? PTR_ERR(type->typ_debugfs_entry)
 					     : -ENOMEM;
diff --git a/lustre/obdclass/lprocfs_jobstats.c b/lustre/obdclass/lprocfs_jobstats.c
index d6d599f55c80..208d6bcde2b4 100644
--- a/lustre/obdclass/lprocfs_jobstats.c
+++ b/lustre/obdclass/lprocfs_jobstats.c
@@ -562,13 +562,13 @@ static int lprocfs_jobstats_seq_release(struct inode *inode, struct file *file)
 	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,
diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c
index 55546f83f7aa..5f1b2799b2f5 100644
--- a/lustre/obdclass/lprocfs_status.c
+++ b/lustre/obdclass/lprocfs_status.c
@@ -82,20 +82,29 @@ struct dentry *ldebugfs_add_simple(struct dentry *root,
 }
 EXPORT_SYMBOL(ldebugfs_add_simple);
 
+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",
@@ -166,7 +175,7 @@ int ldebugfs_add_vars(struct dentry *parent, struct ldebugfs_vars *list,
 }
 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.
@@ -188,16 +197,12 @@ lprocfs_add_vars(struct proc_dir_entry *root, struct lprocfs_vars *list,
 
 	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);
@@ -1589,7 +1594,7 @@ int ldebugfs_register_stats(struct dentry *parent, const char *name,
 	LASSERT(!IS_ERR_OR_NULL(parent));
 
 	entry = debugfs_create_file(name, 0644, parent, stats,
-				    &lprocfs_stats_seq_fops);
+				    &ldebugfs_stats_seq_fops);
 	if (IS_ERR_OR_NULL(entry))
 		return entry ? PTR_ERR(entry) : -ENOMEM;
 
@@ -1597,13 +1602,13 @@ int ldebugfs_register_stats(struct dentry *parent, const char *name,
 }
 EXPORT_SYMBOL_GPL(ldebugfs_register_stats);
 
-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,
@@ -2149,14 +2154,14 @@ EXPORT_SYMBOL_GPL(ldebugfs_seq_create);
 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 == NULL) == ((mode & 0222) == 0));
 
 	entry = proc_create_data(name, mode, parent, seq_fops, data);
 
@@ -2170,7 +2175,7 @@ EXPORT_SYMBOL(lprocfs_seq_create);
 int lprocfs_obd_seq_create(struct obd_device *dev,
 			   const char *name,
 			   mode_t mode,
-			   const struct file_operations *seq_fops,
+			   const struct proc_ops *seq_fops,
 			   void *data)
 {
         return (lprocfs_seq_create(dev->obd_proc_entry, name,
diff --git a/lustre/ptlrpc/gss/lproc_gss.c b/lustre/ptlrpc/gss/lproc_gss.c
index aa8851e6745a..4ae0e35ae76e 100644
--- a/lustre/ptlrpc/gss/lproc_gss.c
+++ b/lustre/ptlrpc/gss/lproc_gss.c
@@ -128,8 +128,8 @@ gss_proc_write_secinit(struct file *file, const char *buffer,
 	return count;
 }
 
-static const struct file_operations gss_proc_secinit = {
-	.write = gss_proc_write_secinit,
+static const struct proc_ops gss_proc_secinit = {
+	.proc_write = gss_proc_write_secinit,
 };
 
 int sptlrpc_krb5_allow_old_client_csum_seq_show(struct seq_file *m, void *data)
@@ -152,9 +152,9 @@ ssize_t sptlrpc_krb5_allow_old_client_csum_seq_write(struct file *file,
 	krb5_allow_old_client_csum = val;
 	return count;
 }
-LDEBUFS_SEQ_FOPS(sptlrpc_krb5_allow_old_client_csum);
+LPROC_SEQ_FOPS(sptlrpc_krb5_allow_old_client_csum);
 
-static struct ldebugfs_vars gss_lprocfs_vars[] = {
+static struct lprocfs_vars gss_lprocfs_vars[] = {
 	{ .name	=	"replays",
 	  .fops	=	&gss_proc_oos_fops	},
 	{ .name	=	"init_channel",
@@ -196,9 +196,9 @@ gss_lk_proc_dl_seq_write(struct file *file, const char __user *buffer,
 
 	return count;
 }
-LDEBUGFS_SEQ_FOPS(gss_lk_proc_dl);
+LPROC_SEQ_FOPS(gss_lk_proc_dl);
 
-static struct ldebugfs_vars gss_lk_lprocfs_vars[] = {
+static struct lprocfs_vars gss_lk_lprocfs_vars[] = {
 	{ .name	=	"debug_level",
 	  .fops	=	&gss_lk_proc_dl_fops	},
 	{ NULL }
diff --git a/lustre/ptlrpc/nodemap_lproc.c b/lustre/ptlrpc/nodemap_lproc.c
index 87a49a2f79e3..0ec091515de2 100644
--- a/lustre/ptlrpc/nodemap_lproc.c
+++ b/lustre/ptlrpc/nodemap_lproc.c
@@ -1244,21 +1244,21 @@ LPROC_SEQ_FOPS_RO(nodemap_deny_unknown);
 LPROC_SEQ_FOPS_RO(nodemap_map_mode);
 LPROC_SEQ_FOPS_RO(nodemap_audit_mode);
 
-const struct file_operations nodemap_ranges_fops = {
+const struct proc_ops nodemap_ranges_fops = {
 	.open			= nodemap_ranges_open,
 	.read			= seq_read,
 	.llseek			= seq_lseek,
 	.release		= single_release
 };
 
-const struct file_operations nodemap_idmap_fops = {
+const struct proc_ops nodemap_idmap_fops = {
 	.open			= nodemap_idmap_open,
 	.read			= seq_read,
 	.llseek			= seq_lseek,
 	.release		= single_release
 };
 
-const struct file_operations nodemap_exports_fops = {
+const struct proc_ops nodemap_exports_fops = {
 	.open			= nodemap_exports_open,
 	.read			= seq_read,
 	.llseek			= seq_lseek,
diff --git a/lustre/ptlrpc/sec_lproc.c b/lustre/ptlrpc/sec_lproc.c
index 5e3c9084b5f2..4f8efe44aa67 100644
--- a/lustre/ptlrpc/sec_lproc.c
+++ b/lustre/ptlrpc/sec_lproc.c
@@ -141,7 +141,7 @@ out:
 LDEBUGFS_SEQ_FOPS_RO(sptlrpc_ctxs_lprocfs);
 
 static ssize_t
-lprocfs_sptlrpc_sepol_seq_write(struct file *file, const char __user *buffer,
+ldebugfs_sptlrpc_sepol_seq_write(struct file *file, const char __user *buffer,
 				size_t count, void *data)
 {
 	struct seq_file	*seq = file->private_data;
@@ -207,7 +207,7 @@ out:
 
 	return rc ? rc : count;
 }
-LDEBUGFS_SEQ_FOPS_WR_ONLY(srpc, sptlrpc_sepol);
+LDEBUGFS_FOPS_WR_ONLY(srpc, sptlrpc_sepol);
 
 int sptlrpc_lprocfs_cliobd_attach(struct obd_device *dev)
 {
@@ -251,8 +251,8 @@ int sptlrpc_lprocfs_cliobd_attach(struct obd_device *dev)
 }
 EXPORT_SYMBOL(sptlrpc_lprocfs_cliobd_attach);
 
-LDEBUGFS_SEQ_FOPS_RO(sptlrpc_proc_enc_pool);
-static struct ldebugfs_vars sptlrpc_lprocfs_vars[] = {
+LPROC_SEQ_FOPS_RO(sptlrpc_proc_enc_pool);
+static struct lprocfs_vars sptlrpc_lprocfs_vars[] = {
 	{ .name	=	"encrypt_page_pools",
 	  .fops	=	&sptlrpc_proc_enc_pool_fops	},
 	{ NULL }
diff --git a/lustre/quota/lproc_quota.c b/lustre/quota/lproc_quota.c
index a9a3b0b12630..678a8b6dc5ed 100644
--- a/lustre/quota/lproc_quota.c
+++ b/lustre/quota/lproc_quota.c
@@ -356,11 +356,11 @@ static int lprocfs_quota_seq_release(struct inode *inode, struct file *file)
 	return seq_release(inode, file);
 }
 
-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,
+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 */
diff --git a/lustre/quota/lquota_internal.h b/lustre/quota/lquota_internal.h
index dc0ddd8a9a78..424aaf57452a 100644
--- a/lustre/quota/lquota_internal.h
+++ b/lustre/quota/lquota_internal.h
@@ -437,7 +437,7 @@ int qmt_glb_init(void);
 void qmt_glb_fini(void);
 
 /* lproc_quota.c */
-extern struct file_operations lprocfs_quota_seq_fops;
+extern struct proc_ops lprocfs_quota_seq_fops;
 
 /* qsd_lib.c */
 int qsd_glb_init(void);
-- 
2.41.0

openSUSE Build Service is sponsored by