Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1371663

Re: [PATCH v3 04/10] lib/uuid: introduce few more generic helpers for UUID

From Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH v3 04/10] lib/uuid: introduce few more generic helpers for UUID
Date 2016-04-05 16:20 +0200
Message-ID <rkzZM-4ZG-23@gated-at.bofh.it> (permalink)
References <rkzGq-4wA-9@gated-at.bofh.it> <rkzGs-4wA-51@gated-at.bofh.it>
Organization Intel Finland Oy

Show all headers | View raw


On Tue, 2016-04-05 at 16:56 +0300, Andy Shevchenko wrote:
> There are new helpers in this patch:
> 
> uuid_is_valid		checks if a UUID is valid
> uuid_be_to_bin		converts from string to binary (big
> endian)
> uuid_le_to_bin		converts from string to binary (little
> endian)
> 
> They will be used in future, i.e. in the following patches in the
> series.
> 
> This also moves indices arrays to lib/uuid.c to be shared accross
> modules.
> 

> --- a/lib/uuid.c
> +++ b/lib/uuid.c

> +static int __uuid_to_bin(const char *uuid, __u8 b[16], const u8
> ei[16])
> +{
> +	static const u8 si[16] =
> {0,2,4,6,9,11,14,16,19,21,24,26,28,30,32,34};
> +	unsigned int i;
> +
> +	if (uuid_is_valid(uuid))

Oops, sorry, typo is here, should be negative check.

if (!uuid_is_valid(uuid))


> +		return -EINVAL;
> +
> +	for (i = 0; i < 16; i++) {
> +		int hi = hex_to_bin(uuid[si[i]] + 0);
> +		int lo = hex_to_bin(uuid[si[i]] + 1);
> +
> +		b[ei[i]] = (hi << 4) | lo;
> +	}
> +
> +	return 0;
> +}

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH v3 00/10] uuid: convert users to generic UUID API Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-04-05 16:00 +0200
  [PATCH v3 03/10] lib/uuid: move generate_random_uuid() to uuid.c Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-04-05 16:00 +0200
  [PATCH v3 06/10] sysctl: drop away useless label Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-04-05 16:00 +0200
    Re: [PATCH v3 06/10] sysctl: drop away useless label Andrew Morton <akpm@linux-foundation.org> - 2016-04-06 00:20 +0200
      Re: [PATCH v3 06/10] sysctl: drop away useless label Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-04-06 13:40 +0200
  [PATCH v3 08/10] efi: redefine type, constant, macro from generic code Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-04-05 16:00 +0200
  [PATCH v3 02/10] ima: use %pU to output UUID in printable format Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-04-05 16:00 +0200
    Re: [PATCH v3 02/10] ima: use %pU to output UUID in printable format Joe Perches <joe@perches.com> - 2016-04-06 01:20 +0200
      Re: [PATCH v3 02/10] ima: use %pU to output UUID in printable format Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-04-06 13:10 +0200
  [PATCH v3 09/10] efivars: use generic UUID library Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-04-05 16:00 +0200
  [PATCH v3 07/10] sysctl: use generic UUID library Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-04-05 16:00 +0200
  [PATCH v3 04/10] lib/uuid: introduce few more generic helpers for UUID Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-04-05 16:00 +0200
    Re: [PATCH v3 04/10] lib/uuid: introduce few more generic helpers  for UUID Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-04-05 16:20 +0200

csiph-web