From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-x243.google.com (mail-pf0-x243.google.com [IPv6:2607:f8b0:400e:c00::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.bufferbloat.net (Postfix) with ESMTPS id D5D593CB38 for ; Mon, 12 Mar 2018 11:11:45 -0400 (EDT) Received: by mail-pf0-x243.google.com with SMTP id u5so4454896pfh.6 for ; Mon, 12 Mar 2018 08:11:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aUrklcELcCM1+xFLXoCPNFruRcz3A1HYC14Z9VAIyL0=; b=pTkbuztDPJwCqdrkAzi1nAJGo59YCKwyCZqRTu84dGCP5s9f+jgo5xWELmNcrAh79l fcbWi6z7EH9JMslG0smTlpIrL1WijYbgxr3G5oicxxUNkagngNJkv34W8X8YbjAN9kAF vk9O5WA/dabceBzGrsJEhg4+katWvJMBVMSM1BQ846UO+NIswf41ABg0eUKW9jdrGFLp jOMSplfywDNd59wPbeCcmE5Dawil3V+D3RJfQHk2Yxiakv9E2PnQeDMFYndcliDuDnC4 TLrLbwkoCuYaaP8huSvrxq0dsiBWtY+6fgObjG61xFWFyvBBJiMRPmtKVNAXg/FrbSdd KHUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aUrklcELcCM1+xFLXoCPNFruRcz3A1HYC14Z9VAIyL0=; b=f/3/gHdcMX1AqdvSJudao14hBC/XFEMFkyi+ti1bVMxjUFkwpAGnwce2mb4ynaC6Xd fHV341VTvS8nZOo9DKuAhSYr32lwn2V2OGdGQhmHa/EIbv4+KXnVQhIEPYrLp/kQBqsD x6f8H1vV0ZZDP5P94ZHaBunvIjEOL9mUNXGKcPJpd7lDMrRaDjt94j4/P+5jX3Mq13tg rbRi3IWVLgCdOI+PDUepOmz1g88oc3+i5Wlm3SWZu8Sb7YmCJf27RP1l1nDoQhkSdN9j uoJZ9Yp0qQdNvd/JBMas6aa0vYXOArLle7QQLqK+gMN0oP7d5Zg7eoSt8Xx8/Fk845Fj /AWA== X-Gm-Message-State: AElRT7G2Tel9WjN8w4H0T3IItYC0cw6BIsDjV1nnny4OgLC/NcawtrCv 6DZgEKu1ALM52TifRM9UT/P50Q== X-Google-Smtp-Source: AG47ELvvKCmswnm9fq3KnGvUAhJVxE/dmit+UsqdQl3BSu1AOEhYW4SzHVINPpSiDwH2UE/94+QIAw== X-Received: by 10.101.71.202 with SMTP id f10mr6839388pgs.91.1520867504870; Mon, 12 Mar 2018 08:11:44 -0700 (PDT) Received: from xeon-e3 (204-195-71-95.wavecable.com. [204.195.71.95]) by smtp.gmail.com with ESMTPSA id p14sm13717485pgu.44.2018.03.12.08.11.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Mar 2018 08:11:44 -0700 (PDT) Date: Mon, 12 Mar 2018 08:11:42 -0700 From: Stephen Hemminger To: Toke =?UTF-8?B?SMO4aWxhbmQtSsO4cmdlbnNlbg==?= Cc: Kevin Darbyshire-Bryant , "cake\@lists.bufferbloat.net" Message-ID: <20180312081142.0a9da85c@xeon-e3> In-Reply-To: <874lllk47a.fsf@toke.dk> References: <20180311091930.86264-1-ldir@darbyshire-bryant.me.uk> <20180311091930.86264-2-ldir@darbyshire-bryant.me.uk> <87bmfujq18.fsf@toke.dk> <5DD63A68-EE32-4A5C-B08E-019FB8CBC9B1@darbyshire-bryant.me.uk> <20180311163423.2e8d63b6@xeon-e3> <874lllk47a.fsf@toke.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Cake] [PATCH 1/2] cake: print_uint format fixes X-BeenThere: cake@lists.bufferbloat.net X-Mailman-Version: 2.1.20 Precedence: list List-Id: Cake - FQ_codel the next generation List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Mar 2018 15:11:46 -0000 On Mon, 12 Mar 2018 10:56:09 +0100 Toke H=C3=B8iland-J=C3=B8rgensen wrote: > Kevin Darbyshire-Bryant writes: >=20 > >> On 11 Mar 2018, at 23:34, Stephen Hemminger wrote: > >>=20 > >> On Sun, 11 Mar 2018 22:10:51 +0000 > >> Kevin Darbyshire-Bryant wrote: > >> =20 > >>> negative? > >>>=20 > >>> Tried it, and you=E2=80=99d sort of guess wrong. I=E2=80=99ll write i= t up tomorrow > >>> =E2=80=98properly=E2=80=99 but =E2=80=98int=E2=80=99 is int length wh= ereas uint is uint64 length. On > >>> big endian it goes wrong. > >>>=20 > >>> Anyway, glad you=E2=80=99ve tested on something little endian. I=E2= =80=99ll try to > >>> submit a patch upstream as requested=E2=80=A6very busy over next 3 da= ys > >>> doing $dayjob so may take a little while. Thanks for boosting > >>> confidence that I=E2=80=99ve not broken it on architectures it used t= o work > >>> on :-) =20 > >>=20 > >> print_uint should be unsigned only. > >>=20 > >> When printing json your version won't work with negative values. =20 > > > > Yes, it should be: print_int(PRINT_ANY, "overhead", "overhead %d ", > > overhead); - certainly that works on my 32 bit big endian box. =20 >=20 > Yeah, this is fixed in the tc-adv git repo now :) >=20 > > Using the =E2=80=98PRId64=E2=80=99 macro won=E2=80=99t work because pri= nt_int is using =E2=80=98int=E2=80=99 > > type internally whereas print_uint uses =E2=80=98uint64_t=E2=80=99 inte= rnally. So the > > format string has to have knowledge of the internal format, *but* > > there=E2=80=99s no clue of the difference in internal format offered by= the > > function name i.e. print_int vs print_uint. > > > > I=E2=80=99d argue it makes more sense to have: print_int/print_uint as = the > > native int length, that hopefully match up with %u & %d and then have > > print_int64/print_uint64 where use of formats PRId64 & PRIu64 is > > advised. =20 >=20 > Yes, this was basically what I meant by "grating"; I really do agree > that this API is confusing. >=20 > Stephen, would you accept patches to fix the API (to add > print_{u,}int64() variants and turn print_uint() into native-int size)? > Or should we stick with the API currently there and live with the > inconsistency? :) >=20 > -Toke I agree print_int should take int, print_uint should take unsigned int, and= there should be print_u64 (and print_u32, print_u8)