gcc 13 does not allow mixing of emum and integer
types between function declaration and implementation.
Cleanup a couple of instances where an enum is treated
as an uint32_t / __u32 and treat it as an enum type.
lustre/lov/lov_ea.c: In function 'lsme_unpack_comp':
lustre/lov/lov_ea.c:531:21: error: array subscript
'struct lov_stripe_md_entry[0]' is partly outside array bounds
of 'struct lov_stripe_md_entry[0]' [-Werror=array-bounds=]
531 | lsme->lsme_magic = magic;
Lustre-change: https://review.whamcloud.com/54468
Lustre-commit: TBD (from
617e7a25b12e0cdb865188414b6d1206eedec69a)
Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Change-Id: I8e2ef989ecbdebe5e13bcea0fbb210c4a14eb45e
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/54873
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
int llapi_pcc_state_get(const char *path, struct lu_pcc_state *state);
int llapi_pccdev_set(const char *mntpath, const char *cmd);
int llapi_pccdev_get(const char *mntpath);
-int llapi_pcc_del(const char *mntpath, const char *pccpath, __u32 flags);
-int llapi_pcc_clear(const char *mntpath, __u32 flags);
+int llapi_pcc_del(const char *mntpath, const char *pccpath,
+ enum lu_pcc_cleanup_flags flags);
+int llapi_pcc_clear(const char *mntpath, enum lu_pcc_cleanup_flags flags);
int llapi_pcc_pin_fd(int fd, __u32 id);
int llapi_pcc_pin_file(const char *path, __u32 id);
int llapi_pcc_pin_fid(const char *lustre_dir, const struct lu_fid *fid, __u32 id);
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 *, __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;
}