[{"id":1741924,"web_url":"http://patchwork.ozlabs.org/comment/1741924/","msgid":"<eb72a9b9-7bf8-9e3c-3db7-e1ab0be770dd@gmx.de>","list_archive_url":null,"date":"2017-08-08T16:56:26","subject":"Re: [U-Boot] [PATCH] vsprintf.c: add GUID printing","submitter":{"id":61270,"url":"http://patchwork.ozlabs.org/api/people/61270/","name":"Heinrich Schuchardt","email":"xypron.glpk@gmx.de"},"content":"On 08/06/2017 01:39 PM, Rob Clark wrote:\n> This works (roughly) the same way as linux's, but we currently always\n> print lower-case (ie. we just keep %pUB and %pUL for compat with linux),\n> mostly just because that is what uuid_bin_to_str() supports.\n> \n>   %pUb:   01020304-0506-0708-090a-0b0c0d0e0f10\n>   %pUl:   04030201-0605-0807-090a-0b0c0d0e0f10\n> \n> It will be used by a later efi_loader paths for efi variables and for\n> device-path-to-text protocol, and also quite useful for debug prints\n> of protocol GUIDs.\n> \n> Signed-off-by: Rob Clark <robdclark@gmail.com>\n> ---\n> This replaces \"efi_loader: add guidstr helper\" in my \"enough UEFI for\n> standard distro boot\" patchset, and could also replace Heinrich's\n> \"efi_loader: write protocol GUID in OpenProtocol\" with a single one-\n> line debug() print.\n> \n>  include/config_fallbacks.h |  1 +\n>  lib/vsprintf.c             | 46 ++++++++++++++++++++++++++++++++++++++++++++--\n>  2 files changed, 45 insertions(+), 2 deletions(-)\n> \n> diff --git a/include/config_fallbacks.h b/include/config_fallbacks.h\n> index 961a83d758..56b9de09f2 100644\n> --- a/include/config_fallbacks.h\n> +++ b/include/config_fallbacks.h\n> @@ -57,6 +57,7 @@\n>  \n>  #if (CONFIG_IS_ENABLED(PARTITION_UUIDS) || \\\n>  \tCONFIG_IS_ENABLED(EFI_PARTITION) || \\\n> +\tCONFIG_IS_ENABLED(EFI_LOADER) || \\\n>  \tdefined(CONFIG_RANDOM_UUID) || \\\n>  \tdefined(CONFIG_CMD_UUID) || \\\n>  \tdefined(CONFIG_BOOTP_PXE)) && \\\n> diff --git a/lib/vsprintf.c b/lib/vsprintf.c\n> index 0c40f852ce..156fda5ad6 100644\n> --- a/lib/vsprintf.c\n> +++ b/lib/vsprintf.c\n> @@ -18,6 +18,7 @@\n>  \n>  #include <common.h>\n>  #include <charset.h>\n> +#include <uuid.h>\n>  \n>  #include <div64.h>\n>  #define noinline __attribute__((noinline))\n> @@ -366,6 +367,40 @@ static char *ip4_addr_string(char *buf, char *end, u8 *addr, int field_width,\n>  }\n>  #endif\n>  \n> +#ifdef CONFIG_LIB_UUID\n> +/*\n> + * This works (roughly) the same way as linux's, but we currently always\n> + * print lower-case (ie. we just keep %pUB and %pUL for compat with linux),\n> + * mostly just because that is what uuid_bin_to_str() supports.\n> + *\n> + *   %pUb:   01020304-0506-0708-090a-0b0c0d0e0f10\n> + *   %pUl:   04030201-0605-0807-090a-0b0c0d0e0f10\n> + */\n> +static char *uuid_string(char *buf, char *end, u8 *addr, int field_width,\n> +\t\t\t int precision, int flags, const char *fmt)\n> +{\n> +\tchar uuid[UUID_STR_LEN + 1];\n> +\tint str_format = UUID_STR_FORMAT_STD;\n> +\n> +\tswitch (*(++fmt)) {\n> +\tcase 'L':\n> +\tcase 'l':\n> +\t\tstr_format = UUID_STR_FORMAT_GUID;\n> +\t\tbreak;\n> +\tcase 'B':\n> +\tcase 'b':\n> +\t\t/* this is the default */\n> +\t\tbreak;\n> +\tdefault:\n> +\t\tbreak;\n> +\t}\n> +\n> +\tuuid_bin_to_str(addr, uuid, str_format);\n> +\n> +\treturn string(buf, end, uuid, field_width, precision, flags);\n> +}\n> +#endif\n> +\n>  /*\n>   * Show a '%p' thing.  A kernel extension is that the '%p' is followed\n>   * by an extra set of alphanumeric characters that are extended format\n> @@ -399,8 +434,8 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr,\n>  \t\t\t      flags);\n>  #endif\n>  \n> -#ifdef CONFIG_CMD_NET\n>  \tswitch (*fmt) {\n> +#ifdef CONFIG_CMD_NET\n>  \tcase 'a':\n>  \t\tflags |= SPECIAL | ZEROPAD;\n>  \n> @@ -430,8 +465,15 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr,\n>  \t\t\t\t\t       precision, flags);\n>  \t\tflags &= ~SPECIAL;\n>  \t\tbreak;\n> -\t}\n>  #endif\n> +#ifdef CONFIG_LIB_UUID\n> +\tcase 'U':\n> +\t\treturn uuid_string(buf, end, ptr, field_width, precision,\n> +\t\t\t\t   flags, fmt);\n> +#endif\n> +\tdefault:\n> +\t\tbreak;\n> +\t}\n>  \tflags |= SMALL;\n>  \tif (field_width == -1) {\n>  \t\tfield_width = 2*sizeof(void *);\n> \n\nI was not able to apply the patch to v2017.09-rc1 nor to git HEAD.\n\nApplying: vsprintf.c: add GUID printing\nerror: patch failed: lib/vsprintf.c:18\nerror: lib/vsprintf.c: patch does not apply\n\nThis is my lib/vsprintf.c:\n 14 #include <stdarg.h>\n 15 #include <linux/types.h>\n 16 #include <linux/string.h>\n 17 #include <linux/ctype.h>\n 18\n 19 #include <common.h>\n 20\n 21 #include <div64.h>\n\nThere is no line with #include <charset.h>.\n\nBest regards\n\nHeinrich Schuchardt","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xRgXx4wD0z9s65\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed,  9 Aug 2017 02:56:48 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 23A0BC21DFB; Tue,  8 Aug 2017 16:56:40 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 682A8C21C4E;\n\tTue,  8 Aug 2017 16:56:38 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 79CBDC21C4E; Tue,  8 Aug 2017 16:56:37 +0000 (UTC)","from mout.gmx.net (mout.gmx.net [212.227.15.15])\n\tby lists.denx.de (Postfix) with ESMTPS id 30124C21C26\n\tfor <u-boot@lists.denx.de>; Tue,  8 Aug 2017 16:56:37 +0000 (UTC)","from [192.168.123.57] ([84.118.154.110]) by mail.gmx.com (mrgmx001\n\t[212.227.17.190]) with ESMTPSA (Nemesis) id\n\t0LzskF-1damK502OR-0154bh; Tue, 08 Aug 2017 18:56:30 +0200"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-0.7 required=5.0 tests=FREEMAIL_FROM,\n\tRCVD_IN_DNSWL_LOW,\n\tRCVD_IN_MSPIKE_H2 autolearn=unavailable autolearn_force=no\n\tversion=3.4.0","To":"Rob Clark <robdclark@gmail.com>,\n\tU-Boot Mailing List <u-boot@lists.denx.de>","References":"<20170806113936.6601-1-robdclark@gmail.com>","From":"Heinrich Schuchardt <xypron.glpk@gmx.de>","Message-ID":"<eb72a9b9-7bf8-9e3c-3db7-e1ab0be770dd@gmx.de>","Date":"Tue, 8 Aug 2017 18:56:26 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.2.1","MIME-Version":"1.0","In-Reply-To":"<20170806113936.6601-1-robdclark@gmail.com>","Content-Language":"en-US","X-Provags-ID":"V03:K0:bDMYhbsZRZXpsQBtbyQgRXXcMqVjO/YWX3iVJwae7Bi2QE5dvWe\n\t0qSHoAn4j07bbqMmxmnSz/bahBc7aid6Csi2nrYAW6TDRVnD6DPGsG2nm7yfrziXBRxiQwO\n\t31qGVhzzeV0ZOMKajOrKk+wFgp5LUYzAX1i0d9+yH25dr6GugYHMOjh/dgofYPpdt3s8qdk\n\tVgHOUfTc++UdqWul/H0Aw==","X-UI-Out-Filterresults":"notjunk:1; V01:K0:eHco7TpKXoQ=:CI4rIP3m69d3AtBQEGJgY7\n\t4EtyOgQqjWwoDsbIUbOsNpr0ayrmtpFf85oEquBG0hkovNTXojySp7SfMuMvGHZVaLs9v1Uf8\n\t5b1o7FiDIyYfvVLOUA5gnsa2e4CyO4DiFcA7EDTpRasa0B+4k3zVtcvrG3EePW1iNA/J2jtf2\n\tde3OmA2LzhbfkvebSrcupXgajjJFu77Wkqw0DPa70sVTbI3K7D80OOfKnfyTONoIRRhUTnOwF\n\txuEzqkwUraxV6wbLRwerp85W/TbrGApOO3kk1T6wX71tKDIRadYOgyQncfBkgbawHeiVgRtpl\n\tLBw3WpE6NKwd1O+0mcr1NVjHBgeQlcKH/j/7a8TZUPMCMak/QP0MbLGXF6zd+Xy67yjHGpoLo\n\tDf5a1qFBr6kxS1XrGzM1WV8cTNFaJuvTiT1v0FAdAKdO7dCFrfRAD03Js+C7T456NHJt06lIq\n\tkISrifgS0FLwbhsmHYI0Sk8y2bi34YsHYV1K2NkQWsvzT7woGYLpLL3Gjtmj0EMyhxjmN0A5B\n\tEMzCZ+KS7m7L8jNyfofOcl2uzxcfk2iEgUDcppM5B9VYWGsSZrnrRJ4OuHMKhuDDRLLKFRo1y\n\tUsBxOdsGwWzWMv0mGOe9X+yHsK7xY8Q5av29yXXeIsQJxtxDte/DjMg1kNtLepdXVWnojrdZM\n\tXQLO4W/UAP8Y2lGc6Z9adh3OCpnptKM9gbcSMX066Hp/48liR6q4ZgVWzMk7r3wKEkBw4eaOn\n\t73foIMv3Q31L1CQUzJh7t1eNnCGYuhAAg52bzhv7nvTEZRcWGCcDm2iH7gYwYieicHIaUX8Rt\n\tZXezvkp93WRIXWPzNuVyAVa3FYe0LU0UA57sunTg991FgqddDE=","Subject":"Re: [U-Boot] [PATCH] vsprintf.c: add GUID printing","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}},{"id":1741942,"web_url":"http://patchwork.ozlabs.org/comment/1741942/","msgid":"<CAF6AEGtgDOWdivLDrQ25_O89GWOC+rj_nr0Gd-R0hadoonLdpQ@mail.gmail.com>","list_archive_url":null,"date":"2017-08-08T17:07:29","subject":"Re: [U-Boot] [PATCH] vsprintf.c: add GUID printing","submitter":{"id":18760,"url":"http://patchwork.ozlabs.org/api/people/18760/","name":"Rob Clark","email":"robdclark@gmail.com"},"content":"On Tue, Aug 8, 2017 at 12:56 PM, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:\n> On 08/06/2017 01:39 PM, Rob Clark wrote:\n>> This works (roughly) the same way as linux's, but we currently always\n>> print lower-case (ie. we just keep %pUB and %pUL for compat with linux),\n>> mostly just because that is what uuid_bin_to_str() supports.\n>>\n>>   %pUb:   01020304-0506-0708-090a-0b0c0d0e0f10\n>>   %pUl:   04030201-0605-0807-090a-0b0c0d0e0f10\n>>\n>> It will be used by a later efi_loader paths for efi variables and for\n>> device-path-to-text protocol, and also quite useful for debug prints\n>> of protocol GUIDs.\n>>\n>> Signed-off-by: Rob Clark <robdclark@gmail.com>\n>> ---\n>> This replaces \"efi_loader: add guidstr helper\" in my \"enough UEFI for\n>> standard distro boot\" patchset, and could also replace Heinrich's\n>> \"efi_loader: write protocol GUID in OpenProtocol\" with a single one-\n>> line debug() print.\n>>\n>>  include/config_fallbacks.h |  1 +\n>>  lib/vsprintf.c             | 46 ++++++++++++++++++++++++++++++++++++++++++++--\n>>  2 files changed, 45 insertions(+), 2 deletions(-)\n>>\n[snip]\n> I was not able to apply the patch to v2017.09-rc1 nor to git HEAD.\n>\n> Applying: vsprintf.c: add GUID printing\n> error: patch failed: lib/vsprintf.c:18\n> error: lib/vsprintf.c: patch does not apply\n>\n> This is my lib/vsprintf.c:\n>  14 #include <stdarg.h>\n>  15 #include <linux/types.h>\n>  16 #include <linux/string.h>\n>  17 #include <linux/ctype.h>\n>  18\n>  19 #include <common.h>\n>  20\n>  21 #include <div64.h>\n>\n> There is no line with #include <charset.h>.\n\nthat comes from the previous patch which adds utf16 support.. I think\nthat should be the only conflicting hunk, the later bits are far\nenough away from the utf16 related hunks.\n\nBR,\n-R","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"CRYx11Cx\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xRgnR2MGJz9s75\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed,  9 Aug 2017 03:07:39 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 10201C21D84; Tue,  8 Aug 2017 17:07:35 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id A1919C21C39;\n\tTue,  8 Aug 2017 17:07:33 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 77B82C21C39; Tue,  8 Aug 2017 17:07:32 +0000 (UTC)","from mail-lf0-f66.google.com (mail-lf0-f66.google.com\n\t[209.85.215.66])\n\tby lists.denx.de (Postfix) with ESMTPS id 4A68CC21C26\n\tfor <u-boot@lists.denx.de>; Tue,  8 Aug 2017 17:07:31 +0000 (UTC)","by mail-lf0-f66.google.com with SMTP id x16so2853195lfb.4\n\tfor <u-boot@lists.denx.de>; Tue, 08 Aug 2017 10:07:31 -0700 (PDT)","by 10.46.82.11 with HTTP; Tue, 8 Aug 2017 10:07:29 -0700 (PDT)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-0.0 required=5.0 tests=FREEMAIL_FROM,\n\tRCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID\n\tautolearn=unavailable autolearn_force=no version=3.4.0","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc; bh=QIzuR88K/Q4DuRi8Gb1fZerFvWX0+uHltKFzPRQy0yA=;\n\tb=CRYx11Cx7ofsp66/aKEPCzzVK390ETWEqflaZedLDKZRzzH3fdW5apmdlPycIaTshk\n\tZfOQxzYHQgINJZ15xCjpxEif1tDy0nl4YKrR9rBJXGMPUj2Id04MT/zer4wCIkFrJQst\n\tpRJtrx6kiqB6Z49bBdhA+gS3DV1KmYgBD6pUVz58MHa8k4e/bGdFvn0Y14Nvo9ddvxUm\n\t4+JurccwOc8GeIXBXIKPy8GHG9BN457x0QMa1skZcd7VzRSSQ8KwqDzUm2TQz+zB+mn1\n\thh8Mg87Gqqbgtk6TqfWCKQAXsmYHwlt1PJpwh07hZZdlkyngE0XxuVUvX4TXAY6K7k20\n\twCvg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=QIzuR88K/Q4DuRi8Gb1fZerFvWX0+uHltKFzPRQy0yA=;\n\tb=rEHTP9lkHdSbHgKXRQ4zEUTSTi87vLPw9AGNlddrMYYBicKxCOTvykoL7waSxSyH86\n\tSqi4VeerjU5KRgJeYtjdbeMN2+t3NQaYbhRd3bvloWKRqcq9SYzDELX49bbQSSnm/5Eb\n\tHXHMNtNdPupdi0BmVICjCb1CO1U1727hB79/iyhUdNirjx4NpofyLrADW7JxQ56tNBMn\n\t5Aw5SFOhu18Ffq6DLeQGfTI+O15uzWp7DYKLOuHYmgagJYQINCMVbq3L9Ni7B8cbAW3o\n\tXIBOToIiJczjktHeVVciBFv8MVW2+Gq7UO0YTJjT2dBm/n8xqV/zkpxh43dqHj8BPSmA\n\tkrbQ==","X-Gm-Message-State":"AHYfb5iG6tD0GGq7BHqx2d03eA1UYIjp5Gj9V14yPWBtvcnfeN3GQHmn\n\twEsQak9XK4+f7Bna4qubXwZwk3auTg==","X-Received":"by 10.25.74.83 with SMTP id x80mr1797514lfa.252.1502212050689;\n\tTue, 08 Aug 2017 10:07:30 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<eb72a9b9-7bf8-9e3c-3db7-e1ab0be770dd@gmx.de>","References":"<20170806113936.6601-1-robdclark@gmail.com>\n\t<eb72a9b9-7bf8-9e3c-3db7-e1ab0be770dd@gmx.de>","From":"Rob Clark <robdclark@gmail.com>","Date":"Tue, 8 Aug 2017 13:07:29 -0400","Message-ID":"<CAF6AEGtgDOWdivLDrQ25_O89GWOC+rj_nr0Gd-R0hadoonLdpQ@mail.gmail.com>","To":"Heinrich Schuchardt <xypron.glpk@gmx.de>","Cc":"U-Boot Mailing List <u-boot@lists.denx.de>","Subject":"Re: [U-Boot] [PATCH] vsprintf.c: add GUID printing","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}}]