orangefs uapi
Subsystems (2)
Martin Brandenburg
reviewercover orangefs uapi
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
Signature · 1 line
2.14.2
Martin Brandenburg
reviewerPATCH 1/7 orangefs: make orangefs_client_debug_init static
--- fs/orangefs/orangefs-debugfs.c | 2 +- fs/orangefs/orangefs-debugfs.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
fs/orangefs/orangefs-debugfs.c +1 -1
@@ -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 ;
fs/orangefs/orangefs-debugfs.h +0 -1
@@ -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 *);
Signature · 1 line
2.14.2
Martin Brandenburg
reviewerPATCH 2/7 orangefs: remove gossip_ldebug and gossip_lerr
In reply to Martin Brandenburggossip_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.
--- fs/orangefs/orangefs-debugfs.c | 2 +- fs/orangefs/protocol.h | 15 --------------- fs/orangefs/super.c | 2 +- 3 files changed, 2 insertions(+), 17 deletions(-)
fs/orangefs/orangefs-debugfs.c +1 -1
@@ -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 ; }
fs/orangefs/protocol.h +0 -15
@@ -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__)
fs/orangefs/super.c +1 -1
@@ -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;
Signature · 1 line
2.14.2
Martin Brandenburg
reviewerPATCH 3/7 orangefs: remove ORANGEFS_KERNEL_DEBUG
In reply to Martin BrandenburgIt wasn't possible to enable it, and it would've had very little effect.
--- fs/orangefs/orangefs-kernel.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
fs/orangefs/orangefs-kernel.h +2 -6
@@ -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 ((definedORANGEFS_KERNEL_DEBUG ) && (definedCONFIG_DEBUG_SLAB )) +#if (definedCONFIG_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[];
Signature · 1 line
2.14.2
Martin Brandenburg
reviewerPATCH 4/7 orangefs: make orangefs_make_bad_inode static
In reply to Martin Brandenburg--- fs/orangefs/orangefs-kernel.h | 2 -- fs/orangefs/orangefs-utils.c | 38 +++++++++++++++++++------------------- 2 files changed, 19 insertions(+), 21 deletions(-)
fs/orangefs/orangefs-kernel.h +0 -2
@@ -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);
fs/orangefs/orangefs-utils.c +19 -19
@@ -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.
Signature · 1 line
2.14.2
Martin Brandenburg
reviewerPATCH 5/7 ornagefs: make several *_operations structs static
In reply to Martin Brandenburg--- fs/orangefs/devorangefs-req.c | 52 +++++++++++++++++++++---------------------- fs/orangefs/inode.c | 4 ++-- fs/orangefs/orangefs-kernel.h | 3 --- 3 files changed, 28 insertions(+), 31 deletions(-)
fs/orangefs/devorangefs-req.c +26 -26
@@ -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 -};
fs/orangefs/inode.c +2 -2
@@ -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,
fs/orangefs/orangefs-kernel.h +0 -3
@@ -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;
Signature · 1 line
2.14.2
Martin Brandenburg
reviewerPATCH 6/7 orangefs: remove unused code
In reply to Martin Brandenburg--- fs/orangefs/orangefs-debug.h | 6 ---- fs/orangefs/orangefs-kernel.h | 77 ------------------------------------------- fs/orangefs/protocol.h | 45 ------------------------- 3 files changed, 128 deletions(-)
fs/orangefs/orangefs-debug.h +0 -6
@@ -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;
fs/orangefs/orangefs-kernel.h +0 -77
126 lines not on this page · raw message
fs/orangefs/protocol.h +0 -45
69 lines not on this page · raw message
Signature · 1 line
2.14.2
Martin Brandenburg
reviewerPATCH 7/7 orangefs: create uapi interface
In reply to Martin BrandenburgThis 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.
--- 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
fs/orangefs/acl.c +0 -1
@@ -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>
fs/orangefs/dcache.c +0 -1
@@ -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. */
fs/orangefs/devorangefs-req.c +0 -2
@@ -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"
fs/orangefs/dir.c +0 -1
@@ -3,7 +3,6 @@* Copyright 2017 Omnibond Systems, L.L.C. */ -#include "protocol.h" #include "orangefs-kernel.h" #include "orangefs-bufmap.h"
fs/orangefs/downcall.h deleted +0 -137
137 lines not on this page · raw message
fs/orangefs/file.c +0 -1
@@ -9,7 +9,6 @@* Linux VFS file operations. */ -#include "protocol.h" #include "orangefs-kernel.h" #include "orangefs-bufmap.h" #include <linux/fs.h>
fs/orangefs/inode.c +0 -1
@@ -10,7 +10,6 @@*/ #include <linux/bvec.h> -#include "protocol.h" #include "orangefs-kernel.h" #include "orangefs-bufmap.h"
fs/orangefs/namei.c +0 -1
@@ -9,7 +9,6 @@* Linux VFS namei operations. */ -#include "protocol.h" #include "orangefs-kernel.h" /*
fs/orangefs/orangefs-bufmap.c +0 -1
@@ -4,7 +4,6 @@* * See COPYING in top-level directory. */ -#include "protocol.h" #include "orangefs-kernel.h" #include "orangefs-bufmap.h"
fs/orangefs/orangefs-cache.c +0 -1
@@ -5,7 +5,6 @@* See COPYING in top-level directory. */ -#include "protocol.h" #include "orangefs-kernel.h" /* tags assigned to kernel upcall operations */
fs/orangefs/orangefs-debug.h +0 -27
@@ -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 {
fs/orangefs/orangefs-debugfs.c +2 -2
@@ -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 \
fs/orangefs/orangefs-dev-proto.h deleted +0 -61
61 lines not on this page · raw message
fs/orangefs/orangefs-kernel.h +2 -1
@@ -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
fs/orangefs/orangefs-mod.c +0 -1
@@ -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"
fs/orangefs/orangefs-sysfs.c +0 -1
@@ -135,7 +135,6 @@#include <linux/module.h> #include <linux/init.h> -#include "protocol.h" #include "orangefs-kernel.h" #include "orangefs-sysfs.h"
fs/orangefs/orangefs-utils.c +0 -2
@@ -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)
fs/orangefs/protocol.h +0 -294
313 lines not on this page · raw message
fs/orangefs/super.c +0 -1
@@ -5,7 +5,6 @@* See COPYING in top-level directory. */ -#include "protocol.h" #include "orangefs-kernel.h" #include "orangefs-bufmap.h"
fs/orangefs/symlink.c +0 -1
@@ -5,7 +5,6 @@* See COPYING in top-level directory. */ -#include "protocol.h" #include "orangefs-kernel.h" #include "orangefs-bufmap.h"
fs/orangefs/upcall.h deleted +0 -260
260 lines not on this page · raw message
fs/orangefs/waitqueue.c +0 -1
@@ -13,7 +13,6 @@* In-kernel waitqueue operations. */ -#include "protocol.h" #include "orangefs-kernel.h" #include "orangefs-bufmap.h"
fs/orangefs/xattr.c +0 -1
@@ -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>
include/uapi/linux/orangefs.h new file +732 -0
732 lines not on this page · raw message
Signature · 1 line
2.14.2
[email protected]
reviewerQuoted 4 lines · Martin Brandenburg
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;
}