From owner-freebsd-fs@FreeBSD.ORG Tue Nov 12 07:54:45 2013 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EBDA4D1C; Tue, 12 Nov 2013 07:54:45 +0000 (UTC) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id 6A403271C; Tue, 12 Nov 2013 07:54:44 +0000 (UTC) Received: from c122-106-156-23.carlnfd1.nsw.optusnet.com.au (c122-106-156-23.carlnfd1.nsw.optusnet.com.au [122.106.156.23]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id E7592780F69; Tue, 12 Nov 2013 18:54:34 +1100 (EST) Date: Tue, 12 Nov 2013 18:54:32 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: sbruno@freebsd.org Subject: Re: [CFR] printf format changes In-Reply-To: <1384203635.1748.49.camel@powernoodle.corp.yahoo.com> Message-ID: <20131112183651.Q1059@besplex.bde.org> References: <1383961188.1526.10.camel@powernoodle.corp.yahoo.com> <20131109183432.R907@besplex.bde.org> <1384203635.1748.49.camel@powernoodle.corp.yahoo.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=DstvpgP+ c=1 sm=1 tr=0 a=ebeQFi2P/qHVC0Yw9JDJ4g==:117 a=PO7r1zJSAAAA:8 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=rXxADq7T2ngA:10 a=6I5d2MoRAAAA:8 a=3oChjJZv1zds7kc0A60A:9 a=CjuIK1q_8ugA:10 Cc: freebsd-fs X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2013 07:54:46 -0000 On Mon, 11 Nov 2013, Sean Bruno wrote: > Updated patch for libzfs. I've continued the (longlong_t) nonsense as > it matches the vendor code, wrapped any lines that go past 80 and reset > the cast and printf() for the time_t argument. This patch is being sent > to illumos for review as issue 4309. > > http://people.freebsd.org/~sbruno/libzfs_update_casting.txt > > Index: cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c > =================================================================== > --- cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c (revision 257998) > +++ cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c (working copy) > @@ -2134,7 +2134,8 @@ > 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; > Next note that the vendor mostly uses KNF. This uses gnu style for the change, despite a 3-line example of KNF continuation indentation being visible in the same part of the patch. > @@ -2648,7 +2649,8 @@ > 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); gnu style. > @@ -2705,7 +2707,8 @@ > return (err); > > if (literal) { > - (void) snprintf(propbuf, proplen, "%llu", propvalue); > + (void) snprintf(propbuf, proplen, "%llu", > + (u_longlong_t)propvalue); > } else { > zfs_nicenum(propvalue, propbuf, proplen); > } gnu style. > Index: cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c > =================================================================== > --- cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c (revision 257998) > +++ cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c (working copy) > @@ -261,7 +261,8 @@ > > 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: gnu style. > @@ -337,7 +338,8 @@ > } > /* FALLTHROUGH */ > default: > - (void) snprintf(buf, len, "%llu", intval); > + (void) snprintf(buf, len, "%llu", > + (u_longlong_t)intval); > } > break; > gnu style. > @@ -3228,7 +3233,7 @@ > > (void) snprintf(msg, sizeof (msg), > dgettext(TEXT_DOMAIN, "cannot clear errors for %llx"), > - guid); > + (longlong_t)guid); > > (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name)); > zc.zc_guid = guid; Sign mismatch in type in the cast. It matches neither the variable nor the format. > @@ -3793,7 +3798,8 @@ > > 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; > } > Sign mismatch. > @@ -3804,7 +3810,7 @@ > 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)); Sign mismatch. > @@ -3825,7 +3831,8 @@ > 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); > } Sign mismatch. > Index: cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c > =================================================================== > --- cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c (revision 257998) > +++ cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c (working copy) > @@ -2083,7 +2083,8 @@ > needagain = B_TRUE; > else > progress = B_TRUE; > - sprintf(guidname, "%lu", thisguid); > + sprintf(guidname, "%llu", > + (u_longlong_t)thisguid); > nvlist_add_boolean(deleted, guidname); > continue; > } gnu style. > @@ -2140,7 +2141,7 @@ > needagain = B_TRUE; > else > progress = B_TRUE; > - sprintf(guidname, "%lu", parent_fromsnap_guid); > + sprintf(guidname, "%llu", (u_longlong_t)parent_fromsnap_guid); > nvlist_add_boolean(deleted, guidname); > continue; > } Line too long. > @@ -2173,7 +2174,7 @@ > if (stream_parent_fromsnap_guid != 0 && > parent_fromsnap_guid != 0 && > stream_parent_fromsnap_guid != parent_fromsnap_guid) { > - sprintf(guidname, "%lu", parent_fromsnap_guid); > + sprintf(guidname, "%ju", (uintmax_t)parent_fromsnap_guid); > if (nvlist_exists(deleted, guidname)) { > progress = B_TRUE; > needagain = B_TRUE; Doesn't use ulonglong_t. Line too long. I think I found all the errors. Bruce