123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427 |
- #include <linux/kernel.h>
- #include <linux/types.h>
- #include <linux/spinlock_types.h>
- #include <linux/slab.h>
- #include <linux/ioctl.h>
- #define ORANGEFS_VERSION_MAJOR 2
- #define ORANGEFS_VERSION_MINOR 9
- #define ORANGEFS_VERSION_SUB 0
- struct orangefs_khandle {
- unsigned char u[16];
- } __aligned(8);
- struct orangefs_object_kref {
- struct orangefs_khandle khandle;
- __s32 fs_id;
- __s32 __pad1;
- };
- static inline int ORANGEFS_khandle_cmp(const struct orangefs_khandle *kh1,
- const struct orangefs_khandle *kh2)
- {
- int i;
- for (i = 15; i >= 0; i--) {
- if (kh1->u[i] > kh2->u[i])
- return 1;
- if (kh1->u[i] < kh2->u[i])
- return -1;
- }
- return 0;
- }
- static inline void ORANGEFS_khandle_to(const struct orangefs_khandle *kh,
- void *p, int size)
- {
- memcpy(p, kh->u, 16);
- memset(p + 16, 0, size - 16);
- }
- static inline void ORANGEFS_khandle_from(struct orangefs_khandle *kh,
- void *p, int size)
- {
- memset(kh, 0, 16);
- memcpy(kh->u, p, 16);
- }
- 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
- #define ORANGEFS_ERROR_BIT (1 << 30)
- #define ORANGEFS_NON_ERRNO_ERROR_BIT (1 << 29)
- #define ORANGEFS_ERROR_CLASS_BITS 0x380
- #define ORANGEFS_ERROR_NUMBER_BITS 0x7f
- #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)
- #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)
- #define ORANGEFS_G_SGID (1 << 10)
- #define ORANGEFS_U_SUID (1 << 11)
- #define INT32_MAX (2147483647)
- #define ORANGEFS_ITERATE_START (INT32_MAX - 1)
- #define ORANGEFS_ITERATE_END (INT32_MAX - 2)
- #define ORANGEFS_ITERATE_NEXT (INT32_MAX - 3)
- #define ORANGEFS_READDIR_START ORANGEFS_ITERATE_START
- #define ORANGEFS_READDIR_END ORANGEFS_ITERATE_END
- #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_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)
- #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
- #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>
- */
- enum ORANGEFS_io_type {
- ORANGEFS_IO_READ = 1,
- ORANGEFS_IO_WRITE = 2
- };
- 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)
- };
- struct ORANGEFS_certificate {
- __u32 buf_size;
- unsigned char *buf;
- };
- struct ORANGEFS_credential {
- __u32 userid;
- __u32 num_groups;
- __u32 *group_array;
- char *issuer;
- __u64 timeout;
- __u32 sig_size;
- unsigned char *signature;
- struct ORANGEFS_certificate certificate;
- };
- #define extra_size_ORANGEFS_credential (ORANGEFS_REQ_LIMIT_GROUPS * \
- sizeof(__u32) + \
- ORANGEFS_REQ_LIMIT_ISSUER + \
- ORANGEFS_REQ_LIMIT_SIGNATURE + \
- extra_size_ORANGEFS_certificate)
- struct ORANGEFS_keyval_pair {
- char key[ORANGEFS_MAX_XATTR_NAMELEN];
- __s32 key_sz;
- __s32 val_sz;
- char val[ORANGEFS_MAX_XATTR_VALUELEN];
- };
- struct ORANGEFS_sys_attr_s {
- __u32 owner;
- __u32 group;
- __u32 perms;
- __u64 atime;
- __u64 mtime;
- __u64 ctime;
- __s64 size;
-
- char *link_target;
-
- __s32 dfile_count;
-
- __s32 distr_dir_servers_initial;
-
- __s32 distr_dir_servers_max;
-
- __s32 distr_dir_split_size;
- __u32 mirror_copies_count;
-
- char *dist_name;
-
- char *dist_params;
- __s64 dirent_count;
- enum orangefs_ds_type objtype;
- __u64 flags;
- __u32 mask;
- __s64 blksize;
- };
- #define ORANGEFS_LOOKUP_LINK_NO_FOLLOW 0
- 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;
- };
- __s32 ORANGEFS_util_translate_mode(int mode);
- #include "orangefs-debug.h"
- #define llu(x) (unsigned long long)(x)
- #define lld(x) (long long)(x)
- #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
- 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,
- };
- #define ORANGEFS_KERNEL_PROTO_VERSION 0
- #define ORANGEFS_MINIMUM_USERSPACE_VERSION 20903
- struct ORANGEFS_dev_map_desc {
- void *ptr;
- __s32 total_size;
- __s32 size;
- __s32 count;
- };
- #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;
- #define gossip_debug(mask, fmt, ...) \
- do { \
- if (orangefs_gossip_debug_mask & (mask)) \
- printk(KERN_DEBUG fmt, ##__VA_ARGS__); \
- } while (0)
- #endif /* GOSSIP_DISABLE_DEBUG */
- #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__)
|