From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00049.outbound.protection.outlook.com [40.107.0.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.bufferbloat.net (Postfix) with ESMTPS id F021D3CB3D for ; Mon, 12 Mar 2018 05:28:45 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=darbyshire-bryant.me.uk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=3NGtMItmrjq4miiJaBbR6n5ytNRgFwvOr/hDmya/TKQ=; b=fet/oAINNm0Eo0qmI25IJ+nsL4nMrRhSZsqEE5WMu4sZQ0pCpjRS2HXi84I3ariVcgVOit6QCft4Lq6uKxqTBdFkBclmKcyyjKb5gDe4Wa6TgPCQGhr1JA0zi41rDIwMXVMUzfeTtBPF/Lk8TbQ0MlLPTCZtpDAlc4oPBwhLOwQ= Received: from AM0PR0702MB3730.eurprd07.prod.outlook.com (52.133.51.23) by AM0PR0702MB3556.eurprd07.prod.outlook.com (52.133.50.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.588.7; Mon, 12 Mar 2018 09:28:44 +0000 Received: from AM0PR0702MB3730.eurprd07.prod.outlook.com ([fe80::a95a:1cfd:7299:5172]) by AM0PR0702MB3730.eurprd07.prod.outlook.com ([fe80::a95a:1cfd:7299:5172%3]) with mapi id 15.20.0588.013; Mon, 12 Mar 2018 09:28:44 +0000 From: Kevin Darbyshire-Bryant To: Stephen Hemminger CC: =?utf-8?B?VG9rZSBIw7hpbGFuZC1Kw7hyZ2Vuc2Vu?= , "cake@lists.bufferbloat.net" Thread-Topic: [Cake] [PATCH 1/2] cake: print_uint format fixes Thread-Index: AQHTuRokH3ZxhvG1+E+9XF/3TwBMk6PLgtCAgAAWnYCAABdXgIAApg6A Date: Mon, 12 Mar 2018 09:28:43 +0000 Message-ID: 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> In-Reply-To: <20180311163423.2e8d63b6@xeon-e3> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-originating-ip: [2a02:c7f:1232:22b::dc83] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR0702MB3556; 7:PqD7vrKM6nQ8zJO8l3YLguCRn4Zb2/EEg6CgC7EH+iJHIzJZtvaouvnz/YpMWPOrCZejVa5YMeOW3wgapVYpfnGX5W8tx4+VrJ1mCTme4p8Hykm26+vecnkcdbG/FF5hwCOUQ6k5xuhLwazFmH1+wp7H+Wb4IP7FzOEsh4l5NXP+hhR+l16McusWVs5Pve+gJaeEuIDziMQ6FX8lrefryjtfim8cjkzQUEPjxYlVxVyamllS9x5QOGLDfJs61dFy x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: edb9e59e-4e7b-4506-0ade-08d587fba658 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(7021125)(5600026)(4604075)(3008032)(4534165)(7022125)(4603075)(4627221)(201702281549075)(7048125)(7024125)(7027125)(7028125)(7023125)(2017052603328)(7153060)(49563074)(7193020); SRVR:AM0PR0702MB3556; x-ms-traffictypediagnostic: AM0PR0702MB3556: authentication-results: spf=none (sender IP is ) smtp.mailfrom=kevin@darbyshire-bryant.me.uk; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(102415395)(6040522)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(10201501046)(3231220)(944501244)(52105095)(6041310)(20161123564045)(20161123562045)(20161123560045)(20161123558120)(2016111802025)(6043046)(6072148)(201708071742011); SRVR:AM0PR0702MB3556; BCL:0; PCL:0; RULEID:; SRVR:AM0PR0702MB3556; x-forefront-prvs: 06098A2863 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(39830400003)(346002)(39380400002)(376002)(396003)(52314003)(189003)(199004)(7736002)(68736007)(4326008)(81156014)(93886005)(478600001)(305945005)(81166006)(316002)(46003)(5660300001)(5250100002)(25786009)(99936001)(33656002)(8676002)(83716003)(106356001)(54906003)(76176011)(14454004)(8936002)(6246003)(2900100001)(86362001)(6486002)(82746002)(36756003)(6512007)(6916009)(2906002)(99286004)(229853002)(53546011)(6506007)(53936002)(74482002)(97736004)(186003)(6116002)(105586002)(102836004)(3660700001)(6436002)(2950100002)(3280700002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0702MB3556; H:AM0PR0702MB3730.eurprd07.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: darbyshire-bryant.me.uk does not designate permitted sender hosts) x-microsoft-antispam-message-info: eBecLr+NYtnvX+Dv9+2rg+JRs69xEAx83nz1D1U3dqZ+zdrpkZG3/bb6jCLVr6L/asza/VwZ9PnzqasEK+A9BD2UehHDWPuoLktq9fOi+VcUpruSk60neh9W6nsKdDfybKlsWEnfm6xKwvgUfG5w/alywsN7VcBU3LwofkblogubSBmnQHJ9XjGxvNyZfo6I6EgueVgeypHzUbJ00IC++LEnKaBK08PMMPqbjwBl1J7eCRS+YaAwmJgUKUhpdAs6KqOtDoucSB/3zxAgd/4c6JwcdxD4x/bkWkHfcxzYKovb6Cs/z4sFBXvUi3ARWAVCxls72ujyK8S/ffL4rF8JkA== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: multipart/signed; boundary="Apple-Mail=_C8633472-C438-4C71-84C8-F57ADB1ED491"; protocol="application/pgp-signature"; micalg=pgp-sha256 MIME-Version: 1.0 X-OriginatorOrg: darbyshire-bryant.me.uk X-MS-Exchange-CrossTenant-Network-Message-Id: edb9e59e-4e7b-4506-0ade-08d587fba658 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Mar 2018 09:28:43.8247 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9151708b-c553-406f-8e56-694f435154a4 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0702MB3556 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 09:28:46 -0000 --Apple-Mail=_C8633472-C438-4C71-84C8-F57ADB1ED491 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > 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 = it up tomorrow =E2=80=98properly=E2=80=99 but =E2=80=98int=E2=80=99 is = int length whereas 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 days doing $dayjob so may take a little while. Thanks = for boosting confidence that I=E2=80=99ve not broken it on architectures = it used to work on :-) >=20 > print_uint should be unsigned only. >=20 > When printing json your version won't work with negative values. Yes, it should be: print_int(PRINT_ANY, "overhead", "overhead %d ", = overhead); - certainly that works on my 32 bit big endian box. Using the =E2=80=98PRId64=E2=80=99 macro won=E2=80=99t work because = print_int is using =E2=80=98int=E2=80=99 type internally whereas = print_uint uses =E2=80=98uint64_t=E2=80=99 internally. 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. But I=E2=80=99m definitely arguing from a position of lack of = knowledge/experience. Cheers, Kevin D-B 012C ACB2 28C6 C53E 9775 9123 B3A2 389B 9DE2 334A --Apple-Mail=_C8633472-C438-4C71-84C8-F57ADB1ED491 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEASyssijGxT6XdZEjs6I4m53iM0oFAlqmSEsACgkQs6I4m53i M0pOdRAAmIelixc1hWkmYoeimCi3skmtb4eAA4pd9whsqYO/86sScxl+bmSK37jq w+0XtIEQum5V6bJENWN4oeVRjKfNC5O5vgXXfe2gxA0lCdddp9Wjq0G0hoIGCUtm pVRx/0WbuMCiV0NFWwzvSmFqel0MgbpdQSVAgOc+xBbzfVXKNyTAk68R8T5wYcMw v7bOx0vdDJAGlgc06GGIAcRUkgJuewDaqjGCNUOfdOIZ2T+WQiPygvCxIVPut6pi uwmxFNLgd5lJQUmG1x30rhiSe9Od+Fq+W1VJgXoKn4Qi+92hn2KBAlXfxG1IPzbB UW+z9iahvDtm1MvMsAEtUddkC6I4VSGxh57UI5WLqlOSG1HgEYojV9XNXWaB9dJ5 ROheBlcWgSMyzQympebhGFBFfPp/GxOtdnzDHxV8lGUgQ+rUsFRQesgjubMShMEx vDJed5IfxXPcL/ZNDpLkjI6zxs3y4vtBQVIrDio3hg/HwrPkhbC0cP0HOLCJybn1 S/Ql+pg9OR28camUAqybb/hmEK6POF4nPBYJPRfga9cade1pwo1e4dJAivvdtAnT +UyOvZdHih8G7LKwgVWiTn96Le3zI21HF8BUFHzB/9s2aFP846FynRIS4Ghyw+qo 6r97jLNF1f6CMW9hJKqyTbn4yl9nhY6OBbv0PIEWYLpXQSqNxnE= =vyRz -----END PGP SIGNATURE----- --Apple-Mail=_C8633472-C438-4C71-84C8-F57ADB1ED491--