提交 aa4ea1c3 编写于 作者: A Andy Shevchenko 提交者: Linus Torvalds

lib/vsprintf: simplify UUID printing

There are few functions here and there along with type definitions that
provide UUID API.  This series consolidates everything under one hood
and converts current users.

This has been tested for a while internally, however it doesn't mean we
covered all possible cases (especially accuracy of UUID constants after
conversion).  So, please test this as much as you can and provide your
tag.  We appreciate the effort.

The ACPI conversion is postponed for now to sort more generic things out
first.

This patch (of 9):

Since we have hex_byte_pack_upper() we may use it directly and avoid
second loop.
Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: NMatt 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: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 f4970682
...@@ -1324,7 +1324,10 @@ char *uuid_string(char *buf, char *end, const u8 *addr, ...@@ -1324,7 +1324,10 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
} }
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
p = hex_byte_pack(p, addr[index[i]]); if (uc)
p = hex_byte_pack_upper(p, addr[index[i]]);
else
p = hex_byte_pack(p, addr[index[i]]);
switch (i) { switch (i) {
case 3: case 3:
case 5: case 5:
...@@ -1337,13 +1340,6 @@ char *uuid_string(char *buf, char *end, const u8 *addr, ...@@ -1337,13 +1340,6 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
*p = 0; *p = 0;
if (uc) {
p = uuid;
do {
*p = toupper(*p);
} while (*(++p));
}
return string(buf, end, uuid, spec); return string(buf, end, uuid, spec);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册