Skip to contentSkip to conversation

staging:lustre: get rid of IOC_LIBCFS_MEMHOG and IOC_LIBCFS_PANIC ioctls

PATCH In review James Simmons 3 participants 11 messages Jan 5, 2016 – Feb 12, 2016 Staging

lore
Share & tools
lore
#0 lore raw

cover staging:lustre: get rid of IOC_LIBCFS_MEMHOG and IOC_LIBCFS_PANIC ioctls

Removing unused IOC_LIBCFS_MEMHOG and IOC_LIBCFS_PANIC ioctls from the libcfs/ lnet/ code. This cleanup allows us to remove the cfs_psdev abstraction.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5844
Reviewed-on: http://review.whamcloud.com/17492

Parinay Kondekar (7):
staging:lustre: remove obsolete comment in libcfs_ioctl.h staging:lustre: remove last bits of the IOC_LIBCFS_PANIC ioctl staging:lustre: remove the IOC_LIBCFS_MEMHOG ioctl staging:lustre: remove struct libcfs_device_userstate staging:lustre: simplify libcfs_psdev_[open|release] staging:lustre: call libcfs_ioctl directly staging:lustre: remove libcfs pseudo device abstraction

 .../staging/lustre/include/linux/libcfs/libcfs.h   |   23 +---
 .../lustre/include/linux/libcfs/libcfs_ioctl.h     |    5 +-
 .../lustre/include/linux/libcfs/libcfs_private.h   |    5 -
 .../staging/lustre/include/linux/lnet/lnetctl.h    |    2 -
 .../lustre/lustre/libcfs/linux/linux-module.c      |   54 +-----
 drivers/staging/lustre/lustre/libcfs/module.c      |  175 +-------------------
 6 files changed, 19 insertions(+), 245 deletions(-)
#1 lore raw

PATCH 1/7 staging:lustre: remove obsolete comment in libcfs_ioctl.h

From: Parinay Kondekar <[email protected]>

The libcfs_ioctl.h header has a comment about a snapshot ioctl which has been removed for years. Lets remove the comment to avoid confusion. Broken out of patch 17492.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5844
Reviewed-on: http://review.whamcloud.com/17492

---
 .../lustre/include/linux/libcfs/libcfs_ioctl.h     |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h +0 -1
