[U-Boot] [PATCH v6 3/6] lib: uuid: add functions to generate UUID version 4

Przemyslaw Marczak p.marczak at samsung.com
Wed Apr 2 10:25:56 CEST 2014


Hello,

On 04/02/2014 10:20 AM, Przemyslaw Marczak wrote:
> This patch adds support to generate UUID (Universally Unique Identifier)
> in version 4 based on RFC4122, which is randomly.
>
> Source: https://www.ietf.org/rfc/rfc4122.txt
>
> Changes:
> - new configs:
>    - CONFIG_LIB_UUID for compile lib/uuid.c
>    - CONFIG_RANDOM_UUID for functions gen_rand_uuid() and gen_rand_uuid_str()
> - add configs dependency to include/config_fallbacks.h for lib uuid.
>
> lib/uuid.c:
> - add gen_rand_uuid() - this function writes 16 bytes len binary representation
>    of UUID v4 to the memory at given address.
>
> - add gen_rand_uuid_str() - this function writes 37 bytes len hexadecimal
>    ASCII string representation of UUID v4 to the memory at given address.
>
> Signed-off-by: Przemyslaw Marczak <p.marczak at samsung.com>
> Cc: Stephen Warren <swarren at nvidia.com>
> Cc: Lukasz Majewski <l.majewski at samsung.com>
> Cc: trini at ti.com
>
> ---
> Changes v2:
> - put uuid generation changes in a separate commit
> - get_uuid_str() - change name to gen_rand_uuid_str()
> - add new function: gen_rand_uuid()
> - remove unnecessary '\0' at the end of uuid string
> - drop unnecessary error checking
> - functions now takes pointers to allocated memory instead of alloc it itself
> - add new config option: CONFIG_RANDOM_UUID
>
> Changes v3:
> - remove unused UUID_STR_BYTE_LEN
> - reword comments
> - remove null pointer checking from gen_rand_uuid() and gen_rand_uuid_str()
> - remove unneeded memset from gen_rand_uuid()
> - undo moving vsprintf.o object in lib/Makefile
> - add attribute "packed" to the uuid structure
> - gen_rand_uuid(): add endian functions for modify uuid data
> - gen_rand_uuid(): use memcpy() to store uuid data into given buffer for avoi
>    unaligned access issues
> - change uuid version and variant masks to proper for use with clrsetbits_*
> - add #ifdef CONFIG_RANDOM_UUID to random uuid code for avoid warnings
>
> Changes v4:
> - add new parameter to define UUID string format for UUID or GUID which differs
>    in endianness of first three string blocks.
> - add uuid structure and version 4 data to uuid header file
> - lib/Makefile: add CONFIG_RAND_UUID dependency to rand.o and uuid.o
>
> Changes v5:
> - reword some comments
> - introduce config CMD_LIB_UUID, cleanup config dependency
> - remove use of typedef uuid_str_t
>
> Changes v6:
> - fix indentation in include/config_fallbacks.h
> ---

I am sending next version because there was an indentation issue in 
version 5 of this patch which is fixed now.

Thanks
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com


More information about the U-Boot mailing list