* [U-Boot] [PATCH] vsprintf.c: add GUID printing
@ 2017-08-06 11:39 Rob Clark
2017-08-08 16:56 ` Heinrich Schuchardt
0 siblings, 1 reply; 3+ messages in thread
From: Rob Clark @ 2017-08-06 11:39 UTC (permalink / raw)
To: u-boot
This works (roughly) the same way as linux's, but we currently always
print lower-case (ie. we just keep %pUB and %pUL for compat with linux),
mostly just because that is what uuid_bin_to_str() supports.
%pUb: 01020304-0506-0708-090a-0b0c0d0e0f10
%pUl: 04030201-0605-0807-090a-0b0c0d0e0f10
It will be used by a later efi_loader paths for efi variables and for
device-path-to-text protocol, and also quite useful for debug prints
of protocol GUIDs.
Signed-off-by: Rob Clark <robdclark@gmail.com>
---
This replaces "efi_loader: add guidstr helper" in my "enough UEFI for
standard distro boot" patchset, and could also replace Heinrich's
"efi_loader: write protocol GUID in OpenProtocol" with a single one-
line debug() print.
include/config_fallbacks.h | 1 +
lib/vsprintf.c | 46 ++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/include/config_fallbacks.h b/include/config_fallbacks.h
index 961a83d758..56b9de09f2 100644
--- a/include/config_fallbacks.h
+++ b/include/config_fallbacks.h
@@ -57,6 +57,7 @@
#if (CONFIG_IS_ENABLED(PARTITION_UUIDS) || \
CONFIG_IS_ENABLED(EFI_PARTITION) || \
+ CONFIG_IS_ENABLED(EFI_LOADER) || \
defined(CONFIG_RANDOM_UUID) || \
defined(CONFIG_CMD_UUID) || \
defined(CONFIG_BOOTP_PXE)) && \
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 0c40f852ce..156fda5ad6 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -18,6 +18,7 @@
#include <common.h>
#include <charset.h>
+#include <uuid.h>
#include <div64.h>
#define noinline __attribute__((noinline))
@@ -366,6 +367,40 @@ static char *ip4_addr_string(char *buf, char *end, u8 *addr, int field_width,
}
#endif
+#ifdef CONFIG_LIB_UUID
+/*
+ * This works (roughly) the same way as linux's, but we currently always
+ * print lower-case (ie. we just keep %pUB and %pUL for compat with linux),
+ * mostly just because that is what uuid_bin_to_str() supports.
+ *
+ * %pUb: 01020304-0506-0708-090a-0b0c0d0e0f10
+ * %pUl: 04030201-0605-0807-090a-0b0c0d0e0f10
+ */
+static char *uuid_string(char *buf, char *end, u8 *addr, int field_width,
+ int precision, int flags, const char *fmt)
+{
+ char uuid[UUID_STR_LEN + 1];
+ int str_format = UUID_STR_FORMAT_STD;
+
+ switch (*(++fmt)) {
+ case 'L':
+ case 'l':
+ str_format = UUID_STR_FORMAT_GUID;
+ break;
+ case 'B':
+ case 'b':
+ /* this is the default */
+ break;
+ default:
+ break;
+ }
+
+ uuid_bin_to_str(addr, uuid, str_format);
+
+ return string(buf, end, uuid, field_width, precision, flags);
+}
+#endif
+
/*
* Show a '%p' thing. A kernel extension is that the '%p' is followed
* by an extra set of alphanumeric characters that are extended format
@@ -399,8 +434,8 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr,
flags);
#endif
-#ifdef CONFIG_CMD_NET
switch (*fmt) {
+#ifdef CONFIG_CMD_NET
case 'a':
flags |= SPECIAL | ZEROPAD;
@@ -430,8 +465,15 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr,
precision, flags);
flags &= ~SPECIAL;
break;
- }
#endif
+#ifdef CONFIG_LIB_UUID
+ case 'U':
+ return uuid_string(buf, end, ptr, field_width, precision,
+ flags, fmt);
+#endif
+ default:
+ break;
+ }
flags |= SMALL;
if (field_width == -1) {
field_width = 2*sizeof(void *);
--
2.13.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] vsprintf.c: add GUID printing
2017-08-06 11:39 [U-Boot] [PATCH] vsprintf.c: add GUID printing Rob Clark
@ 2017-08-08 16:56 ` Heinrich Schuchardt
2017-08-08 17:07 ` Rob Clark
0 siblings, 1 reply; 3+ messages in thread
From: Heinrich Schuchardt @ 2017-08-08 16:56 UTC (permalink / raw)
To: u-boot
On 08/06/2017 01:39 PM, Rob Clark wrote:
> This works (roughly) the same way as linux's, but we currently always
> print lower-case (ie. we just keep %pUB and %pUL for compat with linux),
> mostly just because that is what uuid_bin_to_str() supports.
>
> %pUb: 01020304-0506-0708-090a-0b0c0d0e0f10
> %pUl: 04030201-0605-0807-090a-0b0c0d0e0f10
>
> It will be used by a later efi_loader paths for efi variables and for
> device-path-to-text protocol, and also quite useful for debug prints
> of protocol GUIDs.
>
> Signed-off-by: Rob Clark <robdclark@gmail.com>
> ---
> This replaces "efi_loader: add guidstr helper" in my "enough UEFI for
> standard distro boot" patchset, and could also replace Heinrich's
> "efi_loader: write protocol GUID in OpenProtocol" with a single one-
> line debug() print.
>
> include/config_fallbacks.h | 1 +
> lib/vsprintf.c | 46 ++++++++++++++++++++++++++++++++++++++++++++--
> 2 files changed, 45 insertions(+), 2 deletions(-)
>
> diff --git a/include/config_fallbacks.h b/include/config_fallbacks.h
> index 961a83d758..56b9de09f2 100644
> --- a/include/config_fallbacks.h
> +++ b/include/config_fallbacks.h
> @@ -57,6 +57,7 @@
>
> #if (CONFIG_IS_ENABLED(PARTITION_UUIDS) || \
> CONFIG_IS_ENABLED(EFI_PARTITION) || \
> + CONFIG_IS_ENABLED(EFI_LOADER) || \
> defined(CONFIG_RANDOM_UUID) || \
> defined(CONFIG_CMD_UUID) || \
> defined(CONFIG_BOOTP_PXE)) && \
> diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> index 0c40f852ce..156fda5ad6 100644
> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c
> @@ -18,6 +18,7 @@
>
> #include <common.h>
> #include <charset.h>
> +#include <uuid.h>
>
> #include <div64.h>
> #define noinline __attribute__((noinline))
> @@ -366,6 +367,40 @@ static char *ip4_addr_string(char *buf, char *end, u8 *addr, int field_width,
> }
> #endif
>
> +#ifdef CONFIG_LIB_UUID
> +/*
> + * This works (roughly) the same way as linux's, but we currently always
> + * print lower-case (ie. we just keep %pUB and %pUL for compat with linux),
> + * mostly just because that is what uuid_bin_to_str() supports.
> + *
> + * %pUb: 01020304-0506-0708-090a-0b0c0d0e0f10
> + * %pUl: 04030201-0605-0807-090a-0b0c0d0e0f10
> + */
> +static char *uuid_string(char *buf, char *end, u8 *addr, int field_width,
> + int precision, int flags, const char *fmt)
> +{
> + char uuid[UUID_STR_LEN + 1];
> + int str_format = UUID_STR_FORMAT_STD;
> +
> + switch (*(++fmt)) {
> + case 'L':
> + case 'l':
> + str_format = UUID_STR_FORMAT_GUID;
> + break;
> + case 'B':
> + case 'b':
> + /* this is the default */
> + break;
> + default:
> + break;
> + }
> +
> + uuid_bin_to_str(addr, uuid, str_format);
> +
> + return string(buf, end, uuid, field_width, precision, flags);
> +}
> +#endif
> +
> /*
> * Show a '%p' thing. A kernel extension is that the '%p' is followed
> * by an extra set of alphanumeric characters that are extended format
> @@ -399,8 +434,8 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr,
> flags);
> #endif
>
> -#ifdef CONFIG_CMD_NET
> switch (*fmt) {
> +#ifdef CONFIG_CMD_NET
> case 'a':
> flags |= SPECIAL | ZEROPAD;
>
> @@ -430,8 +465,15 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr,
> precision, flags);
> flags &= ~SPECIAL;
> break;
> - }
> #endif
> +#ifdef CONFIG_LIB_UUID
> + case 'U':
> + return uuid_string(buf, end, ptr, field_width, precision,
> + flags, fmt);
> +#endif
> + default:
> + break;
> + }
> flags |= SMALL;
> if (field_width == -1) {
> field_width = 2*sizeof(void *);
>
I was not able to apply the patch to v2017.09-rc1 nor to git HEAD.
Applying: vsprintf.c: add GUID printing
error: patch failed: lib/vsprintf.c:18
error: lib/vsprintf.c: patch does not apply
This is my lib/vsprintf.c:
14 #include <stdarg.h>
15 #include <linux/types.h>
16 #include <linux/string.h>
17 #include <linux/ctype.h>
18
19 #include <common.h>
20
21 #include <div64.h>
There is no line with #include <charset.h>.
Best regards
Heinrich Schuchardt
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] vsprintf.c: add GUID printing
2017-08-08 16:56 ` Heinrich Schuchardt
@ 2017-08-08 17:07 ` Rob Clark
0 siblings, 0 replies; 3+ messages in thread
From: Rob Clark @ 2017-08-08 17:07 UTC (permalink / raw)
To: u-boot
On Tue, Aug 8, 2017 at 12:56 PM, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> On 08/06/2017 01:39 PM, Rob Clark wrote:
>> This works (roughly) the same way as linux's, but we currently always
>> print lower-case (ie. we just keep %pUB and %pUL for compat with linux),
>> mostly just because that is what uuid_bin_to_str() supports.
>>
>> %pUb: 01020304-0506-0708-090a-0b0c0d0e0f10
>> %pUl: 04030201-0605-0807-090a-0b0c0d0e0f10
>>
>> It will be used by a later efi_loader paths for efi variables and for
>> device-path-to-text protocol, and also quite useful for debug prints
>> of protocol GUIDs.
>>
>> Signed-off-by: Rob Clark <robdclark@gmail.com>
>> ---
>> This replaces "efi_loader: add guidstr helper" in my "enough UEFI for
>> standard distro boot" patchset, and could also replace Heinrich's
>> "efi_loader: write protocol GUID in OpenProtocol" with a single one-
>> line debug() print.
>>
>> include/config_fallbacks.h | 1 +
>> lib/vsprintf.c | 46 ++++++++++++++++++++++++++++++++++++++++++++--
>> 2 files changed, 45 insertions(+), 2 deletions(-)
>>
[snip]
> I was not able to apply the patch to v2017.09-rc1 nor to git HEAD.
>
> Applying: vsprintf.c: add GUID printing
> error: patch failed: lib/vsprintf.c:18
> error: lib/vsprintf.c: patch does not apply
>
> This is my lib/vsprintf.c:
> 14 #include <stdarg.h>
> 15 #include <linux/types.h>
> 16 #include <linux/string.h>
> 17 #include <linux/ctype.h>
> 18
> 19 #include <common.h>
> 20
> 21 #include <div64.h>
>
> There is no line with #include <charset.h>.
that comes from the previous patch which adds utf16 support.. I think
that should be the only conflicting hunk, the later bits are far
enough away from the utf16 related hunks.
BR,
-R
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-08-08 17:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-06 11:39 [U-Boot] [PATCH] vsprintf.c: add GUID printing Rob Clark
2017-08-08 16:56 ` Heinrich Schuchardt
2017-08-08 17:07 ` Rob Clark
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.