Correct some casts in printf arguments in various utilities.
authorSascha Wildner <saw@online.de>
Sat, 1 Jun 2019 08:23:09 +0000 (10:23 +0200)
committerSascha Wildner <saw@online.de>
Sat, 1 Jun 2019 08:23:09 +0000 (10:23 +0200)
sbin/camcontrol/camcontrol.c
sbin/diskinfo/diskinfo.c
sbin/disklabel64/disklabel64.c
sbin/dumpfs/dumpfs.c
sbin/hammer/cmd_blockmap.c
sbin/hammer/cmd_dedup.c
sbin/hammer/cmd_show.c
sbin/ifconfig/ifbridge.c

index 1b98c47..885bb7a 100644 (file)
@@ -3469,7 +3469,7 @@ retry:
                                        bcopy(&lundata->luns[i].lundata[j+1],
                                              &tmp_lun[1], sizeof(tmp_lun) - 1);
                                        fprintf(stdout, "%#jx",
-                                              (intmax_t)scsi_8btou64(tmp_lun));
+                                              (uintmax_t)scsi_8btou64(tmp_lun));
                                        no_more = 1;
                                } else {
                                        fprintf(stderr, "Unknown Extended LUN"
index aba8d5c..984ab0a 100644 (file)
@@ -98,8 +98,8 @@ dumppart(const char *path, struct partinfo *dpart)
        printf("%-16s ", path);
        printf("blksize=%-4d offset=0x%012jx size=0x%012jx ",
                dpart->media_blksize,
-               (intmax_t)dpart->media_offset,
-               (intmax_t)dpart->media_size
+               (uintmax_t)dpart->media_offset,
+               (uintmax_t)dpart->media_size
        );
        if (dpart->media_size >= 100LL*1024*1024*1024) {
                printf("%7.2f GB", 
index 3b9daef..c6d5362 100644 (file)
@@ -642,11 +642,11 @@ display(FILE *f, const struct disklabel64 *lp)
        fprintf(f, "# Calculated informational fields for the slice:\n");
        fprintf(f, "#\n");
        fprintf(f, "# boot space: %10ju bytes\n",
-               (intmax_t)(lp->d_pbase - lp->d_bbase));
+               (uintmax_t)(lp->d_pbase - lp->d_bbase));
        fprintf(f, "# data space: %10ju blocks\t# %6.2f MB (%ju bytes)\n",
-                       (intmax_t)(lp->d_pstop - lp->d_pbase) / blksize,
+                       (uintmax_t)(lp->d_pstop - lp->d_pbase) / blksize,
                        (double)(lp->d_pstop - lp->d_pbase) / 1024.0 / 1024.0,
-                       (intmax_t)(lp->d_pstop - lp->d_pbase));
+                       (uintmax_t)(lp->d_pstop - lp->d_pbase));
        fprintf(f, "#\n");
        fprintf(f, "# NOTE: The partition data base and stop are physically\n");
        fprintf(f, "#       aligned instead of slice-relative aligned.\n");
@@ -659,12 +659,12 @@ display(FILE *f, const struct disklabel64 *lp)
        free(str);
 
        fprintf(f, "label: %s\n", lp->d_packname);
-       fprintf(f, "boot2 data base:      0x%012jx\n", (intmax_t)lp->d_bbase);
-       fprintf(f, "partitions data base: 0x%012jx\n", (intmax_t)lp->d_pbase);
-       fprintf(f, "partitions data stop: 0x%012jx\n", (intmax_t)lp->d_pstop);
-       fprintf(f, "backup label:         0x%012jx\n", (intmax_t)lp->d_abase);
+       fprintf(f, "boot2 data base:      0x%012jx\n", (uintmax_t)lp->d_bbase);
+       fprintf(f, "partitions data base: 0x%012jx\n", (uintmax_t)lp->d_pbase);
+       fprintf(f, "partitions data stop: 0x%012jx\n", (uintmax_t)lp->d_pstop);
+       fprintf(f, "backup label:         0x%012jx\n", (uintmax_t)lp->d_abase);
        fprintf(f, "total size:           0x%012jx\t# %6.2f MB\n",
-               (intmax_t)lp->d_total_size,
+               (uintmax_t)lp->d_total_size,
                (double)lp->d_total_size / 1024.0 / 1024.0);
        fprintf(f, "alignment: %u\n", lp->d_align);
        fprintf(f, "display block size: %u\t# for partition display and edit only\n",
@@ -686,13 +686,13 @@ display(FILE *f, const struct disklabel64 *lp)
                if (pp->p_bsize % lp->d_align)
                    fprintf(f, "%10s  ", "ILLEGAL");
                else
-                   fprintf(f, "%10ju ", (intmax_t)pp->p_bsize / blksize);
+                   fprintf(f, "%10ju ", (uintmax_t)pp->p_bsize / blksize);
 
                if ((pp->p_boffset - lp->d_pbase) % lp->d_align)
                    fprintf(f, "%10s  ", "ILLEGAL");
                else
                    fprintf(f, "%10ju  ",
-                           (intmax_t)(pp->p_boffset - lp->d_pbase) / blksize);
+                           (uintmax_t)(pp->p_boffset - lp->d_pbase) / blksize);
 
                if (pp->p_fstype < FSMAXTYPES)
                        fprintf(f, "%8.8s", fstypenames[pp->p_fstype]);
@@ -1248,7 +1248,7 @@ checklabel(struct disklabel64 *lp)
        }
        if (lp->d_pstop > lp->d_total_size) {
                printf("%012jx\n%012jx\n",
-                       (intmax_t)lp->d_pstop, (intmax_t)lp->d_total_size);
+                       (uintmax_t)lp->d_pstop, (uintmax_t)lp->d_total_size);
                Warning("disklabel control info is beyond the total size");
                return (1);
        }
