From dd8f6da3da2ad1cb4a8c77abcd702697061fa10a Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 14 Jun 2010 14:40:10 -0700 Subject: [PATCH] Update gcc-cast Fix new instances of missing casts or assumed types. --- cmd/zdb/zdb.c | 4 ++-- cmd/ztest/ztest.c | 4 ++-- lib/libzfs/libzfs_pool.c | 15 +++++++++------ module/zfs/sa.c | 4 ++-- module/zfs/zfs_ioctl.c | 4 ++-- 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c index ff73072f8a..92c65bdbc9 100644 --- a/cmd/zdb/zdb.c +++ b/cmd/zdb/zdb.c @@ -865,8 +865,8 @@ dump_history(spa_t *spa) (void) snprintf(internalstr, sizeof (internalstr), "[internal %s txg:%lld] %s", - zfs_history_event_names[ievent], txg, - intstr); + zfs_history_event_names[ievent], + (longlong_t)txg, intstr); cmd = internalstr; } tsec = time; diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c index 2c2382d327..d7877b52d9 100644 --- a/cmd/ztest/ztest.c +++ b/cmd/ztest/ztest.c @@ -2013,7 +2013,7 @@ ztest_od_init(ztest_od_t *od, uint64_t id, char *tag, uint64_t index, od->od_gen = 0; (void) snprintf(od->od_name, sizeof (od->od_name), "%s(%lld)[%llu]", - tag, (int64_t)id, index); + tag, (longlong_t)id, (u_longlong_t)index); } /* @@ -3907,7 +3907,7 @@ ztest_fzap(ztest_ds_t *zd, uint64_t id) int error; (void) snprintf(name, sizeof (name), "fzap-%llu-%llu", - id, value); + (u_longlong_t)id, (u_longlong_t)value); tx = dmu_tx_create(os); dmu_tx_hold_zap(tx, object, B_TRUE, name); diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c index 4f0f6861c1..1d416152fb 100644 --- a/lib/libzfs/libzfs_pool.c +++ b/lib/libzfs/libzfs_pool.c @@ -1223,7 +1223,7 @@ zpool_rewind_exclaim(libzfs_handle_t *hdl, const char *name, boolean_t dryrun, (void) nvlist_lookup_int64(rbi, ZPOOL_CONFIG_REWIND_TIME, &loss); if (localtime_r((time_t *)&rewindto, &t) != NULL && - strftime(timestr, 128, 0, &t) != 0) { + strftime(timestr, 128, "%c", &t) != 0) { if (dryrun) { (void) printf(dgettext(TEXT_DOMAIN, "Would be able to return %s " @@ -1238,13 +1238,14 @@ zpool_rewind_exclaim(libzfs_handle_t *hdl, const char *name, boolean_t dryrun, (void) printf(dgettext(TEXT_DOMAIN, "%s approximately %lld "), dryrun ? "Would discard" : "Discarded", - (loss + 30) / 60); + ((longlong_t)loss + 30) / 60); (void) printf(dgettext(TEXT_DOMAIN, "minutes of transactions.\n")); } else if (loss > 0) { (void) printf(dgettext(TEXT_DOMAIN, "%s approximately %lld "), - dryrun ? "Would discard" : "Discarded", loss); + dryrun ? "Would discard" : "Discarded", + (longlong_t)loss); (void) printf(dgettext(TEXT_DOMAIN, "seconds of transactions.\n")); } @@ -1282,7 +1283,7 @@ zpool_explain_recover(libzfs_handle_t *hdl, const char *name, int reason, "Recovery is possible, but will result in some data loss.\n")); if (localtime_r((time_t *)&rewindto, &t) != NULL && - strftime(timestr, 128, 0, &t) != 0) { + strftime(timestr, 128, "%c", &t) != 0) { (void) printf(dgettext(TEXT_DOMAIN, "\tReturning the pool to its state as of %s\n" "\tshould correct the problem. "), @@ -1296,11 +1297,13 @@ zpool_explain_recover(libzfs_handle_t *hdl, const char *name, int reason, if (loss > 120) { (void) printf(dgettext(TEXT_DOMAIN, "Approximately %lld minutes of data\n" - "\tmust be discarded, irreversibly. "), (loss + 30) / 60); + "\tmust be discarded, irreversibly. "), + ((longlong_t)loss + 30) / 60); } else if (loss > 0) { (void) printf(dgettext(TEXT_DOMAIN, "Approximately %lld seconds of data\n" - "\tmust be discarded, irreversibly. "), loss); + "\tmust be discarded, irreversibly. "), + (longlong_t)loss); } if (edata != 0 && edata != UINT64_MAX) { if (edata == 1) { diff --git a/module/zfs/sa.c b/module/zfs/sa.c index a91b379f99..17649274dd 100644 --- a/module/zfs/sa.c +++ b/module/zfs/sa.c @@ -1469,12 +1469,12 @@ sa_attr_register_sync(sa_handle_t *hdl, dmu_tx_t *tx) mutex_enter(&sa->sa_lock); - if (!sa->sa_need_attr_registration || sa->sa_master_obj == NULL) { + if (!sa->sa_need_attr_registration || sa->sa_master_obj == 0) { mutex_exit(&sa->sa_lock); return; } - if (sa->sa_reg_attr_obj == NULL) { + if (sa->sa_reg_attr_obj == 0) { int error; sa->sa_reg_attr_obj = zap_create(hdl->sa_os, DMU_OT_SA_ATTR_REGISTRATION, DMU_OT_NONE, 0, tx); diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index d05b9468bd..e965aefbcf 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -2274,7 +2274,7 @@ zfs_ioc_set_prop(zfs_cmd_t *zc) error = zfs_set_prop_nvlist(zc->zc_name, source, nvl, &errors); - if (zc->zc_nvlist_dst != NULL && errors != NULL) { + if (zc->zc_nvlist_dst != 0 && errors != NULL) { (void) put_nvlist(zc, errors); } @@ -3709,7 +3709,7 @@ zfs_ioc_clear(zfs_cmd_t *zc) nvlist_t *policy; nvlist_t *config = NULL; - if (zc->zc_nvlist_src == NULL) + if (zc->zc_nvlist_src == 0) return (EINVAL); if ((error = get_nvlist(zc->zc_nvlist_src,