diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2016-05-20 20:01:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-05-20 20:58:30 -0400 |
commit | 2b1b0d66704a8cafe83be7114ec4c15ab3a314ad (patch) | |
tree | 4ad1f40e5907b94bac6a7499e11962bbf6a843c0 /include/linux | |
parent | 8da4b8c48e7b43cb16d05e1dbb34ad9f73ab7efd (diff) |
lib/uuid.c: introduce a few more generic helpers
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 the indices arrays to lib/uuid.c to be shared accross
modules.
[andriy.shevchenko@linux.intel.com: fix typo]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Dmitry Kasatkin <dmitry.kasatkin@gmail.com>
Cc: Mimi Zohar <zohar@linux.vnet.ibm.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/uuid.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/uuid.h b/include/linux/uuid.h index 91c2b6d9cbb7..e0b95e728a77 100644 --- a/include/linux/uuid.h +++ b/include/linux/uuid.h | |||
@@ -22,6 +22,11 @@ | |||
22 | 22 | ||
23 | #include <uapi/linux/uuid.h> | 23 | #include <uapi/linux/uuid.h> |
24 | 24 | ||
25 | /* | ||
26 | * The length of a UUID string ("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") | ||
27 | * not including trailing NUL. | ||
28 | */ | ||
29 | #define UUID_STRING_LEN 36 | ||
25 | 30 | ||
26 | static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2) | 31 | static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2) |
27 | { | 32 | { |
@@ -38,4 +43,12 @@ void generate_random_uuid(unsigned char uuid[16]); | |||
38 | extern void uuid_le_gen(uuid_le *u); | 43 | extern void uuid_le_gen(uuid_le *u); |
39 | extern void uuid_be_gen(uuid_be *u); | 44 | extern void uuid_be_gen(uuid_be *u); |
40 | 45 | ||
46 | bool __must_check uuid_is_valid(const char *uuid); | ||
47 | |||
48 | extern const u8 uuid_le_index[16]; | ||
49 | extern const u8 uuid_be_index[16]; | ||
50 | |||
51 | int uuid_le_to_bin(const char *uuid, uuid_le *u); | ||
52 | int uuid_be_to_bin(const char *uuid, uuid_be *u); | ||
53 | |||
41 | #endif | 54 | #endif |