linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] orangefs uapi
@ 2018-01-26 19:07 Martin Brandenburg
  2018-01-26 19:07 ` [PATCH 1/7] orangefs: make orangefs_client_debug_init static Martin Brandenburg
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Martin Brandenburg @ 2018-01-26 19:07 UTC (permalink / raw)
  To: hubcap, linux-kernel, linux-fsdevel, devel; +Cc: Martin Brandenburg

First delete a good bit of dead code and change a few things to static.

Then move userspace visible interface to uapi.

This isn't immediately helpful without userspace consumers.  This should
be helpful to your [Mike's] work with OrangeFS 3.0.  We will need to
translate between OrangeFS internal data structures and kernel interface
data structures in the pvfs2-client-core.

I have also written a "fakecore" which does about the bare minimum to
start up and respond to mount requests.  I intend to use this as a
vehicle for experimentation with fuzzing and testing performance through
our kernel code without the rest of OrangeFS running.

We'll want to consider whether any names in here should be changed
before setting this in stone.  Most start with orangefs but there's a
few outliers.  Particularly struct ORANGEFS_sys_attr_s contains some
fields which the kernel doesn't need to know.

Martin Brandenburg (7):
  orangefs: make orangefs_client_debug_init static
  orangefs: remove gossip_ldebug and gossip_lerr
  orangefs: remove ORANGEFS_KERNEL_DEBUG
  orangefs: make orangefs_make_bad_inode static
  ornagefs: make several *_operations structs static
  orangefs: remove unused code
  orangefs: create uapi interface

 fs/orangefs/acl.c                |   1 -
 fs/orangefs/dcache.c             |   1 -
 fs/orangefs/devorangefs-req.c    |  54 ++-
 fs/orangefs/dir.c                |   1 -
 fs/orangefs/downcall.h           | 137 --------
 fs/orangefs/file.c               |   1 -
 fs/orangefs/inode.c              |   5 +-
 fs/orangefs/namei.c              |   1 -
 fs/orangefs/orangefs-bufmap.c    |   1 -
 fs/orangefs/orangefs-cache.c     |   1 -
 fs/orangefs/orangefs-debug.h     |  33 --
 fs/orangefs/orangefs-debugfs.c   |   8 +-
 fs/orangefs/orangefs-debugfs.h   |   1 -
 fs/orangefs/orangefs-dev-proto.h |  61 ----
 fs/orangefs/orangefs-kernel.h    |  93 +----
 fs/orangefs/orangefs-mod.c       |   1 -
 fs/orangefs/orangefs-sysfs.c     |   1 -
 fs/orangefs/orangefs-utils.c     |  40 +--
 fs/orangefs/protocol.h           | 354 -------------------
 fs/orangefs/super.c              |   3 +-
 fs/orangefs/symlink.c            |   1 -
 fs/orangefs/upcall.h             | 260 --------------
 fs/orangefs/waitqueue.c          |   1 -
 fs/orangefs/xattr.c              |   1 -
 include/uapi/linux/orangefs.h    | 732 +++++++++++++++++++++++++++++++++++++++
 25 files changed, 788 insertions(+), 1005 deletions(-)
 delete mode 100644 fs/orangefs/downcall.h
 delete mode 100644 fs/orangefs/orangefs-dev-proto.h
 delete mode 100644 fs/orangefs/upcall.h
 create mode 100644 include/uapi/linux/orangefs.h

-- 
2.14.2

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/7] orangefs: make orangefs_client_debug_init static
  2018-01-26 19:07 [PATCH 0/7] orangefs uapi Martin Brandenburg
@ 2018-01-26 19:07 ` Martin Brandenburg
  2018-01-26 19:07 ` [PATCH 2/7] orangefs: remove gossip_ldebug and gossip_lerr Martin Brandenburg
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Martin Brandenburg @ 2018-01-26 19:07 UTC (permalink / raw)
  To: hubcap, linux-kernel, linux-fsdevel, devel; +Cc: Martin Brandenburg

Signed-off-by: Martin Brandenburg <martin@omnibond.com>
---
 fs/orangefs/orangefs-debugfs.c | 2 +-
 fs/orangefs/orangefs-debugfs.h | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/orangefs/orangefs-debugfs.c b/fs/orangefs/orangefs-debugfs.c
index 1c59dff530de..67d531ad5a56 100644
--- a/fs/orangefs/orangefs-debugfs.c
+++ b/fs/orangefs/orangefs-debugfs.c
@@ -328,7 +328,7 @@ static int help_show(struct seq_file *m, void *v)
 /*
  * initialize the client-debug file.
  */
-int orangefs_client_debug_init(void)
+static int orangefs_client_debug_init(void)
 {
 
 	int rc = -ENOMEM;
diff --git a/fs/orangefs/orangefs-debugfs.h b/fs/orangefs/orangefs-debugfs.h
index b5fd9cd4960f..51147f9ce3d6 100644
--- a/fs/orangefs/orangefs-debugfs.h
+++ b/fs/orangefs/orangefs-debugfs.h
@@ -1,7 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 int orangefs_debugfs_init(int);
 void orangefs_debugfs_cleanup(void);
-int orangefs_client_debug_init(void);
 int orangefs_prepare_debugfs_help_string(int);
 int orangefs_debugfs_new_client_mask(void __user *);
 int orangefs_debugfs_new_client_string(void __user *);
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/7] orangefs: remove gossip_ldebug and gossip_lerr
  2018-01-26 19:07 [PATCH 0/7] orangefs uapi Martin Brandenburg
  2018-01-26 19:07 ` [PATCH 1/7] orangefs: make orangefs_client_debug_init static Martin Brandenburg
@ 2018-01-26 19:07 ` Martin Brandenburg
  2018-01-26 19:07 ` [PATCH 3/7] orangefs: remove ORANGEFS_KERNEL_DEBUG Martin Brandenburg
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Martin Brandenburg @ 2018-01-26 19:07 UTC (permalink / raw)
  To: hubcap, linux-kernel, linux-fsdevel, devel; +Cc: Martin Brandenburg

gossip_ldebug is unused.

gossip_lerr is used in two places.  The messages are unique so line
numbers are unnecessary.

Also remove support for compiling gossip messages out.  It wasn't
possible to enable it anyway.

Signed-off-by: Martin Brandenburg <martin@omnibond.com>
---
 fs/orangefs/orangefs-debugfs.c |  2 +-
 fs/orangefs/protocol.h         | 15 ---------------
 fs/orangefs/super.c            |  2 +-
 3 files changed, 2 insertions(+), 17 deletions(-)

diff --git a/fs/orangefs/orangefs-debugfs.c b/fs/orangefs/orangefs-debugfs.c
index 67d531ad5a56..6e35f2f3c897 100644
--- a/fs/orangefs/orangefs-debugfs.c
+++ b/fs/orangefs/orangefs-debugfs.c
@@ -1056,7 +1056,7 @@ int orangefs_debugfs_new_debug(void __user *arg)
 			client_debug_string,
 			llu(mask_info.mask_value));
 	} else {
-		gossip_lerr("Invalid mask type....\n");
+		gossip_err("Invalid mask type....\n");
 		return -EINVAL;
 	}
 
