}
 
 /* lock types */
-typedef enum {
+enum ldlm_mode {
        LCK_MINMODE = 0,
        LCK_EX      = 1,
        LCK_PW      = 2,
        LCK_GROUP   = 64,
        LCK_COS     = 128,
        LCK_MAXMODE
-} ldlm_mode_t;
+};
 
 #define LCK_MODE_NUM    8
 
-typedef enum {
+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
 
 void lustre_swab_ldlm_intent(struct ldlm_intent *i);
 
 struct ldlm_resource_desc {
-       ldlm_type_t lr_type;
+       enum ldlm_type lr_type;
        __u32 lr_padding;       /* also fix lustre_swab_ldlm_resource_desc */
        struct ldlm_res_id lr_name;
 };
 
 struct ldlm_lock_desc {
        struct ldlm_resource_desc l_resource;
-       ldlm_mode_t l_req_mode;
-       ldlm_mode_t l_granted_mode;
+       enum ldlm_mode l_req_mode;
+       enum ldlm_mode l_granted_mode;
        ldlm_wire_policy_data_t l_policy_data;
 };
 
 
 #define LCK_COMPAT_COS (LCK_COS)
 /** @} Lock Compatibility Matrix */
 
-extern ldlm_mode_t lck_compat_array[];
+extern enum ldlm_mode lck_compat_array[];
 
-static inline void lockmode_verify(ldlm_mode_t mode)
+static inline void lockmode_verify(enum ldlm_mode mode)
 {
        LASSERT(mode > LCK_MINMODE && mode < LCK_MAXMODE);
 }
 
-static inline int lockmode_compat(ldlm_mode_t exist_mode, ldlm_mode_t new_mode)
+static inline int lockmode_compat(enum ldlm_mode exist_mode,
+                                 enum ldlm_mode new_mode)
 {
        return (lck_compat_array[exist_mode] & new_mode);
 }
 struct ldlm_interval_tree {
        /** Tree size. */
        int                     lit_size;
-       ldlm_mode_t             lit_mode;  /* lock mode */
+       enum ldlm_mode          lit_mode;  /* lock mode */
        struct interval_node    *lit_root; /* actual ldlm_interval */
 };
 
        struct ldlm_inodebits l_inodebits;
 } ldlm_policy_data_t;
 
-void ldlm_convert_policy_to_local(struct obd_export *exp, ldlm_type_t type,
+void ldlm_convert_policy_to_local(struct obd_export *exp, enum ldlm_type type,
                                  const ldlm_wire_policy_data_t *wpolicy,
                                  ldlm_policy_data_t *lpolicy);
 
         * Requested mode.
         * Protected by lr_lock.
         */
-       ldlm_mode_t             l_req_mode;
+       enum ldlm_mode          l_req_mode;
        /**
         * Granted mode, also protected by lr_lock.
         */
-       ldlm_mode_t             l_granted_mode;
+       enum ldlm_mode          l_granted_mode;
        /** Lock completion handler pointer. Called when lock is granted. */
        ldlm_completion_callback l_completion_ast;
        /**
        /** @} */
 
        /** Type of locks this resource can hold. Only one type per resource. */
-       ldlm_type_t             lr_type; /* LDLM_{PLAIN,EXTENT,FLOCK,IBITS} */
+       enum ldlm_type          lr_type; /* LDLM_{PLAIN,EXTENT,FLOCK,IBITS} */
 
        /** Resource name */
        struct ldlm_res_id      lr_name;
 void ldlm_lock_fail_match_locked(struct ldlm_lock *lock);
 void ldlm_lock_allow_match(struct ldlm_lock *lock);
 void ldlm_lock_allow_match_locked(struct ldlm_lock *lock);
-ldlm_mode_t ldlm_lock_match(struct ldlm_namespace *ns, __u64 flags,
-                           const struct ldlm_res_id *, ldlm_type_t type,
-                           ldlm_policy_data_t *, ldlm_mode_t mode,
-                           struct lustre_handle *, int unref);
-ldlm_mode_t ldlm_revalidate_lock_handle(struct lustre_handle *lockh,
-                                       __u64 *bits);
+enum ldlm_mode ldlm_lock_match(struct ldlm_namespace *ns, __u64 flags,
+                              const struct ldlm_res_id *,
+                              enum ldlm_type type, ldlm_policy_data_t *,
+                              enum ldlm_mode mode, struct lustre_handle *,
+                              int unref);
+enum ldlm_mode ldlm_revalidate_lock_handle(struct lustre_handle *lockh,
+                                          __u64 *bits);
 void ldlm_lock_cancel(struct ldlm_lock *lock);
 void ldlm_lock_dump_handle(int level, struct lustre_handle *);
 void ldlm_unlink_lock_skiplist(struct ldlm_lock *req);
 struct ldlm_resource *ldlm_resource_get(struct ldlm_namespace *ns,
                                        struct ldlm_resource *parent,
                                        const struct ldlm_res_id *,
-                                       ldlm_type_t type, int create);
+                                       enum ldlm_type type, int create);
 int ldlm_resource_putref(struct ldlm_resource *res);
 void ldlm_resource_add_lock(struct ldlm_resource *res,
                            struct list_head *head,
                      struct list_head *cancels, int count);
 
 int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req,
