From: James Simmons Date: Mon, 5 Feb 2018 20:42:25 +0000 (-0500) Subject: LU-6142 uapi: remove remaining typedef in lustre UAPI headers X-Git-Tag: 2.10.59~103 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=1cfad9351affd7bbf4771dc4c28704ce432744ac LU-6142 uapi: remove remaining typedef in lustre UAPI headers Remove remaining tyepdef in lustre UAPI headers to make them linux kernel compliant. Test-Parameters: trivial Change-Id: I13a24deed348e06c1c63bd0c332f63d4f77a0d76 Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/31175 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Ben Evans Reviewed-by: Fan Yong Reviewed-by: Dmitry Eremin Reviewed-by: Sebastien Buisson Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/uapi/linux/lustre/lustre_idl.h b/lustre/include/uapi/linux/lustre/lustre_idl.h index 39419fe..f73ae38 100644 --- a/lustre/include/uapi/linux/lustre/lustre_idl.h +++ b/lustre/include/uapi/linux/lustre/lustre_idl.h @@ -956,18 +956,18 @@ struct obd_connect_data { * Please update DECLARE_CKSUM_NAME/OBD_CKSUM_ALL in obd.h when adding a new * algorithm and also the OBD_FL_CKSUM* flags. */ -typedef enum cksum_types { +enum cksum_types { OBD_CKSUM_CRC32 = 0x00000001, OBD_CKSUM_ADLER = 0x00000002, OBD_CKSUM_CRC32C= 0x00000004, -} cksum_type_t; +}; /* * OST requests: OBDO & OBD request records */ /* opcodes */ -typedef enum { +enum ost_cmd { OST_REPLY = 0, /* reply ? */ OST_GETATTR = 1, OST_SETATTR = 2, @@ -989,7 +989,7 @@ typedef enum { OST_QUOTA_ADJUST_QUNIT = 20, /* not used since 2.4 */ OST_LADVISE = 21, OST_LAST_OPC /* must be < 33 to avoid MDS_GETATTR */ -} ost_cmd_t; +}; #define OST_FIRST_OPC OST_REPLY enum obdo_flags { @@ -1521,11 +1521,11 @@ struct lquota_lvb { #define lvb_glb_ver lvb_id_may_rel /* current version of the global index */ /* op codes */ -typedef enum { +enum quota_cmd { QUOTA_DQACQ = 601, QUOTA_DQREL = 602, QUOTA_LAST_OPC -} quota_cmd_t; +}; #define QUOTA_FIRST_OPC QUOTA_DQACQ /* @@ -1533,7 +1533,7 @@ typedef enum { */ /* opcodes */ -typedef enum { +enum mds_cmd { MDS_GETATTR = 33, MDS_GETATTR_NAME = 34, MDS_CLOSE = 35, @@ -1564,16 +1564,16 @@ typedef enum { MDS_HSM_CT_UNREGISTER = 60, MDS_SWAP_LAYOUTS = 61, MDS_LAST_OPC -} mds_cmd_t; +}; #define MDS_FIRST_OPC MDS_GETATTR /* opcodes for object update */ -typedef enum { +enum update_cmd { OUT_UPDATE = 1000, OUT_UPDATE_LAST_OPC -} update_cmd_t; +}; #define OUT_UPDATE_FIRST_OPC OUT_UPDATE @@ -2214,12 +2214,12 @@ enum fld_op { }; /* LFSCK opcodes */ -typedef enum { +enum lfsck_cmd { LFSCK_NOTIFY = 1101, LFSCK_QUERY = 1102, LFSCK_LAST_OPC, - LFSCK_FIRST_OPC = LFSCK_NOTIFY -} lfsck_cmd_t; + LFSCK_FIRST_OPC = LFSCK_NOTIFY +}; /* * LOV data structures @@ -2255,7 +2255,7 @@ struct lov_desc { * LDLM requests: */ /* opcodes -- MUST be distinct from OST/MDS opcodes */ -typedef enum { +enum ldlm_cmd { LDLM_ENQUEUE = 101, LDLM_CONVERT = 102, LDLM_CANCEL = 103, @@ -2264,7 +2264,7 @@ typedef enum { LDLM_GL_CALLBACK = 106, LDLM_SET_INFO = 107, LDLM_LAST_OPC -} ldlm_cmd_t; +}; #define LDLM_FIRST_OPC LDLM_ENQUEUE #define RES_NAME_SIZE 4 @@ -2279,7 +2279,7 @@ struct ldlm_res_id { (unsigned long long)(res)->lr_name.name[3] /* lock types */ -typedef enum ldlm_mode { +enum ldlm_mode { LCK_MINMODE = 0, LCK_EX = 1, LCK_PW = 2, @@ -2290,17 +2290,17 @@ typedef enum ldlm_mode { LCK_GROUP = 64, LCK_COS = 128, LCK_MAXMODE -} ldlm_mode_t; +}; #define LCK_MODE_NUM 8 -typedef enum ldlm_type { +enum ldlm_type { LDLM_PLAIN = 10, LDLM_EXTENT = 11, LDLM_FLOCK = 12, LDLM_IBITS = 13, LDLM_MAX_TYPE -} ldlm_type_t; +}; #define LDLM_MIN_TYPE LDLM_PLAIN @@ -2335,11 +2335,11 @@ struct ldlm_flock_wire { * this ever changes we will need to swab the union differently based * on the resource type. */ -typedef union ldlm_wire_policy_data { +union ldlm_wire_policy_data { struct ldlm_extent l_extent; struct ldlm_flock_wire l_flock; struct ldlm_inodebits l_inodebits; -} ldlm_wire_policy_data_t; +}; struct barrier_lvb { __u32 lvb_status; @@ -2420,7 +2420,7 @@ struct ldlm_reply { /* * Opcodes for mountconf (mgs and mgc) */ -typedef enum { +enum mgs_cmd { MGS_CONNECT = 250, MGS_DISCONNECT, MGS_EXCEPTION, /* node died, etc. */ @@ -2429,7 +2429,7 @@ typedef enum { MGS_SET_INFO, MGS_CONFIG_READ, MGS_LAST_OPC -} mgs_cmd_t; +}; #define MGS_FIRST_OPC MGS_CONNECT #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 13, 53, 0) @@ -2522,14 +2522,13 @@ struct cfg_marker { /* * Opcodes for multiple servers. */ - -typedef enum { +enum obd_cmd { OBD_PING = 400, OBD_LOG_CANCEL, OBD_QC_CALLBACK, /* not used since 2.4 */ OBD_IDX_READ, OBD_LAST_OPC -} obd_cmd_t; +}; #define OBD_FIRST_OPC OBD_PING /** @@ -2579,7 +2578,7 @@ struct llog_catid { #define LLOG_OP_MAGIC 0x10600000 #define LLOG_OP_MASK 0xfff00000 -typedef enum { +enum llog_op_type { LLOG_PAD_MAGIC = LLOG_OP_MAGIC | 0x00000, OST_SZ_REC = LLOG_OP_MAGIC | 0x00f00, /* OST_RAID1_REC = LLOG_OP_MAGIC | 0x01000, never used */ @@ -2600,7 +2599,7 @@ typedef enum { UPDATE_REC = LLOG_OP_MAGIC | 0xa0000, LLOG_HDR_MAGIC = LLOG_OP_MAGIC | 0x45539, LLOG_LOGID_MAGIC = LLOG_OP_MAGIC | 0x4553b, -} llog_op_type; +}; #define LLOG_REC_HDR_NEEDS_SWABBING(r) \ (((r)->lrh_type & __swab32(LLOG_OP_MASK)) == __swab32(LLOG_OP_MAGIC)) @@ -3107,13 +3106,13 @@ union lu_page { }; /* security opcodes */ -typedef enum { +enum sec_cmd { SEC_CTX_INIT = 801, SEC_CTX_INIT_CONT = 802, SEC_CTX_FINI = 803, SEC_LAST_OPC, SEC_FIRST_OPC = SEC_CTX_INIT -} sec_cmd_t; +}; /* * capa related definitions diff --git a/lustre/include/uapi/linux/lustre/lustre_user.h b/lustre/include/uapi/linux/lustre/lustre_user.h index 46c72b4..f4675e8 100644 --- a/lustre/include/uapi/linux/lustre/lustre_user.h +++ b/lustre/include/uapi/linux/lustre/lustre_user.h @@ -80,22 +80,25 @@ extern "C" { }; #define PRJQUOTA 2 -#if defined(__x86_64__) || defined(__ia64__) || defined(__ppc64__) || \ - defined(__craynv) || defined(__mips64__) || defined(__powerpc64__) || \ - defined(__aarch64__) -typedef struct stat lstat_t; -# define lstat_f lstat -# define fstat_f fstat -# define fstatat_f fstatat -# define HAVE_LOV_USER_MDS_DATA -#elif defined(__USE_LARGEFILE64) || defined(__KERNEL__) -typedef struct stat64 lstat_t; -# define lstat_f lstat64 -# define fstat_f fstat64 -# define fstatat_f fstatat64 -# define HAVE_LOV_USER_MDS_DATA +/* + * We need to always use 64bit version because the structure + * is shared across entire cluster where 32bit and 64bit machines + * are co-existing. + */ +#if __BITS_PER_LONG != 64 || defined(__ARCH_WANT_STAT64) +typedef struct stat64 lstat_t; +#define lstat_f lstat64 +#define fstat_f fstat64 +#define fstatat_f fstatat64 +#else +typedef struct stat lstat_t; +#define lstat_f lstat +#define fstat_f fstat +#define fstatat_f fstatat #endif +#define HAVE_LOV_USER_MDS_DATA + #define LUSTRE_EOF 0xffffffffffffffffULL /* for statfs() */ @@ -892,9 +895,9 @@ struct identity_downcall_data { #define LUSTRE_VOLATILE_HDR ".\x0c\x13\x14\x12:VOLATILE" #define LUSTRE_VOLATILE_HDR_LEN 14 -typedef enum lustre_quota_version { +enum lustre_quota_version { LUSTRE_QUOTA_V2 = 1 -} lustre_quota_version_t; +}; /* XXX: same as if_dqinfo struct in kernel */ struct obd_dqinfo { diff --git a/lustre/osp/osp_internal.h b/lustre/osp/osp_internal.h index e5113b3..b18f5da 100644 --- a/lustre/osp/osp_internal.h +++ b/lustre/osp/osp_internal.h @@ -808,9 +808,9 @@ void osp_lprocfs_init(struct osp_device *osp); /* osp_sync.c */ int osp_sync_declare_add(const struct lu_env *env, struct osp_object *o, - llog_op_type type, struct thandle *th); + enum llog_op_type type, struct thandle *th); int osp_sync_add(const struct lu_env *env, struct osp_object *o, - llog_op_type type, struct thandle *th, + enum llog_op_type type, struct thandle *th, const struct lu_attr *attr); int osp_sync_init(const struct lu_env *env, struct osp_device *d); int osp_sync_fini(struct osp_device *d); diff --git a/lustre/osp/osp_sync.c b/lustre/osp/osp_sync.c index 11ec40b..9323107 100644 --- a/lustre/osp/osp_sync.c +++ b/lustre/osp/osp_sync.c @@ -314,7 +314,7 @@ static inline int osp_sync_can_process_new(struct osp_device *d, * \retval negative negated errno on error */ int osp_sync_declare_add(const struct lu_env *env, struct osp_object *o, - llog_op_type type, struct thandle *th) + enum llog_op_type type, struct thandle *th) { struct osp_thread_info *osi = osp_env_info(env); struct osp_device *d = lu2osp_dev(o->opo_obj.do_lu.lo_dev); @@ -374,7 +374,7 @@ int osp_sync_declare_add(const struct lu_env *env, struct osp_object *o, * \retval negative negated errno on error */ static int osp_sync_add_rec(const struct lu_env *env, struct osp_device *d, - const struct lu_fid *fid, llog_op_type type, + const struct lu_fid *fid, enum llog_op_type type, int count, struct thandle *th, const struct lu_attr *attr) { @@ -462,7 +462,7 @@ static int osp_sync_add_rec(const struct lu_env *env, struct osp_device *d, } int osp_sync_add(const struct lu_env *env, struct osp_object *o, - llog_op_type type, struct thandle *th, + enum llog_op_type type, struct thandle *th, const struct lu_attr *attr) { return osp_sync_add_rec(env, lu2osp_dev(o->opo_obj.do_lu.lo_dev), @@ -674,7 +674,7 @@ static void osp_sync_send_new_rpc(struct osp_device *d, * \retval ERR_PTR(errno) on error */ static struct ptlrpc_request *osp_sync_new_job(struct osp_device *d, - ost_cmd_t op, + enum ost_cmd op, const struct req_format *format) { struct ptlrpc_request *req;