Whamcloud - gitweb
LU-18821 build: fix [-Werror=pointer-to-int-cast] error 40/58440/2
authorJian Yu <yujian@whamcloud.com>
Mon, 17 Mar 2025 17:11:17 +0000 (10:11 -0700)
committerOleg Drokin <green@whamcloud.com>
Wed, 26 Mar 2025 04:06:20 +0000 (04:06 +0000)
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 <yujian@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58440
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Hongchao Zhang <hongchao@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/obd_class.h
lustre/llite/dir.c
lustre/lmv/lmv_obd.c
lustre/lov/lov_obd.c
lustre/mdc/mdc_request.c
lustre/osc/osc_quota.c

index 1fb3be2..b1aa244 100644 (file)
@@ -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;
index 35eb508..36dbfaa 100644 (file)
@@ -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);
index a615836..3cef400 100644 (file)
@@ -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)
index d03f886..d3a4ad2 100644 (file)
@@ -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);
index 6aba39e..4e05efa 100644 (file)
@@ -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);
 
index c5a39f3..389a292 100644 (file)
@@ -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)