-                         ldlm_type_t type, __u8 with_policy, ldlm_mode_t mode,
+                         enum ldlm_type type, __u8 with_policy,
+                         enum ldlm_mode mode,
                          __u64 *flags, void *lvb, __u32 lvb_len,
                          struct lustre_handle *lockh, int rc);
 int ldlm_cli_update_pool(struct ptlrpc_request *req);
 int ldlm_cli_cancel_unused_resource(struct ldlm_namespace *ns,
                                    const struct ldlm_res_id *res_id,
                                    ldlm_policy_data_t *policy,
-                                   ldlm_mode_t mode,
+                                   enum ldlm_mode mode,
                                    ldlm_cancel_flags_t flags,
                                    void *opaque);
 int ldlm_cancel_resource_local(struct ldlm_resource *res,
                               struct list_head *cancels,
                               ldlm_policy_data_t *policy,
-                              ldlm_mode_t mode, __u64 lock_flags,
+                              enum ldlm_mode mode, __u64 lock_flags,
                               ldlm_cancel_flags_t cancel_flags, void *opaque);
 int ldlm_cli_cancel_list_local(struct list_head *cancels, int count,
                               ldlm_cancel_flags_t flags);
 
        /** Handles of locks awaiting client reply ACK */
        struct lustre_handle   rs_locks[RS_MAX_LOCKS];
        /** Lock modes of locks in \a rs_locks */
-       ldlm_mode_t         rs_modes[RS_MAX_LOCKS];
+       enum ldlm_mode      rs_modes[RS_MAX_LOCKS];
 };
 
 struct ptlrpc_thread;
 
                                      struct obd_client_handle *);
        int (*set_lock_data)(struct obd_export *, __u64 *, void *, __u64 *);
 
