Whamcloud - gitweb
LU-5577 changelog: fix comparison between signed and unsigned 74/12474/2
authorDmitry Eremin <dmitry.eremin@intel.com>
Wed, 29 Oct 2014 12:36:25 +0000 (15:36 +0300)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 4 Nov 2014 18:13:10 +0000 (18:13 +0000)
Change type of changelog_*{namelen,size}() to size_t.
Fixed string specifier for unsigned types.

Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Change-Id: Ie24c87242328d14ee608ad38b530a6e581db93b9
Reviewed-on: http://review.whamcloud.com/12474
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: James Nunez <james.a.nunez@intel.com>
lustre/include/lustre/lustre_user.h
lustre/llite/file.c
lustre/lod/lod_lov.c
lustre/osd-ldiskfs/osd_handler.c
lustre/target/out_handler.c
lustre/utils/lfs.c

index 68d186c..28846c7 100644 (file)
@@ -866,9 +866,9 @@ struct changelog_ext_jobid {
 };
 
 
-static inline unsigned int changelog_rec_offset(enum changelog_rec_flags crf)
+static inline size_t changelog_rec_offset(enum changelog_rec_flags crf)
 {
-       unsigned int size = sizeof(struct changelog_rec);
+       size_t size = sizeof(struct changelog_rec);
 
        if (crf & CLF_RENAME)
                size += sizeof(struct changelog_ext_rename);
@@ -879,12 +879,12 @@ static inline unsigned int changelog_rec_offset(enum changelog_rec_flags crf)
        return size;
 }
 
-static inline unsigned int changelog_rec_size(struct changelog_rec *rec)
+static inline size_t changelog_rec_size(struct changelog_rec *rec)
 {
        return changelog_rec_offset(rec->cr_flags);
 }
 
-static inline unsigned int changelog_rec_varsize(struct changelog_rec *rec)
+static inline size_t changelog_rec_varsize(struct changelog_rec *rec)
 {
        return changelog_rec_size(rec) - sizeof(*rec) + rec->cr_namelen;
 }
@@ -916,7 +916,7 @@ static inline char *changelog_rec_name(struct changelog_rec *rec)
                                                  CLF_SUPPORTED);
 }
 
-static inline int changelog_rec_snamelen(struct changelog_rec *rec)
+static inline size_t changelog_rec_snamelen(struct changelog_rec *rec)
 {
        return rec->cr_namelen - strlen(changelog_rec_name(rec)) - 1;
 }
index 5d64995..655ac1a 100644 (file)
@@ -1147,7 +1147,7 @@ ll_file_io_generic(const struct lu_env *env, struct vvp_io_args *args,
        struct range_lock     range;
        ENTRY;
 
-       CDEBUG(D_VFSTRACE, "file: %s, type: %d ppos: "LPU64", count: %zd\n",
+       CDEBUG(D_VFSTRACE, "file: %s, type: %d ppos: "LPU64", count: %zu\n",
                file->f_dentry->d_name.name, iot, *ppos, count);
 
 restart:
@@ -1220,7 +1220,7 @@ out:
        /* If any bit been read/written (result != 0), we just return
         * short read/write instead of restart io. */
        if ((result == 0 || result == -ENODATA) && io->ci_need_restart) {
-               CDEBUG(D_VFSTRACE, "Restart %s on %s from %lld, count:%zd\n",
+               CDEBUG(D_VFSTRACE, "Restart %s on %s from %lld, count:%zu\n",
                       iot == CIT_READ ? "read" : "write",
                       file->f_dentry->d_name.name, *ppos, count);
                LASSERTF(io->ci_nob == 0, "%zd\n", io->ci_nob);
index 6b352e8..2196e79 100644 (file)
@@ -1127,7 +1127,7 @@ int lod_verify_striping(struct lod_device *d, const struct lu_buf *buf,
        LASSERT(sizeof(*lum) < sizeof(*lum3));
 
        if (buf->lb_len < sizeof(*lum)) {
-               CDEBUG(D_IOCTL, "buf len %zd too small for lov_user_md\n",
+               CDEBUG(D_IOCTL, "buf len %zu too small for lov_user_md\n",
                       buf->lb_len);
                GOTO(out, rc = -EINVAL);
        }
@@ -1188,7 +1188,7 @@ int lod_verify_striping(struct lod_device *d, const struct lu_buf *buf,
 
        stripe_count = le16_to_cpu(lum->lmm_stripe_count);
        if (buf->lb_len != lum_size) {
-               CDEBUG(D_IOCTL, "invalid buf len %zd for lov_user_md with "
+               CDEBUG(D_IOCTL, "invalid buf len %zu for lov_user_md with "
                       "magic %#x and stripe_count %u\n",
                       buf->lb_len, magic, stripe_count);
                GOTO(out, rc = -EINVAL);
@@ -1199,7 +1199,7 @@ int lod_verify_striping(struct lod_device *d, const struct lu_buf *buf,
 
        lum3 = buf->lb_buf;
        if (buf->lb_len < sizeof(*lum3)) {
-               CDEBUG(D_IOCTL, "buf len %zd too small for lov_user_md_v3\n",
+               CDEBUG(D_IOCTL, "buf len %zu too small for lov_user_md_v3\n",
                       buf->lb_len);
                GOTO(out, rc = -EINVAL);
        }
index 1a467b3..1c9f610 100644 (file)
@@ -3030,7 +3030,7 @@ static int osd_xattr_set(const struct lu_env *env, struct dt_object *dt,
         if (osd_object_auth(env, dt, capa, CAPA_OPC_META_WRITE))
                 return -EACCES;
 
-       CDEBUG(D_INODE, DFID" set xattr '%s' with size %zd\n",
+       CDEBUG(D_INODE, DFID" set xattr '%s' with size %zu\n",
               PFID(lu_object_fid(&dt->do_lu)), name, buf->lb_len);
 
        osd_trans_exec_op(env, handle, OSD_OT_XATTR_SET);
index a0e4879..8f472e2 100644 (file)
@@ -681,7 +681,7 @@ static int out_xattr_set(struct tgt_session_info *tsi)
 
        tmp = object_update_param_get(update, 2, &size);
        if (tmp == NULL || size != sizeof(*tmp)) {
-               CERROR("%s: emptry or wrong size %zd flag: rc = %d\n",
+               CERROR("%s: emptry or wrong size %zu flag: rc = %d\n",
                       tgt_name(tsi->tsi_tgt), size, -EPROTO);
                RETURN(err_serious(-EPROTO));
        }
@@ -1318,7 +1318,7 @@ static int out_write(struct tgt_session_info *tsi)
 
        tmp = object_update_param_get(update, 1, &size);
        if (tmp == NULL || size != sizeof(*tmp)) {
-               CERROR("%s: empty or wrong size %zd pos: rc = %d\n",
+               CERROR("%s: empty or wrong size %zu pos: rc = %d\n",
                       tgt_name(tsi->tsi_tgt), size, -EPROTO);
                RETURN(err_serious(-EPROTO));
        }
index e1e5a62..fa23bf1 100644 (file)
@@ -3364,7 +3364,7 @@ static int lfs_changelog(int argc, char **argv)
                                printf(" s="DFID" sp="DFID" %.*s",
                                       PFID(&rnm->cr_sfid),
                                       PFID(&rnm->cr_spfid),
-                                      changelog_rec_snamelen(rec),
+                                      (int)changelog_rec_snamelen(rec),
                                       changelog_rec_sname(rec));
                }
                printf("\n");