]> granicus.if.org Git - zfs/commitdiff
Refresh gcc-cast branch
authorBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 4 Dec 2008 22:41:11 +0000 (14:41 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 4 Dec 2008 22:41:11 +0000 (14:41 -0800)
.topdeps [new file with mode: 0644]
.topmsg [new file with mode: 0644]
zfs/lib/libspl/util.c
zfs/lib/libzfs/libzfs_dataset.c
zfs/lib/libzfs/libzfs_pool.c
zfs/lib/libzfs/libzfs_sendrecv.c
zfs/lib/libzfs/libzfs_util.c
zfs/lib/libzpool/zap.c
zfs/lib/libzpool/zfs_ioctl.c
zfs/zcmd/zfs/zfs_main.c
zfs/zcmd/zpool/zpool_main.c

diff --git a/.topdeps b/.topdeps
new file mode 100644 (file)
index 0000000..1f7391f
--- /dev/null
+++ b/.topdeps
@@ -0,0 +1 @@
+master
diff --git a/.topmsg b/.topmsg
new file mode 100644 (file)
index 0000000..5dae05c
--- /dev/null
+++ b/.topmsg
@@ -0,0 +1,7 @@
+From: Brian Behlendorf <behlendorf1@llnl.gov>
+Subject: [PATCH] gcc cast
+
+Gcc -Wall warn: 'lacks a cast'
+Gcc -Wall warn: 'comparison between pointer and integer'
+
+Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
index 781edb6e8abcbd56201364899103bb6134e761c0..360bf7beee16c5edb182cc44e3152252bef6fd81 100644 (file)
@@ -109,7 +109,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 : "",
index a8005ffc0cf53a745ee788e537ad66c99a9db6b4..4aeb9bd091bef752e8faa605a864e1a58634ff6c 100644 (file)
@@ -1172,7 +1172,7 @@ zfs_build_perms(zfs_handle_t *zhp, char *whostr, char *perms,
                        if (sets_nvp)
                                nvlist_free(sets_nvp);
                        (void) snprintf(errbuf, sizeof (errbuf),
-                           dgettext(TEXT_DOMAIN, "Who string is NULL"),
+                           dgettext(TEXT_DOMAIN, "Who string is NULL: %s"),
                            whostr);
                        return (zfs_error(zhp->zfs_hdl, EZFS_BADWHO, errbuf));
                }
@@ -2317,7 +2317,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;
 
index dc5407bef691ff9e6cba177c1b3d306eec0b59f3..ae4b19adba79687a386353a010d307375951d6e9 100644 (file)
@@ -261,7 +261,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;
 
@@ -1661,7 +1661,7 @@ zpool_vdev_fault(zpool_handle_t *zhp, uint64_t guid)
        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;
@@ -1695,7 +1695,7 @@ zpool_vdev_degrade(zpool_handle_t *zhp, uint64_t guid)
        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;
@@ -2068,7 +2068,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;
@@ -2727,7 +2727,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, "<metadata>:<0x%llx>", obj);
+               (void) snprintf(pathname, len, "<metadata>:<0x%llx>", (longlong_t)obj);
                return;
        }
 
@@ -2738,7 +2738,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));
@@ -2759,7 +2759,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);
 }
index a3ed5cea8589b21feb79580a902e7fc783680d70..a7acf3974fb79ffb46705cf39310e744730b6969 100644 (file)
@@ -915,7 +915,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) {
@@ -1665,7 +1665,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) {
index 54de0f4b50a4c3e1ff08b25288503128bb663536..116521cb47b0d8e319bc0790b0edc9987cc26820 100644 (file)
@@ -520,13 +520,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
@@ -670,7 +670,7 @@ zcmd_alloc_dst_nvlist(libzfs_handle_t *hdl, zfs_cmd_t *zc, size_t len)
                len = 2048;
        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);
@@ -686,8 +686,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);
index ca859ec355dab5ceac05deb9fd92a8b49bc42acc..2f604faf9fd1d5990bf213bd7908f63866a486dc 100644 (file)
@@ -476,7 +476,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 */
index b6ad57451e6b4cb84754854182c2cf859785be44..62e105b4713dcdfc0f9099f62b6f83ac48ccc483 100644 (file)
@@ -142,7 +142,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);
@@ -1271,7 +1271,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;
@@ -1669,7 +1669,7 @@ zfs_ioc_pool_get_props(zfs_cmd_t *zc)
 
        error = spa_prop_get(spa, &nvp);
 
-       if (error == 0 && zc->zc_nvlist_dst != NULL)
+       if (error == 0 && zc->zc_nvlist_dst != 0)
                error = put_nvlist(zc, nvp);
        else
                error = EFAULT;
@@ -2045,7 +2045,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,
            &nvprops)) != 0)
                return (error);
@@ -2441,7 +2441,7 @@ zfs_ioc_recv(zfs_cmd_t *zc)
        *tosnap = '\0';
        tosnap++;
 
-       if (zc->zc_nvlist_src != NULL &&
+       if (zc->zc_nvlist_src != 0 &&
            (error = get_nvlist(zc->zc_nvlist_src, zc->zc_nvlist_src_size,
            &props)) != 0)
                return (error);
index f9480ceba8dafc9a34ebd8e8186cd0edf9d50321..b46086c24588d4fe442fb48442edabec34771eec 100644 (file)
@@ -1453,7 +1453,7 @@ upgrade_set_callback(zfs_handle_t *zhp, void *data)
                        /* can't upgrade */
                        (void) printf(gettext("%s: can not be upgraded; "
                            "the pool version needs to first be upgraded\nto "
-                           "version %d\n\n"),
+                           "version %llu\n\n"),
                            zfs_get_name(zhp), SPA_VERSION_FUID);
                        cb->cb_numfailed++;
                        return (0);
@@ -1464,7 +1464,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
@@ -1570,11 +1570,11 @@ zfs_do_upgrade(int argc, char **argv)
                ret = zfs_for_each(argc, argv, flags, ZFS_TYPE_FILESYSTEM,
                    NULL, NULL, 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;
@@ -1659,9 +1659,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");
index 54bba8645c669e5eaa4a13de63ed6519479f057f..316fa291d8bfb6f89ffcb50543aaa57ea6f28468 100644 (file)
@@ -2061,9 +2061,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");
@@ -3368,7 +3368,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) {
@@ -3631,8 +3631,8 @@ get_history_one(zpool_handle_t *zhp, void *data)
                                continue;
                        (void) snprintf(internalstr,
                            sizeof (internalstr),
-                           "[internal %s txg:%lld] %s",
-                           hist_event_table[ievent], txg,
+                           "[internal %s txg:%llu] %s",
+                           hist_event_table[ievent], (u_longlong_t)txg,
                            pathstr);
                        cmdstr = internalstr;
                }