-       ldlm_mode_t (*lock_match)(struct obd_export *, __u64,
-                                 const struct lu_fid *, ldlm_type_t,
-                                 ldlm_policy_data_t *, ldlm_mode_t,
-                                 struct lustre_handle *);
+       enum ldlm_mode (*lock_match)(struct obd_export *, __u64,
+                                    const struct lu_fid *, enum ldlm_type,
+                                    ldlm_policy_data_t *, enum ldlm_mode,
+                                    struct lustre_handle *);
 
        int (*cancel_unused)(struct obd_export *, const struct lu_fid *,
-                            ldlm_policy_data_t *, ldlm_mode_t,
+                            ldlm_policy_data_t *, enum ldlm_mode,
                             ldlm_cancel_flags_t flags, void *opaque);
 
        int (*get_remote_perm)(struct obd_export *, const struct lu_fid *,
 
 static inline int md_cancel_unused(struct obd_export *exp,
                                   const struct lu_fid *fid,
                                   ldlm_policy_data_t *policy,
-                                  ldlm_mode_t mode,
+                                  enum ldlm_mode mode,
                                   ldlm_cancel_flags_t flags,
                                   void *opaque)
 {
        return rc;
 }
 
-static inline ldlm_mode_t md_lock_match(struct obd_export *exp, __u64 flags,
-                                       const struct lu_fid *fid,
-                                       ldlm_type_t type,
-                                       ldlm_policy_data_t *policy,
-                                       ldlm_mode_t mode,
-                                       struct lustre_handle *lockh)
+static inline enum ldlm_mode md_lock_match(struct obd_export *exp, __u64 flags,
+                                          const struct lu_fid *fid,
+                                          enum ldlm_type type,
+                                          ldlm_policy_data_t *policy,
+                                          enum ldlm_mode mode,
+                                          struct lustre_handle *lockh)
 {
        EXP_CHECK_MD_OP(exp, lock_match);
        EXP_MD_COUNTER_INCREMENT(exp, lock_match);
 
        return list_empty(&n->li_group) ? n : NULL;
 }
 
-static inline int lock_mode_to_index(ldlm_mode_t mode)
+static inline int lock_mode_to_index(enum ldlm_mode mode)
 {
        int index;
 
 
 }
 
 static inline void
-ldlm_flock_destroy(struct ldlm_lock *lock, ldlm_mode_t mode, __u64 flags)
+ldlm_flock_destroy(struct ldlm_lock *lock, enum ldlm_mode mode, __u64 flags)
 {
        LDLM_DEBUG(lock, "ldlm_flock_destroy(mode: %d, flags: 0x%llx)",
                   mode, flags);
        struct ldlm_lock *lock = NULL;
        struct ldlm_lock *new = req;
        struct ldlm_lock *new2 = NULL;
-       ldlm_mode_t mode = req->l_req_mode;
+       enum ldlm_mode mode = req->l_req_mode;
        int added = (mode == LCK_NL);
        int overlaps = 0;
        int splitted = 0;
 
                  enum req_location loc, void *data, int size);
 struct ldlm_lock *
 ldlm_lock_create(struct ldlm_namespace *ns, const struct ldlm_res_id *,
-                ldlm_type_t type, ldlm_mode_t,
+                enum ldlm_type type, enum ldlm_mode mode,
                 const struct ldlm_callback_suite *cbs,
                 void *data, __u32 lvb_len, enum lvb_type lvb_type);
 ldlm_error_t ldlm_lock_enqueue(struct ldlm_namespace *, struct ldlm_lock **,
 
 }
 EXPORT_SYMBOL(target_send_reply);
 
-ldlm_mode_t lck_compat_array[] = {
+enum ldlm_mode lck_compat_array[] = {
        [LCK_EX]        = LCK_COMPAT_EX,
        [LCK_PW]        = LCK_COMPAT_PW,
        [LCK_PR]        = LCK_COMPAT_PR,
 
 /**
  * Converts lock policy from local format to on the wire lock_desc format
  */
-static void ldlm_convert_policy_to_wire(ldlm_type_t type,
+static void ldlm_convert_policy_to_wire(enum ldlm_type type,
                                        const ldlm_policy_data_t *lpolicy,
                                        ldlm_wire_policy_data_t *wpolicy)
 {
 /**
  * Converts lock policy from on the wire lock_desc format to local format
  */
-void ldlm_convert_policy_to_local(struct obd_export *exp, ldlm_type_t type,
+void ldlm_convert_policy_to_local(struct obd_export *exp, enum ldlm_type type,
                                  const ldlm_wire_policy_data_t *wpolicy,
                                  ldlm_policy_data_t *lpolicy)
 {
  * comment above ldlm_lock_match
  */
 static struct ldlm_lock *search_queue(struct list_head *queue,
-                                     ldlm_mode_t *mode,
+                                     enum ldlm_mode *mode,
                                      ldlm_policy_data_t *policy,
                                      struct ldlm_lock *old_lock,
                                      __u64 flags, int unref)
        struct list_head       *tmp;
 
        list_for_each(tmp, queue) {
-               ldlm_mode_t match;
+               enum ldlm_mode match;
 
                lock = list_entry(tmp, struct ldlm_lock, l_res_link);
 
  * keep caller code unchanged), the context failure will be discovered by
  * caller sometime later.
  */
-ldlm_mode_t ldlm_lock_match(struct ldlm_namespace *ns, __u64 flags,
-                           const struct ldlm_res_id *res_id, ldlm_type_t type,
-                           ldlm_policy_data_t *policy, ldlm_mode_t mode,
-                           struct lustre_handle *lockh, int unref)
+enum ldlm_mode ldlm_lock_match(struct ldlm_namespace *ns, __u64 flags,
+                              const struct ldlm_res_id *res_id,
+                              enum ldlm_type type,
+                              ldlm_policy_data_t *policy,
+                              enum ldlm_mode mode,
+                              struct lustre_handle *lockh, int unref)
 {
        struct ldlm_resource *res;
        struct ldlm_lock *lock, *old_lock = NULL;
 }
 EXPORT_SYMBOL(ldlm_lock_match);
 
-ldlm_mode_t ldlm_revalidate_lock_handle(struct lustre_handle *lockh,
-                                       __u64 *bits)
+enum ldlm_mode ldlm_revalidate_lock_handle(struct lustre_handle *lockh,
+                                          __u64 *bits)
 {
        struct ldlm_lock *lock;
-       ldlm_mode_t mode = 0;
+       enum ldlm_mode mode = 0;
 
        lock = ldlm_handle2lock(lockh);
        if (lock) {
  */
 struct ldlm_lock *ldlm_lock_create(struct ldlm_namespace *ns,
                                   const struct ldlm_res_id *res_id,
-                                  ldlm_type_t type,
-                                  ldlm_mode_t mode,
+                                  enum ldlm_type type,
+                                  enum ldlm_mode mode,
                                   const struct ldlm_callback_suite *cbs,
                                   void *data, __u32 lvb_len,
                                   enum lvb_type lvb_type)
 
  * Called after receiving reply from server.
  */
 int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req,
-                         ldlm_type_t type, __u8 with_policy, ldlm_mode_t mode,
+                         enum ldlm_type type, __u8 with_policy,
+                         enum ldlm_mode mode,
                          __u64 *flags, void *lvb, __u32 lvb_len,
                          struct lustre_handle *lockh, int rc)
 {
 int ldlm_cancel_resource_local(struct ldlm_resource *res,
                               struct list_head *cancels,
                               ldlm_policy_data_t *policy,
-                              ldlm_mode_t mode, __u64 lock_flags,
+                              enum ldlm_mode mode, __u64 lock_flags,
                               ldlm_cancel_flags_t cancel_flags, void *opaque)
 {
        struct ldlm_lock *lock;
 int ldlm_cli_cancel_unused_resource(struct ldlm_namespace *ns,
                                    const struct ldlm_res_id *res_id,
                                    ldlm_policy_data_t *policy,
-                                   ldlm_mode_t mode,
+                                   enum ldlm_mode mode,
                                    ldlm_cancel_flags_t flags,
                                    void *opaque)
 {
 
  */
 struct ldlm_resource *
 ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent,
-                 const struct ldlm_res_id *name, ldlm_type_t type, int create)
+                 const struct ldlm_res_id *name, enum ldlm_type type,
+                 int create)
 {
        struct hlist_node     *hnode;
        struct ldlm_resource *res;
 
        struct lustre_handle lockh;
        struct lu_dirpage *dp;
        struct page *page;
-       ldlm_mode_t mode;
+       enum ldlm_mode mode;
        int rc;
        __u64 start = 0;
        __u64 end = 0;
 
  * \param l_req_mode [IN] searched lock mode
  * \retval boolean, true iff all bits are found
  */
-int ll_have_md_lock(struct inode *inode, __u64 *bits,  ldlm_mode_t l_req_mode)
+int ll_have_md_lock(struct inode *inode, __u64 *bits,
+                   enum ldlm_mode l_req_mode)
 {
        struct lustre_handle lockh;
        ldlm_policy_data_t policy;
-       ldlm_mode_t mode = (l_req_mode == LCK_MINMODE) ?
+       enum ldlm_mode mode = (l_req_mode == LCK_MINMODE) ?
                                (LCK_CR|LCK_CW|LCK_PR|LCK_PW) : l_req_mode;
        struct lu_fid *fid;
        __u64 flags;
        return *bits == 0;
 }
 
-ldlm_mode_t ll_take_md_lock(struct inode *inode, __u64 bits,
-                           struct lustre_handle *lockh, __u64 flags,
-                           ldlm_mode_t mode)
+enum ldlm_mode ll_take_md_lock(struct inode *inode, __u64 bits,
+                              struct lustre_handle *lockh, __u64 flags,
+                              enum ldlm_mode mode)
 {
        ldlm_policy_data_t policy = { .l_inodebits = {bits} };
        struct lu_fid *fid;
-       ldlm_mode_t rc;
+       enum ldlm_mode rc;
 
        fid = &ll_i2info(inode)->lli_fid;
        CDEBUG(D_INFO, "trying to match res "DFID"\n", PFID(fid));
  * Apply the layout to the inode. Layout lock is held and will be released
  * in this function.
  */
-static int ll_layout_lock_set(struct lustre_handle *lockh, ldlm_mode_t mode,
-                               struct inode *inode, __u32 *gen, bool reconf)
+static int ll_layout_lock_set(struct lustre_handle *lockh, enum ldlm_mode mode,
+                             struct inode *inode, __u32 *gen, bool reconf)
 {
        struct ll_inode_info *lli = ll_i2info(inode);
        struct ll_sb_info    *sbi = ll_i2sbi(inode);
        struct md_op_data     *op_data;
        struct lookup_intent   it;
        struct lustre_handle   lockh;
-       ldlm_mode_t            mode;
+       enum ldlm_mode         mode;
        struct ldlm_enqueue_info einfo = {
                .ei_type = LDLM_IBITS,
                .ei_mode = LCK_CR,
 
 extern struct file_operations ll_file_operations_noflock;
 extern const struct inode_operations ll_file_inode_operations;
 int ll_have_md_lock(struct inode *inode, __u64 *bits,
-                   ldlm_mode_t l_req_mode);
-ldlm_mode_t ll_take_md_lock(struct inode *inode, __u64 bits,
-                           struct lustre_handle *lockh, __u64 flags,
-                           ldlm_mode_t mode);
+                   enum ldlm_mode l_req_mode);
+enum ldlm_mode ll_take_md_lock(struct inode *inode, __u64 bits,
+                              struct lustre_handle *lockh, __u64 flags,
+                              enum ldlm_mode mode);
 int ll_file_open(struct inode *inode, struct file *file);
 int ll_file_release(struct inode *inode, struct file *file);
 int ll_glimpse_ioctl(struct ll_sb_info *sbi,
 
                if (exp_connect_som(ll_i2mdexp(inode)) &&
                    S_ISREG(inode->i_mode)) {
                        struct lustre_handle lockh;
-                       ldlm_mode_t mode;
+                       enum ldlm_mode mode;
 
                        /* As it is possible a blocking ast has been processed
                         * by this time, we need to check there is an UPDATE
 
                                  struct lookup_intent *oit,
                                  struct ptlrpc_request **req)
 {
-       ldlm_mode_t mode;
+       enum ldlm_mode mode;
        struct lustre_handle lockh = { 0 };
        struct md_op_data *op_data;
        struct ll_inode_info *lli = ll_i2info(inode);
 
         NULL)
 
 static int lmv_early_cancel(struct obd_export *exp, struct md_op_data *op_data,
-                           int op_tgt, ldlm_mode_t mode, int bits, int flag)
+                           int op_tgt, enum ldlm_mode mode, int bits,
+                           int flag)
 {
        struct lu_fid     *fid = md_op_data_fid(op_data, flag);
        struct obd_device      *obd = exp->exp_obd;
 }
 
 static int lmv_cancel_unused(struct obd_export *exp, const struct lu_fid *fid,
-                            ldlm_policy_data_t *policy, ldlm_mode_t mode,
+                            ldlm_policy_data_t *policy, enum ldlm_mode mode,
                             ldlm_cancel_flags_t flags, void *opaque)
 {
        struct obd_device       *obd = exp->exp_obd;
        return rc;
 }
 
-static ldlm_mode_t lmv_lock_match(struct obd_export *exp, __u64 flags,
-                                 const struct lu_fid *fid, ldlm_type_t type,
-                                 ldlm_policy_data_t *policy, ldlm_mode_t mode,
-                                 struct lustre_handle *lockh)
+static enum ldlm_mode lmv_lock_match(struct obd_export *exp, __u64 flags,
+                                    const struct lu_fid *fid,
+                                    enum ldlm_type type,
+                                    ldlm_policy_data_t *policy,
+                                    enum ldlm_mode mode,
+                                    struct lustre_handle *lockh)
 {
        struct obd_device       *obd = exp->exp_obd;
        struct lmv_obd    *lmv = &obd->u.lmv;
-       ldlm_mode_t           rc;
+       enum ldlm_mode        rc;
        int                   i;
 
        CDEBUG(D_INODE, "Lock match for "DFID"\n", PFID(fid));
 
                struct ptlrpc_request **req, __u64 extra_lock_flags);
 
 int mdc_resource_get_unused(struct obd_export *exp, const struct lu_fid *fid,
-                           struct list_head *cancels, ldlm_mode_t mode,
+                           struct list_head *cancels, enum ldlm_mode  mode,
                            __u64 bits);
 /* mdc/mdc_request.c */
 int mdc_fid_alloc(struct obd_export *exp, struct lu_fid *fid,
 int mdc_unlink(struct obd_export *exp, struct md_op_data *op_data,
               struct ptlrpc_request **request);
 int mdc_cancel_unused(struct obd_export *exp, const struct lu_fid *fid,
-                     ldlm_policy_data_t *policy, ldlm_mode_t mode,
+                     ldlm_policy_data_t *policy, enum ldlm_mode mode,
                      ldlm_cancel_flags_t flags, void *opaque);
 
 int mdc_revalidate_lock(struct obd_export *exp, struct lookup_intent *it,
                             struct md_enqueue_info *minfo,
                             struct ldlm_enqueue_info *einfo);
 
-ldlm_mode_t mdc_lock_match(struct obd_export *exp, __u64 flags,
-                          const struct lu_fid *fid, ldlm_type_t type,
-                          ldlm_policy_data_t *policy, ldlm_mode_t mode,
-                          struct lustre_handle *lockh);
+enum ldlm_mode mdc_lock_match(struct obd_export *exp, __u64 flags,
+                             const struct lu_fid *fid, enum ldlm_type type,
+                             ldlm_policy_data_t *policy, enum ldlm_mode mode,
+                             struct lustre_handle *lockh);
 
 static inline int mdc_prep_elc_req(struct obd_export *exp,
                                   struct ptlrpc_request *req, int opc,
 
        return 0;
 }
 
-ldlm_mode_t mdc_lock_match(struct obd_export *exp, __u64 flags,
-                          const struct lu_fid *fid, ldlm_type_t type,
-                          ldlm_policy_data_t *policy, ldlm_mode_t mode,
-                          struct lustre_handle *lockh)
+enum ldlm_mode mdc_lock_match(struct obd_export *exp, __u64 flags,
+                             const struct lu_fid *fid, enum ldlm_type type,
+                             ldlm_policy_data_t *policy, enum ldlm_mode mode,
+                             struct lustre_handle *lockh)
 {
        struct ldlm_res_id res_id;
-       ldlm_mode_t rc;
+       enum ldlm_mode rc;
 
        fid_build_reg_res_name(fid, &res_id);
        /* LU-4405: Clear bits not supported by server */
 int mdc_cancel_unused(struct obd_export *exp,
                      const struct lu_fid *fid,
                      ldlm_policy_data_t *policy,
-                     ldlm_mode_t mode,
+                     enum ldlm_mode mode,
                      ldlm_cancel_flags_t flags,
                      void *opaque)
 {
        struct ldlm_res_id res_id;
        struct lustre_handle lockh;
        ldlm_policy_data_t policy;
-       ldlm_mode_t mode;
+       enum ldlm_mode mode;
 
        if (it->d.lustre.it_lock_handle) {
                lockh.cookie = it->d.lustre.it_lock_handle;
 
  * found by @fid. Found locks are added into @cancel list. Returns the amount of
  * locks added to @cancels list. */
 int mdc_resource_get_unused(struct obd_export *exp, const struct lu_fid *fid,
-                           struct list_head *cancels, ldlm_mode_t mode,
+                           struct list_head *cancels, enum ldlm_mode mode,
                            __u64 bits)
 {
        struct ldlm_namespace *ns = exp->exp_obd->obd_namespace;
 
        return (struct cl_object *)&obj->oo_cl;
 }
 
-static inline ldlm_mode_t osc_cl_lock2ldlm(enum cl_lock_mode mode)
+static inline enum ldlm_mode osc_cl_lock2ldlm(enum cl_lock_mode mode)
 {
        LASSERT(mode == CLM_READ || mode == CLM_WRITE || mode == CLM_GROUP);
        if (mode == CLM_READ)
                return LCK_GROUP;
 }
 
-static inline enum cl_lock_mode osc_ldlm2cl_lock(ldlm_mode_t mode)
+static inline enum cl_lock_mode osc_ldlm2cl_lock(enum ldlm_mode mode)
 {
        LASSERT(mode == LCK_PR || mode == LCK_PW || mode == LCK_GROUP);
        if (mode == LCK_PR)
 
  * locks added to @cancels list. */
 static int osc_resource_get_unused(struct obd_export *exp, struct obdo *oa,
                                   struct list_head *cancels,
-                                  ldlm_mode_t mode, __u64 lock_flags)
+                                  enum ldlm_mode mode, __u64 lock_flags)
 {
        struct ldlm_namespace *ns = exp->exp_obd->obd_namespace;
        struct ldlm_res_id res_id;
        struct ptlrpc_request *req = NULL;
        int intent = *flags & LDLM_FL_HAS_INTENT;
        __u64 match_lvb = (agl != 0 ? 0 : LDLM_FL_LVB_READY);
-       ldlm_mode_t mode;
+       enum ldlm_mode mode;
        int rc;
 
        /* Filesystem lock extents are extended to page boundaries so that
 {
        struct obd_device *obd = exp->exp_obd;
        __u64 lflags = *flags;
-       ldlm_mode_t rc;
+       enum ldlm_mode rc;
 
        if (OBD_FAIL_CHECK(OBD_FAIL_OSC_MATCH))
                return -EIO;
                struct ldlm_res_id res_id;
                ldlm_policy_data_t policy;
                struct lustre_handle lockh;
-               ldlm_mode_t mode = 0;
+               enum ldlm_mode mode = 0;
                struct ptlrpc_request *req;
                struct ll_user_fiemap *reply;
                char *tmp;