Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Jan 2017 13:37:09 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r312072 - in stable/11: bin/pax contrib/mtree sbin/fsck_ffs sys/fs/nfsclient sys/fs/tmpfs sys/ufs/ffs sys/ufs/ufs tests/sys/kern/pipe usr.bin/find usr.bin/gzip usr.sbin/fmtree
Message-ID:  <201701131337.v0DDb9tF076313@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Jan 13 13:37:09 2017
New Revision: 312072
URL: https://svnweb.freebsd.org/changeset/base/312072

Log:
  MFC r311522:
  Use type-independent formats for printing nlink_t and ino_t.

Modified:
  stable/11/bin/pax/gen_subs.c
  stable/11/contrib/mtree/create.c
  stable/11/contrib/mtree/spec.c
  stable/11/contrib/mtree/specspec.c
  stable/11/sbin/fsck_ffs/suj.c
  stable/11/sys/fs/nfsclient/nfs_clvnops.c
  stable/11/sys/fs/tmpfs/tmpfs_vnops.c
  stable/11/sys/ufs/ffs/ffs_softdep.c
  stable/11/sys/ufs/ufs/ufs_vnops.c
  stable/11/tests/sys/kern/pipe/pipe_ino_test.c
  stable/11/usr.bin/find/ls.c
  stable/11/usr.bin/gzip/gzip.c
  stable/11/usr.sbin/fmtree/compare.c
  stable/11/usr.sbin/fmtree/create.c
  stable/11/usr.sbin/fmtree/specspec.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/bin/pax/gen_subs.c