index 485ab26..ba47cdf 100644
@@ -102,7 +102,6 @@ struct libcfs_ioctl_handler {
 /* FIXME check conflict with lustre_lib.h */
 #define LIBCFS_IOC_DEBUG_MASK	     _IOWR('f', 250, long)
 
-/* ioctls for manipulating snapshots 30- */
 #define IOC_LIBCFS_TYPE		   'e'
 #define IOC_LIBCFS_MIN_NR		 30
 /* libcfs ioctls */
Signature · 1 line
1.7.1
#2 lore raw

Re: [PATCH 1/7] staging:lustre: remove obsolete comment in libcfs_ioctl.h

Quoted 10 lines · James Simmons

From: Parinay Kondekar <[email protected]>

The libcfs_ioctl.h header has a comment about a snapshot ioctl which has been removed for years. Lets remove the comment to avoid confusion. Broken out of patch 17492.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5844
Reviewed-on: http://review.whamcloud.com/17492

Quoted 7 lines
---
 .../lustre/include/linux/libcfs/libcfs_ioctl.h     |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

Only this patch applied in this series, please rebase the rest of them (fixing up the one I pointed out) and resend.

thanks,

greg k-h

#3 lore raw

PATCH 2/7 staging:lustre: remove last bits of the IOC_LIBCFS_PANIC ioctl

In reply to James Simmons

From: Parinay Kondekar <[email protected]>

A few pieces still exist for the IOC_LIBCFS_PANIC ioctl. Remove these last bits to prevent old tools from using them. The latest lustre utilities no longer use this ioctl.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5844
Reviewed-on: http://review.whamcloud.com/17492

---
 .../lustre/include/linux/libcfs/libcfs_ioctl.h     |    2 +-
 .../staging/lustre/include/linux/lnet/lnetctl.h    |    1 -
 .../lustre/lustre/libcfs/linux/linux-module.c      |    5 -----
 drivers/staging/lustre/lustre/libcfs/module.c      |    5 +----
 4 files changed, 2 insertions(+), 11 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h +1 -1
index ba47cdf..b0d5c78 100644
@@ -105,7 +105,7 @@ struct libcfs_ioctl_handler {
 #define IOC_LIBCFS_TYPE		   'e'
 #define IOC_LIBCFS_MIN_NR		 30
 /* libcfs ioctls */
-#define IOC_LIBCFS_PANIC		   _IOWR('e', 30, long)
+/* IOC_LIBCFS_PANIC obsolete in 2.8.0, was _IOWR('e', 30, IOCTL_LIBCFS_TYPE) */
 #define IOC_LIBCFS_CLEAR_DEBUG	     _IOWR('e', 31, long)
 #define IOC_LIBCFS_MARK_DEBUG	      _IOWR('e', 32, long)
 #define IOC_LIBCFS_MEMHOG		  _IOWR('e', 36, long)
drivers/staging/lustre/include/linux/lnet/lnetctl.h +0 -1
index bdd69b2..b9ec555 100644
@@ -74,6 +74,5 @@ int jt_dbg_debug_file(int argc, char **argv);
 int jt_dbg_clear_debug_buf(int argc, char **argv);
 int jt_dbg_mark_debug_buf(int argc, char **argv);
 int jt_dbg_modules(int argc, char **argv);
-int jt_dbg_panic(int argc, char **argv);
 
 #endif
drivers/staging/lustre/lustre/libcfs/linux/linux-module.c +0 -5
index 70a99cf..4ade712 100644
@@ -147,11 +147,6 @@ static long libcfs_ioctl(struct file *file,
 
 	/* Handle platform-dependent IOC requests */
 	switch (cmd) {
-	case IOC_LIBCFS_PANIC:
-		if (!capable(CFS_CAP_SYS_BOOT))
-			return -EPERM;
-		panic("debugctl-invoked panic");
-		return 0;
 	case IOC_LIBCFS_MEMHOG:
 		if (!capable(CFS_CAP_SYS_ADMIN))
 			return -EPERM;
drivers/staging/lustre/lustre/libcfs/module.c +1 -4
index 329d78c..1ad67c6 100644
@@ -250,10 +250,7 @@ static int libcfs_ioctl_int(struct cfs_psdev_file *pfile, unsigned long cmd,
 	case IOC_LIBCFS_CLEAR_DEBUG:
 		libcfs_debug_clear_buffer();
 		return 0;
-	/*
-	 * case IOC_LIBCFS_PANIC:
-	 * Handled in arch/cfs_module.c
-	 */
+
 	case IOC_LIBCFS_MARK_DEBUG:
 		if (data->ioc_inlbuf1 == NULL ||
 		    data->ioc_inlbuf1[data->ioc_inllen1 - 1] != '\0')
Signature · 1 line
1.7.1
#4 lore raw

PATCH 3/7 staging:lustre: remove the IOC_LIBCFS_MEMHOG ioctl

In reply to James Simmons

From: Parinay Kondekar <[email protected]>

The IOC_LIBCFS_MEMHOG is not needed so remove it.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5844
Reviewed-on: http://review.whamcloud.com/17492

---
 .../lustre/include/linux/libcfs/libcfs_ioctl.h     |    2 +-
 .../staging/lustre/include/linux/lnet/lnetctl.h    |    1 -
 .../lustre/lustre/libcfs/linux/linux-module.c      |    8 --
 drivers/staging/lustre/lustre/libcfs/module.c      |  125 +-------------------
 4 files changed, 2 insertions(+), 134 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h +1 -1
index b0d5c78..7e8ccf6 100644
@@ -108,7 +108,7 @@ struct libcfs_ioctl_handler {
 /* IOC_LIBCFS_PANIC obsolete in 2.8.0, was _IOWR('e', 30, IOCTL_LIBCFS_TYPE) */
 #define IOC_LIBCFS_CLEAR_DEBUG	     _IOWR('e', 31, long)
 #define IOC_LIBCFS_MARK_DEBUG	      _IOWR('e', 32, long)
-#define IOC_LIBCFS_MEMHOG		  _IOWR('e', 36, long)
+/* IOC_LIBCFS_MEMHOG obsolete in 2.8.0, was _IOWR('e', 36, IOCTL_LIBCFS_TYPE) */
 /* lnet ioctls */
 #define IOC_LIBCFS_GET_NI		  _IOWR('e', 50, long)
 #define IOC_LIBCFS_FAIL_NID		_IOWR('e', 51, long)
drivers/staging/lustre/include/linux/lnet/lnetctl.h +0 -1
index b9ec555..a437bf0 100644
@@ -62,7 +62,6 @@ int jt_ptl_print_routes(int argc, char **argv);
 int jt_ptl_fail_nid(int argc, char **argv);
 int jt_ptl_lwt(int argc, char **argv);
 int jt_ptl_testprotocompat(int argc, char **argv);
-int jt_ptl_memhog(int argc, char **argv);
 
 int dbg_initialize(int argc, char **argv);
 int jt_dbg_filter(int argc, char **argv);
drivers/staging/lustre/lustre/libcfs/linux/linux-module.c +0 -8
index 4ade712..0dffff7 100644
@@ -145,14 +145,6 @@ static long libcfs_ioctl(struct file *file,
 		return -EINVAL;
 	}
 
-	/* Handle platform-dependent IOC requests */
-	switch (cmd) {
-	case IOC_LIBCFS_MEMHOG:
-		if (!capable(CFS_CAP_SYS_ADMIN))
-			return -EPERM;
-		/* go thought */
-	}
-
 	pfile.off = 0;
 	pfile.private_data = file->private_data;
 	if (libcfs_psdev_ops.p_ioctl != NULL)
drivers/staging/lustre/lustre/libcfs/module.c +1 -124

144 lines not on this page · raw message

Signature · 1 line
1.7.1
#5 lore raw

PATCH 4/7 staging:lustre: remove struct libcfs_device_userstate

In reply to James Simmons

From: Parinay Kondekar <[email protected]>

With the removal of the IOC_LIBCFS_MEMHOG ioctl we no longer need struct libcfs_device_userstate.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5844
Reviewed-on: http://review.whamcloud.com/17492

---
 .../lustre/include/linux/libcfs/libcfs_private.h   |    5 -----
 .../lustre/lustre/libcfs/linux/linux-module.c      |    8 ++------
 drivers/staging/lustre/lustre/libcfs/module.c      |   16 ----------------
 3 files changed, 2 insertions(+), 27 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_private.h +0 -5
index d6273e1..e044d6f 100644
@@ -391,11 +391,6 @@ int cfs_percpt_atomic_summary(atomic_t **refs);
  * Support for temporary event tracing with minimal Heisenberg effect.
  * -------------------------------------------------------------------- */
 
-struct libcfs_device_userstate {
-	int	   ldu_memhog_pages;
-	struct page   *ldu_memhog_root_page;
-};
-
 #define MKSTR(ptr) ((ptr)) ? (ptr) : ""
 
 static inline int cfs_size_round4(int val)
drivers/staging/lustre/lustre/libcfs/linux/linux-module.c +2 -6
index 0dffff7..33f6036 100644
@@ -98,14 +98,12 @@ int libcfs_ioctl_popdata(void *arg, void *data, int size)
 static int
 libcfs_psdev_open(struct inode *inode, struct file *file)
 {
-	struct libcfs_device_userstate **pdu = NULL;
 	int    rc = 0;
 
 	if (!inode)
 		return -EINVAL;
-	pdu = (struct libcfs_device_userstate **)&file->private_data;
 	if (libcfs_psdev_ops.p_open != NULL)
-		rc = libcfs_psdev_ops.p_open(0, (void *)pdu);
+		rc = libcfs_psdev_ops.p_open(0, NULL);
 	else
 		return -EPERM;
 	return rc;
@@ -115,14 +113,12 @@ libcfs_psdev_open(struct inode *inode, struct file *file)
 static int
 libcfs_psdev_release(struct inode *inode, struct file *file)
 {
-	struct libcfs_device_userstate *pdu;
 	int    rc = 0;
 
 	if (!inode)
 		return -EINVAL;
-	pdu = file->private_data;
 	if (libcfs_psdev_ops.p_close != NULL)
-		rc = libcfs_psdev_ops.p_close(0, (void *)pdu);
+		rc = libcfs_psdev_ops.p_close(0, NULL);
 	else
 		rc = -EPERM;
 	return rc;
drivers/staging/lustre/lustre/libcfs/module.c +0 -16
index 286c53f..80d2333 100644
@@ -71,29 +71,13 @@ static struct dentry *lnet_debugfs_root;
 /* called when opening /dev/device */
 static int libcfs_psdev_open(unsigned long flags, void *args)
 {
-	struct libcfs_device_userstate *ldu;
-
 	try_module_get(THIS_MODULE);
-
-	LIBCFS_ALLOC(ldu, sizeof(*ldu));
-	if (ldu != NULL) {
-		ldu->ldu_memhog_pages = 0;
-		ldu->ldu_memhog_root_page = NULL;
-	}
-	*(struct libcfs_device_userstate **)args = ldu;
-
 	return 0;
 }
 
 /* called when closing /dev/device */
 static int libcfs_psdev_release(unsigned long flags, void *args)
 {
-	struct libcfs_device_userstate *ldu;
-
-	ldu = (struct libcfs_device_userstate *)args;
-	if (ldu != NULL)
-		LIBCFS_FREE(ldu, sizeof(*ldu));
-
 	module_put(THIS_MODULE);
 	return 0;
 }
Signature · 1 line
1.7.1
#6 lore raw

PATCH 5/7 staging:lustre: simplify libcfs_psdev_[open|release]

In reply to James Simmons

From: Parinay Kondekar <[email protected]>

With struct libcfs_device_userstate gone we can move the remaining code of libcfs_psdev_ops.p_[open|close] into the libcfs_psdev_[open|release] functions directly.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5844
Reviewed-on: http://review.whamcloud.com/17492

---
 .../staging/lustre/include/linux/libcfs/libcfs.h   |    2 --
 .../lustre/lustre/libcfs/linux/linux-module.c      |   20 ++++++--------------
 drivers/staging/lustre/lustre/libcfs/module.c      |   16 ----------------
 3 files changed, 6 insertions(+), 32 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs.h +0 -2
index 0d8a91e..06bb676 100644
@@ -73,8 +73,6 @@ struct cfs_psdev_file {
 };
 
 struct cfs_psdev_ops {
-	int (*p_open)(unsigned long, void *);
-	int (*p_close)(unsigned long, void *);
 	int (*p_read)(struct cfs_psdev_file *, char *, unsigned long);
 	int (*p_write)(struct cfs_psdev_file *, char *, unsigned long);
 	int (*p_ioctl)(struct cfs_psdev_file *, unsigned long, void *);
drivers/staging/lustre/lustre/libcfs/linux/linux-module.c +6 -14
index 33f6036..64f0fbf 100644
@@ -98,30 +98,22 @@ int libcfs_ioctl_popdata(void *arg, void *data, int size)
 static int
 libcfs_psdev_open(struct inode *inode, struct file *file)
 {
-	int    rc = 0;
-
 	if (!inode)
 		return -EINVAL;
-	if (libcfs_psdev_ops.p_open != NULL)
-		rc = libcfs_psdev_ops.p_open(0, NULL);
-	else
-		return -EPERM;
-	return rc;
+
+	try_module_get(THIS_MODULE);
+	return 0;
 }
 
 /* called when closing /dev/device */
 static int
 libcfs_psdev_release(struct inode *inode, struct file *file)
 {
-	int    rc = 0;
-
 	if (!inode)
 		return -EINVAL;
-	if (libcfs_psdev_ops.p_close != NULL)
-		rc = libcfs_psdev_ops.p_close(0, NULL);
-	else
-		rc = -EPERM;
-	return rc;
+
+	module_put(THIS_MODULE);
+	return 0;
 }
 
 static long libcfs_ioctl(struct file *file,
drivers/staging/lustre/lustre/libcfs/module.c +0 -16
index 80d2333..8a8a533 100644
@@ -68,20 +68,6 @@ MODULE_LICENSE("GPL");
 
 static struct dentry *lnet_debugfs_root;
 
-/* called when opening /dev/device */
-static int libcfs_psdev_open(unsigned long flags, void *args)
-{
-	try_module_get(THIS_MODULE);
-	return 0;
-}
-
-/* called when closing /dev/device */
-static int libcfs_psdev_release(unsigned long flags, void *args)
-{
-	module_put(THIS_MODULE);
-	return 0;
-}
-
 static DECLARE_RWSEM(ioctl_list_sem);
 static LIST_HEAD(ioctl_list);
 
@@ -180,8 +166,6 @@ out:
 }
 
 struct cfs_psdev_ops libcfs_psdev_ops = {
-	libcfs_psdev_open,
-	libcfs_psdev_release,
 	NULL,
 	NULL,
 	libcfs_ioctl
Signature · 1 line
1.7.1
#7 lore raw

Re: [PATCH 5/7] staging:lustre: simplify libcfs_psdev_[open|release]

Quoted 42 lines · James Simmons

From: Parinay Kondekar <[email protected]>

With struct libcfs_device_userstate gone we can move the remaining code of libcfs_psdev_ops.p_[open|close] into the libcfs_psdev_[open|release] functions directly.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5844
Reviewed-on: http://review.whamcloud.com/17492

---
 .../staging/lustre/include/linux/libcfs/libcfs.h   |    2 --
 .../lustre/lustre/libcfs/linux/linux-module.c      |   20 ++++++--------------
 drivers/staging/lustre/lustre/libcfs/module.c      |   16 ----------------
 3 files changed, 6 insertions(+), 32 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs.h +0 -2
index 0d8a91e..06bb676 100644
@@ -73,8 +73,6 @@ struct cfs_psdev_file {
 };
 
 struct cfs_psdev_ops {
-	int (*p_open)(unsigned long, void *);
-	int (*p_close)(unsigned long, void *);
 	int (*p_read)(struct cfs_psdev_file *, char *, unsigned long);
 	int (*p_write)(struct cfs_psdev_file *, char *, unsigned long);
 	int (*p_ioctl)(struct cfs_psdev_file *, unsigned long, void *);
drivers/staging/lustre/lustre/libcfs/linux/linux-module.c +0 -1
index 33f6036..64f0fbf 100644
@@ -98,30 +98,22 @@ int libcfs_ioctl_popdata(void *arg, void *data, int size)
 static int
 libcfs_psdev_open(struct inode *inode, struct file *file)
 {
-	int    rc = 0;

drivers/staging/lustre/lustre/libcfs/linux/linux-module.c int libcfs_ioctl_popdata(void *arg, void *data, int size) · line 104

Quoted 10 lines
drivers/staging/lustre/lustre/libcfs/linux/linux-module.c +2 -6
-
 	if (!inode)
 		return -EINVAL;
-	if (libcfs_psdev_ops.p_open != NULL)
-		rc = libcfs_psdev_ops.p_open(0, NULL);
-	else
-		return -EPERM;
-	return rc;
+
+	try_module_get(THIS_MODULE);

Note, code like this is racy and incorrect and never needed, please fix this up properly (hint, set the module in the file operations.)

Again, if you ever see code with that line, it is incorrect.

thanks,

greg k-h

#8 lore raw

RE: [lustre-devel] [PATCH 5/7] staging:lustre: simplify libcfs_psdev_[open|release]

Quoted 23 lines
Quoted 9 lines
drivers/staging/lustre/lustre/libcfs/linux/linux-module.c +0 -1
index 33f6036..64f0fbf 100644
@@ -98,30 +98,22 @@ int libcfs_ioctl_popdata(void *arg, void *data, int size)
 static int
 libcfs_psdev_open(struct inode *inode, struct file *file)
 {
-	int    rc = 0;

drivers/staging/lustre/lustre/libcfs/linux/linux-module.c int libcfs_ioctl_popdata(void *arg, void *data, int size) · line 104

Quoted 10 lines
drivers/staging/lustre/lustre/libcfs/linux/linux-module.c +2 -6
-
 	if (!inode)
 		return -EINVAL;
-	if (libcfs_psdev_ops.p_open != NULL)
-		rc = libcfs_psdev_ops.p_open(0, NULL);
-	else
-		return -EPERM;
-	return rc;
+
+	try_module_get(THIS_MODULE);

Note, code like this is racy and incorrect and never needed, please fix this up properly (hint, set the module in the file operations.)

Quoted 1 line

Again, if you ever see code with that line, it is incorrect.

So simple

static struct file_operations libcfs_fops = {
.module = THIS_MODULE,
.unlocked_ioctl = libcfs_psdev_ioctl,
};

With the open and release deleted should do the trick then.

#9 lore raw

PATCH 6/7 staging:lustre: call libcfs_ioctl directly

In reply to James Simmons

From: Parinay Kondekar <[email protected]>

No reason to go through the cfs_psdev_ops abstract to call libcfs_ioctl. Just call libcfs_ioctl directly.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5844
Reviewed-on: http://review.whamcloud.com/17492

---
 .../staging/lustre/include/linux/libcfs/libcfs.h   |    2 +-
 .../lustre/lustre/libcfs/linux/linux-module.c      |   13 ++++---------
 drivers/staging/lustre/lustre/libcfs/module.c      |    4 ++--
 3 files changed, 7 insertions(+), 12 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs.h +1 -1
index 06bb676..38d65ee 100644
@@ -75,8 +75,8 @@ struct cfs_psdev_file {
 struct cfs_psdev_ops {
 	int (*p_read)(struct cfs_psdev_file *, char *, unsigned long);
 	int (*p_write)(struct cfs_psdev_file *, char *, unsigned long);
-	int (*p_ioctl)(struct cfs_psdev_file *, unsigned long, void *);
 };
+int libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd, void *arg);
 
 /*
  * Drop into debugger, if possible. Implementation is provided by platform.
drivers/staging/lustre/lustre/libcfs/linux/linux-module.c +4 -9
index 64f0fbf..0710d0b 100644
@@ -116,11 +116,10 @@ libcfs_psdev_release(struct inode *inode, struct file *file)
 	return 0;
 }
 
-static long libcfs_ioctl(struct file *file,
-			 unsigned int cmd, unsigned long arg)
+static long
+libcfs_psdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
 	struct cfs_psdev_file	 pfile;
-	int    rc = 0;
 
 	if (!capable(CAP_SYS_ADMIN))
 		return -EACCES;
@@ -135,15 +134,11 @@ static long libcfs_ioctl(struct file *file,
 
 	pfile.off = 0;
 	pfile.private_data = file->private_data;
-	if (libcfs_psdev_ops.p_ioctl != NULL)
-		rc = libcfs_psdev_ops.p_ioctl(&pfile, cmd, (void *)arg);
-	else
-		rc = -EPERM;
-	return rc;
+	return libcfs_ioctl(&pfile, cmd, (void __user *)arg);
 }
 
 static const struct file_operations libcfs_fops = {
-	.unlocked_ioctl	= libcfs_ioctl,
+	.unlocked_ioctl	= libcfs_psdev_ioctl,
 	.open		= libcfs_psdev_open,
 	.release	= libcfs_psdev_release,
 };
drivers/staging/lustre/lustre/libcfs/module.c +2 -2
index 8a8a533..63b2b37 100644
@@ -140,7 +140,8 @@ static int libcfs_ioctl_int(struct cfs_psdev_file *pfile, unsigned long cmd,
 	return err;
 }
 
-static int libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd, void *arg)
+int
+libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd, void *arg)
 {
 	char    *buf;
 	struct libcfs_ioctl_data *data;
@@ -168,7 +169,6 @@ out:
 struct cfs_psdev_ops libcfs_psdev_ops = {
 	NULL,
 	NULL,
-	libcfs_ioctl
 };
 
 static int proc_call_handler(void *data, int write, loff_t *ppos,
Signature · 1 line
1.7.1
#10 lore raw

PATCH 7/7 staging:lustre: remove libcfs pseudo device abstraction

In reply to James Simmons

From: Parinay Kondekar <[email protected]>

With the libcfs ioctl cleanup we no longer need the libcfs pseudo device abstraction.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5844
Reviewed-on: http://review.whamcloud.com/17492

---
 .../staging/lustre/include/linux/libcfs/libcfs.h   |   21 +-------------------
 .../lustre/lustre/libcfs/linux/linux-module.c      |    6 +----
 drivers/staging/lustre/lustre/libcfs/module.c      |   13 +++--------
 3 files changed, 6 insertions(+), 34 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs.h +1 -20
index 38d65ee..6995367 100644
@@ -59,24 +59,7 @@
 #define LNET_ACCEPTOR_MIN_RESERVED_PORT    512
 #define LNET_ACCEPTOR_MAX_RESERVED_PORT    1023
 
-/*
- * libcfs pseudo device operations
- *
- * It's just draft now.
- */
-
-struct cfs_psdev_file {
-	unsigned long   off;
-	void	    *private_data;
-	unsigned long   reserved1;
-	unsigned long   reserved2;
-};
-
-struct cfs_psdev_ops {
-	int (*p_read)(struct cfs_psdev_file *, char *, unsigned long);
-	int (*p_write)(struct cfs_psdev_file *, char *, unsigned long);
-};
-int libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd, void *arg);
+int libcfs_ioctl(unsigned long cmd, void *arg);
 
 /*
  * Drop into debugger, if possible. Implementation is provided by platform.
@@ -143,8 +126,6 @@ extern struct miscdevice libcfs_dev;
 extern char lnet_upcall[1024];
 extern char lnet_debug_log_upcall[1024];
 
-extern struct cfs_psdev_ops libcfs_psdev_ops;
-
 extern struct cfs_wi_sched *cfs_sched_rehash;
 
 struct lnet_debugfs_symlink_def {
drivers/staging/lustre/lustre/libcfs/linux/linux-module.c +1 -5
index 0710d0b..02ef039 100644
@@ -119,8 +119,6 @@ libcfs_psdev_release(struct inode *inode, struct file *file)
 static long
 libcfs_psdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
-	struct cfs_psdev_file	 pfile;
-
 	if (!capable(CAP_SYS_ADMIN))
 		return -EACCES;
 
@@ -132,9 +130,7 @@ libcfs_psdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 		return -EINVAL;
 	}
 
-	pfile.off = 0;
-	pfile.private_data = file->private_data;
-	return libcfs_ioctl(&pfile, cmd, (void __user *)arg);
+	return libcfs_ioctl(cmd, (void __user *)arg);
 }
 
 static const struct file_operations libcfs_fops = {
drivers/staging/lustre/lustre/libcfs/module.c +4 -9
index 63b2b37..1c8da7d 100644
@@ -101,8 +101,8 @@ int libcfs_deregister_ioctl(struct libcfs_ioctl_handler *hand)
 }
 EXPORT_SYMBOL(libcfs_deregister_ioctl);
 
-static int libcfs_ioctl_int(struct cfs_psdev_file *pfile, unsigned long cmd,
-			    void *arg, struct libcfs_ioctl_data *data)
+static int
+libcfs_ioctl_int(unsigned long cmd, void *arg, struct libcfs_ioctl_data *data)
 {
 	int err = -EINVAL;
 
@@ -141,7 +141,7 @@ static int libcfs_ioctl_int(struct cfs_psdev_file *pfile, unsigned long cmd,
 }
 
 int
-libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd, void *arg)
+libcfs_ioctl(unsigned long cmd, void *arg)
 {
 	char    *buf;
 	struct libcfs_ioctl_data *data;
@@ -159,18 +159,13 @@ libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd, void *arg)
 	}
 	data = (struct libcfs_ioctl_data *)buf;
 
-	err = libcfs_ioctl_int(pfile, cmd, arg, data);
+	err = libcfs_ioctl_int(cmd, arg, data);
 
 out:
 	LIBCFS_FREE(buf, 1024);
 	return err;
 }
 
-struct cfs_psdev_ops libcfs_psdev_ops = {
-	NULL,
-	NULL,
-};
-
 static int proc_call_handler(void *data, int write, loff_t *ppos,
 		void __user *buffer, size_t *lenp,
 		int (*handler)(void *data, int write,
Signature · 1 line
1.7.1