{"id":798362,"url":"http://patchwork.ozlabs.org/api/patches/798362/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20170806113936.6601-1-robdclark@gmail.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170806113936.6601-1-robdclark@gmail.com>","list_archive_url":null,"date":"2017-08-06T11:39:31","name":"[U-Boot] vsprintf.c: add GUID printing","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"98f1ab1aee5fce90f2440321a3bee22230c7628b","submitter":{"id":18760,"url":"http://patchwork.ozlabs.org/api/people/18760/?format=json","name":"Rob Clark","email":"robdclark@gmail.com"},"delegate":{"id":3651,"url":"http://patchwork.ozlabs.org/api/users/3651/?format=json","username":"trini","first_name":"Tom","last_name":"Rini","email":"trini@ti.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20170806113936.6601-1-robdclark@gmail.com/mbox/","series":[],"comments":"http://patchwork.ozlabs.org/api/patches/798362/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/798362/checks/","tags":{},"related":[],"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=\"gS+39kjO\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xQJcH69ykz9s8P\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun,  6 Aug 2017 21:39:58 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 51860C22023; Sun,  6 Aug 2017 11:39:48 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id BEF86C21F02;\n\tSun,  6 Aug 2017 11:39:46 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 9A620C21F02; Sun,  6 Aug 2017 11:39:44 +0000 (UTC)","from mail-qk0-f194.google.com (mail-qk0-f194.google.com\n\t[209.85.220.194])\n\tby lists.denx.de (Postfix) with ESMTPS id 61E72C21EA7\n\tfor <u-boot@lists.denx.de>; Sun,  6 Aug 2017 11:39:43 +0000 (UTC)","by mail-qk0-f194.google.com with SMTP id q66so5451916qki.1\n\tfor <u-boot@lists.denx.de>; Sun, 06 Aug 2017 04:39:43 -0700 (PDT)","from localhost ([2601:184:4780:aac0:25f8:dd96:a084:785a])\n\tby smtp.gmail.com with ESMTPSA id\n\tq9sm3845885qki.73.2017.08.06.04.39.40\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tSun, 06 Aug 2017 04:39:40 -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=from:to:cc:subject:date:message-id;\n\tbh=/3JVwRKJ+0nXlm91zKLNz3uDSYXeEKbNCCt0VPVe0K0=;\n\tb=gS+39kjOMfTSh9dpKauegIKbphKPfhw+13ujOTQH9eZ8AKgOdcQAgPkqO1WIlPFk0K\n\ts5c+tz4aJ4CshdCpnaxkLQsD91zcxd8KoNI4uoqb0wlqDsnQ+LM+FYcgtWcL124+3ZIH\n\t8VrIhWyucA6FQm2ibZIbl+7zJyx/uemJ84HeV4k+7QU8GWawUj74eYWLc/d88eIKetdJ\n\tCGKZCBSt4PF3i50Jd3BJm2AYULpJZ5f9Edkf4hj3goROyJCktkXM5gvIoosnQDMCOTVF\n\tT6CB2CHapSzNOD7f5UDxUGY7Yaj1cL9wDy3VFze6LJBT5SS64QJDhKZS9n/U70EBqH6V\n\tEhiQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id;\n\tbh=/3JVwRKJ+0nXlm91zKLNz3uDSYXeEKbNCCt0VPVe0K0=;\n\tb=pue9QV1xi+q2jXjiC/ACvoa8uCjF8NgDjre9K3YP0tet3PyG1dNzD7IEV7dp/swhQR\n\tKXSWCcerjak8vfSK8R3Ls4XPYauEdm0/nmJNb+bNZm7Ce8XVY05FiZcEO057Jl89mDDq\n\twiPur4qG3oMwqDq4d+zzEzKZMoJHS+Lu9vVaTb8BisJMFRapKYahh88VSNNb1hedZeUB\n\t4pf/WV53uapDFlDCxH8gb42KfBAyScawovgyPvLgqRqQtERgs0vZ4fPYw2wq7PzLwpIQ\n\tmxobDQB66qb9dYcoqUJcE8dxzUBv2TrsgB+wbA7/0Rx7B2B27IpQio3uO0RGgcXnY0K+\n\taEsQ==","X-Gm-Message-State":"AHYfb5giKL9Q7szeXo2rkGxHcQbm6kXuo7Bbb+y0bSpKAR3ojnOQDXVE\n\tYjBE+s7xxMIIgfC7cXA=","X-Received":"by 10.55.40.104 with SMTP id o101mr10097897qkh.311.1502019581846;\n\tSun, 06 Aug 2017 04:39:41 -0700 (PDT)","From":"Rob Clark <robdclark@gmail.com>","To":"U-Boot Mailing List <u-boot@lists.denx.de>","Date":"Sun,  6 Aug 2017 07:39:31 -0400","Message-Id":"<20170806113936.6601-1-robdclark@gmail.com>","X-Mailer":"git-send-email 2.13.0","Cc":"Heinrich Schuchardt <xypron.glpk@gmx.de>","Subject":"[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>","MIME-Version":"1.0","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>"},"content":"This works (roughly) the same way as linux's, but we currently always\nprint lower-case (ie. we just keep %pUB and %pUL for compat with linux),\nmostly 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\nIt will be used by a later efi_loader paths for efi variables and for\ndevice-path-to-text protocol, and also quite useful for debug prints\nof protocol GUIDs.\n\nSigned-off-by: Rob Clark <robdclark@gmail.com>\n---\nThis replaces \"efi_loader: add guidstr helper\" in my \"enough UEFI for\nstandard distro boot\" patchset, and could also replace Heinrich's\n\"efi_loader: write protocol GUID in OpenProtocol\" with a single one-\nline debug() print.\n\n include/config_fallbacks.h |  1 +\n lib/vsprintf.c             | 46 ++++++++++++++++++++++++++++++++++++++++++++--\n 2 files changed, 45 insertions(+), 2 deletions(-)","diff":"diff --git a/include/config_fallbacks.h b/include/config_fallbacks.h\nindex 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)) && \\\ndiff --git a/lib/vsprintf.c b/lib/vsprintf.c\nindex 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","prefixes":["U-Boot"]}