==============================================================================
--- stable/11/bin/pax/gen_subs.c	Fri Jan 13 13:03:47 2017	(r312071)
+++ stable/11/bin/pax/gen_subs.c	Fri Jan 13 13:37:09 2017	(r312072)
@@ -109,7 +109,8 @@ ls_list(ARCHD *arcn, time_t now, FILE *f
 	 */
 	if (strftime(f_date,DATELEN,timefrmt,localtime(&(sbp->st_mtime))) == 0)
 		f_date[0] = '\0';
-	(void)fprintf(fp, "%s%2u %-12s %-12s ", f_mode, sbp->st_nlink,
+	(void)fprintf(fp, "%s%2ju %-12s %-12s ", f_mode,
+		(uintmax_t)sbp->st_nlink,
 		name_uid(sbp->st_uid, 1), name_gid(sbp->st_gid, 1));
 
 	/*

Modified: stable/11/contrib/mtree/create.c
==============================================================================
--- stable/11/contrib/mtree/create.c	Fri Jan 13 13:03:47 2017	(r312071)
+++ stable/11/contrib/mtree/create.c	Fri Jan 13 13:37:09 2017	(r312072)
@@ -224,7 +224,8 @@ statf(FILE *fp, int indent, FTSENT *p)
 		output(fp, indent, &offset, "device=%#jx",
 		    (uintmax_t)p->fts_statp->st_rdev);
 	if (keys & F_NLINK && p->fts_statp->st_nlink != 1)
-		output(fp, indent, &offset, "nlink=%u", p->fts_statp->st_nlink);
+		output(fp, indent, &offset, "nlink=%ju",
+		    (uintmax_t)p->fts_statp->st_nlink);
 	if (keys & F_SIZE &&
 	    (flavor == F_FREEBSD9 || S_ISREG(p->fts_statp->st_mode)))
 		output(fp, indent, &offset, "size=%ju",

Modified: stable/11/contrib/mtree/spec.c
==============================================================================
--- stable/11/contrib/mtree/spec.c	Fri Jan 13 13:03:47 2017	(r312071)
+++ stable/11/contrib/mtree/spec.c	Fri Jan 13 13:37:09 2017	(r312072)
@@ -363,7 +363,8 @@ dump_nodes(FILE *fp, const char *dir, NO
 			appendfield(fp, pathlast, "device=%#jx",
 			    (uintmax_t)cur->st_rdev);
 		if (MATCHFLAG(F_NLINK))
-			appendfield(fp, pathlast, "nlink=%d", cur->st_nlink);
+			appendfield(fp, pathlast, "nlink=%ju",
+			    (uintmax_t)cur->st_nlink);
 		if (MATCHFLAG(F_SLINK))
 			appendfield(fp, pathlast, "link=%s",
 			    vispath(cur->slink));

Modified: stable/11/contrib/mtree/specspec.c
==============================================================================
--- stable/11/contrib/mtree/specspec.c	Fri Jan 13 13:03:47 2017	(r312071)
+++ stable/11/contrib/mtree/specspec.c	Fri Jan 13 13:37:09 2017	(r312072)
@@ -73,7 +73,7 @@ shownode(NODE *n, int f, char const *pat
 	if (f & F_MODE)
 		printf(" mode=%o", n->st_mode);
 	if (f & F_NLINK)
-		printf(" nlink=%d", n->st_nlink);
+		printf(" nlink=%ju", (uintmax_t)n->st_nlink);
 	if (f & F_SIZE)
 		printf(" size=%jd", (intmax_t)n->st_size);
 	if (f & F_UID)

Modified: stable/11/sbin/fsck_ffs/suj.c
==============================================================================
--- stable/11/sbin/fsck_ffs/suj.c	Fri Jan 13 13:03:47 2017	(r312071)
+++ stable/11/sbin/fsck_ffs/suj.c	Fri Jan 13 13:37:09 2017	(r312072)
@@ -1396,11 +1396,12 @@ ino_adjust(struct suj_ino *sino)
 	ip = ino_read(ino);
 	mode = DIP(ip, di_mode) & IFMT;
 	if (nlink > LINK_MAX)
-		err_suj("ino %ju nlink manipulation error, new %d, old %d\n",
-		    (uintmax_t)ino, nlink, DIP(ip, di_nlink));
+		err_suj("ino %ju nlink manipulation error, new %ju, old %d\n",
+		    (uintmax_t)ino, (uintmax_t)nlink, DIP(ip, di_nlink));
 	if (debug)
-		printf("Adjusting ino %ju, nlink %d, old link %d lastmode %o\n",
-		    (uintmax_t)ino, nlink, DIP(ip, di_nlink), sino->si_mode);
+	       printf("Adjusting ino %ju, nlink %ju, old link %d lastmode %o\n",
+		    (uintmax_t)ino, (uintmax_t)nlink, DIP(ip, di_nlink),
+		    sino->si_mode);
 	if (mode == 0) {
 		if (debug)
 			printf("ino %ju, zero inode freeing bitmap\n",
@@ -1419,8 +1420,9 @@ ino_adjust(struct suj_ino *sino)
 	/* If the inode doesn't have enough links to live, free it. */
 	if (nlink < reqlink) {
 		if (debug)
-			printf("ino %ju not enough links to live %d < %d\n",
-			    (uintmax_t)ino, nlink, reqlink);
+			printf("ino %ju not enough links to live %ju < %ju\n",
+			    (uintmax_t)ino, (uintmax_t)nlink,
+			    (uintmax_t)reqlink);
 		ino_reclaim(ip, ino, mode);
 		return;
 	}
@@ -1657,10 +1659,12 @@ ino_check(struct suj_ino *sino)
 			err_suj("Inode mode/directory type mismatch %o != %o\n",
 			    mode, rrec->jr_mode);
 		if (debug)
-			printf("jrefrec: op %d ino %ju, nlink %d, parent %d, "
+			printf("jrefrec: op %d ino %ju, nlink %ju, parent %ju, "
 			    "diroff %jd, mode %o, isat %d, isdot %d\n",
 			    rrec->jr_op, (uintmax_t)rrec->jr_ino,
-			    rrec->jr_nlink, rrec->jr_parent, rrec->jr_diroff,
+			    (uintmax_t)rrec->jr_nlink,
+			    (uintmax_t)rrec->jr_parent,
+			    (uintmax_t)rrec->jr_diroff,
 			    rrec->jr_mode, isat, isdot);
 		mode = rrec->jr_mode & IFMT;
 		if (rrec->jr_op == JOP_REMREF)
@@ -1677,8 +1681,10 @@ ino_check(struct suj_ino *sino)
 	 * by one.
 	 */
 	if (debug)
-		printf("ino %ju nlink %d newlinks %d removes %d dotlinks %d\n",
-		    (uintmax_t)ino, nlink, newlinks, removes, dotlinks);
+		printf(
+		    "ino %ju nlink %ju newlinks %ju removes %ju dotlinks %ju\n",
+		    (uintmax_t)ino, (uintmax_t)nlink, (uintmax_t)newlinks,
+		    (uintmax_t)removes, (uintmax_t)dotlinks);
 	nlink += newlinks;
 	nlink -= removes;
 	sino->si_linkadj = 1;
@@ -1962,15 +1968,17 @@ ino_append(union jrec *rec)
 	mvrec = &rec->rec_jmvrec;
 	refrec = &rec->rec_jrefrec;
 	if (debug && mvrec->jm_op == JOP_MVREF)
-		printf("ino move: ino %d, parent %d, diroff %jd, oldoff %jd\n",
-		    mvrec->jm_ino, mvrec->jm_parent, mvrec->jm_newoff,
-		    mvrec->jm_oldoff);
+		printf("ino move: ino %ju, parent %ju, "
+		    "diroff %jd, oldoff %jd\n",
+		    (uintmax_t)mvrec->jm_ino, (uintmax_t)mvrec->jm_parent,
+		    (uintmax_t)mvrec->jm_newoff, (uintmax_t)mvrec->jm_oldoff);
 	else if (debug &&
 	    (refrec->jr_op == JOP_ADDREF || refrec->jr_op == JOP_REMREF))
-		printf("ino ref: op %d, ino %d, nlink %d, "
-		    "parent %d, diroff %jd\n",
-		    refrec->jr_op, refrec->jr_ino, refrec->jr_nlink,
-		    refrec->jr_parent, refrec->jr_diroff);
+		printf("ino ref: op %d, ino %ju, nlink %ju, "
+		    "parent %ju, diroff %jd\n",
+		    refrec->jr_op, (uintmax_t)refrec->jr_ino,
+		    (uintmax_t)refrec->jr_nlink,
+		    (uintmax_t)refrec->jr_parent, (uintmax_t)refrec->jr_diroff);
 	sino = ino_lookup(((struct jrefrec *)rec)->jr_ino, 1);
 	sino->si_hasrecs = 1;
 	srec = errmalloc(sizeof(*srec));
@@ -2182,9 +2190,10 @@ blk_build(struct jblkrec *blkrec)
 
 	if (debug)
 		printf("blk_build: op %d blkno %jd frags %d oldfrags %d "
-		    "ino %d lbn %jd\n",
-		    blkrec->jb_op, blkrec->jb_blkno, blkrec->jb_frags,
-		    blkrec->jb_oldfrags, blkrec->jb_ino, blkrec->jb_lbn);
+		    "ino %ju lbn %jd\n",
+		    blkrec->jb_op, (uintmax_t)blkrec->jb_blkno,
+		    blkrec->jb_frags, blkrec->jb_oldfrags,
+		    (uintmax_t)blkrec->jb_ino, (uintmax_t)blkrec->jb_lbn);
 
 	blk = blknum(fs, blkrec->jb_blkno);
 	frag = fragnum(fs, blkrec->jb_blkno);
@@ -2232,8 +2241,9 @@ ino_build_trunc(struct jtrncrec *rec)
 	struct suj_ino *sino;
 
 	if (debug)
-		printf("ino_build_trunc: op %d ino %d, size %jd\n",
-		    rec->jt_op, rec->jt_ino, rec->jt_size);
+		printf("ino_build_trunc: op %d ino %ju, size %jd\n",
+		    rec->jt_op, (uintmax_t)rec->jt_ino,
+		    (uintmax_t)rec->jt_size);
 	sino = ino_lookup(rec->jt_ino, 1);
 	if (rec->jt_op == JOP_SYNC) {
 		sino->si_trunc = NULL;

Modified: stable/11/sys/fs/nfsclient/nfs_clvnops.c
==============================================================================
--- stable/11/sys/fs/nfsclient/nfs_clvnops.c	Fri Jan 13 13:03:47 2017	(r312071)
+++ stable/11/sys/fs/nfsclient/nfs_clvnops.c	Fri Jan 13 13:37:09 2017	(r312072)
@@ -3135,8 +3135,8 @@ nfs_print(struct vop_print_args *ap)
 	struct vnode *vp = ap->a_vp;
 	struct nfsnode *np = VTONFS(vp);
 
-	printf("\tfileid %ld fsid 0x%x", np->n_vattr.na_fileid,
-	    np->n_vattr.na_fsid);
+	printf("\tfileid %jd fsid 0x%jx", (uintmax_t)np->n_vattr.na_fileid,
+	    (uintmax_t)np->n_vattr.na_fsid);
 	if (vp->v_type == VFIFO)
 		fifo_printinfo(vp);
 	printf("\n");

Modified: stable/11/sys/fs/tmpfs/tmpfs_vnops.c
==============================================================================
--- stable/11/sys/fs/tmpfs/tmpfs_vnops.c	Fri Jan 13 13:03:47 2017	(r312071)
+++ stable/11/sys/fs/tmpfs/tmpfs_vnops.c	Fri Jan 13 13:37:09 2017	(r312072)
@@ -1286,8 +1286,8 @@ tmpfs_print(struct vop_print_args *v)
 
 	node = VP_TO_TMPFS_NODE(vp);
 
-	printf("tag VT_TMPFS, tmpfs_node %p, flags 0x%lx, links %d\n",
-	    node, node->tn_flags, node->tn_links);
+	printf("tag VT_TMPFS, tmpfs_node %p, flags 0x%lx, links %jd\n",
+	    node, node->tn_flags, (uintmax_t)node->tn_links);
 	printf("\tmode 0%o, owner %d, group %d, size %jd, status 0x%x\n",
 	    node->tn_mode, node->tn_uid, node->tn_gid,
 	    (intmax_t)node->tn_size, node->tn_status);

Modified: stable/11/sys/ufs/ffs/ffs_softdep.c
==============================================================================
--- stable/11/sys/ufs/ffs/ffs_softdep.c	Fri Jan 13 13:03:47 2017	(r312071)
+++ stable/11/sys/ufs/ffs/ffs_softdep.c	Fri Jan 13 13:37:09 2017	(r312072)
@@ -11525,7 +11525,8 @@ handle_written_inodeblock(inodedep, bp, 
 		panic("handle_written_inodeblock: bad size");
 	if (inodedep->id_savednlink > LINK_MAX)
 		panic("handle_written_inodeblock: Invalid link count "
-		    "%d for inodedep %p", inodedep->id_savednlink, inodedep);
+		    "%jd for inodedep %p", (uintmax_t)inodedep->id_savednlink,
+		    inodedep);
 	if (fstype == UFS1) {
 		if (dp1->di_nlink != inodedep->id_savednlink) { 
 			dp1->di_nlink = inodedep->id_savednlink;
@@ -14271,13 +14272,14 @@ softdep_error(func, error)
 static void
 inodedep_print(struct inodedep *inodedep, int verbose)
 {
-	db_printf("%p fs %p st %x ino %jd inoblk %jd delta %d nlink %d"
+	db_printf("%p fs %p st %x ino %jd inoblk %jd delta %jd nlink %jd"
 	    " saveino %p\n",
 	    inodedep, inodedep->id_fs, inodedep->id_state,
 	    (intmax_t)inodedep->id_ino,
 	    (intmax_t)fsbtodb(inodedep->id_fs,
 	    ino_to_fsba(inodedep->id_fs, inodedep->id_ino)),
-	    inodedep->id_nlinkdelta, inodedep->id_savednlink,
+	    (intmax_t)inodedep->id_nlinkdelta,
+	    (intmax_t)inodedep->id_savednlink,
 	    inodedep->id_savedino1);
 
 	if (verbose == 0)

Modified: stable/11/sys/ufs/ufs/ufs_vnops.c
==============================================================================
--- stable/11/sys/ufs/ufs/ufs_vnops.c	Fri Jan 13 13:03:47 2017	(r312071)
+++ stable/11/sys/ufs/ufs/ufs_vnops.c	Fri Jan 13 13:37:09 2017	(r312072)
@@ -948,8 +948,8 @@ print_bad_link_count(const char *funcnam
 	struct inode *dip;
 
 	dip = VTOI(dvp);
-	uprintf("%s: Bad link count %d on parent inode %d in file system %s\n",
-	    funcname, dip->i_effnlink, dip->i_number,
+	uprintf("%s: Bad link count %d on parent inode %jd in file system %s\n",
+	    funcname, dip->i_effnlink, (intmax_t)dip->i_number,
 	    dvp->v_mount->mnt_stat.f_mntonname);
 }
 

Modified: stable/11/tests/sys/kern/pipe/pipe_ino_test.c
==============================================================================
--- stable/11/tests/sys/kern/pipe/pipe_ino_test.c	Fri Jan 13 13:03:47 2017	(r312071)
+++ stable/11/tests/sys/kern/pipe/pipe_ino_test.c	Fri Jan 13 13:37:09 2017	(r312072)
@@ -53,9 +53,11 @@ main(void)
 	if (fstat(pipefd[1], &st2) == -1)
 		err(1, "FAIL: fstat st2");
 	if (st1.st_dev != st2.st_dev || st1.st_dev == 0 || st2.st_dev == 0)
-		errx(1, "FAIL: wrong dev number %d %d", st1.st_dev, st2.st_dev);
+		errx(1, "FAIL: wrong dev number %ju %ju",
+		    (uintmax_t)st1.st_dev, (uintmax_t)st2.st_dev);
 	if (st1.st_ino == st2.st_ino)
-		errx(1, "FAIL: inode numbers are equal: %d", st1.st_ino);
+		errx(1, "FAIL: inode numbers are equal: %ju",
+		    (uintmax_t)st1.st_ino);
 
 	close(pipefd[0]);
 	close(pipefd[1]);

Modified: stable/11/usr.bin/find/ls.c
==============================================================================
--- stable/11/usr.bin/find/ls.c	Fri Jan 13 13:03:47 2017	(r312071)
+++ stable/11/usr.bin/find/ls.c	Fri Jan 13 13:37:09 2017	(r312072)
@@ -65,7 +65,8 @@ printlong(char *name, char *accpath, str
 
 	(void)printf("%6ju %8"PRId64" ", (uintmax_t)sb->st_ino, sb->st_blocks);
 	(void)strmode(sb->st_mode, modep);
-	(void)printf("%s %3u %-*s %-*s ", modep, sb->st_nlink, MAXLOGNAME - 1,
+	(void)printf("%s %3ju %-*s %-*s ", modep, (uintmax_t)sb->st_nlink,
+	    MAXLOGNAME - 1,
 	    user_from_uid(sb->st_uid, 0), MAXLOGNAME - 1,
 	    group_from_gid(sb->st_gid, 0));
 

Modified: stable/11/usr.bin/gzip/gzip.c
==============================================================================
--- stable/11/usr.bin/gzip/gzip.c	Fri Jan 13 13:03:47 2017	(r312071)
+++ stable/11/usr.bin/gzip/gzip.c	Fri Jan 13 13:37:09 2017	(r312072)
@@ -1252,8 +1252,8 @@ file_compress(char *file, char *outfile,
 	if (cflag == 0) {
 #ifndef SMALL
 		if (isb.st_nlink > 1 && fflag == 0) {
-			maybe_warnx("%s has %d other link%s -- skipping",
-			    file, isb.st_nlink - 1,
+			maybe_warnx("%s has %ju other link%s -- skipping",
+			    file, (uintmax_t)isb.st_nlink - 1,
 			    (isb.st_nlink - 1) == 1 ? "" : "s");
 			close(in);
 			return (-1);
@@ -1448,8 +1448,8 @@ file_uncompress(char *file, char *outfil
 			goto lose;
 #ifndef SMALL
 		if (isb.st_nlink > 1 && lflag == 0 && fflag == 0) {
-			maybe_warnx("%s has %d other links -- skipping",
-			    file, isb.st_nlink - 1);
+			maybe_warnx("%s has %ju other links -- skipping",
+			    file, (uintmax_t)isb.st_nlink - 1);
 			goto lose;
 		}
 		if (nflag == 0 && timestamp)

Modified: stable/11/usr.sbin/fmtree/compare.c
==============================================================================
--- stable/11/usr.sbin/fmtree/compare.c	Fri Jan 13 13:03:47 2017	(r312071)
+++ stable/11/usr.sbin/fmtree/compare.c	Fri Jan 13 13:37:09 2017	(r312072)
@@ -165,8 +165,9 @@ typeerr:		LABEL;
 	if (s->flags & F_NLINK && s->type != F_DIR &&
 	    s->st_nlink != p->fts_statp->st_nlink) {
 		LABEL;
-		(void)printf("%slink_count expected %u found %u\n",
-		    tab, s->st_nlink, p->fts_statp->st_nlink);
+		(void)printf("%slink_count expected %ju found %ju\n",
+		    tab, (uintmax_t)s->st_nlink,
+		    (uintmax_t)p->fts_statp->st_nlink);
 		tab = "\t";
 	}
 	if (s->flags & F_SIZE && s->st_size != p->fts_statp->st_size &&

Modified: stable/11/usr.sbin/fmtree/create.c
==============================================================================
--- stable/11/usr.sbin/fmtree/create.c	Fri Jan 13 13:03:47 2017	(r312071)
+++ stable/11/usr.sbin/fmtree/create.c	Fri Jan 13 13:37:09 2017	(r312072)
@@ -207,7 +207,8 @@ statf(int indent, FTSENT *p)
 	if (keys & F_MODE && (p->fts_statp->st_mode & MBITS) != mode)
 		output(indent, &offset, "mode=%#o", p->fts_statp->st_mode & MBITS);
 	if (keys & F_NLINK && p->fts_statp->st_nlink != 1)
-		output(indent, &offset, "nlink=%u", p->fts_statp->st_nlink);
+		output(indent, &offset, "nlink=%ju",
+		    (uintmax_t)p->fts_statp->st_nlink);
 	if (keys & F_SIZE && S_ISREG(p->fts_statp->st_mode))
 		output(indent, &offset, "size=%jd",
 		    (intmax_t)p->fts_statp->st_size);

Modified: stable/11/usr.sbin/fmtree/specspec.c
==============================================================================
--- stable/11/usr.sbin/fmtree/specspec.c	Fri Jan 13 13:03:47 2017	(r312071)
+++ stable/11/usr.sbin/fmtree/specspec.c	Fri Jan 13 13:37:09 2017	(r312072)
@@ -64,7 +64,7 @@ shownode(NODE *n, int f, char const *pat
 	if (f & F_MODE)
 		printf(" mode=%o", n->st_mode);
 	if (f & F_NLINK)
-		printf(" nlink=%d", n->st_nlink);
+		printf(" nlink=%ju", (uintmax_t)n->st_nlink);
 	if (f & F_SIZE)
 		printf(" size=%jd", (intmax_t)n->st_size);
 	if (f & F_UID)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701131337.v0DDb9tF076313>