diff --git a/fs/orangefs/protocol.h b/fs/orangefs/protocol.h
index e0bf5e4dce0d..dc6e3e6269c3 100644
--- a/fs/orangefs/protocol.h
+++ b/fs/orangefs/protocol.h
@@ -395,13 +395,6 @@ struct ORANGEFS_dev_map_desc {
 
 /* gossip.h *****************************************************************/
 
-#ifdef GOSSIP_DISABLE_DEBUG
-#define gossip_debug(mask, fmt, ...)					\
-do {									\
-	if (0)								\
-		printk(KERN_DEBUG fmt, ##__VA_ARGS__);			\
-} while (0)
-#else
 extern __u64 orangefs_gossip_debug_mask;
 
 /* try to avoid function call overhead by checking masks in macro */
@@ -410,13 +403,5 @@ do {									\
 	if (orangefs_gossip_debug_mask & (mask))			\
 		printk(KERN_DEBUG fmt, ##__VA_ARGS__);			\
 } while (0)
-#endif /* GOSSIP_DISABLE_DEBUG */
-
-/* do file and line number printouts w/ the GNU preprocessor */
-#define gossip_ldebug(mask, fmt, ...)					\
-	gossip_debug(mask, "%s: " fmt, __func__, ##__VA_ARGS__)
 
 #define gossip_err pr_err
-#define gossip_lerr(fmt, ...)						\
-	gossip_err("%s line %d: " fmt,					\
-		   __FILE__, __LINE__, ##__VA_ARGS__)
diff --git a/fs/orangefs/super.c b/fs/orangefs/super.c
index 36f1390b5ed7..a4f4b508eff2 100644
--- a/fs/orangefs/super.c
+++ b/fs/orangefs/super.c
@@ -335,7 +335,7 @@ static int orangefs_encode_fh(struct inode *inode,
 	struct orangefs_object_kref refn;
 
 	if (*max_len < len) {
-		gossip_lerr("fh buffer is too small for encoding\n");
+		gossip_err("fh buffer is too small for encoding\n");
 		*max_len = len;
 		type = 255;
 		goto out;
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/7] orangefs: remove ORANGEFS_KERNEL_DEBUG
  2018-01-26 19:07 [PATCH 0/7] orangefs uapi Martin Brandenburg
  2018-01-26 19:07 ` [PATCH 1/7] orangefs: make orangefs_client_debug_init static Martin Brandenburg
  2018-01-26 19:07 ` [PATCH 2/7] orangefs: remove gossip_ldebug and gossip_lerr Martin Brandenburg
@ 2018-01-26 19:07 ` Martin Brandenburg
  2018-01-26 19:07 ` [PATCH 4/7] orangefs: make orangefs_make_bad_inode static Martin Brandenburg
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Martin Brandenburg @ 2018-01-26 19:07 UTC (permalink / raw)
  To: hubcap, linux-kernel, linux-fsdevel, devel; +Cc: Martin Brandenburg

It wasn't possible to enable it, and it would've had very little effect.

Signed-off-by: Martin Brandenburg <martin@omnibond.com>
---
 fs/orangefs/orangefs-kernel.h | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/fs/orangefs/orangefs-kernel.h b/fs/orangefs/orangefs-kernel.h
index 2595453fe737..25bacc334d91 100644
--- a/fs/orangefs/orangefs-kernel.h
+++ b/fs/orangefs/orangefs-kernel.h
@@ -56,11 +56,7 @@
 
 #include "orangefs-dev-proto.h"
 
-#ifdef ORANGEFS_KERNEL_DEBUG
-#define ORANGEFS_DEFAULT_OP_TIMEOUT_SECS       10
-#else
 #define ORANGEFS_DEFAULT_OP_TIMEOUT_SECS       20
-#endif
 
 #define ORANGEFS_BUFMAP_WAIT_TIMEOUT_SECS   30
 
@@ -104,11 +100,11 @@ enum orangefs_vfs_op_states {
  * orangefs kernel memory related flags
  */
 
-#if ((defined ORANGEFS_KERNEL_DEBUG) && (defined CONFIG_DEBUG_SLAB))
+#if (defined CONFIG_DEBUG_SLAB)
 #define ORANGEFS_CACHE_CREATE_FLAGS SLAB_RED_ZONE
 #else
 #define ORANGEFS_CACHE_CREATE_FLAGS 0
-#endif /* ((defined ORANGEFS_KERNEL_DEBUG) && (defined CONFIG_DEBUG_SLAB)) */
+#endif
 
 extern int orangefs_init_acl(struct inode *inode, struct inode *dir);
 extern const struct xattr_handler *orangefs_xattr_handlers[];
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/7] orangefs: make orangefs_make_bad_inode static
  2018-01-26 19:07 [PATCH 0/7] orangefs uapi Martin Brandenburg
                   ` (2 preceding siblings ...)
  2018-01-26 19:07 ` [PATCH 3/7] orangefs: remove ORANGEFS_KERNEL_DEBUG Martin Brandenburg
@ 2018-01-26 19:07 ` Martin Brandenburg
  2018-01-26 19:07 ` [PATCH 5/7] ornagefs: make several *_operations structs static Martin Brandenburg
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Martin Brandenburg @ 2018-01-26 19:07 UTC (permalink / raw)
  To: hubcap, linux-kernel, linux-fsdevel, devel; +Cc: Martin Brandenburg

Signed-off-by: Martin Brandenburg <martin@omnibond.com>
---
 fs/orangefs/orangefs-kernel.h |  2 --
 fs/orangefs/orangefs-utils.c  | 38 +++++++++++++++++++-------------------
 2 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/fs/orangefs/orangefs-kernel.h b/fs/orangefs/orangefs-kernel.h
index 25bacc334d91..eebbaece85ef 100644
--- a/fs/orangefs/orangefs-kernel.h
+++ b/fs/orangefs/orangefs-kernel.h
@@ -467,8 +467,6 @@ int orangefs_inode_check_changed(struct inode *inode);
 
 int orangefs_inode_setattr(struct inode *inode, struct iattr *iattr);
 
-void orangefs_make_bad_inode(struct inode *inode);
-
 int orangefs_unmount_sb(struct super_block *sb);
 
 bool orangefs_cancel_op_in_progress(struct orangefs_kernel_op_s *op);
diff --git a/fs/orangefs/orangefs-utils.c b/fs/orangefs/orangefs-utils.c
index 97fe93129f38..3098c2ee7b5f 100644
--- a/fs/orangefs/orangefs-utils.c
+++ b/fs/orangefs/orangefs-utils.c
@@ -230,6 +230,25 @@ static int orangefs_inode_type(enum orangefs_ds_type objtype)
 		return -1;
 }
 
+static void orangefs_make_bad_inode(struct inode *inode)
+{
+	if (is_root_handle(inode)) {
+		/*
+		 * if this occurs, the pvfs2-client-core was killed but we
+		 * can't afford to lose the inode operations and such
+		 * associated with the root handle in any case.
+		 */
+		gossip_debug(GOSSIP_UTILS_DEBUG,
+			     "*** NOT making bad root inode %pU\n",
+			     get_khandle_from_ino(inode));
+	} else {
+		gossip_debug(GOSSIP_UTILS_DEBUG,
+			     "*** making bad inode %pU\n",
+			     get_khandle_from_ino(inode));
+		make_bad_inode(inode);
+	}
+}
+
 static int orangefs_inode_is_stale(struct inode *inode, int new,
     struct ORANGEFS_sys_attr_s *attrs, char *link_target)
 {
@@ -444,25 +463,6 @@ int orangefs_inode_setattr(struct inode *inode, struct iattr *iattr)
 	return ret;
 }
 
-void orangefs_make_bad_inode(struct inode *inode)
-{
-	if (is_root_handle(inode)) {
-		/*
-		 * if this occurs, the pvfs2-client-core was killed but we
-		 * can't afford to lose the inode operations and such
-		 * associated with the root handle in any case.
-		 */
-		gossip_debug(GOSSIP_UTILS_DEBUG,
-			     "*** NOT making bad root inode %pU\n",
-			     get_khandle_from_ino(inode));
-	} else {
-		gossip_debug(GOSSIP_UTILS_DEBUG,
-			     "*** making bad inode %pU\n",
-			     get_khandle_from_ino(inode));
-		make_bad_inode(inode);
-	}
-}
-
 /*
  * The following is a very dirty hack that is now a permanent part of the
  * ORANGEFS protocol. See protocol.h for more error definitions.
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/7] ornagefs: make several *_operations structs static
  2018-01-26 19:07 [PATCH 0/7] orangefs uapi Martin Brandenburg
                   ` (3 preceding siblings ...)
  2018-01-26 19:07 ` [PATCH 4/7] orangefs: make orangefs_make_bad_inode static Martin Brandenburg
@ 2018-01-26 19:07 ` Martin Brandenburg
  2018-01-26 19:07 ` [PATCH 6/7] orangefs: remove unused code Martin Brandenburg
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Martin Brandenburg @ 2018-01-26 19:07 UTC (permalink / raw)
  To: hubcap, linux-kernel, linux-fsdevel, devel; +Cc: Martin Brandenburg

Signed-off-by: Martin Brandenburg <martin@omnibond.com>
---
 fs/orangefs/devorangefs-req.c | 52 +++++++++++++++++++++----------------------
 fs/orangefs/inode.c           |  4 ++--
 fs/orangefs/orangefs-kernel.h |  3 ---
 3 files changed, 28 insertions(+), 31 deletions(-)

diff --git a/fs/orangefs/devorangefs-req.c b/fs/orangefs/devorangefs-req.c
index c584ad8d023c..eea83603e3dd 100644
--- a/fs/orangefs/devorangefs-req.c
+++ b/fs/orangefs/devorangefs-req.c
@@ -779,6 +779,32 @@ static long orangefs_devreq_compat_ioctl(struct file *filp, unsigned int cmd,
 
 #endif /* CONFIG_COMPAT is in .config */
 
+static unsigned int orangefs_devreq_poll(struct file *file,
+				      struct poll_table_struct *poll_table)
+{
+	int poll_revent_mask = 0;
+
+	poll_wait(file, &orangefs_request_list_waitq, poll_table);
+
+	if (!list_empty(&orangefs_request_list))
+		poll_revent_mask |= POLL_IN;
+	return poll_revent_mask;
+}
+
+static const struct file_operations orangefs_devreq_file_operations = {
+	.owner = THIS_MODULE,
+	.read = orangefs_devreq_read,
+	.write_iter = orangefs_devreq_write_iter,
+	.open = orangefs_devreq_open,
+	.release = orangefs_devreq_release,
+	.unlocked_ioctl = orangefs_devreq_ioctl,
+
+#ifdef CONFIG_COMPAT		/* CONFIG_COMPAT is in .config */
+	.compat_ioctl = orangefs_devreq_compat_ioctl,
+#endif
+	.poll = orangefs_devreq_poll
+};
+
 /* the assigned character device major number */
 static int orangefs_dev_major;
 
@@ -814,29 +840,3 @@ void orangefs_dev_cleanup(void)
 		     "*** /dev/%s character device unregistered ***\n",
 		     ORANGEFS_REQDEVICE_NAME);
 }
-
-static unsigned int orangefs_devreq_poll(struct file *file,
-				      struct poll_table_struct *poll_table)
-{
-	int poll_revent_mask = 0;
-
-	poll_wait(file, &orangefs_request_list_waitq, poll_table);
-
-	if (!list_empty(&orangefs_request_list))
-		poll_revent_mask |= POLL_IN;
-	return poll_revent_mask;
-}
-
-const struct file_operations orangefs_devreq_file_operations = {
-	.owner = THIS_MODULE,
-	.read = orangefs_devreq_read,
-	.write_iter = orangefs_devreq_write_iter,
-	.open = orangefs_devreq_open,
-	.release = orangefs_devreq_release,
-	.unlocked_ioctl = orangefs_devreq_ioctl,
-
-#ifdef CONFIG_COMPAT		/* CONFIG_COMPAT is in .config */
-	.compat_ioctl = orangefs_devreq_compat_ioctl,
-#endif
-	.poll = orangefs_devreq_poll
-};
diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c
index fe1d705ad91f..79c61da8b1bc 100644
--- a/fs/orangefs/inode.c
+++ b/fs/orangefs/inode.c
@@ -138,7 +138,7 @@ static ssize_t orangefs_direct_IO(struct kiocb *iocb,
 }
 
 /** ORANGEFS2 implementation of address space operations */
-const struct address_space_operations orangefs_address_operations = {
+static const struct address_space_operations orangefs_address_operations = {
 	.readpage = orangefs_readpage,
 	.readpages = orangefs_readpages,
 	.invalidatepage = orangefs_invalidatepage,
@@ -307,7 +307,7 @@ int orangefs_update_time(struct inode *inode, struct timespec *time, int flags)
 }
 
 /* ORANGEDS2 implementation of VFS inode operations for files */
-const struct inode_operations orangefs_file_inode_operations = {
+static const struct inode_operations orangefs_file_inode_operations = {
 	.get_acl = orangefs_get_acl,
 	.set_acl = orangefs_set_acl,
 	.setattr = orangefs_setattr,
diff --git a/fs/orangefs/orangefs-kernel.h b/fs/orangefs/orangefs-kernel.h
index eebbaece85ef..f49d53de8901 100644
--- a/fs/orangefs/orangefs-kernel.h
+++ b/fs/orangefs/orangefs-kernel.h
@@ -487,14 +487,11 @@ extern struct list_head *orangefs_htable_ops_in_progress;
 extern spinlock_t orangefs_htable_ops_in_progress_lock;
 extern int hash_table_size;
 
-extern const struct address_space_operations orangefs_address_operations;
-extern const struct inode_operations orangefs_file_inode_operations;
 extern const struct file_operations orangefs_file_operations;
 extern const struct inode_operations orangefs_symlink_inode_operations;
 extern const struct inode_operations orangefs_dir_inode_operations;
 extern const struct file_operations orangefs_dir_operations;
 extern const struct dentry_operations orangefs_dentry_operations;
-extern const struct file_operations orangefs_devreq_file_operations;
 
 extern wait_queue_head_t orangefs_bufmap_init_waitq;
 
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 6/7] orangefs: remove unused code
  2018-01-26 19:07 [PATCH 0/7] orangefs uapi Martin Brandenburg
                   ` (4 preceding siblings ...)
  2018-01-26 19:07 ` [PATCH 5/7] ornagefs: make several *_operations structs static Martin Brandenburg
@ 2018-01-26 19:07 ` Martin Brandenburg
  2018-01-26 19:07 ` [PATCH 7/7] orangefs: create uapi interface Martin Brandenburg
  2018-01-26 19:15 ` [PATCH 0/7] orangefs uapi martin
  7 siblings, 0 replies; 9+ messages in thread
From: Martin Brandenburg @ 2018-01-26 19:07 UTC (permalink / raw)
  To: hubcap, linux-kernel, linux-fsdevel, devel; +Cc: Martin Brandenburg

Signed-off-by: Martin Brandenburg <martin@omnibond.com>
---
 fs/orangefs/orangefs-debug.h  |  6 ----
 fs/orangefs/orangefs-kernel.h | 77 -------------------------------------------
 fs/orangefs/protocol.h        | 45 -------------------------
 3 files changed, 128 deletions(-)

diff --git a/fs/orangefs/orangefs-debug.h b/fs/orangefs/orangefs-debug.h
index c7db56a31b92..6e079d4230d0 100644
--- a/fs/orangefs/orangefs-debug.h
+++ b/fs/orangefs/orangefs-debug.h
@@ -43,12 +43,6 @@
 #define GOSSIP_MAX_NR                 16
 #define GOSSIP_MAX_DEBUG              (((__u64)1 << GOSSIP_MAX_NR) - 1)
 
-/*function prototypes*/
-__u64 ORANGEFS_kmod_eventlog_to_mask(const char *event_logging);
-__u64 ORANGEFS_debug_eventlog_to_mask(const char *event_logging);
-char *ORANGEFS_debug_mask_to_eventlog(__u64 mask);
-char *ORANGEFS_kmod_mask_to_eventlog(__u64 mask);
-
 /* a private internal type */
 struct __keyword_mask_s {
 	const char *keyword;
diff --git a/fs/orangefs/orangefs-kernel.h b/fs/orangefs/orangefs-kernel.h
index f49d53de8901..c29bb0ebc6bb 100644
--- a/fs/orangefs/orangefs-kernel.h
+++ b/fs/orangefs/orangefs-kernel.h
@@ -65,11 +65,7 @@
 #define ORANGEFS_REQDEVICE_NAME          "pvfs2-req"
 
 #define ORANGEFS_DEVREQ_MAGIC             0x20030529
-#define ORANGEFS_LINK_MAX                 0x000000FF
 #define ORANGEFS_PURGE_RETRY_COUNT     0x00000005
-#define ORANGEFS_MAX_NUM_OPTIONS          0x00000004
-#define ORANGEFS_MAX_MOUNT_OPT_LEN        0x00000080
-#define ORANGEFS_MAX_FSKEY_LEN            64
 
 #define MAX_DEV_REQ_UPSIZE (2 * sizeof(__s32) +   \
 sizeof(__u64) + sizeof(struct orangefs_upcall_s))
@@ -112,15 +108,6 @@ extern const struct xattr_handler *orangefs_xattr_handlers[];
 extern struct posix_acl *orangefs_get_acl(struct inode *inode, int type);
 extern int orangefs_set_acl(struct inode *inode, struct posix_acl *acl, int type);
 
-/*
- * Redefine xtvec structure so that we could move helper functions out of
- * the define
- */
-struct xtvec {
-	__kernel_off_t xtv_off;		/* must be off_t */
-	__kernel_size_t xtv_len;	/* must be size_t */
-};
-
 /*
  * orangefs data structures
  */
@@ -224,39 +211,6 @@ struct orangefs_sb_info_s {
 	struct list_head list;
 };
 
-/*
- * structure that holds the state of any async I/O operation issued
- * through the VFS. Needed especially to handle cancellation requests
- * or even completion notification so that the VFS client-side daemon
- * can free up its vfs_request slots.
- */
-struct orangefs_kiocb_s {
-	/* the pointer to the task that initiated the AIO */
-	struct task_struct *tsk;
-
-	/* pointer to the kiocb that kicked this operation */
-	struct kiocb *kiocb;
-
-	/* buffer index that was used for the I/O */
-	struct orangefs_bufmap *bufmap;
-	int buffer_index;
-
-	/* orangefs kernel operation type */
-	struct orangefs_kernel_op_s *op;
-
-	/* set to indicate the type of the operation */
-	int rw;
-
-	/* file offset */
-	loff_t offset;
-
-	/* and the count in bytes */
-	size_t bytes_to_be_copied;
-
-	ssize_t bytes_copied;
-	int needs_cleanup;
-};
-
 struct orangefs_stats {
 	unsigned long cache_hits;
 	unsigned long cache_misses;
@@ -305,21 +259,6 @@ static inline struct orangefs_khandle *get_khandle_from_ino(struct inode *inode)
 	return &(ORANGEFS_I(inode)->refn.khandle);
 }
 
-static inline ino_t get_ino_from_khandle(struct inode *inode)
-{
-	struct orangefs_khandle *khandle;
-	ino_t ino;
-
-	khandle = get_khandle_from_ino(inode);
-	ino = orangefs_khandle_to_ino(khandle);
-	return ino;
-}
-
-static inline ino_t get_parent_ino_from_dentry(struct dentry *dentry)
-{
-	return get_ino_from_khandle(dentry->d_parent->d_inode);
-}
-
 static inline int is_root_handle(struct inode *inode)
 {
 	gossip_debug(GOSSIP_DCACHE_DEBUG,
@@ -391,7 +330,6 @@ void fsid_key_table_finalize(void);
 /*
  * defined in inode.c
  */
-__u32 convert_to_orangefs_mask(unsigned long lite_mask);
 struct inode *orangefs_new_inode(struct super_block *sb,
 			      struct inode *dir,
 			      int mode,
@@ -410,17 +348,6 @@ int orangefs_update_time(struct inode *, struct timespec *, int);
 /*
  * defined in xattr.c
  */
-int orangefs_setxattr(struct dentry *dentry,
-		   const char *name,
-		   const void *value,
-		   size_t size,
-		   int flags);
-
-ssize_t orangefs_getxattr(struct dentry *dentry,
-		       const char *name,
-		       void *buffer,
-		       size_t size);
-
 ssize_t orangefs_listxattr(struct dentry *dentry, char *buffer, size_t size);
 
 /*
@@ -467,8 +394,6 @@ int orangefs_inode_check_changed(struct inode *inode);
 
 int orangefs_inode_setattr(struct inode *inode, struct iattr *iattr);
 
-int orangefs_unmount_sb(struct super_block *sb);
-
 bool orangefs_cancel_op_in_progress(struct orangefs_kernel_op_s *op);
 
 int orangefs_normalize_to_errno(__s32 error_code);
@@ -493,8 +418,6 @@ extern const struct inode_operations orangefs_dir_inode_operations;
 extern const struct file_operations orangefs_dir_operations;
 extern const struct dentry_operations orangefs_dentry_operations;
 
-extern wait_queue_head_t orangefs_bufmap_init_waitq;
-
 /*
  * misc convenience macros
  */
diff --git a/fs/orangefs/protocol.h b/fs/orangefs/protocol.h
index dc6e3e6269c3..61ee8d64c842 100644
--- a/fs/orangefs/protocol.h
+++ b/fs/orangefs/protocol.h
@@ -5,11 +5,6 @@
 #include <linux/slab.h>
 #include <linux/ioctl.h>
 
-/* pvfs2-config.h ***********************************************************/
-#define ORANGEFS_VERSION_MAJOR 2
-#define ORANGEFS_VERSION_MINOR 9
-#define ORANGEFS_VERSION_SUB 0
-
 /* khandle stuff  ***********************************************************/
 
 /*
@@ -70,16 +65,6 @@ static inline void ORANGEFS_khandle_from(struct orangefs_khandle *kh,
 }
 
 /* pvfs2-types.h ************************************************************/
-typedef __u32 ORANGEFS_uid;
-typedef __u32 ORANGEFS_gid;
-typedef __s32 ORANGEFS_fs_id;
-typedef __u32 ORANGEFS_permissions;
-typedef __u64 ORANGEFS_time;
-typedef __s64 ORANGEFS_size;
-typedef __u64 ORANGEFS_flags;
-typedef __u64 ORANGEFS_ds_position;
-typedef __s32 ORANGEFS_error;
-typedef __s64 ORANGEFS_offset;
 
 #define ORANGEFS_SUPER_MAGIC 0x20030528
 
@@ -145,7 +130,6 @@ typedef __s64 ORANGEFS_offset;
 #define ORANGEFS_APPEND_FL    FS_APPEND_FL
 #define ORANGEFS_NOATIME_FL   FS_NOATIME_FL
 #define ORANGEFS_MIRROR_FL    0x01000000ULL
-#define ORANGEFS_O_EXECUTE (1 << 0)
 #define ORANGEFS_FS_ID_NULL       ((__s32)0)
 #define ORANGEFS_ATTR_SYS_UID                   (1 << 0)
 #define ORANGEFS_ATTR_SYS_GID                   (1 << 1)
@@ -229,35 +213,6 @@ enum orangefs_ds_type {
 	ORANGEFS_TYPE_INTERNAL = (1 << 5)	/* for the server's private use */
 };
 
-/*
- * ORANGEFS_certificate simply stores a buffer with the buffer size.
- * The buffer can be converted to an OpenSSL X509 struct for use.
- */
-struct ORANGEFS_certificate {
-	__u32 buf_size;
-	unsigned char *buf;
-};
-
-/*
- * A credential identifies a user and is signed by the client/user
- * private key.
- */
-struct ORANGEFS_credential {
-	__u32 userid;	/* user id */
-	__u32 num_groups;	/* length of group_array */
-	__u32 *group_array;	/* groups for which the user is a member */
-	char *issuer;		/* alias of the issuing server */
-	__u64 timeout;	/* seconds after epoch to time out */
-	__u32 sig_size;	/* length of the signature in bytes */
-	unsigned char *signature;	/* digital signature */
-	struct ORANGEFS_certificate certificate;	/* user certificate buffer */
-};
-#define extra_size_ORANGEFS_credential (ORANGEFS_REQ_LIMIT_GROUPS	*	\
-				    sizeof(__u32)		+	\
-				    ORANGEFS_REQ_LIMIT_ISSUER	+	\
-				    ORANGEFS_REQ_LIMIT_SIGNATURE	+	\
-				    extra_size_ORANGEFS_certificate)
-
 /* This structure is used by the VFS-client interaction alone */
 struct ORANGEFS_keyval_pair {
 	char key[ORANGEFS_MAX_XATTR_NAMELEN];
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 7/7] orangefs: create uapi interface
  2018-01-26 19:07 [PATCH 0/7] orangefs uapi Martin Brandenburg
                   ` (5 preceding siblings ...)
  2018-01-26 19:07 ` [PATCH 6/7] orangefs: remove unused code Martin Brandenburg
@ 2018-01-26 19:07 ` Martin Brandenburg
  2018-01-26 19:15 ` [PATCH 0/7] orangefs uapi martin
  7 siblings, 0 replies; 9+ messages in thread
From: Martin Brandenburg @ 2018-01-26 19:07 UTC (permalink / raw)
  To: hubcap, linux-kernel, linux-fsdevel, devel; +Cc: Martin Brandenburg

This formally separates userspace visible and kernel internal data
structures.  The sole consumer of this would be the pvfs2-client-core,
which currently simply defines all these structures itself.  Most of
these are shared with the rest of the OrangeFS userspace client and
server code.

As the userspace OrangeFS client and server progress, they are beginning
to change their "internal" definitions.  This will allow us to separate
data structures which will be sent to the kernel and data structures
which belong to userspace.

This is accomplished by moving everything relevant from fs/orangefs/*.h
to include/uapi/linux/orangefs.h.

Signed-off-by: Martin Brandenburg <martin@omnibond.com>
---
 fs/orangefs/acl.c                |   1 -
 fs/orangefs/dcache.c             |   1 -
 fs/orangefs/devorangefs-req.c    |   2 -
 fs/orangefs/dir.c                |   1 -
 fs/orangefs/downcall.h           | 137 --------
 fs/orangefs/file.c               |   1 -
 fs/orangefs/inode.c              |   1 -
 fs/orangefs/namei.c              |   1 -
 fs/orangefs/orangefs-bufmap.c    |   1 -
 fs/orangefs/orangefs-cache.c     |   1 -
 fs/orangefs/orangefs-debug.h     |  27 --
 fs/orangefs/orangefs-debugfs.c   |   4 +-
 fs/orangefs/orangefs-dev-proto.h |  61 ----
 fs/orangefs/orangefs-kernel.h    |   3 +-
 fs/orangefs/orangefs-mod.c       |   1 -
 fs/orangefs/orangefs-sysfs.c     |   1 -
 fs/orangefs/orangefs-utils.c     |   2 -
 fs/orangefs/protocol.h           | 294 ----------------
 fs/orangefs/super.c              |   1 -
 fs/orangefs/symlink.c            |   1 -
 fs/orangefs/upcall.h             | 260 --------------
 fs/orangefs/waitqueue.c          |   1 -
 fs/orangefs/xattr.c              |   1 -
 include/uapi/linux/orangefs.h    | 732 +++++++++++++++++++++++++++++++++++++++
 24 files changed, 736 insertions(+), 800 deletions(-)
 delete mode 100644 fs/orangefs/downcall.h
 delete mode 100644 fs/orangefs/orangefs-dev-proto.h
 delete mode 100644 fs/orangefs/upcall.h
 create mode 100644 include/uapi/linux/orangefs.h

diff --git a/fs/orangefs/acl.c b/fs/orangefs/acl.c
index 480ea059a680..796c22f80b78 100644
--- a/fs/orangefs/acl.c
+++ b/fs/orangefs/acl.c
@@ -5,7 +5,6 @@
  * See COPYING in top-level directory.
  */
 
-#include "protocol.h"
 #include "orangefs-kernel.h"
 #include "orangefs-bufmap.h"
 #include <linux/posix_acl_xattr.h>
diff --git a/fs/orangefs/dcache.c b/fs/orangefs/dcache.c
index ae782df5c063..b1a6854a7584 100644
--- a/fs/orangefs/dcache.c
+++ b/fs/orangefs/dcache.c
@@ -9,7 +9,6 @@
  *  Implementation of dentry (directory cache) functions.
  */
 
-#include "protocol.h"
 #include "orangefs-kernel.h"
 
 /* Returns 1 if dentry can still be trusted, else 0. */
diff --git a/fs/orangefs/devorangefs-req.c b/fs/orangefs/devorangefs-req.c
index eea83603e3dd..b824ea1bbd2d 100644
--- a/fs/orangefs/devorangefs-req.c
+++ b/fs/orangefs/devorangefs-req.c
@@ -8,9 +8,7 @@
  * See COPYING in top-level directory.
  */
 
-#include "protocol.h"
 #include "orangefs-kernel.h"
-#include "orangefs-dev-proto.h"
 #include "orangefs-bufmap.h"
 #include "orangefs-debugfs.h"
 
diff --git a/fs/orangefs/dir.c b/fs/orangefs/dir.c
index e2c2699d8016..e760315acd2a 100644
--- a/fs/orangefs/dir.c
+++ b/fs/orangefs/dir.c
@@ -3,7 +3,6 @@
  * Copyright 2017 Omnibond Systems, L.L.C.
  */
 
-#include "protocol.h"
 #include "orangefs-kernel.h"
 #include "orangefs-bufmap.h"
 
diff --git a/fs/orangefs/downcall.h b/fs/orangefs/downcall.h
deleted file mode 100644
index ea2332e16af9..000000000000
--- a/fs/orangefs/downcall.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * (C) 2001 Clemson University and The University of Chicago
- *
- * See COPYING in top-level directory.
- */
-
-/*
- *  Definitions of downcalls used in Linux kernel module.
- */
-
-#ifndef __DOWNCALL_H
-#define __DOWNCALL_H
-
-/*
- * Sanitized the device-client core interaction
- * for clean 32-64 bit usage
- */
-struct orangefs_io_response {
-	__s64 amt_complete;
-};
-
-struct orangefs_lookup_response {
-	struct orangefs_object_kref refn;
-};
-
-struct orangefs_create_response {
-	struct orangefs_object_kref refn;
-};
-
-struct orangefs_symlink_response {
-	struct orangefs_object_kref refn;
-};
-
-struct orangefs_getattr_response {
-	struct ORANGEFS_sys_attr_s attributes;
-	char link_target[ORANGEFS_NAME_MAX];
-};
-
-struct orangefs_mkdir_response {
-	struct orangefs_object_kref refn;
-};
-
-struct orangefs_statfs_response {
-	__s64 block_size;
-	__s64 blocks_total;
-	__s64 blocks_avail;
-	__s64 files_total;
-	__s64 files_avail;
-};
-
-struct orangefs_fs_mount_response {
-	__s32 fs_id;
-	__s32 id;
-	struct orangefs_khandle root_khandle;
-};
-
-/* the getxattr response is the attribute value */
-struct orangefs_getxattr_response {
-	__s32 val_sz;
-	__s32 __pad1;
-	char val[ORANGEFS_MAX_XATTR_VALUELEN];
-};
-
-/* the listxattr response is an array of attribute names */
-struct orangefs_listxattr_response {
-	__s32 returned_count;
-	__s32 __pad1;
-	__u64 token;
-	char key[ORANGEFS_MAX_XATTR_LISTLEN * ORANGEFS_MAX_XATTR_NAMELEN];
-	__s32 keylen;
-	__s32 __pad2;
-	__s32 lengths[ORANGEFS_MAX_XATTR_LISTLEN];
-};
-
-struct orangefs_param_response {
-	union {
-		__s64 value64;
-		__s32 value32[2];
-	} u;
-};
-
-#define PERF_COUNT_BUF_SIZE 4096
-struct orangefs_perf_count_response {
-	char buffer[PERF_COUNT_BUF_SIZE];
-};
-
-#define FS_KEY_BUF_SIZE 4096
-struct orangefs_fs_key_response {
-	__s32 fs_keylen;
-	__s32 __pad1;
-	char fs_key[FS_KEY_BUF_SIZE];
-};
-
-/* 2.9.6 */
-struct orangefs_features_response {
-	__u64 features;
-};
-
-struct orangefs_downcall_s {
-	__s32 type;
-	__s32 status;
-	/* currently trailer is used only by readdir */
-	__s64 trailer_size;
-	char *trailer_buf;
-
-	union {
-		struct orangefs_io_response io;
-		struct orangefs_lookup_response lookup;
-		struct orangefs_create_response create;
-		struct orangefs_symlink_response sym;
-		struct orangefs_getattr_response getattr;
-		struct orangefs_mkdir_response mkdir;
-		struct orangefs_statfs_response statfs;
-		struct orangefs_fs_mount_response fs_mount;
-		struct orangefs_getxattr_response getxattr;
-		struct orangefs_listxattr_response listxattr;
-		struct orangefs_param_response param;
-		struct orangefs_perf_count_response perf_count;
-		struct orangefs_fs_key_response fs_key;
-		struct orangefs_features_response features;
-	} resp;
-};
-
-/*
- * The readdir response comes in the trailer.  It is followed by the
- * directory entries as described in dir.c.
- */
-
-struct orangefs_readdir_response_s {
-	__u64 token;
-	__u64 directory_version;
-	__u32 __pad2;
-	__u32 orangefs_dirent_outcount;
-};
-
-#endif /* __DOWNCALL_H */
diff --git a/fs/orangefs/file.c b/fs/orangefs/file.c
index 0d228cd087e6..15ac531f19cf 100644
--- a/fs/orangefs/file.c
+++ b/fs/orangefs/file.c
@@ -9,7 +9,6 @@
  *  Linux VFS file operations.
  */
 
-#include "protocol.h"
 #include "orangefs-kernel.h"
 #include "orangefs-bufmap.h"
 #include <linux/fs.h>
diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c
index 79c61da8b1bc..a922c9da80d6 100644
--- a/fs/orangefs/inode.c
+++ b/fs/orangefs/inode.c
@@ -10,7 +10,6 @@
  */
 
 #include <linux/bvec.h>
-#include "protocol.h"
 #include "orangefs-kernel.h"
 #include "orangefs-bufmap.h"
 
diff --git a/fs/orangefs/namei.c b/fs/orangefs/namei.c
index c98bba2dbc94..b9828481f916 100644
--- a/fs/orangefs/namei.c
+++ b/fs/orangefs/namei.c
@@ -9,7 +9,6 @@
  *  Linux VFS namei operations.
  */
 
-#include "protocol.h"
 #include "orangefs-kernel.h"
 
 /*
diff --git a/fs/orangefs/orangefs-bufmap.c b/fs/orangefs/orangefs-bufmap.c
index 59f444dced9b..ee11b29c3a9e 100644
--- a/fs/orangefs/orangefs-bufmap.c
+++ b/fs/orangefs/orangefs-bufmap.c
@@ -4,7 +4,6 @@
  *
  * See COPYING in top-level directory.
  */
-#include "protocol.h"
 #include "orangefs-kernel.h"
 #include "orangefs-bufmap.h"
 
diff --git a/fs/orangefs/orangefs-cache.c b/fs/orangefs/orangefs-cache.c
index 3b6982bf6bcf..a02288721060 100644
--- a/fs/orangefs/orangefs-cache.c
+++ b/fs/orangefs/orangefs-cache.c
@@ -5,7 +5,6 @@
  * See COPYING in top-level directory.
  */
 
-#include "protocol.h"
 #include "orangefs-kernel.h"
 
 /* tags assigned to kernel upcall operations */
diff --git a/fs/orangefs/orangefs-debug.h b/fs/orangefs/orangefs-debug.h
index 6e079d4230d0..383b709d41a1 100644
--- a/fs/orangefs/orangefs-debug.h
+++ b/fs/orangefs/orangefs-debug.h
@@ -13,35 +13,8 @@
 #ifndef __ORANGEFS_DEBUG_H
 #define __ORANGEFS_DEBUG_H
 
-#ifdef __KERNEL__
 #include <linux/types.h>
 #include <linux/kernel.h>
-#else
-#include <stdint.h>
-#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
-#endif
-
-#define	GOSSIP_NO_DEBUG			(__u64)0
-
-#define GOSSIP_SUPER_DEBUG		((__u64)1 << 0)
-#define GOSSIP_INODE_DEBUG		((__u64)1 << 1)
-#define GOSSIP_FILE_DEBUG		((__u64)1 << 2)
-#define GOSSIP_DIR_DEBUG		((__u64)1 << 3)
-#define GOSSIP_UTILS_DEBUG		((__u64)1 << 4)
-#define GOSSIP_WAIT_DEBUG		((__u64)1 << 5)
-#define GOSSIP_ACL_DEBUG		((__u64)1 << 6)
-#define GOSSIP_DCACHE_DEBUG		((__u64)1 << 7)
-#define GOSSIP_DEV_DEBUG		((__u64)1 << 8)
-#define GOSSIP_NAME_DEBUG		((__u64)1 << 9)
-#define GOSSIP_BUFMAP_DEBUG		((__u64)1 << 10)
-#define GOSSIP_CACHE_DEBUG		((__u64)1 << 11)
-#define GOSSIP_DEBUGFS_DEBUG		((__u64)1 << 12)
-#define GOSSIP_XATTR_DEBUG		((__u64)1 << 13)
-#define GOSSIP_INIT_DEBUG		((__u64)1 << 14)
-#define GOSSIP_SYSFS_DEBUG		((__u64)1 << 15)
-
-#define GOSSIP_MAX_NR                 16
-#define GOSSIP_MAX_DEBUG              (((__u64)1 << GOSSIP_MAX_NR) - 1)
 
 /* a private internal type */
 struct __keyword_mask_s {
diff --git a/fs/orangefs/orangefs-debugfs.c b/fs/orangefs/orangefs-debugfs.c
index 6e35f2f3c897..af14e80211c9 100644
--- a/fs/orangefs/orangefs-debugfs.c
+++ b/fs/orangefs/orangefs-debugfs.c
@@ -40,9 +40,9 @@
 
 #include <linux/uaccess.h>
 
-#include "orangefs-debugfs.h"
-#include "protocol.h"
 #include "orangefs-kernel.h"
+#include "orangefs-debug.h"
+#include "orangefs-debugfs.h"
 
 #define DEBUG_HELP_STRING_SIZE 4096
 #define HELP_STRING_UNINITIALIZED \
diff --git a/fs/orangefs/orangefs-dev-proto.h b/fs/orangefs/orangefs-dev-proto.h
deleted file mode 100644
index dc6609824965..000000000000
--- a/fs/orangefs/orangefs-dev-proto.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * (C) 2001 Clemson University and The University of Chicago
- *
- * See COPYING in top-level directory.
- */
-
-#ifndef _ORANGEFS_DEV_PROTO_H
-#define _ORANGEFS_DEV_PROTO_H
-
-/*
- * types and constants shared between user space and kernel space for
- * device interaction using a common protocol
- */
-
-/*
- * valid orangefs kernel operation types
- */
-#define ORANGEFS_VFS_OP_INVALID           0xFF000000
-#define ORANGEFS_VFS_OP_FILE_IO        0xFF000001
-#define ORANGEFS_VFS_OP_LOOKUP         0xFF000002
-#define ORANGEFS_VFS_OP_CREATE         0xFF000003
-#define ORANGEFS_VFS_OP_GETATTR        0xFF000004
-#define ORANGEFS_VFS_OP_REMOVE         0xFF000005
-#define ORANGEFS_VFS_OP_MKDIR          0xFF000006
-#define ORANGEFS_VFS_OP_READDIR        0xFF000007
-#define ORANGEFS_VFS_OP_SETATTR        0xFF000008
-#define ORANGEFS_VFS_OP_SYMLINK        0xFF000009
-#define ORANGEFS_VFS_OP_RENAME         0xFF00000A
-#define ORANGEFS_VFS_OP_STATFS         0xFF00000B
-#define ORANGEFS_VFS_OP_TRUNCATE       0xFF00000C
-#define ORANGEFS_VFS_OP_RA_FLUSH       0xFF00000D
-#define ORANGEFS_VFS_OP_FS_MOUNT       0xFF00000E
-#define ORANGEFS_VFS_OP_FS_UMOUNT      0xFF00000F
-#define ORANGEFS_VFS_OP_GETXATTR       0xFF000010
-#define ORANGEFS_VFS_OP_SETXATTR          0xFF000011
-#define ORANGEFS_VFS_OP_LISTXATTR         0xFF000012
-#define ORANGEFS_VFS_OP_REMOVEXATTR       0xFF000013
-#define ORANGEFS_VFS_OP_PARAM          0xFF000014
-#define ORANGEFS_VFS_OP_PERF_COUNT     0xFF000015
-#define ORANGEFS_VFS_OP_CANCEL            0xFF00EE00
-#define ORANGEFS_VFS_OP_FSYNC          0xFF00EE01
-#define ORANGEFS_VFS_OP_FSKEY             0xFF00EE02
-#define ORANGEFS_VFS_OP_READDIRPLUS       0xFF00EE03
-#define ORANGEFS_VFS_OP_FEATURES	0xFF00EE05 /* 2.9.6 */
-
-/* features is a 64-bit unsigned bitmask */
-#define ORANGEFS_FEATURE_READAHEAD 1
-
-/*
- * Misc constants. Please retain them as multiples of 8!
- * Otherwise 32-64 bit interactions will be messed up :)
- */
-#define ORANGEFS_MAX_DEBUG_STRING_LEN	0x00000800
-
-#define ORANGEFS_MAX_DIRENT_COUNT_READDIR 512
-
-#include "upcall.h"
-#include "downcall.h"
-
-#endif
diff --git a/fs/orangefs/orangefs-kernel.h b/fs/orangefs/orangefs-kernel.h
index c29bb0ebc6bb..4f26fcbb9c83 100644
--- a/fs/orangefs/orangefs-kernel.h
+++ b/fs/orangefs/orangefs-kernel.h
@@ -54,7 +54,8 @@
 
 #include <asm/unaligned.h>
 
-#include "orangefs-dev-proto.h"
+#include <linux/orangefs.h>
+#include "protocol.h"
 
 #define ORANGEFS_DEFAULT_OP_TIMEOUT_SECS       20
 
diff --git a/fs/orangefs/orangefs-mod.c b/fs/orangefs/orangefs-mod.c
index 85ef87245a87..cf9f3259ad93 100644
--- a/fs/orangefs/orangefs-mod.c
+++ b/fs/orangefs/orangefs-mod.c
@@ -7,7 +7,6 @@
  * See COPYING in top-level directory.
  */
 
-#include "protocol.h"
 #include "orangefs-kernel.h"
 #include "orangefs-debugfs.h"
 #include "orangefs-sysfs.h"
diff --git a/fs/orangefs/orangefs-sysfs.c b/fs/orangefs/orangefs-sysfs.c
index 079a465796f3..71177ef3d8b6 100644
--- a/fs/orangefs/orangefs-sysfs.c
+++ b/fs/orangefs/orangefs-sysfs.c
@@ -135,7 +135,6 @@
 #include <linux/module.h>
 #include <linux/init.h>
 
-#include "protocol.h"
 #include "orangefs-kernel.h"
 #include "orangefs-sysfs.h"
 
diff --git a/fs/orangefs/orangefs-utils.c b/fs/orangefs/orangefs-utils.c
index 3098c2ee7b5f..f690bd0f084c 100644
--- a/fs/orangefs/orangefs-utils.c
+++ b/fs/orangefs/orangefs-utils.c
@@ -5,9 +5,7 @@
  * See COPYING in top-level directory.
  */
 #include <linux/kernel.h>
-#include "protocol.h"
 #include "orangefs-kernel.h"
-#include "orangefs-dev-proto.h"
 #include "orangefs-bufmap.h"
 
 __s32 fsid_of_op(struct orangefs_kernel_op_s *op)
diff --git a/fs/orangefs/protocol.h b/fs/orangefs/protocol.h
index 61ee8d64c842..e16d09e5b030 100644
--- a/fs/orangefs/protocol.h
+++ b/fs/orangefs/protocol.h
@@ -7,27 +7,6 @@
 
 /* khandle stuff  ***********************************************************/
 
-/*
- * The 2.9 core will put 64 bit handles in here like this:
- *    1234 0000 0000 5678
- * The 3.0 and beyond cores will put 128 bit handles in here like this:
- *    1234 5678 90AB CDEF
- * The kernel module will always use the first four bytes and
- * the last four bytes as an inum.
- */
-struct orangefs_khandle {
-	unsigned char u[16];
-}  __aligned(8);
-
-/*
- * kernel version of an object ref.
- */
-struct orangefs_object_kref {
-	struct orangefs_khandle khandle;
-	__s32 fs_id;
-	__s32 __pad1;
-};
-
 /*
  * compare 2 khandles assumes little endian thus from large address to
  * small address
@@ -68,286 +47,13 @@ static inline void ORANGEFS_khandle_from(struct orangefs_khandle *kh,
 
 #define ORANGEFS_SUPER_MAGIC 0x20030528
 
-/*
- * ORANGEFS error codes are a signed 32-bit integer. Error codes are negative, but
- * the sign is stripped before decoding.
- */
-
-/* Bit 31 is not used since it is the sign. */
-
-/*
- * Bit 30 specifies that this is a ORANGEFS error. A ORANGEFS error is either an
- * encoded errno value or a ORANGEFS protocol error.
- */
-#define ORANGEFS_ERROR_BIT (1 << 30)
-
-/*
- * Bit 29 specifies that this is a ORANGEFS protocol error and not an encoded
- * errno value.
- */
-#define ORANGEFS_NON_ERRNO_ERROR_BIT (1 << 29)
-
-/*
- * Bits 9, 8, and 7 specify the error class, which encodes the section of
- * server code the error originated in for logging purposes. It is not used
- * in the kernel except to be masked out.
- */
-#define ORANGEFS_ERROR_CLASS_BITS 0x380
-
-/* Bits 6 - 0 are reserved for the actual error code. */
-#define ORANGEFS_ERROR_NUMBER_BITS 0x7f
-
-/* Encoded errno values decoded by PINT_errno_mapping in orangefs-utils.c. */
-
-/* Our own ORANGEFS protocol error codes. */
-#define ORANGEFS_ECANCEL    (1|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
-#define ORANGEFS_EDEVINIT   (2|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
-#define ORANGEFS_EDETAIL    (3|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
-#define ORANGEFS_EHOSTNTFD  (4|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
-#define ORANGEFS_EADDRNTFD  (5|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
-#define ORANGEFS_ENORECVR   (6|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
-#define ORANGEFS_ETRYAGAIN  (7|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
-#define ORANGEFS_ENOTPVFS   (8|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
-#define ORANGEFS_ESECURITY  (9|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
-
-/* permission bits */
-#define ORANGEFS_O_EXECUTE (1 << 0)
-#define ORANGEFS_O_WRITE   (1 << 1)
-#define ORANGEFS_O_READ    (1 << 2)
-#define ORANGEFS_G_EXECUTE (1 << 3)
-#define ORANGEFS_G_WRITE   (1 << 4)
-#define ORANGEFS_G_READ    (1 << 5)
-#define ORANGEFS_U_EXECUTE (1 << 6)
-#define ORANGEFS_U_WRITE   (1 << 7)
-#define ORANGEFS_U_READ    (1 << 8)
-/* no ORANGEFS_U_VTX (sticky bit) */
-#define ORANGEFS_G_SGID    (1 << 10)
-#define ORANGEFS_U_SUID    (1 << 11)
-
-#define ORANGEFS_ITERATE_START    2147483646
-#define ORANGEFS_ITERATE_END      2147483645
-#define ORANGEFS_IMMUTABLE_FL FS_IMMUTABLE_FL
-#define ORANGEFS_APPEND_FL    FS_APPEND_FL
-#define ORANGEFS_NOATIME_FL   FS_NOATIME_FL
-#define ORANGEFS_MIRROR_FL    0x01000000ULL
-#define ORANGEFS_FS_ID_NULL       ((__s32)0)
-#define ORANGEFS_ATTR_SYS_UID                   (1 << 0)
-#define ORANGEFS_ATTR_SYS_GID                   (1 << 1)
-#define ORANGEFS_ATTR_SYS_PERM                  (1 << 2)
-#define ORANGEFS_ATTR_SYS_ATIME                 (1 << 3)
-#define ORANGEFS_ATTR_SYS_CTIME                 (1 << 4)
-#define ORANGEFS_ATTR_SYS_MTIME                 (1 << 5)
-#define ORANGEFS_ATTR_SYS_TYPE                  (1 << 6)
-#define ORANGEFS_ATTR_SYS_ATIME_SET             (1 << 7)
-#define ORANGEFS_ATTR_SYS_MTIME_SET             (1 << 8)
-#define ORANGEFS_ATTR_SYS_SIZE                  (1 << 20)
-#define ORANGEFS_ATTR_SYS_LNK_TARGET            (1 << 24)
-#define ORANGEFS_ATTR_SYS_DFILE_COUNT           (1 << 25)
-#define ORANGEFS_ATTR_SYS_DIRENT_COUNT          (1 << 26)
-#define ORANGEFS_ATTR_SYS_BLKSIZE               (1 << 28)
-#define ORANGEFS_ATTR_SYS_MIRROR_COPIES_COUNT   (1 << 29)
-#define ORANGEFS_ATTR_SYS_COMMON_ALL	\
-	(ORANGEFS_ATTR_SYS_UID	|	\
-	 ORANGEFS_ATTR_SYS_GID	|	\
-	 ORANGEFS_ATTR_SYS_PERM	|	\
-	 ORANGEFS_ATTR_SYS_ATIME	|	\
-	 ORANGEFS_ATTR_SYS_CTIME	|	\
-	 ORANGEFS_ATTR_SYS_MTIME	|	\
-	 ORANGEFS_ATTR_SYS_TYPE)
-
-#define ORANGEFS_ATTR_SYS_ALL_SETABLE		\
-(ORANGEFS_ATTR_SYS_COMMON_ALL-ORANGEFS_ATTR_SYS_TYPE)
-
-#define ORANGEFS_ATTR_SYS_ALL_NOHINT			\
-	(ORANGEFS_ATTR_SYS_COMMON_ALL		|	\
-	 ORANGEFS_ATTR_SYS_SIZE			|	\
-	 ORANGEFS_ATTR_SYS_LNK_TARGET		|	\
-	 ORANGEFS_ATTR_SYS_DFILE_COUNT		|	\
-	 ORANGEFS_ATTR_SYS_MIRROR_COPIES_COUNT	|	\
-	 ORANGEFS_ATTR_SYS_DIRENT_COUNT		|	\
-	 ORANGEFS_ATTR_SYS_BLKSIZE)
-
-#define ORANGEFS_XATTR_REPLACE 0x2
-#define ORANGEFS_XATTR_CREATE  0x1
-#define ORANGEFS_MAX_SERVER_ADDR_LEN 256
-#define ORANGEFS_NAME_MAX                256
-/*
- * max extended attribute name len as imposed by the VFS and exploited for the
- * upcall request types.
- * NOTE: Please retain them as multiples of 8 even if you wish to change them
- * This is *NECESSARY* for supporting 32 bit user-space binaries on a 64-bit
- * kernel. Due to implementation within DBPF, this really needs to be
- * ORANGEFS_NAME_MAX, which it was the same value as, but no reason to let it
- * break if that changes in the future.
- */
-#define ORANGEFS_MAX_XATTR_NAMELEN   ORANGEFS_NAME_MAX	/* Not the same as
-						 * XATTR_NAME_MAX defined
-						 * by <linux/xattr.h>
-						 */
-#define ORANGEFS_MAX_XATTR_VALUELEN  8192	/* Not the same as XATTR_SIZE_MAX
-					 * defined by <linux/xattr.h>
-					 */
-#define ORANGEFS_MAX_XATTR_LISTLEN   16	/* Not the same as XATTR_LIST_MAX
-					 * defined by <linux/xattr.h>
-					 */
-/*
- * ORANGEFS I/O operation types, used in both system and server interfaces.
- */
-enum ORANGEFS_io_type {
-	ORANGEFS_IO_READ = 1,
-	ORANGEFS_IO_WRITE = 2
-};
-
-/*
- * If this enum is modified the server parameters related to the precreate pool
- * batch and low threshold sizes may need to be modified  to reflect this
- * change.
- */
-enum orangefs_ds_type {
-	ORANGEFS_TYPE_NONE = 0,
-	ORANGEFS_TYPE_METAFILE = (1 << 0),
-	ORANGEFS_TYPE_DATAFILE = (1 << 1),
-	ORANGEFS_TYPE_DIRECTORY = (1 << 2),
-	ORANGEFS_TYPE_SYMLINK = (1 << 3),
-	ORANGEFS_TYPE_DIRDATA = (1 << 4),
-	ORANGEFS_TYPE_INTERNAL = (1 << 5)	/* for the server's private use */
-};
-
-/* This structure is used by the VFS-client interaction alone */
-struct ORANGEFS_keyval_pair {
-	char key[ORANGEFS_MAX_XATTR_NAMELEN];
-	__s32 key_sz;	/* __s32 for portable, fixed-size structures */
-	__s32 val_sz;
-	char val[ORANGEFS_MAX_XATTR_VALUELEN];
-};
-
-/* pvfs2-sysint.h ***********************************************************/
-/* Describes attributes for a file, directory, or symlink. */
-struct ORANGEFS_sys_attr_s {
-	__u32 owner;
-	__u32 group;
-	__u32 perms;
-	__u64 atime;
-	__u64 mtime;
-	__u64 ctime;
-	__s64 size;
-
-	/* NOTE: caller must free if valid */
-	char *link_target;
-
-	/* Changed to __s32 so that size of structure does not change */
-	__s32 dfile_count;
-
-	/* Changed to __s32 so that size of structure does not change */
-	__s32 distr_dir_servers_initial;
-
-	/* Changed to __s32 so that size of structure does not change */
-	__s32 distr_dir_servers_max;
-
-	/* Changed to __s32 so that size of structure does not change */
-	__s32 distr_dir_split_size;
-
-	__u32 mirror_copies_count;
-
-	/* NOTE: caller must free if valid */
-	char *dist_name;
-
-	/* NOTE: caller must free if valid */
-	char *dist_params;
-
-	__s64 dirent_count;
-	enum orangefs_ds_type objtype;
-	__u64 flags;
-	__u32 mask;
-	__s64 blksize;
-};
-
-#define ORANGEFS_LOOKUP_LINK_NO_FOLLOW 0
-
-/* pint-dev.h ***************************************************************/
-
-/* parameter structure used in ORANGEFS_DEV_DEBUG ioctl command */
-struct dev_mask_info_s {
-	enum {
-		KERNEL_MASK,
-		CLIENT_MASK,
-	} mask_type;
-	__u64 mask_value;
-};
-
-struct dev_mask2_info_s {
-	__u64 mask1_value;
-	__u64 mask2_value;
-};
-
 /* pvfs2-util.h *************************************************************/
 __s32 ORANGEFS_util_translate_mode(int mode);
 
-/* pvfs2-debug.h ************************************************************/
-#include "orangefs-debug.h"
-
 /* pvfs2-internal.h *********************************************************/
 #define llu(x) (unsigned long long)(x)
 #define lld(x) (long long)(x)
 
-/* pint-dev-shared.h ********************************************************/
-#define ORANGEFS_DEV_MAGIC 'k'
-
-#define ORANGEFS_READDIR_DEFAULT_DESC_COUNT  5
-
-#define DEV_GET_MAGIC           0x1
-#define DEV_GET_MAX_UPSIZE      0x2
-#define DEV_GET_MAX_DOWNSIZE    0x3
-#define DEV_MAP                 0x4
-#define DEV_REMOUNT_ALL         0x5
-#define DEV_DEBUG               0x6
-#define DEV_UPSTREAM            0x7
-#define DEV_CLIENT_MASK         0x8
-#define DEV_CLIENT_STRING       0x9
-#define DEV_MAX_NR              0xa
-
-/* supported ioctls, codes are with respect to user-space */
-enum {
-	ORANGEFS_DEV_GET_MAGIC = _IOW(ORANGEFS_DEV_MAGIC, DEV_GET_MAGIC, __s32),
-	ORANGEFS_DEV_GET_MAX_UPSIZE =
-	    _IOW(ORANGEFS_DEV_MAGIC, DEV_GET_MAX_UPSIZE, __s32),
-	ORANGEFS_DEV_GET_MAX_DOWNSIZE =
-	    _IOW(ORANGEFS_DEV_MAGIC, DEV_GET_MAX_DOWNSIZE, __s32),
-	ORANGEFS_DEV_MAP = _IO(ORANGEFS_DEV_MAGIC, DEV_MAP),
-	ORANGEFS_DEV_REMOUNT_ALL = _IO(ORANGEFS_DEV_MAGIC, DEV_REMOUNT_ALL),
-	ORANGEFS_DEV_DEBUG = _IOR(ORANGEFS_DEV_MAGIC, DEV_DEBUG, __s32),
-	ORANGEFS_DEV_UPSTREAM = _IOW(ORANGEFS_DEV_MAGIC, DEV_UPSTREAM, int),
-	ORANGEFS_DEV_CLIENT_MASK = _IOW(ORANGEFS_DEV_MAGIC,
-				    DEV_CLIENT_MASK,
-				    struct dev_mask2_info_s),
-	ORANGEFS_DEV_CLIENT_STRING = _IOW(ORANGEFS_DEV_MAGIC,
-				      DEV_CLIENT_STRING,
-				      char *),
-	ORANGEFS_DEV_MAXNR = DEV_MAX_NR,
-};
-
-/*
- * version number for use in communicating between kernel space and user
- * space. Zero signifies the upstream version of the kernel module.
- */
-#define ORANGEFS_KERNEL_PROTO_VERSION 0
-#define ORANGEFS_MINIMUM_USERSPACE_VERSION 20903
-
-/*
- * describes memory regions to map in the ORANGEFS_DEV_MAP ioctl.
- * NOTE: See devorangefs-req.c for 32 bit compat structure.
- * Since this structure has a variable-sized layout that is different
- * on 32 and 64 bit platforms, we need to normalize to a 64 bit layout
- * on such systems before servicing ioctl calls from user-space binaries
- * that may be 32 bit!
- */
-struct ORANGEFS_dev_map_desc {
-	void *ptr;
-	__s32 total_size;
-	__s32 size;
-	__s32 count;
-};
-
 /* gossip.h *****************************************************************/
 
 extern __u64 orangefs_gossip_debug_mask;
diff --git a/fs/orangefs/super.c b/fs/orangefs/super.c
index a4f4b508eff2..b75896728e33 100644
--- a/fs/orangefs/super.c
+++ b/fs/orangefs/super.c
@@ -5,7 +5,6 @@
  * See COPYING in top-level directory.
  */
 
-#include "protocol.h"
 #include "orangefs-kernel.h"
 #include "orangefs-bufmap.h"
 
diff --git a/fs/orangefs/symlink.c b/fs/orangefs/symlink.c
index db107fe91ab3..106c0dfd48bf 100644
--- a/fs/orangefs/symlink.c
+++ b/fs/orangefs/symlink.c
@@ -5,7 +5,6 @@
  * See COPYING in top-level directory.
  */
 
-#include "protocol.h"
 #include "orangefs-kernel.h"
 #include "orangefs-bufmap.h"
 
diff --git a/fs/orangefs/upcall.h b/fs/orangefs/upcall.h
deleted file mode 100644
index 16118452aa12..000000000000
--- a/fs/orangefs/upcall.h
+++ /dev/null
@@ -1,260 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * (C) 2001 Clemson University and The University of Chicago
- *
- * See COPYING in top-level directory.
- */
-
-#ifndef __UPCALL_H
-#define __UPCALL_H
-
-/*
- * Sanitized this header file to fix
- * 32-64 bit interaction issues between
- * client-core and device
- */
-struct orangefs_io_request_s {
-	__s32 __pad1;
-	__s32 buf_index;
-	__s32 count;
-	__s32 __pad2;
-	__s64 offset;
-	struct orangefs_object_kref refn;
-	enum ORANGEFS_io_type io_type;
-	__s32 readahead_size;
-};
-
-struct orangefs_lookup_request_s {
-	__s32 sym_follow;
-	__s32 __pad1;
-	struct orangefs_object_kref parent_refn;
-	char d_name[ORANGEFS_NAME_MAX];
-};
-
-struct orangefs_create_request_s {
-	struct orangefs_object_kref parent_refn;
-	struct ORANGEFS_sys_attr_s attributes;
-	char d_name[ORANGEFS_NAME_MAX];
-};
-
-struct orangefs_symlink_request_s {
-	struct orangefs_object_kref parent_refn;
-	struct ORANGEFS_sys_attr_s attributes;
-	char entry_name[ORANGEFS_NAME_MAX];
-	char target[ORANGEFS_NAME_MAX];
-};
-
-struct orangefs_getattr_request_s {
-	struct orangefs_object_kref refn;
-	__u32 mask;
-	__u32 __pad1;
-};
-
-struct orangefs_setattr_request_s {
-	struct orangefs_object_kref refn;
-	struct ORANGEFS_sys_attr_s attributes;
-};
-
-struct orangefs_remove_request_s {
-	struct orangefs_object_kref parent_refn;
-	char d_name[ORANGEFS_NAME_MAX];
-};
-
-struct orangefs_mkdir_request_s {
-	struct orangefs_object_kref parent_refn;
-	struct ORANGEFS_sys_attr_s attributes;
-	char d_name[ORANGEFS_NAME_MAX];
-};
-
-struct orangefs_readdir_request_s {
-	struct orangefs_object_kref refn;
-	__u64 token;
-	__s32 max_dirent_count;
-	__s32 buf_index;
-};
-
-struct orangefs_readdirplus_request_s {
-	struct orangefs_object_kref refn;
-	__u64 token;
-	__s32 max_dirent_count;
-	__u32 mask;
-	__s32 buf_index;
-	__s32 __pad1;
-};
-
-struct orangefs_rename_request_s {
-	struct orangefs_object_kref old_parent_refn;
-	struct orangefs_object_kref new_parent_refn;
-	char d_old_name[ORANGEFS_NAME_MAX];
-	char d_new_name[ORANGEFS_NAME_MAX];
-};
-
-struct orangefs_statfs_request_s {
-	__s32 fs_id;
-	__s32 __pad1;
-};
-
-struct orangefs_truncate_request_s {
-	struct orangefs_object_kref refn;
-	__s64 size;
-};
-
-struct orangefs_ra_cache_flush_request_s {
-	struct orangefs_object_kref refn;
-};
-
-struct orangefs_fs_mount_request_s {
-	char orangefs_config_server[ORANGEFS_MAX_SERVER_ADDR_LEN];
-};
-
-struct orangefs_fs_umount_request_s {
-	__s32 id;
-	__s32 fs_id;
-	char orangefs_config_server[ORANGEFS_MAX_SERVER_ADDR_LEN];
-};
-
-struct orangefs_getxattr_request_s {
-	struct orangefs_object_kref refn;
-	__s32 key_sz;
-	__s32 __pad1;
-	char key[ORANGEFS_MAX_XATTR_NAMELEN];
-};
-
-struct orangefs_setxattr_request_s {
-	struct orangefs_object_kref refn;
-	struct ORANGEFS_keyval_pair keyval;
-	__s32 flags;
-	__s32 __pad1;
-};
-
-struct orangefs_listxattr_request_s {
-	struct orangefs_object_kref refn;
-	__s32 requested_count;
-	__s32 __pad1;
-	__u64 token;
-};
-
-struct orangefs_removexattr_request_s {
-	struct orangefs_object_kref refn;
-	__s32 key_sz;
-	__s32 __pad1;
-	char key[ORANGEFS_MAX_XATTR_NAMELEN];
-};
-
-struct orangefs_op_cancel_s {
-	__u64 op_tag;
-};
-
-struct orangefs_fsync_request_s {
-	struct orangefs_object_kref refn;
-};
-
-enum orangefs_param_request_type {
-	ORANGEFS_PARAM_REQUEST_SET = 1,
-	ORANGEFS_PARAM_REQUEST_GET = 2
-};
-
-enum orangefs_param_request_op {
-	ORANGEFS_PARAM_REQUEST_OP_ACACHE_TIMEOUT_MSECS = 1,
-	ORANGEFS_PARAM_REQUEST_OP_ACACHE_HARD_LIMIT = 2,
-	ORANGEFS_PARAM_REQUEST_OP_ACACHE_SOFT_LIMIT = 3,
-	ORANGEFS_PARAM_REQUEST_OP_ACACHE_RECLAIM_PERCENTAGE = 4,
-	ORANGEFS_PARAM_REQUEST_OP_PERF_TIME_INTERVAL_SECS = 5,
-	ORANGEFS_PARAM_REQUEST_OP_PERF_HISTORY_SIZE = 6,
-	ORANGEFS_PARAM_REQUEST_OP_PERF_RESET = 7,
-	ORANGEFS_PARAM_REQUEST_OP_NCACHE_TIMEOUT_MSECS = 8,
-	ORANGEFS_PARAM_REQUEST_OP_NCACHE_HARD_LIMIT = 9,
-	ORANGEFS_PARAM_REQUEST_OP_NCACHE_SOFT_LIMIT = 10,
-	ORANGEFS_PARAM_REQUEST_OP_NCACHE_RECLAIM_PERCENTAGE = 11,
-	ORANGEFS_PARAM_REQUEST_OP_STATIC_ACACHE_TIMEOUT_MSECS = 12,
-	ORANGEFS_PARAM_REQUEST_OP_STATIC_ACACHE_HARD_LIMIT = 13,
-	ORANGEFS_PARAM_REQUEST_OP_STATIC_ACACHE_SOFT_LIMIT = 14,
-	ORANGEFS_PARAM_REQUEST_OP_STATIC_ACACHE_RECLAIM_PERCENTAGE = 15,
-	ORANGEFS_PARAM_REQUEST_OP_CLIENT_DEBUG = 16,
-	ORANGEFS_PARAM_REQUEST_OP_CCACHE_TIMEOUT_SECS = 17,
-	ORANGEFS_PARAM_REQUEST_OP_CCACHE_HARD_LIMIT = 18,
-	ORANGEFS_PARAM_REQUEST_OP_CCACHE_SOFT_LIMIT = 19,
-	ORANGEFS_PARAM_REQUEST_OP_CCACHE_RECLAIM_PERCENTAGE = 20,
-	ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_TIMEOUT_SECS = 21,
-	ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_HARD_LIMIT = 22,
-	ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_SOFT_LIMIT = 23,
-	ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_RECLAIM_PERCENTAGE = 24,
-	ORANGEFS_PARAM_REQUEST_OP_TWO_MASK_VALUES = 25,
-	ORANGEFS_PARAM_REQUEST_OP_READAHEAD_SIZE = 26,
-	ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT = 27,
-	ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE = 28,
-	ORANGEFS_PARAM_REQUEST_OP_READAHEAD_READCNT = 29,
-};
-
-struct orangefs_param_request_s {
-	enum orangefs_param_request_type type;
-	enum orangefs_param_request_op op;
-	union {
-		__s64 value64;
-		__s32 value32[2];
-	} u;
-	char s_value[ORANGEFS_MAX_DEBUG_STRING_LEN];
-};
-
-enum orangefs_perf_count_request_type {
-	ORANGEFS_PERF_COUNT_REQUEST_ACACHE = 1,
-	ORANGEFS_PERF_COUNT_REQUEST_NCACHE = 2,
-	ORANGEFS_PERF_COUNT_REQUEST_CAPCACHE = 3,
-};
-
-struct orangefs_perf_count_request_s {
-	enum orangefs_perf_count_request_type type;
-	__s32 __pad1;
-};
-
-struct orangefs_fs_key_request_s {
-	__s32 fsid;
-	__s32 __pad1;
-};
-
-/* 2.9.6 */
-struct orangefs_features_request_s {
-	__u64 features;
-};
-
-struct orangefs_upcall_s {
-	__s32 type;
-	__u32 uid;
-	__u32 gid;
-	int pid;
-	int tgid;
-	/* Trailers unused but must be retained for protocol compatibility. */
-	__s64 trailer_size;
-	char *trailer_buf;
-
-	union {
-		struct orangefs_io_request_s io;
-		struct orangefs_lookup_request_s lookup;
-		struct orangefs_create_request_s create;
-		struct orangefs_symlink_request_s sym;
-		struct orangefs_getattr_request_s getattr;
-		struct orangefs_setattr_request_s setattr;
-		struct orangefs_remove_request_s remove;
-		struct orangefs_mkdir_request_s mkdir;
-		struct orangefs_readdir_request_s readdir;
-		struct orangefs_readdirplus_request_s readdirplus;
-		struct orangefs_rename_request_s rename;
-		struct orangefs_statfs_request_s statfs;
-		struct orangefs_truncate_request_s truncate;
-		struct orangefs_ra_cache_flush_request_s ra_cache_flush;
-		struct orangefs_fs_mount_request_s fs_mount;
-		struct orangefs_fs_umount_request_s fs_umount;
-		struct orangefs_getxattr_request_s getxattr;
-		struct orangefs_setxattr_request_s setxattr;
-		struct orangefs_listxattr_request_s listxattr;
-		struct orangefs_removexattr_request_s removexattr;
-		struct orangefs_op_cancel_s cancel;
-		struct orangefs_fsync_request_s fsync;
-		struct orangefs_param_request_s param;
-		struct orangefs_perf_count_request_s perf_count;
-		struct orangefs_fs_key_request_s fs_key;
-		struct orangefs_features_request_s features;
-	} req;
-};
-
-#endif /* __UPCALL_H */
diff --git a/fs/orangefs/waitqueue.c b/fs/orangefs/waitqueue.c
index 0577d6dba8c8..1992a2647b8a 100644
--- a/fs/orangefs/waitqueue.c
+++ b/fs/orangefs/waitqueue.c
@@ -13,7 +13,6 @@
  *  In-kernel waitqueue operations.
  */
 
-#include "protocol.h"
 #include "orangefs-kernel.h"
 #include "orangefs-bufmap.h"
 
diff --git a/fs/orangefs/xattr.c b/fs/orangefs/xattr.c
index 03bcb871544d..b3b0db56b408 100644
--- a/fs/orangefs/xattr.c
+++ b/fs/orangefs/xattr.c
@@ -9,7 +9,6 @@
  *  Linux VFS extended attribute operations.
  */
 
-#include "protocol.h"
 #include "orangefs-kernel.h"
 #include "orangefs-bufmap.h"
 #include <linux/posix_acl_xattr.h>
diff --git a/include/uapi/linux/orangefs.h b/include/uapi/linux/orangefs.h
new file mode 100644
index 000000000000..eb201fa68c43
--- /dev/null
+++ b/include/uapi/linux/orangefs.h
@@ -0,0 +1,732 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * (C) 2001 Clemson University and The University of Chicago
+ * Copyright 2018 Omnibond Systems, L.L.C.
+ *
+ * See COPYING in top-level directory.
+ */
+
+#ifndef _UAPI_LINUX_ORANGEFS_H
+#define _UAPI_LINUX_ORANGEFS_H
+
+#include <linux/ioctl.h>
+#include <linux/types.h>
+
+/*
+ * valid orangefs kernel operation types
+ */
+#define ORANGEFS_VFS_OP_INVALID      0xFF000000
+#define ORANGEFS_VFS_OP_FILE_IO      0xFF000001
+#define ORANGEFS_VFS_OP_LOOKUP       0xFF000002
+#define ORANGEFS_VFS_OP_CREATE       0xFF000003
+#define ORANGEFS_VFS_OP_GETATTR      0xFF000004
+#define ORANGEFS_VFS_OP_REMOVE       0xFF000005
+#define ORANGEFS_VFS_OP_MKDIR        0xFF000006
+#define ORANGEFS_VFS_OP_READDIR      0xFF000007
+#define ORANGEFS_VFS_OP_SETATTR      0xFF000008
+#define ORANGEFS_VFS_OP_SYMLINK      0xFF000009
+#define ORANGEFS_VFS_OP_RENAME       0xFF00000A
+#define ORANGEFS_VFS_OP_STATFS       0xFF00000B
+#define ORANGEFS_VFS_OP_TRUNCATE     0xFF00000C
+#define ORANGEFS_VFS_OP_RA_FLUSH     0xFF00000D
+#define ORANGEFS_VFS_OP_FS_MOUNT     0xFF00000E
+#define ORANGEFS_VFS_OP_FS_UMOUNT    0xFF00000F
+#define ORANGEFS_VFS_OP_GETXATTR     0xFF000010
+#define ORANGEFS_VFS_OP_SETXATTR     0xFF000011
+#define ORANGEFS_VFS_OP_LISTXATTR    0xFF000012
+#define ORANGEFS_VFS_OP_REMOVEXATTR  0xFF000013
+#define ORANGEFS_VFS_OP_PARAM        0xFF000014
+#define ORANGEFS_VFS_OP_PERF_COUNT   0xFF000015
+#define ORANGEFS_VFS_OP_CANCEL       0xFF00EE00
+#define ORANGEFS_VFS_OP_FSYNC        0xFF00EE01
+#define ORANGEFS_VFS_OP_FSKEY        0xFF00EE02
+#define ORANGEFS_VFS_OP_READDIRPLUS  0xFF00EE03
+#define ORANGEFS_VFS_OP_FEATURES     0xFF00EE05 /* 2.9.6 */
+
+/* features is a 64-bit unsigned bitmask */
+#define ORANGEFS_FEATURE_READAHEAD 1
+
+/*
+ * Misc constants. Please retain them as multiples of 8!
+ * Otherwise 32-64 bit interactions will be messed up :)
+ */
+#define ORANGEFS_MAX_DEBUG_STRING_LEN 0x00000800
+
+#define ORANGEFS_MAX_DIRENT_COUNT_READDIR 512
+
+/*
+ * The 2.9 core will put 64 bit handles in here like this:
+ *    1234 0000 0000 5678
+ * The 3.0 and beyond cores will put 128 bit handles in here like this:
+ *    1234 5678 90AB CDEF
+ * The kernel module will always use the first four bytes and
+ * the last four bytes as an inum.
+ */
+struct orangefs_khandle {
+	unsigned char u[16];
+} __attribute__((aligned(8)));
+
+/*
+ * kernel version of an object ref.
+ */
+struct orangefs_object_kref {
+	struct orangefs_khandle khandle;
+	__s32 fs_id;
+	__s32 __pad1;
+};
+
+/*
+ * ORANGEFS error codes are a signed 32-bit integer. Error codes are negative, but
+ * the sign is stripped before decoding.
+ */
+
+/* Bit 31 is not used since it is the sign. */
+
+/*
+ * Bit 30 specifies that this is a ORANGEFS error. A ORANGEFS error is either an
+ * encoded errno value or a ORANGEFS protocol error.
+ */
+#define ORANGEFS_ERROR_BIT (1 << 30)
+
+/*
+ * Bit 29 specifies that this is a ORANGEFS protocol error and not an encoded
+ * errno value.
+ */
+#define ORANGEFS_NON_ERRNO_ERROR_BIT (1 << 29)
+
+/*
+ * Bits 9, 8, and 7 specify the error class, which encodes the section of
+ * server code the error originated in for logging purposes. It is not used
+ * in the kernel except to be masked out.
+ */
+#define ORANGEFS_ERROR_CLASS_BITS 0x380
+
+/* Bits 6 - 0 are reserved for the actual error code. */
+#define ORANGEFS_ERROR_NUMBER_BITS 0x7f
+
+/* Encoded errno values decoded by PINT_errno_mapping in orangefs-utils.c. */
+
+/* Our own ORANGEFS protocol error codes. */
+#define ORANGEFS_ECANCEL    (1|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
+#define ORANGEFS_EDEVINIT   (2|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
+#define ORANGEFS_EDETAIL    (3|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
+#define ORANGEFS_EHOSTNTFD  (4|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
+#define ORANGEFS_EADDRNTFD  (5|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
+#define ORANGEFS_ENORECVR   (6|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
+#define ORANGEFS_ETRYAGAIN  (7|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
+#define ORANGEFS_ENOTPVFS   (8|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
+#define ORANGEFS_ESECURITY  (9|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
+
+/* permission bits */
+#define ORANGEFS_O_EXECUTE (1 << 0)
+#define ORANGEFS_O_WRITE   (1 << 1)
+#define ORANGEFS_O_READ    (1 << 2)
+#define ORANGEFS_G_EXECUTE (1 << 3)
+#define ORANGEFS_G_WRITE   (1 << 4)
+#define ORANGEFS_G_READ    (1 << 5)
+#define ORANGEFS_U_EXECUTE (1 << 6)
+#define ORANGEFS_U_WRITE   (1 << 7)
+#define ORANGEFS_U_READ    (1 << 8)
+/* no ORANGEFS_U_VTX (sticky bit) */
+#define ORANGEFS_G_SGID    (1 << 10)
+#define ORANGEFS_U_SUID    (1 << 11)
+
+#define ORANGEFS_ITERATE_START  2147483646
+#define ORANGEFS_ITERATE_END    2147483645
+#define ORANGEFS_IMMUTABLE_FL   FS_IMMUTABLE_FL
+#define ORANGEFS_APPEND_FL      FS_APPEND_FL
+#define ORANGEFS_NOATIME_FL     FS_NOATIME_FL
+#define ORANGEFS_MIRROR_FL      0x01000000ULL
+#define ORANGEFS_FS_ID_NULL     ((__s32)0)
+#define ORANGEFS_ATTR_SYS_UID                  (1 << 0)
+#define ORANGEFS_ATTR_SYS_GID                  (1 << 1)
+#define ORANGEFS_ATTR_SYS_PERM                 (1 << 2)
+#define ORANGEFS_ATTR_SYS_ATIME                (1 << 3)
+#define ORANGEFS_ATTR_SYS_CTIME                (1 << 4)
+#define ORANGEFS_ATTR_SYS_MTIME                (1 << 5)
+#define ORANGEFS_ATTR_SYS_TYPE                 (1 << 6)
+#define ORANGEFS_ATTR_SYS_ATIME_SET            (1 << 7)
+#define ORANGEFS_ATTR_SYS_MTIME_SET            (1 << 8)
+#define ORANGEFS_ATTR_SYS_SIZE                 (1 << 20)
+#define ORANGEFS_ATTR_SYS_LNK_TARGET           (1 << 24)
+#define ORANGEFS_ATTR_SYS_DFILE_COUNT          (1 << 25)
+#define ORANGEFS_ATTR_SYS_DIRENT_COUNT         (1 << 26)
+#define ORANGEFS_ATTR_SYS_BLKSIZE              (1 << 28)
+#define ORANGEFS_ATTR_SYS_MIRROR_COPIES_COUNT  (1 << 29)
+#define ORANGEFS_ATTR_SYS_COMMON_ALL	\
+	(ORANGEFS_ATTR_SYS_UID	|	\
+	 ORANGEFS_ATTR_SYS_GID	|	\
+	 ORANGEFS_ATTR_SYS_PERM	|	\
+	 ORANGEFS_ATTR_SYS_ATIME	|	\
+	 ORANGEFS_ATTR_SYS_CTIME	|	\
+	 ORANGEFS_ATTR_SYS_MTIME	|	\
+	 ORANGEFS_ATTR_SYS_TYPE)
+
+#define ORANGEFS_ATTR_SYS_ALL_SETABLE		\
+(ORANGEFS_ATTR_SYS_COMMON_ALL-ORANGEFS_ATTR_SYS_TYPE)
+
+#define ORANGEFS_ATTR_SYS_ALL_NOHINT			\
+	(ORANGEFS_ATTR_SYS_COMMON_ALL		|	\
+	 ORANGEFS_ATTR_SYS_SIZE			|	\
+	 ORANGEFS_ATTR_SYS_LNK_TARGET		|	\
+	 ORANGEFS_ATTR_SYS_DFILE_COUNT		|	\
+	 ORANGEFS_ATTR_SYS_MIRROR_COPIES_COUNT	|	\
+	 ORANGEFS_ATTR_SYS_DIRENT_COUNT		|	\
+	 ORANGEFS_ATTR_SYS_BLKSIZE)
+
+#define ORANGEFS_XATTR_REPLACE 0x2
+#define ORANGEFS_XATTR_CREATE  0x1
+#define ORANGEFS_MAX_SERVER_ADDR_LEN 256
+#define ORANGEFS_NAME_MAX                256
+/*
+ * max extended attribute name len as imposed by the VFS and exploited for the
+ * upcall request types.
+ * NOTE: Please retain them as multiples of 8 even if you wish to change them
+ * This is *NECESSARY* for supporting 32 bit user-space binaries on a 64-bit
+ * kernel. Due to implementation within DBPF, this really needs to be
+ * ORANGEFS_NAME_MAX, which it was the same value as, but no reason to let it
+ * break if that changes in the future.
+ */
+#define ORANGEFS_MAX_XATTR_NAMELEN   ORANGEFS_NAME_MAX	/* Not the same as
+						 * XATTR_NAME_MAX defined
+						 * by <linux/xattr.h>
+						 */
+#define ORANGEFS_MAX_XATTR_VALUELEN  8192	/* Not the same as XATTR_SIZE_MAX
+					 * defined by <linux/xattr.h>
+					 */
+#define ORANGEFS_MAX_XATTR_LISTLEN   16	/* Not the same as XATTR_LIST_MAX
+					 * defined by <linux/xattr.h>
+					 */
+/*
+ * ORANGEFS I/O operation types, used in both system and server interfaces.
+ */
+enum ORANGEFS_io_type {
+	ORANGEFS_IO_READ = 1,
+	ORANGEFS_IO_WRITE = 2
+};
+
+/*
+ * If this enum is modified the server parameters related to the precreate pool
+ * batch and low threshold sizes may need to be modified  to reflect this
+ * change.
+ */
+enum orangefs_ds_type {
+	ORANGEFS_TYPE_NONE = 0,
+	ORANGEFS_TYPE_METAFILE = (1 << 0),
+	ORANGEFS_TYPE_DATAFILE = (1 << 1),
+	ORANGEFS_TYPE_DIRECTORY = (1 << 2),
+	ORANGEFS_TYPE_SYMLINK = (1 << 3),
+	ORANGEFS_TYPE_DIRDATA = (1 << 4),
+	ORANGEFS_TYPE_INTERNAL = (1 << 5)	/* for the server's private use */
+};
+
+/* This structure is used by the VFS-client interaction alone */
+struct ORANGEFS_keyval_pair {
+	char key[ORANGEFS_MAX_XATTR_NAMELEN];
+	__s32 key_sz;	/* __s32 for portable, fixed-size structures */
+	__s32 val_sz;
+	char val[ORANGEFS_MAX_XATTR_VALUELEN];
+};
+
+/* pvfs2-sysint.h ***********************************************************/
+/* Describes attributes for a file, directory, or symlink. */
+struct ORANGEFS_sys_attr_s {
+	__u32 owner;
+	__u32 group;
+	__u32 perms;
+	__u64 atime;
+	__u64 mtime;
+	__u64 ctime;
+	__s64 size;
+
+	/* NOTE: caller must free if valid */
+	char *link_target;
+
+	/* Changed to __s32 so that size of structure does not change */
+	__s32 dfile_count;
+
+	/* Changed to __s32 so that size of structure does not change */
+	__s32 distr_dir_servers_initial;
+
+	/* Changed to __s32 so that size of structure does not change */
+	__s32 distr_dir_servers_max;
+
+	/* Changed to __s32 so that size of structure does not change */
+	__s32 distr_dir_split_size;
+
+	__u32 mirror_copies_count;
+
+	/* NOTE: caller must free if valid */
+	char *dist_name;
+
+	/* NOTE: caller must free if valid */
+	char *dist_params;
+
+	__s64 dirent_count;
+	enum orangefs_ds_type objtype;
+	__u64 flags;
+	__u32 mask;
+	__s64 blksize;
+};
+
+#define ORANGEFS_LOOKUP_LINK_NO_FOLLOW 0
+
+/* pint-dev.h ***************************************************************/
+
+/* parameter structure used in ORANGEFS_DEV_DEBUG ioctl command */
+struct dev_mask_info_s {
+	enum {
+		KERNEL_MASK,
+		CLIENT_MASK,
+	} mask_type;
+	__u64 mask_value;
+};
+
+struct dev_mask2_info_s {
+	__u64 mask1_value;
+	__u64 mask2_value;
+};
+
+#define	GOSSIP_NO_DEBUG			(__u64)0
+
+#define GOSSIP_SUPER_DEBUG		((__u64)1 << 0)
+#define GOSSIP_INODE_DEBUG		((__u64)1 << 1)
+#define GOSSIP_FILE_DEBUG		((__u64)1 << 2)
+#define GOSSIP_DIR_DEBUG		((__u64)1 << 3)
+#define GOSSIP_UTILS_DEBUG		((__u64)1 << 4)
+#define GOSSIP_WAIT_DEBUG		((__u64)1 << 5)
+#define GOSSIP_ACL_DEBUG		((__u64)1 << 6)
+#define GOSSIP_DCACHE_DEBUG		((__u64)1 << 7)
+#define GOSSIP_DEV_DEBUG		((__u64)1 << 8)
+#define GOSSIP_NAME_DEBUG		((__u64)1 << 9)
+#define GOSSIP_BUFMAP_DEBUG		((__u64)1 << 10)
+#define GOSSIP_CACHE_DEBUG		((__u64)1 << 11)
+#define GOSSIP_DEBUGFS_DEBUG		((__u64)1 << 12)
+#define GOSSIP_XATTR_DEBUG		((__u64)1 << 13)
+#define GOSSIP_INIT_DEBUG		((__u64)1 << 14)
+#define GOSSIP_SYSFS_DEBUG		((__u64)1 << 15)
+
+#define GOSSIP_MAX_NR                 16
+#define GOSSIP_MAX_DEBUG              (((__u64)1 << GOSSIP_MAX_NR) - 1)
+
+/* pint-dev-shared.h ********************************************************/
+#define ORANGEFS_DEV_MAGIC 'k'
+
+#define ORANGEFS_READDIR_DEFAULT_DESC_COUNT  5
+
+#define DEV_GET_MAGIC           0x1
+#define DEV_GET_MAX_UPSIZE      0x2
+#define DEV_GET_MAX_DOWNSIZE    0x3
+#define DEV_MAP                 0x4
+#define DEV_REMOUNT_ALL         0x5
+#define DEV_DEBUG               0x6
+#define DEV_UPSTREAM            0x7
+#define DEV_CLIENT_MASK         0x8
+#define DEV_CLIENT_STRING       0x9
+#define DEV_MAX_NR              0xa
+
+/* supported ioctls, codes are with respect to user-space */
+enum {
+	ORANGEFS_DEV_GET_MAGIC = _IOW(ORANGEFS_DEV_MAGIC, DEV_GET_MAGIC, __s32),
+	ORANGEFS_DEV_GET_MAX_UPSIZE =
+	    _IOW(ORANGEFS_DEV_MAGIC, DEV_GET_MAX_UPSIZE, __s32),
+	ORANGEFS_DEV_GET_MAX_DOWNSIZE =
+	    _IOW(ORANGEFS_DEV_MAGIC, DEV_GET_MAX_DOWNSIZE, __s32),
+	ORANGEFS_DEV_MAP = _IO(ORANGEFS_DEV_MAGIC, DEV_MAP),
+	ORANGEFS_DEV_REMOUNT_ALL = _IO(ORANGEFS_DEV_MAGIC, DEV_REMOUNT_ALL),
+	ORANGEFS_DEV_DEBUG = _IOR(ORANGEFS_DEV_MAGIC, DEV_DEBUG, __s32),
+	ORANGEFS_DEV_UPSTREAM = _IOW(ORANGEFS_DEV_MAGIC, DEV_UPSTREAM, int),
+	ORANGEFS_DEV_CLIENT_MASK = _IOW(ORANGEFS_DEV_MAGIC,
+				    DEV_CLIENT_MASK,
+				    struct dev_mask2_info_s),
+	ORANGEFS_DEV_CLIENT_STRING = _IOW(ORANGEFS_DEV_MAGIC,
+				      DEV_CLIENT_STRING,
+				      char *),
+	ORANGEFS_DEV_MAXNR = DEV_MAX_NR,
+};
+
+/*
+ * version number for use in communicating between kernel space and user
+ * space. Zero signifies the upstream version of the kernel module.
+ */
+#define ORANGEFS_KERNEL_PROTO_VERSION 0
+#define ORANGEFS_MINIMUM_USERSPACE_VERSION 20903
+
+/*
+ * describes memory regions to map in the ORANGEFS_DEV_MAP ioctl.
+ * NOTE: See devorangefs-req.c for 32 bit compat structure.
+ * Since this structure has a variable-sized layout that is different
+ * on 32 and 64 bit platforms, we need to normalize to a 64 bit layout
+ * on such systems before servicing ioctl calls from user-space binaries
+ * that may be 32 bit!
+ */
+struct ORANGEFS_dev_map_desc {
+	void *ptr;
+	__s32 total_size;
+	__s32 size;
+	__s32 count;
+};
+
+struct orangefs_io_response {
+	__s64 amt_complete;
+};
+
+struct orangefs_lookup_response {
+	struct orangefs_object_kref refn;
+};
+
+struct orangefs_create_response {
+	struct orangefs_object_kref refn;
+};
+
+struct orangefs_symlink_response {
+	struct orangefs_object_kref refn;
+};
+
+struct orangefs_getattr_response {
+	struct ORANGEFS_sys_attr_s attributes;
+	char link_target[ORANGEFS_NAME_MAX];
+};
+
+struct orangefs_mkdir_response {
+	struct orangefs_object_kref refn;
+};
+
+struct orangefs_statfs_response {
+	__s64 block_size;
+	__s64 blocks_total;
+	__s64 blocks_avail;
+	__s64 files_total;
+	__s64 files_avail;
+};
+
+struct orangefs_fs_mount_response {
+	__s32 fs_id;
+	__s32 id;
+	struct orangefs_khandle root_khandle;
+};
+
+/* the getxattr response is the attribute value */
+struct orangefs_getxattr_response {
+	__s32 val_sz;
+	__s32 __pad1;
+	char val[ORANGEFS_MAX_XATTR_VALUELEN];
+};
+
+/* the listxattr response is an array of attribute names */
+struct orangefs_listxattr_response {
+	__s32 returned_count;
+	__s32 __pad1;
+	__u64 token;
+	char key[ORANGEFS_MAX_XATTR_LISTLEN * ORANGEFS_MAX_XATTR_NAMELEN];
+	__s32 keylen;
+	__s32 __pad2;
+	__s32 lengths[ORANGEFS_MAX_XATTR_LISTLEN];
+};
+
+struct orangefs_param_response {
+	union {
+		__s64 value64;
+		__s32 value32[2];
+	} u;
+};
+
+#define PERF_COUNT_BUF_SIZE 4096
+struct orangefs_perf_count_response {
+	char buffer[PERF_COUNT_BUF_SIZE];
+};
+
+#define FS_KEY_BUF_SIZE 4096
+struct orangefs_fs_key_response {
+	__s32 fs_keylen;
+	__s32 __pad1;
+	char fs_key[FS_KEY_BUF_SIZE];
+};
+
+/* 2.9.6 */
+struct orangefs_features_response {
+	__u64 features;
+};
+
+struct orangefs_downcall_s {
+	__s32 type;
+	__s32 status;
+	/* currently trailer is used only by readdir */
+	__s64 trailer_size;
+	char *trailer_buf;
+
+	union {
+		struct orangefs_io_response io;
+		struct orangefs_lookup_response lookup;
+		struct orangefs_create_response create;
+		struct orangefs_symlink_response sym;
+		struct orangefs_getattr_response getattr;
+		struct orangefs_mkdir_response mkdir;
+		struct orangefs_statfs_response statfs;
+		struct orangefs_fs_mount_response fs_mount;
+		struct orangefs_getxattr_response getxattr;
+		struct orangefs_listxattr_response listxattr;
+		struct orangefs_param_response param;
+		struct orangefs_perf_count_response perf_count;
+		struct orangefs_fs_key_response fs_key;
+		struct orangefs_features_response features;
+	} resp;
+};
+
+/*
+ * The readdir response comes in the trailer.  It is followed by the
+ * directory entries as described in dir.c.
+ */
+
+struct orangefs_readdir_response_s {
+	__u64 token;
+	__u64 directory_version;
+	__u32 __pad2;
+	__u32 orangefs_dirent_outcount;
+};
+
+struct orangefs_io_request_s {
+	__s32 __pad1;
+	__s32 buf_index;
+	__s32 count;
+	__s32 __pad2;
+	__s64 offset;
+	struct orangefs_object_kref refn;
+	enum ORANGEFS_io_type io_type;
+	__s32 readahead_size;
+};
+
+struct orangefs_lookup_request_s {
+	__s32 sym_follow;
+	__s32 __pad1;
+	struct orangefs_object_kref parent_refn;
+	char d_name[ORANGEFS_NAME_MAX];
+};
+
+struct orangefs_create_request_s {
+	struct orangefs_object_kref parent_refn;
+	struct ORANGEFS_sys_attr_s attributes;
+	char d_name[ORANGEFS_NAME_MAX];
+};
+
+struct orangefs_symlink_request_s {
+	struct orangefs_object_kref parent_refn;
+	struct ORANGEFS_sys_attr_s attributes;
+	char entry_name[ORANGEFS_NAME_MAX];
+	char target[ORANGEFS_NAME_MAX];
+};
+
+struct orangefs_getattr_request_s {
+	struct orangefs_object_kref refn;
+	__u32 mask;
+	__u32 __pad1;
+};
+
+struct orangefs_setattr_request_s {
+	struct orangefs_object_kref refn;
+	struct ORANGEFS_sys_attr_s attributes;
+};
+
+struct orangefs_remove_request_s {
+	struct orangefs_object_kref parent_refn;
+	char d_name[ORANGEFS_NAME_MAX];
+};
+
+struct orangefs_mkdir_request_s {
+	struct orangefs_object_kref parent_refn;
+	struct ORANGEFS_sys_attr_s attributes;
+	char d_name[ORANGEFS_NAME_MAX];
+};
+
+struct orangefs_readdir_request_s {
+	struct orangefs_object_kref refn;
+	__u64 token;
+	__s32 max_dirent_count;
+	__s32 buf_index;
+};
+
+struct orangefs_readdirplus_request_s {
+	struct orangefs_object_kref refn;
+	__u64 token;
+	__s32 max_dirent_count;
+	__u32 mask;
+	__s32 buf_index;
+	__s32 __pad1;
+};
+
+struct orangefs_rename_request_s {
+	struct orangefs_object_kref old_parent_refn;
+	struct orangefs_object_kref new_parent_refn;
+	char d_old_name[ORANGEFS_NAME_MAX];
+	char d_new_name[ORANGEFS_NAME_MAX];
+};
+
+struct orangefs_statfs_request_s {
+	__s32 fs_id;
+	__s32 __pad1;
+};
+
+struct orangefs_truncate_request_s {
+	struct orangefs_object_kref refn;
+	__s64 size;
+};
+
+struct orangefs_ra_cache_flush_request_s {
+	struct orangefs_object_kref refn;
+};
+
+struct orangefs_fs_mount_request_s {
+	char orangefs_config_server[ORANGEFS_MAX_SERVER_ADDR_LEN];
+};
+
+struct orangefs_fs_umount_request_s {
+	__s32 id;
+	__s32 fs_id;
+	char orangefs_config_server[ORANGEFS_MAX_SERVER_ADDR_LEN];
+};
+
+struct orangefs_getxattr_request_s {
+	struct orangefs_object_kref refn;
+	__s32 key_sz;
+	__s32 __pad1;
+	char key[ORANGEFS_MAX_XATTR_NAMELEN];
+};
+
+struct orangefs_setxattr_request_s {
+	struct orangefs_object_kref refn;
+	struct ORANGEFS_keyval_pair keyval;
+	__s32 flags;
+	__s32 __pad1;
+};
+
+struct orangefs_listxattr_request_s {
+	struct orangefs_object_kref refn;
+	__s32 requested_count;
+	__s32 __pad1;
+	__u64 token;
+};
+
+struct orangefs_removexattr_request_s {
+	struct orangefs_object_kref refn;
+	__s32 key_sz;
+	__s32 __pad1;
+	char key[ORANGEFS_MAX_XATTR_NAMELEN];
+};
+
+struct orangefs_op_cancel_s {
+	__u64 op_tag;
+};
+
+struct orangefs_fsync_request_s {
+	struct orangefs_object_kref refn;
+};
+
+enum orangefs_param_request_type {
+	ORANGEFS_PARAM_REQUEST_SET = 1,
+	ORANGEFS_PARAM_REQUEST_GET = 2
+};
+
+enum orangefs_param_request_op {
+	ORANGEFS_PARAM_REQUEST_OP_ACACHE_TIMEOUT_MSECS = 1,
+	ORANGEFS_PARAM_REQUEST_OP_ACACHE_HARD_LIMIT = 2,
+	ORANGEFS_PARAM_REQUEST_OP_ACACHE_SOFT_LIMIT = 3,
+	ORANGEFS_PARAM_REQUEST_OP_ACACHE_RECLAIM_PERCENTAGE = 4,
+	ORANGEFS_PARAM_REQUEST_OP_PERF_TIME_INTERVAL_SECS = 5,
+	ORANGEFS_PARAM_REQUEST_OP_PERF_HISTORY_SIZE = 6,
+	ORANGEFS_PARAM_REQUEST_OP_PERF_RESET = 7,
+	ORANGEFS_PARAM_REQUEST_OP_NCACHE_TIMEOUT_MSECS = 8,
+	ORANGEFS_PARAM_REQUEST_OP_NCACHE_HARD_LIMIT = 9,
+	ORANGEFS_PARAM_REQUEST_OP_NCACHE_SOFT_LIMIT = 10,
+	ORANGEFS_PARAM_REQUEST_OP_NCACHE_RECLAIM_PERCENTAGE = 11,
+	ORANGEFS_PARAM_REQUEST_OP_STATIC_ACACHE_TIMEOUT_MSECS = 12,
+	ORANGEFS_PARAM_REQUEST_OP_STATIC_ACACHE_HARD_LIMIT = 13,
+	ORANGEFS_PARAM_REQUEST_OP_STATIC_ACACHE_SOFT_LIMIT = 14,
+	ORANGEFS_PARAM_REQUEST_OP_STATIC_ACACHE_RECLAIM_PERCENTAGE = 15,
+	ORANGEFS_PARAM_REQUEST_OP_CLIENT_DEBUG = 16,
+	ORANGEFS_PARAM_REQUEST_OP_CCACHE_TIMEOUT_SECS = 17,
+	ORANGEFS_PARAM_REQUEST_OP_CCACHE_HARD_LIMIT = 18,
+	ORANGEFS_PARAM_REQUEST_OP_CCACHE_SOFT_LIMIT = 19,
+	ORANGEFS_PARAM_REQUEST_OP_CCACHE_RECLAIM_PERCENTAGE = 20,
+	ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_TIMEOUT_SECS = 21,
+	ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_HARD_LIMIT = 22,
+	ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_SOFT_LIMIT = 23,
+	ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_RECLAIM_PERCENTAGE = 24,
+	ORANGEFS_PARAM_REQUEST_OP_TWO_MASK_VALUES = 25,
+	ORANGEFS_PARAM_REQUEST_OP_READAHEAD_SIZE = 26,
+	ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT = 27,
+	ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE = 28,
+	ORANGEFS_PARAM_REQUEST_OP_READAHEAD_READCNT = 29,
+};
+
+struct orangefs_param_request_s {
+	enum orangefs_param_request_type type;
+	enum orangefs_param_request_op op;
+	union {
+		__s64 value64;
+		__s32 value32[2];
+	} u;
+	char s_value[ORANGEFS_MAX_DEBUG_STRING_LEN];
+};
+
+enum orangefs_perf_count_request_type {
+	ORANGEFS_PERF_COUNT_REQUEST_ACACHE = 1,
+	ORANGEFS_PERF_COUNT_REQUEST_NCACHE = 2,
+	ORANGEFS_PERF_COUNT_REQUEST_CAPCACHE = 3,
+};
+
+struct orangefs_perf_count_request_s {
+	enum orangefs_perf_count_request_type type;
+	__s32 __pad1;
+};
+
+struct orangefs_fs_key_request_s {
+	__s32 fsid;
+	__s32 __pad1;
+};
+
+/* 2.9.6 */
+struct orangefs_features_request_s {
+	__u64 features;
+};
+
+struct orangefs_upcall_s {
+	__s32 type;
+	__u32 uid;
+	__u32 gid;
+	int pid;
+	int tgid;
+	/* Trailers unused but must be retained for protocol compatibility. */
+	__s64 trailer_size;
+	char *trailer_buf;
+
+	union {
+		struct orangefs_io_request_s io;
+		struct orangefs_lookup_request_s lookup;
+		struct orangefs_create_request_s create;
+		struct orangefs_symlink_request_s sym;
+		struct orangefs_getattr_request_s getattr;
+		struct orangefs_setattr_request_s setattr;
+		struct orangefs_remove_request_s remove;
+		struct orangefs_mkdir_request_s mkdir;
+		struct orangefs_readdir_request_s readdir;
+		struct orangefs_readdirplus_request_s readdirplus;
+		struct orangefs_rename_request_s rename;
+		struct orangefs_statfs_request_s statfs;
+		struct orangefs_truncate_request_s truncate;
+		struct orangefs_ra_cache_flush_request_s ra_cache_flush;
+		struct orangefs_fs_mount_request_s fs_mount;
+		struct orangefs_fs_umount_request_s fs_umount;
+		struct orangefs_getxattr_request_s getxattr;
+		struct orangefs_setxattr_request_s setxattr;
+		struct orangefs_listxattr_request_s listxattr;
+		struct orangefs_removexattr_request_s removexattr;
+		struct orangefs_op_cancel_s cancel;
+		struct orangefs_fsync_request_s fsync;
+		struct orangefs_param_request_s param;
+		struct orangefs_perf_count_request_s perf_count;
+		struct orangefs_fs_key_request_s fs_key;
+		struct orangefs_features_request_s features;
+	} req;
+};
+
+#endif /* _UAPI_LINUX_ORANGEFS_H */
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/7] orangefs uapi
  2018-01-26 19:07 [PATCH 0/7] orangefs uapi Martin Brandenburg
                   ` (6 preceding siblings ...)
  2018-01-26 19:07 ` [PATCH 7/7] orangefs: create uapi interface Martin Brandenburg
@ 2018-01-26 19:15 ` martin
  7 siblings, 0 replies; 9+ messages in thread
From: martin @ 2018-01-26 19:15 UTC (permalink / raw)
  To: hubcap, linux-kernel, linux-fsdevel, devel

On Fri, Jan 26, 2018 at 02:07:10PM -0500, Martin Brandenburg wrote:
> I have also written a "fakecore" which does about the bare minimum to
> start up and respond to mount requests.  I intend to use this as a
> vehicle for experimentation with fuzzing and testing performance through
> our kernel code without the rest of OrangeFS running.

#include <sys/ioctl.h>
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

#include "linux/include/uapi/linux/orangefs.h"

#define ORANGEFS_REQDEVICE_NAME          "pvfs2-req"

struct downcall {
	int32_t proto_ver;
	int32_t magic;
	int32_t tag;
	struct orangefs_downcall_s d;
};

struct upcall {
	int32_t proto_ver;
	int32_t magic;
	int32_t tag;
	struct orangefs_upcall_s u;
};

static int mounted = 0;

int process_request(struct upcall *upcall, struct downcall *downcall)
{
	struct stat sb;
	switch (upcall->u.type) {
	case ORANGEFS_VFS_OP_GETATTR:
		downcall->d.resp.getattr.attributes.objtype =
		    ORANGEFS_TYPE_DIRECTORY;
		return 0;
	case ORANGEFS_VFS_OP_FS_MOUNT:
		if (mounted) {
			downcall->d.status = -(ORANGEFS_ERROR_BIT|EPERM);
			return 0;
		}
		downcall->d.resp.fs_mount.fs_id = 1;
		downcall->d.resp.fs_mount.id = mounted;
		downcall->d.resp.fs_mount.root_khandle.u[0] = 1;
		if (stat(".", &sb)) {
			downcall->d.status = -(ORANGEFS_ERROR_BIT|errno);
			return 0;
		}
		memcpy(downcall->d.resp.fs_mount.root_khandle.u, &sb.st_ino,
		    sizeof sb.st_ino);
		mounted = 1;
		return 0;
	case ORANGEFS_VFS_OP_FS_UMOUNT:
		mounted = 0;
		return 0;
	default:
		downcall->d.status = -(ORANGEFS_ERROR_BIT|EPERM);
		return 0;
	}
}

int main(void)
{
	int32_t magic, max_upsize, max_downsize;
	struct downcall downcall;
	struct upcall upcall;
	int fd, upstream;

	fd = open("/dev/" ORANGEFS_REQDEVICE_NAME, O_RDWR|O_NONBLOCK);
	if (fd == -1) {
		perror("open");
		return 1;
	}

	if (ioctl(fd, ORANGEFS_DEV_GET_MAGIC, &magic)) {
		perror("ioctl");
		return 1;
	}
	if (ioctl(fd, ORANGEFS_DEV_GET_MAX_UPSIZE, &max_upsize)) {
		perror("ioctl");
		return 1;
	}
	if (ioctl(fd, ORANGEFS_DEV_GET_MAX_DOWNSIZE, &max_downsize)) {
		perror("ioctl");
		return 1;
	}
	if (ioctl(fd, ORANGEFS_DEV_UPSTREAM, &upstream)) {
		perror("ioctl");
		return 1;
	}

	printf("magic: %d\n", magic);
	printf("max_upsize: %d, sizeof upcall: %d\n",
	    max_upsize, sizeof upcall);
	printf("max_downsize: %d, sizeof downcall: %d\n",
	    max_downsize, sizeof downcall);
	printf("upstream: %d\n", upstream);

	while (1) {
		int r;
		r = read(fd, &upcall, sizeof upcall);
		if (r == -1) {
			if (errno == EAGAIN)
				continue;
			perror("read");
			return 1;
		} else if (r < sizeof upcall) {
			fprintf(stderr, "short read\n");
			return 1;
		}
		downcall.proto_ver = ORANGEFS_MINIMUM_USERSPACE_VERSION;
		downcall.magic = upcall.magic;
		downcall.tag = upcall.tag;
		memset(&downcall.d, 0, sizeof downcall.d);
		downcall.d.type = upcall.u.type;
		downcall.d.status = 0;
		printf("read tag type %d\n", upcall.tag, upcall.u.type);
		if (process_request(&upcall, &downcall)) {
			fprintf(stderr, "process_request failed\n");
			return 1;
		}
		r = write(fd, &downcall, sizeof downcall);
		if (r == -1) {
			perror("write");
			return 1;
		} else if (r < sizeof downcall) {
			perror("short write");
			return 1;
		}
		printf("wrote tag %d status %d\n", downcall.tag,
		    downcall.d.status);
	}

	if (close(fd)) {
		perror("close");
		return 1;
	}
	return 0;
}

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-01-26 19:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-26 19:07 [PATCH 0/7] orangefs uapi Martin Brandenburg
2018-01-26 19:07 ` [PATCH 1/7] orangefs: make orangefs_client_debug_init static Martin Brandenburg
2018-01-26 19:07 ` [PATCH 2/7] orangefs: remove gossip_ldebug and gossip_lerr Martin Brandenburg
2018-01-26 19:07 ` [PATCH 3/7] orangefs: remove ORANGEFS_KERNEL_DEBUG Martin Brandenburg
2018-01-26 19:07 ` [PATCH 4/7] orangefs: make orangefs_make_bad_inode static Martin Brandenburg
2018-01-26 19:07 ` [PATCH 5/7] ornagefs: make several *_operations structs static Martin Brandenburg
2018-01-26 19:07 ` [PATCH 6/7] orangefs: remove unused code Martin Brandenburg
2018-01-26 19:07 ` [PATCH 7/7] orangefs: create uapi interface Martin Brandenburg
2018-01-26 19:15 ` [PATCH 0/7] orangefs uapi martin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).