@@ -1364,9 +1364,9 @@ checklabel(struct disklabel64 *lp)
                                    pp->p_fstype != FS_VINUM) {
                                        fprintf(stderr,
 "Offset 0x%012jx for partition %c overlaps previous partition which ends at 0x%012jx\n",
-                                           (intmax_t)pp->p_boffset,
+                                           (uintmax_t)pp->p_boffset,
                                            i + 'a',
-                                           (intmax_t)current_offset);
+                                           (uintmax_t)current_offset);
                                        fprintf(stderr,
 "Labels with any *'s for offset must be in ascending order by sector\n");
                                        errors++;
index db1d23e..13c7dce 100644 (file)
@@ -162,7 +162,7 @@ dumpfs(char *name)
            afs.fs_contigsumsize);
        printf("nindir\t%d\tinopb\t%d\tnspf\t%d\tmaxfilesize\t%ju\n",
            afs.fs_nindir, afs.fs_inopb, afs.fs_nspf,
-           (intmax_t)afs.fs_maxfilesize);
+           (uintmax_t)afs.fs_maxfilesize);
        printf("sblkno\t%d\tcblkno\t%d\tiblkno\t%d\tdblkno\t%d\n",
            afs.fs_sblkno, afs.fs_cblkno, afs.fs_iblkno, afs.fs_dblkno);
        printf("sbsize\t%d\tcgsize\t%d\tcgoffset %d\tcgmask\t0x%08x\n",
@@ -261,7 +261,7 @@ dumpcg(char *name, int fd, int c)
        printf("magic\t%x\ttell\t%jx\ttime\t%s",
            afs.fs_postblformat == FS_42POSTBLFMT ?
            ((struct ocg *)&acg)->cg_magic : acg.cg_magic,
-           (intmax_t)cur, ctime(&cg_time));
+           (uintmax_t)cur, ctime(&cg_time));
        printf("cgx\t%d\tncyl\t%d\tniblk\t%d\tndblk\t%d\n",
            acg.cg_cgx, acg.cg_ncyl, acg.cg_niblk, acg.cg_ndblk);
        printf("nbfree\t%d\tndir\t%d\tnifree\t%d\tnffree\t%d\n",
index c85259f..a367390 100644 (file)
@@ -30,8 +30,6 @@
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- *
- * $DragonFly: src/sbin/hammer/cmd_blockmap.c,v 1.4 2008/07/19 18:48:14 dillon Exp $
  */
 
 #include "hammer.h"
@@ -588,20 +586,20 @@ dump_collect(collect_t collect, zone_stat_t stats)
 
                if (track2->zone != layer2->zone) {
                        printf("BZ\tblock=%016jx calc zone=%-2d, got zone=%-2d\n",
-                               (intmax_t)offset,
+                               (uintmax_t)offset,
                                track2->zone,
                                layer2->zone);
                        collect->error++;
                } else if (track2->bytes_free != layer2->bytes_free) {
                        printf("BM\tblock=%016jx zone=%-2d calc %d free, got %d\n",
-                               (intmax_t)offset,
+                               (uintmax_t)offset,
                                layer2->zone,
                                track2->bytes_free,
                                layer2->bytes_free);
                        collect->error++;
                } else if (VerboseOpt) {
                        printf("\tblock=%016jx zone=%-2d %d free (correct)\n",
-                               (intmax_t)offset,
+                               (uintmax_t)offset,
                                layer2->zone,
                                track2->bytes_free);
                }
index 7690850..d77028f 100644 (file)
@@ -1022,8 +1022,8 @@ dump_simulated_dedup(void)
        RB_FOREACH(sim_de, sim_dedup_entry_rb_tree, &sim_dedup_tree) {
                printf("\tcrc=%08x cnt=%ju size=%ju\n",
                        sim_de->crc,
-                       (intmax_t)sim_de->ref_blks,
-                       (intmax_t)sim_de->ref_size);
+                       (uintmax_t)sim_de->ref_blks,
+                       (uintmax_t)sim_de->ref_size);
        }
        printf("end of dump ===\n");
 }
