From owner-svn-src-all@FreeBSD.ORG Wed Mar 3 23:36:29 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A654F106566C for ; Wed, 3 Mar 2010 23:36:29 +0000 (UTC) (envelope-from max@love2party.net) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.8]) by mx1.freebsd.org (Postfix) with ESMTP id 5318B8FC08 for ; Wed, 3 Mar 2010 23:36:29 +0000 (UTC) Received: from vampire.homelinux.org (dslb-088-067-239-163.pools.arcor-ip.net [88.67.239.163]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0MFi3J-1NzIRK2OKD-00FKC9; Thu, 04 Mar 2010 00:36:27 +0100 Received: (qmail 47803 invoked from network); 3 Mar 2010 23:36:26 -0000 Received: from f8x64.laiers.local (192.168.4.188) by mx.laiers.local with SMTP; 3 Mar 2010 23:36:26 -0000 From: Max Laier Organization: FreeBSD To: Garrett Cooper Date: Thu, 4 Mar 2010 00:36:25 +0100 User-Agent: KMail/1.12.4 (FreeBSD/8.0-RELEASE-p2; KDE/4.3.5; amd64; ; ) References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201003040036.25583.max@love2party.net> X-Provags-ID: V01U2FsdGVkX1/BNFsUpT63PpGuiFhCyK8ceQ7ZBvtc/3s0HtK gJM61cZy8J9gQfXFcOns9Z2PDK828nO1eEJo0HpBwDSqwASNcT Jn9vJKWqTRwHNWAVsS9lA== Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Warner Losh Subject: Re: svn commit: r204672 - head/sbin/newfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Mar 2010 23:36:29 -0000 On Thursday 04 March 2010 00:25:53 Garrett Cooper wrote: > On Mar 3, 2010, at 1:53 PM, Warner Losh wrote: > > Author: imp > > Date: Wed Mar 3 21:53:25 2010 > > New Revision: 204672 > > URL: http://svn.freebsd.org/changeset/base/204672 > > > > Log: > > Cast these to intmax_t before printing to fix build bustage. Better > > solutions welcome. > > > > Modified: > > head/sbin/newfs/mkfs.c > > > > Modified: head/sbin/newfs/mkfs.c > > === > > === > > === > > ===================================================================== > > --- head/sbin/newfs/mkfs.c Wed Mar 3 21:47:25 2010 (r204671) > > +++ head/sbin/newfs/mkfs.c Wed Mar 3 21:53:25 2010 (r204672) > > @@ -191,8 +191,8 @@ restart: > > exit(17); > > } > > if (sblock.fs_fsize < sectorsize) { > > - printf("increasing fragment size from %d to sector size (%d) > > \n", > > - sblock.fs_fsize, sectorsize); > > + printf("increasing fragment size from %d to sector size > > (%jd)\n", > > + sblock.fs_fsize, (intmax_t)sectorsize); > > sblock.fs_fsize = sectorsize; > > } > > if (sblock.fs_bsize > MAXBSIZE) { > > @@ -337,8 +337,8 @@ restart: > > } else if (density < minfragsperinode * fsize) { > > origdensity = density; > > density = minfragsperinode * fsize; > > - fprintf(stderr, "density increased from %d to %d\n", > > - origdensity, density); > > + fprintf(stderr, "density increased from %d to %jd\n", > > + origdensity, (intmax_t)density); > > } > > origdensity = density; > > for (;;) { > > @@ -346,8 +346,9 @@ restart: > > if (fragsperinode < minfragsperinode) { > > bsize <<= 1; > > fsize <<= 1; > > - printf("Block size too small for a file system %s %d\n", > > - "of this size. Increasing blocksize to", bsize); > > + printf("Block size too small for a file system %s %jd\n", > > + "of this size. Increasing blocksize to", > > + (intmax_t)bsize); > > goto restart; > > } > > minfpg = fragsperinode * INOPB(&sblock); > > @@ -371,7 +372,8 @@ restart: > > density -= sblock.fs_fsize; > > } > > if (density != origdensity) > > - printf("density reduced from %d to %d\n", origdensity, > > density); > > + printf("density reduced from %d to %jd\n", origdensity, > > + (intmax_t)density); > > /* > > * Start packing more blocks into the cylinder group until > > * it cannot grow any larger, the number of cylinder groups > > Use PRId64 from inttypes.h ? you just forgot to type ";)" there, didn't you? How are the PRI* macros better than an intmax_t cast? In my opinion, the intmax_t cast and %j is the best, realistic solution for this. I have partitioned in the past that we change int64 types to "long long" on platforms with 64bit "long". That way you can print int64 types with "%ll" on all platforms. But casting to intmax is just as good and the compiler should be able to figure out what goes on and make it a no-op. Regards, Max