From b8864a233c569edcc57c686f3ea8cd1ae3b89153 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 26 Aug 2010 09:52:39 -0700 Subject: [PATCH] Fix gcc cast warnings Gcc -Wall warn: 'lacks a cast' Gcc -Wall warn: 'comparison between pointer and integer' Signed-off-by: Brian Behlendorf --- cmd/zdb/zdb.c | 4 ++-- cmd/zfs/zfs_main.c | 16 ++++++++-------- cmd/zpool/zpool_main.c | 10 +++++----- cmd/ztest/ztest.c | 34 ++++++++++++++++++++++------------ lib/libnvpair/libnvpair.c | 6 +++--- lib/libzfs/libzfs_dataset.c | 5 +++-- lib/libzfs/libzfs_diff.c | 4 ++-- lib/libzfs/libzfs_pool.c | 31 +++++++++++++++++-------------- lib/libzfs/libzfs_sendrecv.c | 4 ++-- lib/libzfs/libzfs_util.c | 9 ++++----- lib/libzpool/util.c | 2 +- module/zfs/arc.c | 18 +++++++++--------- module/zfs/sa.c | 4 ++-- module/zfs/zap.c | 2 +- module/zfs/zfs_ioctl.c | 16 ++++++++-------- module/zfs/zil.c | 2 +- 16 files changed, 90 insertions(+), 77 deletions(-) diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c index 45b27b0a4500..891cb9c209df 100644 --- a/cmd/zdb/zdb.c +++ b/cmd/zdb/zdb.c @@ -874,8 +874,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/zfs/zfs_main.c b/cmd/zfs/zfs_main.c index f694ee18fb0c..5be1263e9a3d 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -1682,7 +1682,7 @@ upgrade_set_callback(zfs_handle_t *zhp, void *data) if (version < cb->cb_version) { char verstr[16]; (void) snprintf(verstr, sizeof (verstr), - "%llu", cb->cb_version); + "%llu", (u_longlong_t)cb->cb_version); if (cb->cb_lastfs[0] && !same_pool(zhp, cb->cb_lastfs)) { /* * If they did "zfs upgrade -a", then we could @@ -1720,7 +1720,7 @@ zfs_do_upgrade(int argc, char **argv) boolean_t showversions = B_FALSE; int ret; upgrade_cbdata_t cb = { 0 }; - char c; + signed char c; int flags = ZFS_ITER_ARGS_CAN_BE_PATHS; /* check options */ @@ -1789,11 +1789,11 @@ zfs_do_upgrade(int argc, char **argv) ret = zfs_for_each(argc, argv, flags, ZFS_TYPE_FILESYSTEM, NULL, NULL, 0, upgrade_set_callback, &cb); (void) printf(gettext("%llu filesystems upgraded\n"), - cb.cb_numupgraded); + (u_longlong_t)cb.cb_numupgraded); if (cb.cb_numsamegraded) { (void) printf(gettext("%llu filesystems already at " "this version\n"), - cb.cb_numsamegraded); + (u_longlong_t)cb.cb_numsamegraded); } if (cb.cb_numfailed != 0) ret = 1; @@ -1957,9 +1957,9 @@ print_header(zprop_list_t *pl) if (pl->pl_next == NULL && !right_justify) (void) printf("%s", header); else if (right_justify) - (void) printf("%*s", pl->pl_width, header); + (void) printf("%*s", (int)pl->pl_width, header); else - (void) printf("%-*s", pl->pl_width, header); + (void) printf("%-*s", (int)pl->pl_width, header); } (void) printf("\n"); @@ -2550,7 +2550,7 @@ zfs_do_set(int argc, char **argv) usage(B_FALSE); } - ret = zfs_for_each(argc - 2, argv + 2, NULL, + ret = zfs_for_each(argc - 2, argv + 2, 0, ZFS_TYPE_DATASET, NULL, NULL, 0, set_callback, &cb); return (ret); @@ -2567,7 +2567,7 @@ zfs_do_snapshot(int argc, char **argv) { boolean_t recursive = B_FALSE; int ret; - char c; + signed char c; nvlist_t *props; if (nvlist_alloc(&props, NV_UNIQUE_NAME, 0) != 0) diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index 8aa985b1a552..4fe14c827984 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -2438,9 +2438,9 @@ print_header(zprop_list_t *pl) if (pl->pl_next == NULL && !right_justify) (void) printf("%s", header); else if (right_justify) - (void) printf("%*s", pl->pl_width, header); + (void) printf("%*s", (int)pl->pl_width, header); else - (void) printf("%-*s", pl->pl_width, header); + (void) printf("%-*s", (int)pl->pl_width, header); } (void) printf("\n"); @@ -3906,7 +3906,7 @@ upgrade_one(zpool_handle_t *zhp, void *data) if (cur_version > cbp->cb_version) { (void) printf(gettext("Pool '%s' is already formatted " "using more current version '%llu'.\n"), - zpool_get_name(zhp), cur_version); + zpool_get_name(zhp), (u_longlong_t) cur_version); return (0); } if (cur_version == cbp->cb_version) { @@ -4147,8 +4147,8 @@ get_history_one(zpool_handle_t *zhp, void *data) continue; (void) snprintf(internalstr, sizeof (internalstr), - "[internal %s txg:%lld] %s", - zfs_history_event_names[ievent], txg, + "[internal %s txg:%llu] %s", + zfs_history_event_names[ievent], (u_longlong_t)txg, pathstr); cmdstr = internalstr; } diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c index a6503f477b9c..771f1427e37a 100644 --- a/cmd/ztest/ztest.c +++ b/cmd/ztest/ztest.c @@ -2022,7 +2022,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); } /* @@ -3042,11 +3042,16 @@ ztest_dsl_dataset_cleanup(char *osname, uint64_t id) char snap3name[MAXNAMELEN]; int error; - (void) snprintf(snap1name, MAXNAMELEN, "%s@s1_%llu", osname, id); - (void) snprintf(clone1name, MAXNAMELEN, "%s/c1_%llu", osname, id); - (void) snprintf(snap2name, MAXNAMELEN, "%s@s2_%llu", clone1name, id); - (void) snprintf(clone2name, MAXNAMELEN, "%s/c2_%llu", osname, id); - (void) snprintf(snap3name, MAXNAMELEN, "%s@s3_%llu", clone1name, id); + (void) snprintf(snap1name, MAXNAMELEN, "%s@s1_%llu", + osname, (u_longlong_t)id); + (void) snprintf(clone1name, MAXNAMELEN, "%s/c1_%llu", + osname, (u_longlong_t)id); + (void) snprintf(snap2name, MAXNAMELEN, "%s@s2_%llu", + clone1name, (u_longlong_t)id); + (void) snprintf(clone2name, MAXNAMELEN, "%s/c2_%llu", + osname, (u_longlong_t)id); + (void) snprintf(snap3name, MAXNAMELEN, "%s@s3_%llu", + clone1name, (u_longlong_t)id); error = dmu_objset_destroy(clone2name, B_FALSE); if (error && error != ENOENT) @@ -3086,11 +3091,16 @@ ztest_dsl_dataset_promote_busy(ztest_ds_t *zd, uint64_t id) ztest_dsl_dataset_cleanup(osname, id); - (void) snprintf(snap1name, MAXNAMELEN, "%s@s1_%llu", osname, id); - (void) snprintf(clone1name, MAXNAMELEN, "%s/c1_%llu", osname, id); - (void) snprintf(snap2name, MAXNAMELEN, "%s@s2_%llu", clone1name, id); - (void) snprintf(clone2name, MAXNAMELEN, "%s/c2_%llu", osname, id); - (void) snprintf(snap3name, MAXNAMELEN, "%s@s3_%llu", clone1name, id); + (void) snprintf(snap1name, MAXNAMELEN, "%s@s1_%llu", + osname, (u_longlong_t)id); + (void) snprintf(clone1name, MAXNAMELEN, "%s/c1_%llu", + osname, (u_longlong_t)id); + (void) snprintf(snap2name, MAXNAMELEN, "%s@s2_%llu", + clone1name, (u_longlong_t)id); + (void) snprintf(clone2name, MAXNAMELEN, "%s/c2_%llu", + osname, (u_longlong_t)id); + (void) snprintf(snap3name, MAXNAMELEN, "%s@s3_%llu", + clone1name, (u_longlong_t)id); error = dmu_objset_snapshot(osname, strchr(snap1name, '@')+1, NULL, NULL, B_FALSE, B_FALSE, -1); @@ -3912,7 +3922,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/libnvpair/libnvpair.c b/lib/libnvpair/libnvpair.c index 16bce483bee5..f669f9a893bf 100644 --- a/lib/libnvpair/libnvpair.c +++ b/lib/libnvpair/libnvpair.c @@ -210,7 +210,7 @@ NVLIST_PRTFUNC(int32, int32_t, int32_t, "%d") NVLIST_PRTFUNC(uint32, uint32_t, uint32_t, "0x%x") NVLIST_PRTFUNC(int64, int64_t, longlong_t, "%lld") NVLIST_PRTFUNC(uint64, uint64_t, u_longlong_t, "0x%llx") -NVLIST_PRTFUNC(double, double, double, "0x%llf") +NVLIST_PRTFUNC(double, double, double, "0x%f") NVLIST_PRTFUNC(string, char *, char *, "%s") NVLIST_PRTFUNC(hrtime, hrtime_t, hrtime_t, "0x%llx") @@ -1216,7 +1216,7 @@ nvpair_value_match_regex(nvpair_t *nvp, int ai, boolean_t val, val_arg; /* scanf boolean_t from value and check for match */ - sr = sscanf(value, "%"SCNi32, &val_arg); + sr = sscanf(value, "%"SCNi32, (int32_t *)&val_arg); if ((sr == 1) && (nvpair_value_boolean_value(nvp, &val) == 0) && (val == val_arg)) @@ -1227,7 +1227,7 @@ nvpair_value_match_regex(nvpair_t *nvp, int ai, boolean_t *val_array, val_arg; /* check indexed value of array for match */ - sr = sscanf(value, "%"SCNi32, &val_arg); + sr = sscanf(value, "%"SCNi32, (int32_t *)&val_arg); if ((sr == 1) && (nvpair_value_boolean_array(nvp, &val_array, &a_len) == 0) && diff --git a/lib/libzfs/libzfs_dataset.c b/lib/libzfs/libzfs_dataset.c index b7c1360db4b7..3d31c106d356 100644 --- a/lib/libzfs/libzfs_dataset.c +++ b/lib/libzfs/libzfs_dataset.c @@ -1906,7 +1906,7 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char *propbuf, size_t proplen, localtime_r(&time, &t) == NULL || strftime(propbuf, proplen, "%a %b %e %k:%M %Y", &t) == 0) - (void) snprintf(propbuf, proplen, "%llu", val); + (void) snprintf(propbuf, proplen, "%llu", (u_longlong_t) val); } break; @@ -2391,7 +2391,8 @@ zfs_prop_get_userquota(zfs_handle_t *zhp, const char *propname, return (err); if (literal) { - (void) snprintf(propbuf, proplen, "%llu", propvalue); + (void) snprintf(propbuf, proplen, "%llu", + (u_longlong_t)propvalue); } else if (propvalue == 0 && (type == ZFS_PROP_USERQUOTA || type == ZFS_PROP_GROUPQUOTA)) { (void) strlcpy(propbuf, "none", proplen); diff --git a/lib/libzfs/libzfs_diff.c b/lib/libzfs/libzfs_diff.c index 888224f3bc83..4614526cb4dc 100644 --- a/lib/libzfs/libzfs_diff.c +++ b/lib/libzfs/libzfs_diff.c @@ -118,7 +118,7 @@ get_stats_for_obj(differ_info_t *di, const char *dsname, uint64_t obj, (void) snprintf(di->errbuf, sizeof (di->errbuf), dgettext(TEXT_DOMAIN, "Unable to determine path or stats for " - "object %lld in %s"), obj, dsname); + "object %lld in %s"), (longlong_t)obj, dsname); return (-1); } } @@ -406,7 +406,7 @@ write_free_diffs(FILE *fp, differ_info_t *di, dmu_diff_record_t *dr) (void) snprintf(di->errbuf, sizeof (di->errbuf), dgettext(TEXT_DOMAIN, "next allocated object (> %lld) find failure"), - zc.zc_obj); + (longlong_t)zc.zc_obj); di->zerr = errno; break; } diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c index 7df7e910ddc5..3cb7bbc911e5 100644 --- a/lib/libzfs/libzfs_pool.c +++ b/lib/libzfs/libzfs_pool.c @@ -228,7 +228,7 @@ zpool_get_prop(zpool_handle_t *zhp, zpool_prop_t prop, char *buf, size_t len, case ZPOOL_PROP_GUID: intval = zpool_get_prop_int(zhp, prop, &src); - (void) snprintf(buf, len, "%llu", intval); + (void) snprintf(buf, len, "%llu", (u_longlong_t)intval); break; case ZPOOL_PROP_ALTROOT: @@ -295,7 +295,7 @@ zpool_get_prop(zpool_handle_t *zhp, zpool_prop_t prop, char *buf, size_t len, vs->vs_aux), len); break; default: - (void) snprintf(buf, len, "%llu", intval); + (void) snprintf(buf, len, "%llu", (u_longlong_t)intval); } break; @@ -1238,7 +1238,7 @@ zpool_rewind_exclaim(libzfs_handle_t *hdl, const char *name, boolean_t dryrun, (void) nvlist_lookup_int64(nv, 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 " @@ -1253,13 +1253,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")); } @@ -1298,7 +1299,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. "), @@ -1312,11 +1313,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) { @@ -2260,7 +2263,7 @@ zpool_vdev_fault(zpool_handle_t *zhp, uint64_t guid, vdev_aux_t aux) libzfs_handle_t *hdl = zhp->zpool_hdl; (void) snprintf(msg, sizeof (msg), - dgettext(TEXT_DOMAIN, "cannot fault %llu"), guid); + dgettext(TEXT_DOMAIN, "cannot fault %llu"), (u_longlong_t)guid); (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name)); zc.zc_guid = guid; @@ -2295,7 +2298,7 @@ zpool_vdev_degrade(zpool_handle_t *zhp, uint64_t guid, vdev_aux_t aux) libzfs_handle_t *hdl = zhp->zpool_hdl; (void) snprintf(msg, sizeof (msg), - dgettext(TEXT_DOMAIN, "cannot degrade %llu"), guid); + dgettext(TEXT_DOMAIN, "cannot degrade %llu"), (u_longlong_t)guid); (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name)); zc.zc_guid = guid; @@ -2954,7 +2957,7 @@ zpool_vdev_clear(zpool_handle_t *zhp, uint64_t guid) (void) snprintf(msg, sizeof (msg), dgettext(TEXT_DOMAIN, "cannot clear errors for %llx"), - guid); + (u_longlong_t)guid); (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name)); zc.zc_guid = guid; @@ -3475,7 +3478,7 @@ zpool_obj_to_path(zpool_handle_t *zhp, uint64_t dsobj, uint64_t obj, if (dsobj == 0) { /* special case for the MOS */ - (void) snprintf(pathname, len, ":<0x%llx>", obj); + (void) snprintf(pathname, len, ":<0x%llx>", (longlong_t)obj); return; } @@ -3486,7 +3489,7 @@ zpool_obj_to_path(zpool_handle_t *zhp, uint64_t dsobj, uint64_t obj, ZFS_IOC_DSOBJ_TO_DSNAME, &zc) != 0) { /* just write out a path of two object numbers */ (void) snprintf(pathname, len, "<0x%llx>:<0x%llx>", - dsobj, obj); + (longlong_t)dsobj, (longlong_t)obj); return; } (void) strlcpy(dsname, zc.zc_value, sizeof (dsname)); @@ -3507,7 +3510,7 @@ zpool_obj_to_path(zpool_handle_t *zhp, uint64_t dsobj, uint64_t obj, dsname, zc.zc_value); } } else { - (void) snprintf(pathname, len, "%s:<0x%llx>", dsname, obj); + (void) snprintf(pathname, len, "%s:<0x%llx>", dsname, (longlong_t)obj); } free(mntpnt); } diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c index 3093ab974d06..8d6c43807e29 100644 --- a/lib/libzfs/libzfs_sendrecv.c +++ b/lib/libzfs/libzfs_sendrecv.c @@ -1571,7 +1571,7 @@ recv_rename(libzfs_handle_t *hdl, const char *name, const char *tryname, (void) strncpy(newname, name, baselen); (void) snprintf(newname+baselen, ZFS_MAXNAMELEN-baselen, - "recv-%u-%u", getpid(), seq); + "recv-%ld-%u", (long) getpid(), seq); (void) strlcpy(zc.zc_value, newname, sizeof (zc.zc_value)); if (flags.verbose) { @@ -2490,7 +2490,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap, (void) printf("found clone origin %s\n", zc.zc_string); } - stream_wantsnewfs = (drrb->drr_fromguid == NULL || + stream_wantsnewfs = (drrb->drr_fromguid == 0 || (drrb->drr_flags & DRR_FLAG_CLONE)); if (stream_wantsnewfs) { diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c index 01b7c8732efd..fbed42f066e1 100644 --- a/lib/libzfs/libzfs_util.c +++ b/lib/libzfs/libzfs_util.c @@ -571,13 +571,13 @@ zfs_nicenum(uint64_t num, char *buf, size_t buflen) u = " KMGTPE"[index]; if (index == 0) { - (void) snprintf(buf, buflen, "%llu", n); + (void) snprintf(buf, buflen, "%llu", (u_longlong_t) n); } else if ((num & ((1ULL << 10 * index) - 1)) == 0) { /* * If this is an even multiple of the base, always display * without any decimal precision. */ - (void) snprintf(buf, buflen, "%llu%c", n, u); + (void) snprintf(buf, buflen, "%llu%c", (u_longlong_t) n, u); } else { /* * We want to choose a precision that reflects the best choice @@ -724,7 +724,7 @@ zcmd_alloc_dst_nvlist(libzfs_handle_t *hdl, zfs_cmd_t *zc, size_t len) len = 16 * 1024; zc->zc_nvlist_dst_size = len; if ((zc->zc_nvlist_dst = (uint64_t)(uintptr_t) - zfs_alloc(hdl, zc->zc_nvlist_dst_size)) == NULL) + zfs_alloc(hdl, zc->zc_nvlist_dst_size)) == 0) return (-1); return (0); @@ -740,8 +740,7 @@ zcmd_expand_dst_nvlist(libzfs_handle_t *hdl, zfs_cmd_t *zc) { free((void *)(uintptr_t)zc->zc_nvlist_dst); if ((zc->zc_nvlist_dst = (uint64_t)(uintptr_t) - zfs_alloc(hdl, zc->zc_nvlist_dst_size)) - == NULL) + zfs_alloc(hdl, zc->zc_nvlist_dst_size)) == 0) return (-1); return (0); diff --git a/lib/libzpool/util.c b/lib/libzpool/util.c index 9b99531fd1c5..231043d75bed 100644 --- a/lib/libzpool/util.c +++ b/lib/libzpool/util.c @@ -108,7 +108,7 @@ show_vdev_stats(const char *desc, const char *ctype, nvlist_t *nv, int indent) (void) printf("%*s%s%*s%*s%*s %5s %5s %5s %5s %5s %5s %5s\n", indent, "", prefix, - indent + strlen(prefix) - 25 - (vs->vs_space ? 0 : 12), + (int)(indent+strlen(prefix)-25-(vs->vs_space ? 0 : 12)), desc, vs->vs_space ? 6 : 0, vs->vs_space ? used : "", vs->vs_space ? 6 : 0, vs->vs_space ? avail : "", diff --git a/module/zfs/arc.c b/module/zfs/arc.c index de09ca9a9a46..e9db5340ef7c 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -1725,12 +1725,12 @@ arc_evict(arc_state_t *state, uint64_t spa, int64_t bytes, boolean_t recycle, if (mru_over > 0 && arc_mru_ghost->arcs_lsize[type] > 0) { int64_t todelete = MIN(arc_mru_ghost->arcs_lsize[type], mru_over); - arc_evict_ghost(arc_mru_ghost, NULL, todelete); + arc_evict_ghost(arc_mru_ghost, 0, todelete); } else if (arc_mfu_ghost->arcs_lsize[type] > 0) { int64_t todelete = MIN(arc_mfu_ghost->arcs_lsize[type], arc_mru_ghost->arcs_size + arc_mfu_ghost->arcs_size - arc_c); - arc_evict_ghost(arc_mfu_ghost, NULL, todelete); + arc_evict_ghost(arc_mfu_ghost, 0, todelete); } } @@ -1838,13 +1838,13 @@ arc_adjust(void) if (adjustment > 0 && arc_mru->arcs_lsize[ARC_BUFC_DATA] > 0) { delta = MIN(arc_mru->arcs_lsize[ARC_BUFC_DATA], adjustment); - (void) arc_evict(arc_mru, NULL, delta, FALSE, ARC_BUFC_DATA); + (void) arc_evict(arc_mru, 0, delta, FALSE, ARC_BUFC_DATA); adjustment -= delta; } if (adjustment > 0 && arc_mru->arcs_lsize[ARC_BUFC_METADATA] > 0) { delta = MIN(arc_mru->arcs_lsize[ARC_BUFC_METADATA], adjustment); - (void) arc_evict(arc_mru, NULL, delta, FALSE, + (void) arc_evict(arc_mru, 0, delta, FALSE, ARC_BUFC_METADATA); } @@ -1856,14 +1856,14 @@ arc_adjust(void) if (adjustment > 0 && arc_mfu->arcs_lsize[ARC_BUFC_DATA] > 0) { delta = MIN(adjustment, arc_mfu->arcs_lsize[ARC_BUFC_DATA]); - (void) arc_evict(arc_mfu, NULL, delta, FALSE, ARC_BUFC_DATA); + (void) arc_evict(arc_mfu, 0, delta, FALSE, ARC_BUFC_DATA); adjustment -= delta; } if (adjustment > 0 && arc_mfu->arcs_lsize[ARC_BUFC_METADATA] > 0) { int64_t delta = MIN(adjustment, arc_mfu->arcs_lsize[ARC_BUFC_METADATA]); - (void) arc_evict(arc_mfu, NULL, delta, FALSE, + (void) arc_evict(arc_mfu, 0, delta, FALSE, ARC_BUFC_METADATA); } @@ -1875,7 +1875,7 @@ arc_adjust(void) if (adjustment > 0 && arc_mru_ghost->arcs_size > 0) { delta = MIN(arc_mru_ghost->arcs_size, adjustment); - arc_evict_ghost(arc_mru_ghost, NULL, delta); + arc_evict_ghost(arc_mru_ghost, 0, delta); } adjustment = @@ -1883,7 +1883,7 @@ arc_adjust(void) if (adjustment > 0 && arc_mfu_ghost->arcs_size > 0) { delta = MIN(arc_mfu_ghost->arcs_size, adjustment); - arc_evict_ghost(arc_mfu_ghost, NULL, delta); + arc_evict_ghost(arc_mfu_ghost, 0, delta); } } @@ -2303,7 +2303,7 @@ arc_get_data_buf(arc_buf_t *buf) state = (arc_mru->arcs_lsize[type] >= size && mfu_space > arc_mfu->arcs_size) ? arc_mru : arc_mfu; } - if ((buf->b_data = arc_evict(state, NULL, size, TRUE, type)) == NULL) { + if ((buf->b_data = arc_evict(state, 0, size, TRUE, type)) == NULL) { if (type == ARC_BUFC_METADATA) { buf->b_data = zio_buf_alloc(size); arc_space_consume(size, ARC_SPACE_DATA); diff --git a/module/zfs/sa.c b/module/zfs/sa.c index d5c985bf13cf..cf87c867e7ea 100644 --- a/module/zfs/sa.c +++ b/module/zfs/sa.c @@ -1545,12 +1545,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) { sa->sa_reg_attr_obj = zap_create(hdl->sa_os, DMU_OT_SA_ATTR_REGISTRATION, DMU_OT_NONE, 0, tx); VERIFY(zap_add(hdl->sa_os, sa->sa_master_obj, diff --git a/module/zfs/zap.c b/module/zfs/zap.c index 288a4d99ab25..89446a4fbdfc 100644 --- a/module/zfs/zap.c +++ b/module/zfs/zap.c @@ -483,7 +483,7 @@ zap_open_leaf(uint64_t blkid, dmu_buf_t *db) ASSERT3U(ZAP_LEAF_HASH_NUMENTRIES(l), >, ZAP_LEAF_NUMCHUNKS(l) / 3); /* The chunks should begin at the end of the hash table */ - ASSERT3P(&ZAP_LEAF_CHUNK(l, 0), ==, + ASSERT3P(&ZAP_LEAF_CHUNK(l, 0), ==, (zap_leaf_chunk_t *) &l->l_phys->l_hash[ZAP_LEAF_HASH_NUMENTRIES(l)]); /* The chunks should end at the end of the block */ diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index 1b63c9bf45ef..ff31144d3633 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -166,7 +166,7 @@ history_str_get(zfs_cmd_t *zc) { char *buf; - if (zc->zc_history == NULL) + if (zc->zc_history == 0) return (NULL); buf = kmem_alloc(HIS_MAX_RECORD_LEN, KM_SLEEP); @@ -1866,7 +1866,7 @@ zfs_ioc_objset_zplprops(zfs_cmd_t *zc) * which we aren't supposed to do with a DS_MODE_USER * hold, because it could be inconsistent. */ - if (zc->zc_nvlist_dst != NULL && + if (zc->zc_nvlist_dst != 0 && !zc->zc_objset_stats.dds_inconsistent && dmu_objset_type(os) == DMU_OST_ZFS) { nvlist_t *nv; @@ -2458,7 +2458,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); } @@ -2609,7 +2609,7 @@ zfs_ioc_pool_get_props(zfs_cmd_t *zc) spa_close(spa, FTAG); } - if (error == 0 && zc->zc_nvlist_dst != NULL) + if (error == 0 && zc->zc_nvlist_dst != 0) error = put_nvlist(zc, nvp); else error = EFAULT; @@ -2917,7 +2917,7 @@ zfs_ioc_create(zfs_cmd_t *zc) strchr(zc->zc_name, '%')) return (EINVAL); - if (zc->zc_nvlist_src != NULL && + if (zc->zc_nvlist_src != 0 && (error = get_nvlist(zc->zc_nvlist_src, zc->zc_nvlist_src_size, zc->zc_iflags, &nvprops)) != 0) return (error); @@ -3041,7 +3041,7 @@ zfs_ioc_snapshot(zfs_cmd_t *zc) if (snapshot_namecheck(zc->zc_value, NULL, NULL) != 0) return (EINVAL); - if (zc->zc_nvlist_src != NULL && + if (zc->zc_nvlist_src != 0 && (error = get_nvlist(zc->zc_nvlist_src, zc->zc_nvlist_src_size, zc->zc_iflags, &nvprops)) != 0) return (error); @@ -3563,7 +3563,7 @@ zfs_ioc_recv(zfs_cmd_t *zc) tosnap = strchr(tofs, '@'); *tosnap++ = '\0'; - if (zc->zc_nvlist_src != NULL && + if (zc->zc_nvlist_src != 0 && (error = get_nvlist(zc->zc_nvlist_src, zc->zc_nvlist_src_size, zc->zc_iflags, &props)) != 0) return (error); @@ -3919,7 +3919,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, diff --git a/module/zfs/zil.c b/module/zfs/zil.c index e89a24e41936..fd4d76821428 100644 --- a/module/zfs/zil.c +++ b/module/zfs/zil.c @@ -1299,7 +1299,7 @@ zil_clean(zilog_t *zilog, uint64_t synced_txg) * created a bad performance problem. */ if (taskq_dispatch(zilog->zl_clean_taskq, - (void (*)(void *))zil_itxg_clean, clean_me, TQ_NOSLEEP) == NULL) + (void (*)(void *))zil_itxg_clean, clean_me, TQ_NOSLEEP) == 0) zil_itxg_clean(clean_me); }