@@ -1045,8 +1045,8 @@ dump_real_dedup(void)
                                printf("\t\tcrc=%08x cnt=%ju size=%ju\n\t"
                                       "\t\tsha=",
                                       sha_de->leaf.data_crc,
-                                      (intmax_t)sha_de->ref_blks,
-                                      (intmax_t)sha_de->ref_size);
+                                      (uintmax_t)sha_de->ref_blks,
+                                      (uintmax_t)sha_de->ref_size);
                                for (i = 0; i < SHA256_DIGEST_LENGTH; ++i)
                                        printf("%02x", sha_de->sha_hash[i]);
                                printf("\n");
@@ -1054,8 +1054,8 @@ dump_real_dedup(void)
                } else {
                        printf("\tcrc=%08x cnt=%ju size=%ju\n",
                               de->leaf.data_crc,
-                              (intmax_t)de->u.de.ref_blks,
-                              (intmax_t)de->u.de.ref_size);
+                              (uintmax_t)de->u.de.ref_blks,
+                              (uintmax_t)de->u.de.ref_size);
                }
        }
        printf("end of dump ===\n");
index 5e8c792..af14043 100644 (file)
@@ -815,8 +815,8 @@ print_record(hammer_btree_elm_t elm)
        case HAMMER_RECTYPE_PFS:
                printf("\n%s%17s", INDENT, "");
                printf("pfs sync_beg_tid=%016jx sync_end_tid=%016jx\n",
-                       (intmax_t)data->pfsd.sync_beg_tid,
-                       (intmax_t)data->pfsd.sync_end_tid);
+                       (uintmax_t)data->pfsd.sync_beg_tid,
+                       (uintmax_t)data->pfsd.sync_end_tid);
                hammer_uuid_to_string(&data->pfsd.shared_uuid, &str1);
                hammer_uuid_to_string(&data->pfsd.unique_uuid, &str2);
                printf("%17s", "");
@@ -834,7 +834,7 @@ print_record(hammer_btree_elm_t elm)
        case HAMMER_RECTYPE_SNAPSHOT:
                printf("\n%s%17s", INDENT, "");
                printf("snapshot tid=%016jx label=\"%s\"",
-                       (intmax_t)data->snap.tid, data->snap.label);
+                       (uintmax_t)data->snap.tid, data->snap.label);
                break;
        case HAMMER_RECTYPE_CONFIG:
                if (VerboseOpt > 2) {
@@ -1066,18 +1066,18 @@ hammer_cmd_show_undo(void)
                                hdr->hdr_size, hdr->hdr_seq);
                        break;
                case HAMMER_HEAD_TYPE_UNDO:
-                       printf("UNDO(%d)\tseq=%08x offset=%016jx bytes=%d",
+                       printf("UNDO(%u)\tseq=%08x offset=%016jx bytes=%d",
                                hdr->hdr_size, hdr->hdr_seq,
-                               (intmax_t)head->undo.undo_offset,
+                               (uintmax_t)head->undo.undo_offset,
                                head->undo.undo_data_bytes);
                        break;
                case HAMMER_HEAD_TYPE_REDO:
-                       printf("REDO(%d)\tseq=%08x offset=%016jx bytes=%d "
+                       printf("REDO(%u)\tseq=%08x offset=%016jx bytes=%d "
                                "objid=%016jx flags=%08x lo=%08x",
                                hdr->hdr_size, hdr->hdr_seq,
-                               (intmax_t)head->redo.redo_offset,
+                               (uintmax_t)head->redo.redo_offset,
                                head->redo.redo_data_bytes,
-                               (intmax_t)head->redo.redo_objid,
+                               (uintmax_t)head->redo.redo_objid,
                                head->redo.redo_flags,
                                head->redo.redo_localization);
                        break;
index 81c5c2d..526611c 100644 (file)
@@ -163,18 +163,18 @@ bridge_interfaces(int s, const char *prefix)
                        printf("%sbondweight %u\n",
                                pad, req->ifbr_bond_weight);
                        printf("%sdesignated root:   %016jx\n",
-                               pad, (intmax_t)req->ifbr_designated_root);
+                               pad, (uintmax_t)req->ifbr_designated_root);
                        printf("%sdesignated bridge: %016jx\n",
-                               pad, (intmax_t)req->ifbr_designated_bridge);
+                               pad, (uintmax_t)req->ifbr_designated_bridge);
                        printf("%sdesignated cost:   %u\n",
                                pad, req->ifbr_designated_cost);
                        printf("%sdesignated port:   %u\n",
                                pad, req->ifbr_designated_port);
                        if (verbose) {
                                printf("%speer root:   %016jx\n",
-                                       pad, (intmax_t)req->ifbr_peer_root);
+                                       pad, (uintmax_t)req->ifbr_peer_root);
                                printf("%speer bridge: %016jx\n",
-                                       pad, (intmax_t)req->ifbr_peer_bridge);
+                                       pad, (uintmax_t)req->ifbr_peer_bridge);
                                printf("%speer cost:   %u\n",
                                        pad, req->ifbr_peer_cost);
                                printf("%speer port:   %u\n",