From: Dmitry Eremin Date: Wed, 29 Oct 2014 12:36:25 +0000 (+0300) Subject: LU-5577 changelog: fix comparison between signed and unsigned X-Git-Tag: 2.6.90~6 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=6c48a3d3797ae23102c4d0d717842693fa1dc82d LU-5577 changelog: fix comparison between signed and unsigned Change type of changelog_*{namelen,size}() to size_t. Fixed string specifier for unsigned types. Signed-off-by: Dmitry Eremin Change-Id: Ie24c87242328d14ee608ad38b530a6e581db93b9 Reviewed-on: http://review.whamcloud.com/12474 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Andreas Dilger Reviewed-by: James Nunez --- diff --git a/lustre/include/lustre/lustre_user.h b/lustre/include/lustre/lustre_user.h index 68d186c..28846c7 100644 --- a/lustre/include/lustre/lustre_user.h +++ b/lustre/include/lustre/lustre_user.h @@ -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; } diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 5d64995..655ac1a 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -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); diff --git a/lustre/lod/lod_lov.c b/lustre/lod/lod_lov.c index 6b352e8..2196e79 100644 --- a/lustre/lod/lod_lov.c +++ b/lustre/lod/lod_lov.c @@ -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); } diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index 1a467b3..1c9f610 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -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); diff --git a/lustre/target/out_handler.c b/lustre/target/out_handler.c index a0e4879..8f472e2 100644 --- a/lustre/target/out_handler.c +++ b/lustre/target/out_handler.c @@ -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)); } diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index e1e5a62..fa23bf1 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -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");