{"id":811947,"url":"http://patchwork.ozlabs.org/api/patches/811947/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20170909104746.5948-5-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":"<20170909104746.5948-5-robdclark@gmail.com>","list_archive_url":null,"date":"2017-09-09T10:47:42","name":"[U-Boot,v2,4/5] vsprintf.c: add GUID printing","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"9198242a997934837dbd8a1c15b44d4c718eaf5f","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/20170909104746.5948-5-robdclark@gmail.com/mbox/","series":[{"id":2341,"url":"http://patchwork.ozlabs.org/api/series/2341/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=2341","date":"2017-09-09T10:47:38","name":"vsprintf and short-wchar","version":2,"mbox":"http://patchwork.ozlabs.org/series/2341/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/811947/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/811947/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=\"tf8jmeDv\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xq9vK2fJ4z9s7h\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat,  9 Sep 2017 20:50:21 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 19975C21F36; Sat,  9 Sep 2017 10:49:31 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id F2F05C21DAA;\n\tSat,  9 Sep 2017 10:49:28 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid DA720C21F12; Sat,  9 Sep 2017 10:48:17 +0000 (UTC)","from mail-qt0-f195.google.com (mail-qt0-f195.google.com\n\t[209.85.216.195])\n\tby lists.denx.de (Postfix) with ESMTPS id D89A0C21F14\n\tfor <u-boot@lists.denx.de>; Sat,  9 Sep 2017 10:48:13 +0000 (UTC)","by mail-qt0-f195.google.com with SMTP id 7so2925098qtz.3\n\tfor <u-boot@lists.denx.de>; Sat, 09 Sep 2017 03:48:13 -0700 (PDT)","from localhost ([2601:184:4780:aac0:25f8:dd96:a084:785a])\n\tby smtp.gmail.com with ESMTPSA id\n\tv192sm2639859qka.76.2017.09.09.03.48.11\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tSat, 09 Sep 2017 03:48:11 -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:in-reply-to:references;\n\tbh=UtZV03JjXi+eiSU/qqVR7KqV9LeZSs4U2HwrkOTZ908=;\n\tb=tf8jmeDvyIdffgfXOSqFN4s9NEtBXqZge0iFqimMC+T+DqV7G5nx2Co0aJXWwmGgtw\n\tXZ7LGl8dDTLqnDUM2BPDRyPqeg+hH+MMzdnQXZYlzNv+qyDJmelNXpgkDZ9aN92ceM6y\n\tCgyck5m4l82c//F2ZmTtaKdDtpX/ymOfD34Pr6udvbIRIiz3ZOE/INDe88X0VK1gctZB\n\t2dHePWkPzsGKDq7qu8L+zoJHcLbodXakrzHrPWII+S+TIshBvgLCMR/sPBx3hOxMG3JY\n\tVERIlfoxS1/HJHpDPouTuu0DCauZf0VZKtyirSMrsrA5f9ggqBym38lrInIej4vu6jtB\n\tBU2g==","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:in-reply-to\n\t:references;\n\tbh=UtZV03JjXi+eiSU/qqVR7KqV9LeZSs4U2HwrkOTZ908=;\n\tb=GQSKDvd3zqFgo9FGMRxTVFBWVJwZP5I9M8bd2pmAcR2FCT+8+uP2357WDVcR1YijEU\n\tOLm0yVikyDP+/Rb+l+ehf7sFJ71Slzumgu6htvzq2BJUf7lnK/MMKvq3fdLUy1o57eI6\n\tMHjK+iC3p1jbh84VLEdK98ks3U2iRsjnQ72V5jyGDFx4oRHxjA/QBX9JxW6V1Wa6m0Ea\n\tCX/QXlBlyOm89SXvBMDyGxv3qdI0N2p4S7dPD6NI1Nqi7AzIvFHp9BFGEqRi8QRmcrM+\n\tWPZRTwkPg60UOlhqXfh4cjo8amsHRNOo7iwY9920NcCy1AFAzRQwP9vGJiOlriDNZu/p\n\tAunA==","X-Gm-Message-State":"AHPjjUi0S5GVfpV2GTJh2uAtbQcveQZc9VX6N3+xTZtWfBKban+adCmV\n\tBGkK+62qkIN9umjyyC0=","X-Google-Smtp-Source":"AOwi7QBxkr3otmA8EAe+KB/P/LxvwVjQzU2v3mBlE0zyzp6oow+lItOTS+oXG8p5EEouIK2b1/Ke2g==","X-Received":"by 10.237.43.229 with SMTP id e92mr7793170qtd.216.1504954092582; \n\tSat, 09 Sep 2017 03:48:12 -0700 (PDT)","From":"Rob Clark <robdclark@gmail.com>","To":"U-Boot Mailing List <u-boot@lists.denx.de>","Date":"Sat,  9 Sep 2017 06:47:42 -0400","Message-Id":"<20170909104746.5948-5-robdclark@gmail.com>","X-Mailer":"git-send-email 2.13.5","In-Reply-To":"<20170909104746.5948-1-robdclark@gmail.com>","References":"<20170909104746.5948-1-robdclark@gmail.com>","Cc":"Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,\n\tHeinrich Schuchardt <xypron.glpk@gmx.de>, Stefan Roese <sr@denx.de>","Subject":"[U-Boot] [PATCH v2 4/5] 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>\nTested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>\n---\n examples/api/Makefile      |  1 +\n include/config_fallbacks.h |  1 +\n lib/vsprintf.c             | 46 ++++++++++++++++++++++++++++++++++++++++++++--\n 3 files changed, 46 insertions(+), 2 deletions(-)","diff":"diff --git a/examples/api/Makefile b/examples/api/Makefile\nindex 87c15d0f68..899527267d 100644\n--- a/examples/api/Makefile\n+++ b/examples/api/Makefile\n@@ -35,6 +35,7 @@ EXT_COBJ-y += lib/string.o\n EXT_COBJ-y += lib/time.o\n EXT_COBJ-y += lib/vsprintf.o\n EXT_COBJ-y += lib/charset.o\n+EXT_COBJ-$(CONFIG_LIB_UUID) += lib/uuid.o\n EXT_SOBJ-$(CONFIG_PPC) += arch/powerpc/lib/ppcstring.o\n ifeq ($(ARCH),arm)\n EXT_SOBJ-$(CONFIG_USE_ARCH_MEMSET) += arch/arm/lib/memset.o\ndiff --git a/include/config_fallbacks.h b/include/config_fallbacks.h\nindex 46b7a2a6f2..2c4d43d672 100644\n--- a/include/config_fallbacks.h\n+++ b/include/config_fallbacks.h\n@@ -58,6 +58,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 97bed9d36d..dd572d2868 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","v2","4/5"]}