From 532ed744188343cc3dc058ec96f55df94a6c8dab Mon Sep 17 00:00:00 2001 From: Jian Yu Date: Mon, 17 Mar 2025 10:11:17 -0700 Subject: [PATCH] LU-18821 build: fix [-Werror=pointer-to-int-cast] error This patch fixes the following error on 32-bit architectures by replacing the __u64 cast with uintptr_t, which is either 32-bit or 64-bit: lustre/include/obd_class.h: In function 'obd_quota_iter': lustre/include/obd_class.h:1289:39: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] 1289 | oqctl->qc_iter_list = (__u64)list; | ^ cc1: all warnings being treated as errors Change-Id: I5938a4c09a50010ce3b99bc6f978fed5cc32a5d6 Signed-off-by: Jian Yu Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58440 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Hongchao Zhang Reviewed-by: Oleg Drokin --- lustre/include/obd_class.h | 2 +- lustre/llite/dir.c | 6 +++--- lustre/lmv/lmv_obd.c | 3 ++- lustre/lov/lov_obd.c | 2 +- lustre/mdc/mdc_request.c | 3 ++- lustre/osc/osc_quota.c | 3 ++- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index 1fb3be2..b1aa244 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -1320,7 +1320,7 @@ static inline int obd_quota_iter(struct obd_export *exp, int rc = 0; do { - oqctl->qc_iter_list = (__u64)list; + oqctl->qc_iter_list = (uintptr_t)list; rc = obd_quotactl(exp, oqctl); if (rc) break; diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c index 35eb508..36dbfaa 100644 --- a/lustre/llite/dir.c +++ b/lustre/llite/dir.c @@ -1497,21 +1497,21 @@ static int quotactl_iter(struct ll_sb_info *sbi, struct if_quotactl *qctl) GOTO(out, rc = -ENOMEM); QCTL_COPY(oqctl, qctl); - oqctl->qc_iter_list = (__u64)&iter_quota_glb_list; + oqctl->qc_iter_list = (uintptr_t)&iter_quota_glb_list; rc = obd_quotactl(sbi->ll_md_exp, oqctl); if (rc) GOTO(cleanup, rc); QCTL_COPY(oqctl, qctl); oqctl->qc_cmd = LUSTRE_Q_ITEROQUOTA; - oqctl->qc_iter_list = (__u64)&iter_obd_quota_md_list; + oqctl->qc_iter_list = (uintptr_t)&iter_obd_quota_md_list; rc = obd_quotactl(sbi->ll_md_exp, oqctl); if (rc) GOTO(cleanup, rc); QCTL_COPY(oqctl, qctl); oqctl->qc_cmd = LUSTRE_Q_ITEROQUOTA; - oqctl->qc_iter_list = (__u64)&iter_obd_quota_dt_list; + oqctl->qc_iter_list = (uintptr_t)&iter_obd_quota_dt_list; rc = obd_quotactl(sbi->ll_dt_exp, oqctl); if (rc) GOTO(cleanup, rc); diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index a615836..3cef400 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -4162,7 +4162,8 @@ static int lmv_quotactl(struct obd_device *unused, struct obd_export *exp, if (oqctl->qc_cmd == LUSTRE_Q_ITERQUOTA || oqctl->qc_cmd == LUSTRE_Q_ITEROQUOTA) { - struct list_head *lst = (struct list_head *)oqctl->qc_iter_list; + struct list_head *lst = + (struct list_head *)(uintptr_t)(oqctl->qc_iter_list); int err; if (oqctl->qc_cmd == LUSTRE_Q_ITERQUOTA) diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index d03f886..d3a4ad2 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -1260,7 +1260,7 @@ static int lov_quotactl(struct obd_device *obd, struct obd_export *exp, } if (oqctl->qc_cmd == LUSTRE_Q_ITEROQUOTA) - lst = (struct list_head *)oqctl->qc_iter_list; + lst = (struct list_head *)(uintptr_t)(oqctl->qc_iter_list); /* for lov tgt */ lov_tgts_getref(obd); diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index 6aba39e..4e05efa 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -2148,7 +2148,8 @@ static int mdc_quotactl(struct obd_device *unused, struct obd_export *exp, if (req->rq_repmsg && (oqc = req_capsule_server_get(&req->rq_pill, &RMF_OBD_QUOTACTL))) { - struct list_head *lst = (struct list_head *)oqctl->qc_iter_list; + struct list_head *lst = + (struct list_head *)(uintptr_t)(oqctl->qc_iter_list); QCTL_COPY(oqctl, oqc); diff --git a/lustre/osc/osc_quota.c b/lustre/osc/osc_quota.c index c5a39f3..389a292 100644 --- a/lustre/osc/osc_quota.c +++ b/lustre/osc/osc_quota.c @@ -221,7 +221,8 @@ int osc_quotactl(struct obd_device *unused, struct obd_export *exp, CERROR("ptlrpc_queue_wait failed, rc: %d\n", rc); if (rc == 0 && req->rq_repmsg) { - struct list_head *lst = (struct list_head *)oqctl->qc_iter_list; + struct list_head *lst = + (struct list_head *)(uintptr_t)(oqctl->qc_iter_list); oqc = req_capsule_server_get(&req->rq_pill, &RMF_OBD_QUOTACTL); if (!oqc) -- 1.8.3.1