/* SPDX-License-Identifier: GPL-2.0 */ #include <linux/kernel.h> #include <linux/types.h> #include <linux/spinlock_types.h> #include <linux/slab.h> #include <linux/ioctl.h> /* 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 { … } __aligned(…); /* * kernel version of an object ref. */ struct orangefs_object_kref { … }; /* * compare 2 khandles assumes little endian thus from large address to * small address */ static inline int ORANGEFS_khandle_cmp(const struct orangefs_khandle *kh1, const struct orangefs_khandle *kh2) { … } static inline void ORANGEFS_khandle_to(const struct orangefs_khandle *kh, void *p, int size) { … } static inline void ORANGEFS_khandle_from(struct orangefs_khandle *kh, void *p, int size) { … } /* pvfs2-types.h ************************************************************/ #define ORANGEFS_SUPER_MAGIC … /* * 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 … /* * Bit 29 specifies that this is a ORANGEFS protocol error and not an encoded * errno value. */ #define ORANGEFS_NON_ERRNO_ERROR_BIT … /* * 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 … /* Bits 6 - 0 are reserved for the actual error code. */ #define ORANGEFS_ERROR_NUMBER_BITS … /* Encoded errno values decoded by PINT_errno_mapping in orangefs-utils.c. */ /* Our own ORANGEFS protocol error codes. */ #define ORANGEFS_ECANCEL … #define ORANGEFS_EDEVINIT … #define ORANGEFS_EDETAIL … #define ORANGEFS_EHOSTNTFD … #define ORANGEFS_EADDRNTFD … #define ORANGEFS_ENORECVR … #define ORANGEFS_ETRYAGAIN … #define ORANGEFS_ENOTPVFS … #define ORANGEFS_ESECURITY … /* permission bits */ #define ORANGEFS_O_EXECUTE … #define ORANGEFS_O_WRITE … #define ORANGEFS_O_READ … #define ORANGEFS_G_EXECUTE … #define ORANGEFS_G_WRITE … #define ORANGEFS_G_READ … #define ORANGEFS_U_EXECUTE … #define ORANGEFS_U_WRITE … #define ORANGEFS_U_READ … /* no ORANGEFS_U_VTX (sticky bit) */ #define ORANGEFS_G_SGID … #define ORANGEFS_U_SUID … #define ORANGEFS_ITERATE_START … #define ORANGEFS_ITERATE_END … #define ORANGEFS_IMMUTABLE_FL … #define ORANGEFS_APPEND_FL … #define ORANGEFS_NOATIME_FL … #define ORANGEFS_MIRROR_FL … #define ORANGEFS_FS_ID_NULL … #define ORANGEFS_ATTR_SYS_UID … #define ORANGEFS_ATTR_SYS_GID … #define ORANGEFS_ATTR_SYS_PERM … #define ORANGEFS_ATTR_SYS_ATIME … #define ORANGEFS_ATTR_SYS_CTIME … #define ORANGEFS_ATTR_SYS_MTIME … #define ORANGEFS_ATTR_SYS_TYPE … #define ORANGEFS_ATTR_SYS_ATIME_SET … #define ORANGEFS_ATTR_SYS_MTIME_SET … #define ORANGEFS_ATTR_SYS_SIZE … #define ORANGEFS_ATTR_SYS_LNK_TARGET … #define ORANGEFS_ATTR_SYS_DFILE_COUNT … #define ORANGEFS_ATTR_SYS_DIRENT_COUNT … #define ORANGEFS_ATTR_SYS_BLKSIZE … #define ORANGEFS_ATTR_SYS_MIRROR_COPIES_COUNT … #define ORANGEFS_ATTR_SYS_COMMON_ALL … #define ORANGEFS_ATTR_SYS_ALL_SETABLE … #define ORANGEFS_ATTR_SYS_ALL_NOHINT … #define ORANGEFS_XATTR_REPLACE … #define ORANGEFS_XATTR_CREATE … #define ORANGEFS_MAX_SERVER_ADDR_LEN … #define ORANGEFS_NAME_MAX … /* * 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 … #define ORANGEFS_MAX_XATTR_VALUELEN … #define ORANGEFS_MAX_XATTR_LISTLEN … /* * ORANGEFS I/O operation types, used in both system and server interfaces. */ enum ORANGEFS_io_type { … }; /* * 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 { … }; /* This structure is used by the VFS-client interaction alone */ struct ORANGEFS_keyval_pair { … }; /* pvfs2-sysint.h ***********************************************************/ /* Describes attributes for a file, directory, or symlink. */ struct ORANGEFS_sys_attr_s { … }; #define ORANGEFS_LOOKUP_LINK_NO_FOLLOW … /* pint-dev.h ***************************************************************/ /* parameter structure used in ORANGEFS_DEV_DEBUG ioctl command */ struct dev_mask_info_s { … }; struct dev_mask2_info_s { … }; /* pvfs2-util.h *************************************************************/ __s32 ORANGEFS_util_translate_mode(int mode); /* pvfs2-debug.h ************************************************************/ #include "orangefs-debug.h" /* pvfs2-internal.h *********************************************************/ #define llu(x) … #define lld(x) … /* pint-dev-shared.h ********************************************************/ #define ORANGEFS_DEV_MAGIC … #define ORANGEFS_READDIR_DEFAULT_DESC_COUNT … #define DEV_GET_MAGIC … #define DEV_GET_MAX_UPSIZE … #define DEV_GET_MAX_DOWNSIZE … #define DEV_MAP … #define DEV_REMOUNT_ALL … #define DEV_DEBUG … #define DEV_UPSTREAM … #define DEV_CLIENT_MASK … #define DEV_CLIENT_STRING … #define DEV_MAX_NR … /* supported ioctls, codes are with respect to user-space */ enum { … }; /* * 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 … #define ORANGEFS_MINIMUM_USERSPACE_VERSION … /* * 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 { … }; /* gossip.h *****************************************************************/ extern __u64 orangefs_gossip_debug_mask; /* try to avoid function call overhead by checking masks in macro */ #define gossip_debug(mask, fmt, ...) … #define gossip_err …