LLAPI_LAYOUT_COMP_USE_LAST = 2,
LLAPI_LAYOUT_COMP_USE_NEXT = 3,
LLAPI_LAYOUT_COMP_USE_PREV = 4,
+
+ /* ensure -fshort-enums keeps u32 size for interop */
+ _LLAPI_LAYOUT_COMP_TYPE_SIZE = (__u32)-1,
};
/**
/**
* Select the currently active component at the specified position.
*/
-int llapi_layout_comp_use(struct llapi_layout *layout, uint32_t pos);
+int llapi_layout_comp_use(struct llapi_layout *layout,
+ enum llapi_layout_comp_use pos);
/**
* Add layout components to an existing file.
*/
int ptlrpc_unpack_rep_msg(struct ptlrpc_request *req, int len);
int ptlrpc_unpack_req_msg(struct ptlrpc_request *req, int len);
-int lustre_msg_check_version(struct lustre_msg *msg, __u32 version);
+int lustre_msg_check_version(struct lustre_msg *msg,
+ enum lustre_msg_version version);
void lustre_init_msg_v2(struct lustre_msg_v2 *msg, int count, __u32 *lens,
char **bufs);
int lustre_pack_request(struct ptlrpc_request *req, __u32 magic, int count,
void lustre_msg_set_buflen(struct lustre_msg *m, __u32 n, __u32 len);
__u32 lustre_msg_bufcount(struct lustre_msg *m);
char *lustre_msg_string(struct lustre_msg *m, __u32 n, __u32 max_len);
-__u32 lustre_msghdr_get_flags(struct lustre_msg *msg);
+enum lustre_msghdr lustre_msghdr_get_flags(struct lustre_msg *msg);
void lustre_msghdr_set_flags(struct lustre_msg *msg, __u32 flags);
__u32 lustre_msg_get_flags(struct lustre_msg *msg);
void lustre_msg_add_flags(struct lustre_msg *msg, __u32 flags);
magic = le32_to_cpu(lmm->lmm_magic);
if (!lov_supported_comp_magic(magic)) {
struct lov_stripe_md_entry *lsme;
+ size_t lsme_sz = offsetof(typeof(*lsme), lsme_oinfo[0]);
+ struct lov_stripe_md_entry lsme_init = {
+ .lsme_pattern = le32_to_cpu(lmm->lmm_pattern),
+ .lsme_magic = magic,
+ };
/* allocate a lsme holder for invalid magic lmm */
- OBD_ALLOC_LARGE(lsme, offsetof(typeof(*lsme), lsme_oinfo[0]));
- lsme->lsme_magic = magic;
- lsme->lsme_pattern = le32_to_cpu(lmm->lmm_pattern);
+ OBD_ALLOC_LARGE(lsme, lsme_sz);
+ if (!lsme)
+ return ERR_PTR(-ENOMEM);
+
+ memcpy(lsme, &lsme_init, lsme_sz);
return lsme;
}