* [PATCH 0/9] Add vsprintf extension %pU to print UUID/GUIDs and use it
@ 2009-09-29 5:01 Joe Perches
2009-09-29 5:01 ` [PATCH 1/9] lib/vsprintf.c: Add %pU to print UUID/GUIDs Joe Perches
` (9 more replies)
0 siblings, 10 replies; 27+ messages in thread
From: Joe Perches @ 2009-09-29 5:01 UTC (permalink / raw)
To: linux-kernel
Cc: Adrian Hunter, Alex Elder, Artem Bityutskiy, Christoph Hellwig,
Harvey Harrison, Huang Ying, Ingo Molnar, Jeff Garzik,
Laurent Pinchart, Matt Mackall, Mauro Carvalho Chehab,
Neil Brown, Steven Whitehouse, xfs-masters
It makes an x86 defconfig smaller compiled with gcc 4.4 smaller too
old:
$ size vmlinux
text data bss dec hex filename
6981105 678300 1359668 9019073 899ec1 vmlinux
new:
$ size vmlinux
text data bss dec hex filename
6980770 678380 1359668 9018818 899dc2 vmlinux
Joe Perches (9):
lib/vsprintf.c: Add %pU to print UUID/GUIDs
efi.h: Use %pUr to print UUIDs
random.c: Use %pU to print UUIDs
drivers/firmware/dmi_scan.c: Use %pUX to print UUIDs
drivers/md/md.c: Use %pU to print UUIDs
drivers/media/video/uvc: Use %pUr to print UUIDs
fs/gfs2/sys.c: Use %pUX to print UUIDs
fs/ubifs: Use %pUX to print UUIDs
fs/xfs/xfs_log_recover.c: Use %pU to print UUIDs
drivers/char/random.c | 10 +---
drivers/firmware/dmi_scan.c | 5 +--
drivers/md/md.c | 16 ++------
drivers/media/video/uvc/uvc_ctrl.c | 69 ++++++++++++++++------------------
drivers/media/video/uvc/uvc_driver.c | 7 +--
drivers/media/video/uvc/uvcvideo.h | 10 -----
fs/gfs2/sys.c | 16 +------
fs/ubifs/debug.c | 9 +---
fs/ubifs/super.c | 7 +---
fs/xfs/xfs_log_recover.c | 14 ++-----
include/linux/efi.h | 6 +--
lib/vsprintf.c | 58 ++++++++++++++++++++++++++++-
12 files changed, 111 insertions(+), 116 deletions(-)
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH 1/9] lib/vsprintf.c: Add %pU to print UUID/GUIDs
2009-09-29 5:01 [PATCH 0/9] Add vsprintf extension %pU to print UUID/GUIDs and use it Joe Perches
@ 2009-09-29 5:01 ` Joe Perches
2009-10-01 7:10 ` Geert Uytterhoeven
2009-09-29 5:01 ` [PATCH 2/9] efi.h: Use %pUr to print UUIDs Joe Perches
` (8 subsequent siblings)
9 siblings, 1 reply; 27+ messages in thread
From: Joe Perches @ 2009-09-29 5:01 UTC (permalink / raw)
To: linux-kernel
Cc: Adrian Hunter, Alex Elder, Artem Bityutskiy, Christoph Hellwig,
Harvey Harrison, Huang Ying, Ingo Molnar, Jeff Garzik,
Laurent Pinchart, Matt Mackall, Mauro Carvalho Chehab,
Neil Brown, Steven Whitehouse, xfs-masters, David S. Miller
UUID/GUIDs are somewhat common in kernel source.
Standardize the printed style of UUID/GUIDs by using
another extension to %p.
%pU: 01020304-0506-0708-090a-0b0c0d0e0f10
%pUr: 04030201-0605-0807-090a-0b0c0d0e0f10
%pU[r]X:Use upper case hex
Signed-off-by: Joe Perches <joe@perches.com>
---
lib/vsprintf.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 57 insertions(+), 1 deletions(-)
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index b91839e..68a49bb 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -790,6 +790,53 @@ static char *ip4_addr_string(char *buf, char *end, const u8 *addr,
return string(buf, end, ip4_addr, spec);
}
+static char *uuid_string(char *buf, char *end, const u8 *addr,
+ struct printf_spec spec, const char *fmt)
+{
+ char uuid[sizeof("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")];
+ char *p = uuid;
+ int i;
+ static const u8 r[16] = {3,2,1,0,5,4,7,6,8,9,10,11,12,13,14,15};
+ static const u8 n[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
+ const u8 *index = n;
+ bool uc = false;
+
+ while (isalnum(*(++fmt))) {
+ switch (*fmt) {
+ case 'r':
+ index = r;
+ break;
+ case 'X':
+ uc = true;
+ break;
+ }
+ }
+
+ for (i = 0; i < 16; i++) {
+ p = pack_hex_byte(p, addr[index[i]]);
+ switch (i) {
+ case 3:
+ case 5:
+ case 7:
+ case 9:
+ *p++ = '-';
+ break;
+ }
+ }
+
+ *p = 0;
+
+ if (uc) {
+ p = uuid;
+ while (*p) {
+ *p = toupper(*p);
+ p++;
+ }
+ }
+
+ return string(buf, end, uuid, spec);
+}
+
/*
* Show a '%p' thing. A kernel extension is that the '%p' is followed
* by an extra set of alphanumeric characters that are extended format
@@ -814,6 +861,13 @@ static char *ip4_addr_string(char *buf, char *end, const u8 *addr,
* IPv4 uses dot-separated decimal with leading 0's (010.123.045.006)
* - 'I6c' for IPv6 addresses printed as specified by
* http://www.ietf.org/id/draft-kawamura-ipv6-text-representation-03.txt
+ * - 'U' For a 16 byte UUID/GUID, it prints the UUID/GUID in the form
+ * "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
+ * Options for %pU are:
+ * 'X' use upper case hex digits
+ * 'r' use LE byte order for U32 and U16s equivalents. Use indices:
+ * [3][2][1][0]-[5][4]-[7][6]-[9][8]-[10]...[15]
+ *
* Note: The difference between 'S' and 'F' is that on ia64 and ppc64
* function pointers are really function descriptors, which contain a
* pointer to the real address.
@@ -828,9 +882,9 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr,
case 'F':
case 'f':
ptr = dereference_function_descriptor(ptr);
- case 's':
/* Fallthrough */
case 'S':
+ case 's':
return symbol_string(buf, end, ptr, spec, *fmt);
case 'R':
return resource_string(buf, end, ptr, spec);
@@ -853,6 +907,8 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr,
return ip4_addr_string(buf, end, ptr, spec, fmt);
}
break;
+ case 'U':
+ return uuid_string(buf, end, ptr, spec, fmt);
}
spec.flags |= SMALL;
if (spec.field_width == -1) {
--
1.6.3.1.10.g659a0.dirty
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 2/9] efi.h: Use %pUr to print UUIDs
2009-09-29 5:01 [PATCH 0/9] Add vsprintf extension %pU to print UUID/GUIDs and use it Joe Perches
2009-09-29 5:01 ` [PATCH 1/9] lib/vsprintf.c: Add %pU to print UUID/GUIDs Joe Perches
@ 2009-09-29 5:01 ` Joe Perches
2009-09-29 5:01 ` [PATCH 3/9] random.c: Use %pU " Joe Perches
` (7 subsequent siblings)
9 siblings, 0 replies; 27+ messages in thread
From: Joe Perches @ 2009-09-29 5:01 UTC (permalink / raw)
To: linux-kernel
Cc: Adrian Hunter, Alex Elder, Artem Bityutskiy, Christoph Hellwig,
Harvey Harrison, Huang Ying, Ingo Molnar, Jeff Garzik,
Laurent Pinchart, Matt Mackall, Mauro Carvalho Chehab,
Neil Brown, Steven Whitehouse, xfs-masters, Russ Anderson
Signed-off-by: Joe Perches <joe@perches.com>
---
include/linux/efi.h | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/include/linux/efi.h b/include/linux/efi.h
index ce4581f..dd85b39 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -280,11 +280,7 @@ efi_guidcmp (efi_guid_t left, efi_guid_t right)
static inline char *
efi_guid_unparse(efi_guid_t *guid, char *out)
{
- sprintf(out, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
- guid->b[3], guid->b[2], guid->b[1], guid->b[0],
- guid->b[5], guid->b[4], guid->b[7], guid->b[6],
- guid->b[8], guid->b[9], guid->b[10], guid->b[11],
- guid->b[12], guid->b[13], guid->b[14], guid->b[15]);
+ sprintf(out, "%pUr", guid->b);
return out;
}
--
1.6.3.1.10.g659a0.dirty
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 3/9] random.c: Use %pU to print UUIDs
2009-09-29 5:01 [PATCH 0/9] Add vsprintf extension %pU to print UUID/GUIDs and use it Joe Perches
2009-09-29 5:01 ` [PATCH 1/9] lib/vsprintf.c: Add %pU to print UUID/GUIDs Joe Perches
2009-09-29 5:01 ` [PATCH 2/9] efi.h: Use %pUr to print UUIDs Joe Perches
@ 2009-09-29 5:01 ` Joe Perches
2009-09-29 5:01 ` [PATCH 4/9] drivers/firmware/dmi_scan.c: Use %pUX " Joe Perches
` (6 subsequent siblings)
9 siblings, 0 replies; 27+ messages in thread
From: Joe Perches @ 2009-09-29 5:01 UTC (permalink / raw)
To: linux-kernel
Cc: Adrian Hunter, Alex Elder, Artem Bityutskiy, Christoph Hellwig,
Harvey Harrison, Huang Ying, Ingo Molnar, Jeff Garzik,
Laurent Pinchart, Matt Mackall, Mauro Carvalho Chehab,
Neil Brown, Steven Whitehouse, xfs-masters, Yinghai Lu
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/char/random.c | 10 +++-------
1 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 04b505e..7104df9 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1245,12 +1245,8 @@ static int proc_do_uuid(ctl_table *table, int write,
if (uuid[8] == 0)
generate_random_uuid(uuid);
- sprintf(buf, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-"
- "%02x%02x%02x%02x%02x%02x",
- uuid[0], uuid[1], uuid[2], uuid[3],
- uuid[4], uuid[5], uuid[6], uuid[7],
- uuid[8], uuid[9], uuid[10], uuid[11],
- uuid[12], uuid[13], uuid[14], uuid[15]);
+ sprintf(buf, "%pU", uuid);
+
fake_table.data = buf;
fake_table.maxlen = sizeof(buf);
@@ -1350,7 +1346,7 @@ ctl_table random_table[] = {
/********************************************************************
*
- * Random funtions for networking
+ * Random functions for networking
*
********************************************************************/
--
1.6.3.1.10.g659a0.dirty
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 4/9] drivers/firmware/dmi_scan.c: Use %pUX to print UUIDs
2009-09-29 5:01 [PATCH 0/9] Add vsprintf extension %pU to print UUID/GUIDs and use it Joe Perches
` (2 preceding siblings ...)
2009-09-29 5:01 ` [PATCH 3/9] random.c: Use %pU " Joe Perches
@ 2009-09-29 5:01 ` Joe Perches
2009-09-29 5:01 ` [PATCH 5/9] drivers/md/md.c: Use %pU " Joe Perches
` (5 subsequent siblings)
9 siblings, 0 replies; 27+ messages in thread
From: Joe Perches @ 2009-09-29 5:01 UTC (permalink / raw)
To: linux-kernel
Cc: Adrian Hunter, Alex Elder, Artem Bityutskiy, Christoph Hellwig,
Harvey Harrison, Huang Ying, Ingo Molnar, Jeff Garzik,
Laurent Pinchart, Matt Mackall, Mauro Carvalho Chehab,
Neil Brown, Steven Whitehouse, xfs-masters, Tejun Heo
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/firmware/dmi_scan.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index 938100f..c0deabb 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -169,10 +169,7 @@ static void __init dmi_save_uuid(const struct dmi_header *dm, int slot, int inde
if (!s)
return;
- sprintf(s,
- "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
- d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7],
- d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15]);
+ sprintf(s, "%pUX", d);
dmi_ident[slot] = s;
}
--
1.6.3.1.10.g659a0.dirty
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 5/9] drivers/md/md.c: Use %pU to print UUIDs
2009-09-29 5:01 [PATCH 0/9] Add vsprintf extension %pU to print UUID/GUIDs and use it Joe Perches
` (3 preceding siblings ...)
2009-09-29 5:01 ` [PATCH 4/9] drivers/firmware/dmi_scan.c: Use %pUX " Joe Perches
@ 2009-09-29 5:01 ` Joe Perches
2009-09-29 5:01 ` [PATCH 6/9] drivers/media/video/uvc: Use %pUr " Joe Perches
` (4 subsequent siblings)
9 siblings, 0 replies; 27+ messages in thread
From: Joe Perches @ 2009-09-29 5:01 UTC (permalink / raw)
To: linux-kernel
Cc: Adrian Hunter, Alex Elder, Artem Bityutskiy, Christoph Hellwig,
Harvey Harrison, Huang Ying, Ingo Molnar, Jeff Garzik,
Laurent Pinchart, Matt Mackall, Mauro Carvalho Chehab,
Neil Brown, Steven Whitehouse, xfs-masters, Andre Noll,
linux-raid
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/md/md.c | 16 ++++------------
1 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 26ba42a..68b52d7 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1813,15 +1813,11 @@ static void print_sb_1(struct mdp_superblock_1 *sb)
uuid = sb->set_uuid;
printk(KERN_INFO
- "md: SB: (V:%u) (F:0x%08x) Array-ID:<%02x%02x%02x%02x"
- ":%02x%02x:%02x%02x:%02x%02x:%02x%02x%02x%02x%02x%02x>\n"
+ "md: SB: (V:%u) (F:0x%08x) Array-ID:<%pU>\n"
"md: Name: \"%s\" CT:%llu\n",
le32_to_cpu(sb->major_version),
le32_to_cpu(sb->feature_map),
- uuid[0], uuid[1], uuid[2], uuid[3],
- uuid[4], uuid[5], uuid[6], uuid[7],
- uuid[8], uuid[9], uuid[10], uuid[11],
- uuid[12], uuid[13], uuid[14], uuid[15],
+ uuid,
sb->set_name,
(unsigned long long)le64_to_cpu(sb->ctime)
& MD_SUPERBLOCK_1_TIME_SEC_MASK);
@@ -1830,8 +1826,7 @@ static void print_sb_1(struct mdp_superblock_1 *sb)
printk(KERN_INFO
"md: L%u SZ%llu RD:%u LO:%u CS:%u DO:%llu DS:%llu SO:%llu"
" RO:%llu\n"
- "md: Dev:%08x UUID: %02x%02x%02x%02x:%02x%02x:%02x%02x:%02x%02x"
- ":%02x%02x%02x%02x%02x%02x\n"
+ "md: Dev:%08x UUID: %pU\n"
"md: (F:0x%08x) UT:%llu Events:%llu ResyncOffset:%llu CSUM:0x%08x\n"
"md: (MaxDev:%u) \n",
le32_to_cpu(sb->level),
@@ -1844,10 +1839,7 @@ static void print_sb_1(struct mdp_superblock_1 *sb)
(unsigned long long)le64_to_cpu(sb->super_offset),
(unsigned long long)le64_to_cpu(sb->recovery_offset),
le32_to_cpu(sb->dev_number),
- uuid[0], uuid[1], uuid[2], uuid[3],
- uuid[4], uuid[5], uuid[6], uuid[7],
- uuid[8], uuid[9], uuid[10], uuid[11],
- uuid[12], uuid[13], uuid[14], uuid[15],
+ uuid,
sb->devflags,
(unsigned long long)le64_to_cpu(sb->utime) & MD_SUPERBLOCK_1_TIME_SEC_MASK,
(unsigned long long)le64_to_cpu(sb->events),
--
1.6.3.1.10.g659a0.dirty
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 6/9] drivers/media/video/uvc: Use %pUr to print UUIDs
2009-09-29 5:01 [PATCH 0/9] Add vsprintf extension %pU to print UUID/GUIDs and use it Joe Perches
` (4 preceding siblings ...)
2009-09-29 5:01 ` [PATCH 5/9] drivers/md/md.c: Use %pU " Joe Perches
@ 2009-09-29 5:01 ` Joe Perches
2009-10-01 0:20 ` Laurent Pinchart
2009-09-29 5:01 ` [Cluster-devel] " Joe Perches
` (3 subsequent siblings)
9 siblings, 1 reply; 27+ messages in thread
From: Joe Perches @ 2009-09-29 5:01 UTC (permalink / raw)
To: linux-kernel
Cc: Adrian Hunter, Alex Elder, Artem Bityutskiy, Christoph Hellwig,
Harvey Harrison, Huang Ying, Ingo Molnar, Jeff Garzik,
Laurent Pinchart, Matt Mackall, Mauro Carvalho Chehab,
Neil Brown, Steven Whitehouse, xfs-masters, linux-media
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/media/video/uvc/uvc_ctrl.c | 69 ++++++++++++++++------------------
drivers/media/video/uvc/uvc_driver.c | 7 +--
drivers/media/video/uvc/uvcvideo.h | 10 -----
3 files changed, 35 insertions(+), 51 deletions(-)
diff --git a/drivers/media/video/uvc/uvc_ctrl.c b/drivers/media/video/uvc/uvc_ctrl.c
index c3225a5..2959e46 100644
--- a/drivers/media/video/uvc/uvc_ctrl.c
+++ b/drivers/media/video/uvc/uvc_ctrl.c
@@ -1093,8 +1093,8 @@ int uvc_xu_ctrl_query(struct uvc_video_chain *chain,
if (!found) {
uvc_trace(UVC_TRACE_CONTROL,
- "Control " UVC_GUID_FORMAT "/%u not found.\n",
- UVC_GUID_ARGS(entity->extension.guidExtensionCode),
+ "Control %pUr/%u not found.\n",
+ entity->extension.guidExtensionCode,
xctrl->selector);
return -EINVAL;
}
@@ -1171,9 +1171,9 @@ int uvc_ctrl_resume_device(struct uvc_device *dev)
(ctrl->info->flags & UVC_CONTROL_RESTORE) == 0)
continue;
- printk(KERN_INFO "restoring control " UVC_GUID_FORMAT
- "/%u/%u\n", UVC_GUID_ARGS(ctrl->info->entity),
- ctrl->info->index, ctrl->info->selector);
+ printk(KERN_INFO "restoring control %pUr/%u/%u\n",
+ ctrl->info->entity,
+ ctrl->info->index, ctrl->info->selector);
ctrl->dirty = 1;
}
@@ -1228,46 +1228,43 @@ static void uvc_ctrl_add_ctrl(struct uvc_device *dev,
dev->intfnum, info->selector, (__u8 *)&size, 2);
if (ret < 0) {
uvc_trace(UVC_TRACE_CONTROL, "GET_LEN failed on "
- "control " UVC_GUID_FORMAT "/%u (%d).\n",
- UVC_GUID_ARGS(info->entity), info->selector,
- ret);
+ "control %pUr/%u (%d).\n",
+ info->entity, info->selector, ret);
return;
}
if (info->size != le16_to_cpu(size)) {
- uvc_trace(UVC_TRACE_CONTROL, "Control " UVC_GUID_FORMAT
- "/%u size doesn't match user supplied "
- "value.\n", UVC_GUID_ARGS(info->entity),
- info->selector);
+ uvc_trace(UVC_TRACE_CONTROL,
+ "Control %pUr/%u size doesn't match user supplied value.\n",
+ info->entity, info->selector);
return;
}
ret = uvc_query_ctrl(dev, UVC_GET_INFO, ctrl->entity->id,
dev->intfnum, info->selector, &inf, 1);
if (ret < 0) {
- uvc_trace(UVC_TRACE_CONTROL, "GET_INFO failed on "
- "control " UVC_GUID_FORMAT "/%u (%d).\n",
- UVC_GUID_ARGS(info->entity), info->selector,
- ret);
+ uvc_trace(UVC_TRACE_CONTROL,
+ "GET_INFO failed on control %pUr/%u (%d).\n",
+ info->entity, info->selector, ret);
return;
}
flags = info->flags;
if (((flags & UVC_CONTROL_GET_CUR) && !(inf & (1 << 0))) ||
((flags & UVC_CONTROL_SET_CUR) && !(inf & (1 << 1)))) {
- uvc_trace(UVC_TRACE_CONTROL, "Control "
- UVC_GUID_FORMAT "/%u flags don't match "
- "supported operations.\n",
- UVC_GUID_ARGS(info->entity), info->selector);
+ uvc_trace(UVC_TRACE_CONTROL,
+ "Control %pUr/%u flags don't match supported operations.\n",
+ info->entity, info->selector);
return;
}
}
ctrl->info = info;
ctrl->data = kmalloc(ctrl->info->size * UVC_CTRL_NDATA, GFP_KERNEL);
- uvc_trace(UVC_TRACE_CONTROL, "Added control " UVC_GUID_FORMAT "/%u "
- "to device %s entity %u\n", UVC_GUID_ARGS(ctrl->info->entity),
- ctrl->info->selector, dev->udev->devpath, entity->id);
+ uvc_trace(UVC_TRACE_CONTROL,
+ "Added control %pUr/%u to device %s entity %u\n",
+ ctrl->info->entity, ctrl->info->selector,
+ dev->udev->devpath, entity->id);
}
/*
@@ -1293,17 +1290,16 @@ int uvc_ctrl_add_info(struct uvc_control_info *info)
continue;
if (ctrl->selector == info->selector) {
- uvc_trace(UVC_TRACE_CONTROL, "Control "
- UVC_GUID_FORMAT "/%u is already defined.\n",
- UVC_GUID_ARGS(info->entity), info->selector);
+ uvc_trace(UVC_TRACE_CONTROL,
+ "Control %pUr/%u is already defined.\n",
+ info->entity, info->selector);
ret = -EEXIST;
goto end;
}
if (ctrl->index == info->index) {
- uvc_trace(UVC_TRACE_CONTROL, "Control "
- UVC_GUID_FORMAT "/%u would overwrite index "
- "%d.\n", UVC_GUID_ARGS(info->entity),
- info->selector, info->index);
+ uvc_trace(UVC_TRACE_CONTROL,
+ "Control %pUr/%u would overwrite index %d.\n",
+ info->entity, info->selector, info->index);
ret = -EEXIST;
goto end;
}
@@ -1344,10 +1340,9 @@ int uvc_ctrl_add_mapping(struct uvc_control_mapping *mapping)
continue;
if (info->size * 8 < mapping->size + mapping->offset) {
- uvc_trace(UVC_TRACE_CONTROL, "Mapping '%s' would "
- "overflow control " UVC_GUID_FORMAT "/%u\n",
- mapping->name, UVC_GUID_ARGS(info->entity),
- info->selector);
+ uvc_trace(UVC_TRACE_CONTROL,
+ "Mapping '%s' would overflow control %pUr/%u\n",
+ mapping->name, info->entity, info->selector);
ret = -EOVERFLOW;
goto end;
}
@@ -1366,9 +1361,9 @@ int uvc_ctrl_add_mapping(struct uvc_control_mapping *mapping)
mapping->ctrl = info;
list_add_tail(&mapping->list, &info->mappings);
- uvc_trace(UVC_TRACE_CONTROL, "Adding mapping %s to control "
- UVC_GUID_FORMAT "/%u.\n", mapping->name,
- UVC_GUID_ARGS(info->entity), info->selector);
+ uvc_trace(UVC_TRACE_CONTROL,
+ "Adding mapping %s to control %pUr/%u.\n",
+ mapping->name, info->entity, info->selector);
ret = 0;
break;
diff --git a/drivers/media/video/uvc/uvc_driver.c b/drivers/media/video/uvc/uvc_driver.c
index 8756be5..647d0a2 100644
--- a/drivers/media/video/uvc/uvc_driver.c
+++ b/drivers/media/video/uvc/uvc_driver.c
@@ -328,11 +328,10 @@ static int uvc_parse_format(struct uvc_device *dev,
sizeof format->name);
format->fcc = fmtdesc->fcc;
} else {
- uvc_printk(KERN_INFO, "Unknown video format "
- UVC_GUID_FORMAT "\n",
- UVC_GUID_ARGS(&buffer[5]));
+ uvc_printk(KERN_INFO, "Unknown video format %pUr\n",
+ &buffer[5]);
snprintf(format->name, sizeof format->name,
- UVC_GUID_FORMAT, UVC_GUID_ARGS(&buffer[5]));
+ "%pUr", &Buffer[5]);
format->fcc = 0;
}
diff --git a/drivers/media/video/uvc/uvcvideo.h b/drivers/media/video/uvc/uvcvideo.h
index e7958aa..9f4a437 100644
--- a/drivers/media/video/uvc/uvcvideo.h
+++ b/drivers/media/video/uvc/uvcvideo.h
@@ -555,16 +555,6 @@ extern unsigned int uvc_trace_param;
#define uvc_printk(level, msg...) \
printk(level "uvcvideo: " msg)
-#define UVC_GUID_FORMAT "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-" \
- "%02x%02x%02x%02x%02x%02x"
-#define UVC_GUID_ARGS(guid) \
- (guid)[3], (guid)[2], (guid)[1], (guid)[0], \
- (guid)[5], (guid)[4], \
- (guid)[7], (guid)[6], \
- (guid)[8], (guid)[9], \
- (guid)[10], (guid)[11], (guid)[12], \
- (guid)[13], (guid)[14], (guid)[15]
-
/* --------------------------------------------------------------------------
* Internal functions.
*/
--
1.6.3.1.10.g659a0.dirty
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 7/9] fs/gfs2/sys.c: Use %pUX to print UUIDs
2009-09-29 5:01 [PATCH 0/9] Add vsprintf extension %pU to print UUID/GUIDs and use it Joe Perches
@ 2009-09-29 5:01 ` Joe Perches
2009-09-29 5:01 ` [PATCH 2/9] efi.h: Use %pUr to print UUIDs Joe Perches
` (8 subsequent siblings)
9 siblings, 0 replies; 27+ messages in thread
From: Joe Perches @ 2009-09-29 5:01 UTC (permalink / raw)
To: linux-kernel
Cc: Adrian Hunter, Alex Elder, Artem Bityutskiy, Christoph Hellwig,
Harvey Harrison, Huang Ying, Ingo Molnar, Jeff Garzik,
Laurent Pinchart, Matt Mackall, Mauro Carvalho Chehab,
Neil Brown, Steven Whitehouse, xfs-masters, Abhijith Das,
cluster-devel
Signed-off-by: Joe Perches <joe@perches.com>
---
fs/gfs2/sys.c | 16 +++-------------
1 files changed, 3 insertions(+), 13 deletions(-)
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index 4463297..56901be 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -85,11 +85,7 @@ static ssize_t uuid_show(struct gfs2_sbd *sdp, char *buf)
buf[0] = '\0';
if (!gfs2_uuid_valid(uuid))
return 0;
- return snprintf(buf, PAGE_SIZE, "%02X%02X%02X%02X-%02X%02X-"
- "%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X\n",
- uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5],
- uuid[6], uuid[7], uuid[8], uuid[9], uuid[10], uuid[11],
- uuid[12], uuid[13], uuid[14], uuid[15]);
+ return snprintf(buf, PAGE_SIZE, "%pUX\n", uuid);
}
static ssize_t freeze_show(struct gfs2_sbd *sdp, char *buf)
@@ -573,14 +569,8 @@ static int gfs2_uevent(struct kset *kset, struct kobject *kobj,
add_uevent_var(env, "LOCKPROTO=%s", sdp->sd_proto_name);
if (!sdp->sd_args.ar_spectator)
add_uevent_var(env, "JOURNALID=%u", sdp->sd_lockstruct.ls_jid);
- if (gfs2_uuid_valid(uuid)) {
- add_uevent_var(env, "UUID=%02X%02X%02X%02X-%02X%02X-%02X%02X-"
- "%02X%02X-%02X%02X%02X%02X%02X%02X",
- uuid[0], uuid[1], uuid[2], uuid[3], uuid[4],
- uuid[5], uuid[6], uuid[7], uuid[8], uuid[9],
- uuid[10], uuid[11], uuid[12], uuid[13],
- uuid[14], uuid[15]);
- }
+ if (gfs2_uuid_valid(uuid))
+ add_uevent_var(env, "UUID=%pUX", uuid);
return 0;
}
--
1.6.3.1.10.g659a0.dirty
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [Cluster-devel] [PATCH 7/9] fs/gfs2/sys.c: Use %pUX to print UUIDs
@ 2009-09-29 5:01 ` Joe Perches
0 siblings, 0 replies; 27+ messages in thread
From: Joe Perches @ 2009-09-29 5:01 UTC (permalink / raw)
To: cluster-devel.redhat.com
Signed-off-by: Joe Perches <joe@perches.com>
---
fs/gfs2/sys.c | 16 +++-------------
1 files changed, 3 insertions(+), 13 deletions(-)
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index 4463297..56901be 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -85,11 +85,7 @@ static ssize_t uuid_show(struct gfs2_sbd *sdp, char *buf)
buf[0] = '\0';
if (!gfs2_uuid_valid(uuid))
return 0;
- return snprintf(buf, PAGE_SIZE, "%02X%02X%02X%02X-%02X%02X-"
- "%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X\n",
- uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5],
- uuid[6], uuid[7], uuid[8], uuid[9], uuid[10], uuid[11],
- uuid[12], uuid[13], uuid[14], uuid[15]);
+ return snprintf(buf, PAGE_SIZE, "%pUX\n", uuid);
}
static ssize_t freeze_show(struct gfs2_sbd *sdp, char *buf)
@@ -573,14 +569,8 @@ static int gfs2_uevent(struct kset *kset, struct kobject *kobj,
add_uevent_var(env, "LOCKPROTO=%s", sdp->sd_proto_name);
if (!sdp->sd_args.ar_spectator)
add_uevent_var(env, "JOURNALID=%u", sdp->sd_lockstruct.ls_jid);
- if (gfs2_uuid_valid(uuid)) {
- add_uevent_var(env, "UUID=%02X%02X%02X%02X-%02X%02X-%02X%02X-"
- "%02X%02X-%02X%02X%02X%02X%02X%02X",
- uuid[0], uuid[1], uuid[2], uuid[3], uuid[4],
- uuid[5], uuid[6], uuid[7], uuid[8], uuid[9],
- uuid[10], uuid[11], uuid[12], uuid[13],
- uuid[14], uuid[15]);
- }
+ if (gfs2_uuid_valid(uuid))
+ add_uevent_var(env, "UUID=%pUX", uuid);
return 0;
}
--
1.6.3.1.10.g659a0.dirty
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 8/9] fs/ubifs: Use %pUX to print UUIDs
2009-09-29 5:01 [PATCH 0/9] Add vsprintf extension %pU to print UUID/GUIDs and use it Joe Perches
@ 2009-09-29 5:01 ` Joe Perches
2009-09-29 5:01 ` [PATCH 2/9] efi.h: Use %pUr to print UUIDs Joe Perches
` (8 subsequent siblings)
9 siblings, 0 replies; 27+ messages in thread
From: Joe Perches @ 2009-09-29 5:01 UTC (permalink / raw)
To: linux-kernel
Cc: Adrian Hunter, Alex Elder, Artem Bityutskiy, Christoph Hellwig,
Harvey Harrison, Huang Ying, Ingo Molnar, Jeff Garzik,
Laurent Pinchart, Matt Mackall, Mauro Carvalho Chehab,
Neil Brown, Steven Whitehouse, xfs-masters, linux-mtd
Signed-off-by: Joe Perches <joe@perches.com>
---
fs/ubifs/debug.c | 9 ++-------
fs/ubifs/super.c | 7 +------
2 files changed, 3 insertions(+), 13 deletions(-)
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c
index dbc093a..b16779e 100644
--- a/fs/ubifs/debug.c
+++ b/fs/ubifs/debug.c
@@ -350,13 +350,8 @@ void dbg_dump_node(const struct ubifs_info *c, const void *node)
le32_to_cpu(sup->fmt_version));
printk(KERN_DEBUG "\ttime_gran %u\n",
le32_to_cpu(sup->time_gran));
- printk(KERN_DEBUG "\tUUID %02X%02X%02X%02X-%02X%02X"
- "-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X\n",
- sup->uuid[0], sup->uuid[1], sup->uuid[2], sup->uuid[3],
- sup->uuid[4], sup->uuid[5], sup->uuid[6], sup->uuid[7],
- sup->uuid[8], sup->uuid[9], sup->uuid[10], sup->uuid[11],
- sup->uuid[12], sup->uuid[13], sup->uuid[14],
- sup->uuid[15]);
+ printk(KERN_DEBUG "\tUUID %pUX\n",
+ sup->uuid);
break;
}
case UBIFS_MST_NODE:
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 333e181..7d59ab7 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1393,12 +1393,7 @@ static int mount_ubifs(struct ubifs_info *c)
c->leb_size, c->leb_size >> 10);
dbg_msg("data journal heads: %d",
c->jhead_cnt - NONDATA_JHEADS_CNT);
- dbg_msg("UUID: %02X%02X%02X%02X-%02X%02X"
- "-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
- c->uuid[0], c->uuid[1], c->uuid[2], c->uuid[3],
- c->uuid[4], c->uuid[5], c->uuid[6], c->uuid[7],
- c->uuid[8], c->uuid[9], c->uuid[10], c->uuid[11],
- c->uuid[12], c->uuid[13], c->uuid[14], c->uuid[15]);
+ dbg_msg("UUID: %pUX", c->uuid);
dbg_msg("big_lpt %d", c->big_lpt);
dbg_msg("log LEBs: %d (%d - %d)",
c->log_lebs, UBIFS_LOG_LNUM, c->log_last);
--
1.6.3.1.10.g659a0.dirty
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 8/9] fs/ubifs: Use %pUX to print UUIDs
@ 2009-09-29 5:01 ` Joe Perches
0 siblings, 0 replies; 27+ messages in thread
From: Joe Perches @ 2009-09-29 5:01 UTC (permalink / raw)
To: linux-kernel
Cc: Steven Whitehouse, Artem Bityutskiy, Matt Mackall, Alex Elder,
xfs-masters, Jeff Garzik, Neil Brown, Laurent Pinchart,
linux-mtd, Huang Ying, Ingo Molnar, Adrian Hunter,
Christoph Hellwig, Mauro Carvalho Chehab, Harvey Harrison
Signed-off-by: Joe Perches <joe@perches.com>
---
fs/ubifs/debug.c | 9 ++-------
fs/ubifs/super.c | 7 +------
2 files changed, 3 insertions(+), 13 deletions(-)
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c
index dbc093a..b16779e 100644
--- a/fs/ubifs/debug.c
+++ b/fs/ubifs/debug.c
@@ -350,13 +350,8 @@ void dbg_dump_node(const struct ubifs_info *c, const void *node)
le32_to_cpu(sup->fmt_version));
printk(KERN_DEBUG "\ttime_gran %u\n",
le32_to_cpu(sup->time_gran));
- printk(KERN_DEBUG "\tUUID %02X%02X%02X%02X-%02X%02X"
- "-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X\n",
- sup->uuid[0], sup->uuid[1], sup->uuid[2], sup->uuid[3],
- sup->uuid[4], sup->uuid[5], sup->uuid[6], sup->uuid[7],
- sup->uuid[8], sup->uuid[9], sup->uuid[10], sup->uuid[11],
- sup->uuid[12], sup->uuid[13], sup->uuid[14],
- sup->uuid[15]);
+ printk(KERN_DEBUG "\tUUID %pUX\n",
+ sup->uuid);
break;
}
case UBIFS_MST_NODE:
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 333e181..7d59ab7 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1393,12 +1393,7 @@ static int mount_ubifs(struct ubifs_info *c)
c->leb_size, c->leb_size >> 10);
dbg_msg("data journal heads: %d",
c->jhead_cnt - NONDATA_JHEADS_CNT);
- dbg_msg("UUID: %02X%02X%02X%02X-%02X%02X"
- "-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
- c->uuid[0], c->uuid[1], c->uuid[2], c->uuid[3],
- c->uuid[4], c->uuid[5], c->uuid[6], c->uuid[7],
- c->uuid[8], c->uuid[9], c->uuid[10], c->uuid[11],
- c->uuid[12], c->uuid[13], c->uuid[14], c->uuid[15]);
+ dbg_msg("UUID: %pUX", c->uuid);
dbg_msg("big_lpt %d", c->big_lpt);
dbg_msg("log LEBs: %d (%d - %d)",
c->log_lebs, UBIFS_LOG_LNUM, c->log_last);
--
1.6.3.1.10.g659a0.dirty
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 9/9] fs/xfs/xfs_log_recover.c: Use %pU to print UUIDs
2009-09-29 5:01 [PATCH 0/9] Add vsprintf extension %pU to print UUID/GUIDs and use it Joe Perches
@ 2009-09-29 5:01 ` Joe Perches
2009-09-29 5:01 ` [PATCH 2/9] efi.h: Use %pUr to print UUIDs Joe Perches
` (8 subsequent siblings)
9 siblings, 0 replies; 27+ messages in thread
From: Joe Perches @ 2009-09-29 5:01 UTC (permalink / raw)
To: linux-kernel
Cc: Adrian Hunter, Alex Elder, Artem Bityutskiy, Christoph Hellwig,
Harvey Harrison, Huang Ying, Ingo Molnar, Jeff Garzik,
Laurent Pinchart, Matt Mackall, Mauro Carvalho Chehab,
Neil Brown, Steven Whitehouse, xfs-masters, Dave Chinner, xfs
Signed-off-by: Joe Perches <joe@perches.com>
---
fs/xfs/xfs_log_recover.c | 14 ++++----------
1 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 1099395..3b8e3df 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -225,16 +225,10 @@ xlog_header_check_dump(
xfs_mount_t *mp,
xlog_rec_header_t *head)
{
- int b;
-
- cmn_err(CE_DEBUG, "%s: SB : uuid = ", __func__);
- for (b = 0; b < 16; b++)
- cmn_err(CE_DEBUG, "%02x", ((__uint8_t *)&mp->m_sb.sb_uuid)[b]);
- cmn_err(CE_DEBUG, ", fmt = %d\n", XLOG_FMT);
- cmn_err(CE_DEBUG, " log : uuid = ");
- for (b = 0; b < 16; b++)
- cmn_err(CE_DEBUG, "%02x", ((__uint8_t *)&head->h_fs_uuid)[b]);
- cmn_err(CE_DEBUG, ", fmt = %d\n", be32_to_cpu(head->h_fmt));
+ cmn_err(CE_DEBUG, "%s: SB : uuid = %pU, fmt = %d\n",
+ __func__, &mp->m_sb.sb_uuid, XLOG_FMT);
+ cmn_err(CE_DEBUG, " log : uuid = %pU, fmt = %d\n",
+ &head->h_fs_uuid, be32_to_cpu(head->h_fmt));
}
#else
#define xlog_header_check_dump(mp, head)
--
1.6.3.1.10.g659a0.dirty
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 9/9] fs/xfs/xfs_log_recover.c: Use %pU to print UUIDs
@ 2009-09-29 5:01 ` Joe Perches
0 siblings, 0 replies; 27+ messages in thread
From: Joe Perches @ 2009-09-29 5:01 UTC (permalink / raw)
To: linux-kernel
Cc: xfs, Steven Whitehouse, Artem Bityutskiy, Matt Mackall,
Alex Elder, xfs-masters, Jeff Garzik, Neil Brown,
Laurent Pinchart, Huang Ying, Ingo Molnar, Adrian Hunter,
Christoph Hellwig, Mauro Carvalho Chehab, Harvey Harrison
Signed-off-by: Joe Perches <joe@perches.com>
---
fs/xfs/xfs_log_recover.c | 14 ++++----------
1 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 1099395..3b8e3df 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -225,16 +225,10 @@ xlog_header_check_dump(
xfs_mount_t *mp,
xlog_rec_header_t *head)
{
- int b;
-
- cmn_err(CE_DEBUG, "%s: SB : uuid = ", __func__);
- for (b = 0; b < 16; b++)
- cmn_err(CE_DEBUG, "%02x", ((__uint8_t *)&mp->m_sb.sb_uuid)[b]);
- cmn_err(CE_DEBUG, ", fmt = %d\n", XLOG_FMT);
- cmn_err(CE_DEBUG, " log : uuid = ");
- for (b = 0; b < 16; b++)
- cmn_err(CE_DEBUG, "%02x", ((__uint8_t *)&head->h_fs_uuid)[b]);
- cmn_err(CE_DEBUG, ", fmt = %d\n", be32_to_cpu(head->h_fmt));
+ cmn_err(CE_DEBUG, "%s: SB : uuid = %pU, fmt = %d\n",
+ __func__, &mp->m_sb.sb_uuid, XLOG_FMT);
+ cmn_err(CE_DEBUG, " log : uuid = %pU, fmt = %d\n",
+ &head->h_fs_uuid, be32_to_cpu(head->h_fmt));
}
#else
#define xlog_header_check_dump(mp, head)
--
1.6.3.1.10.g659a0.dirty
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH 0/9] Add vsprintf extension %pU to print UUID/GUIDs and use it
2009-09-29 5:01 [PATCH 0/9] Add vsprintf extension %pU to print UUID/GUIDs and use it Joe Perches
` (8 preceding siblings ...)
2009-09-29 5:01 ` Joe Perches
@ 2009-09-29 5:57 ` Huang Ying
2009-10-01 0:07 ` Laurent Pinchart
9 siblings, 1 reply; 27+ messages in thread
From: Huang Ying @ 2009-09-29 5:57 UTC (permalink / raw)
To: Joe Perches
Cc: linux-kernel, Adrian Hunter, Alex Elder, Artem Bityutskiy,
Christoph Hellwig, Harvey Harrison, Ingo Molnar, Jeff Garzik,
Laurent Pinchart, Matt Mackall, Mauro Carvalho Chehab,
Neil Brown, Steven Whitehouse, xfs-masters, Andi Kleen, Greg KH
[-- Attachment #1: Type: text/plain, Size: 731 bytes --]
Hi, Joe,
Thanks for the patch. I think that is a good idea.
For your patch. I think you need a changelog for each patch.
It seems that the binary representation of UUID can be little-endian
(used by most kernel components) or big-endian (defined by RFC4122, used
in network?). Maybe we should consider about that.
In fact, I find there are many different UUID/GUID definitions in
kernel, such as that in efi, many file systems, some drivers, etc. It
seems that every kernel components need UUID/GUID has its own
definition, so I think we should unify all the UUID/GUID definitions in
kernel too. The file attached is a draft unified UUID/GUID definition,
with byte-order issue in mind.
Any comment?
Best Regards,
Huang Ying
[-- Attachment #2: 0010-uuid.patch --]
[-- Type: text/x-patch, Size: 4528 bytes --]
From: Huang Ying <ying.huang@intel.com>
Date: Fri, 7 Aug 2009 15:03:15 +0800
Subject: [PATCH] Unified UUID/GUID definition
There are many different UUID/GUID definitions in kernel, such as that
in efi, many file systems, some drivers, etc. Every kernel components
need UUID/GUID has its own definition. This patch provides a unified
definition for UUID/GUID.
The binary representation of UUID/GUID can be little-endian (used by
EFI, etc) or big-endian (defined by RFC4122), so both is defined.
Signed-off-by: Huang Ying <ying.huang@intel.com>
---
include/linux/uuid.h | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++
lib/Makefile | 2 -
lib/uuid.c | 33 ++++++++++++++++
3 files changed, 135 insertions(+), 1 deletion(-)
create mode 100644 include/linux/uuid.h
create mode 100644 lib/uuid.c
--- /dev/null
+++ b/include/linux/uuid.h
@@ -0,0 +1,101 @@
+/*
+ * Unified UUID/GUID definition
+ *
+ * Copyright (C) 2009, Intel Corp.
+ * Huang Ying <ying.huang@intel.com>
+ *
+ * This file is released under the GPLv2.
+ */
+
+#ifndef _LINUX_UUID_H_
+#define _LINUX_UUID_H_
+
+#include <linux/types.h>
+#include <linux/string.h>
+
+typedef struct {
+ u8 b[16];
+} luuid_t;
+
+typedef struct {
+ u8 b[16];
+} buuid_t;
+
+#define LUUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
+((luuid_t) \
+{{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
+ (b) & 0xff, ((b) >> 8) & 0xff, \
+ (c) & 0xff, ((c) >> 8) & 0xff, \
+ (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
+
+#define BUUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
+((luuid_t) \
+{{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
+ ((b) >> 8) & 0xff, (b) & 0xff, \
+ ((c) >> 8) & 0xff, (c) & 0xff, \
+ (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
+
+#define NULL_UUID \
+ LUUID(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \
+ 0x00, 0x00, 0x00, 0x00)
+
+static inline int luuid_cmp(luuid_t g1, luuid_t g2)
+{
+ return memcmp(&g1, &g2, sizeof(luuid_t));
+}
+
+static inline int buuid_cmp(buuid_t g1, buuid_t g2)
+{
+ return memcmp(&g1, &g2, sizeof(buuid_t));
+}
+
+static inline char *luuid_to_str(char *str, const luuid_t *g)
+{
+ sprintf(str, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-"
+ "%02x%02x%02x%02x%02x%02x",
+ g->b[3], g->b[2], g->b[1], g->b[0],
+ g->b[5], g->b[4], g->b[7], g->b[6],
+ g->b[8], g->b[9], g->b[10], g->b[11],
+ g->b[12], g->b[13], g->b[14], g->b[15]);
+ return str;
+}
+
+static inline char *buuid_to_str(char *str, const buuid_t *g)
+{
+ sprintf(str, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-"
+ "%02x%02x%02x%02x%02x%02x",
+ g->b[0], g->b[1], g->b[2], g->b[3],
+ g->b[4], g->b[5], g->b[6], g->b[7],
+ g->b[8], g->b[9], g->b[10], g->b[11],
+ g->b[12], g->b[13], g->b[14], g->b[15]);
+ return str;
+}
+
+static inline void luuid_to_buuid(buuid_t *bg, const luuid_t *lg)
+{
+ bg->b[0] = lg->b[3];
+ bg->b[1] = lg->b[2];
+ bg->b[2] = lg->b[1];
+ bg->b[3] = lg->b[0];
+ bg->b[4] = lg->b[5];
+ bg->b[5] = lg->b[4];
+ bg->b[6] = lg->b[7];
+ bg->b[7] = lg->b[6];
+}
+
+static inline void buuid_to_luuid(luuid_t *lg, const buuid_t *bg)
+{
+ lg->b[0] = bg->b[3];
+ lg->b[1] = bg->b[2];
+ lg->b[2] = bg->b[1];
+ lg->b[3] = bg->b[0];
+ lg->b[4] = bg->b[5];
+ lg->b[5] = bg->b[4];
+ lg->b[6] = bg->b[7];
+ lg->b[7] = bg->b[6];
+}
+
+extern void luuid_gen(luuid_t *g);
+extern void buuid_gen(buuid_t *g);
+
+#endif
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -21,7 +21,7 @@ lib-y += kobject.o kref.o klist.o
obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \
bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \
- string_helpers.o gcd.o
+ string_helpers.o gcd.o uuid.o
ifeq ($(CONFIG_DEBUG_KOBJECT),y)
CFLAGS_kobject.o += -DDEBUG
--- /dev/null
+++ b/lib/uuid.c
@@ -0,0 +1,33 @@
+/*
+ * Unified UUID/GUID definition
+ *
+ * Copyright (C) 2009, Intel Corp.
+ * Huang Ying <ying.huang@intel.com>
+ *
+ * This file is released under the GPLv2.
+ */
+
+#include <linux/kernel.h>
+#include <linux/uuid.h>
+#include <linux/random.h>
+
+static void uuid_gen_common(u8 b[16])
+{
+ get_random_bytes(b, 16);
+ /* reversion 0b10 */
+ b[8] = (b[8] & 0x3F) | 0x80;
+}
+
+void luuid_gen(luuid_t *lg)
+{
+ uuid_gen_common(lg->b);
+ /* version 4 : random generation */
+ lg->b[7] = (lg->b[7] & 0x0F) | 0x40;
+}
+
+void buuid_gen(buuid_t *bg)
+{
+ uuid_gen_common(bg->b);
+ /* version 4 : random generation */
+ bg->b[6] = (bg->b[6] & 0x0F) | 0x40;
+}
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 7/9] fs/gfs2/sys.c: Use %pUX to print UUIDs
2009-09-29 5:01 ` [Cluster-devel] " Joe Perches
@ 2009-09-29 8:50 ` Steven Whitehouse
-1 siblings, 0 replies; 27+ messages in thread
From: Steven Whitehouse @ 2009-09-29 8:50 UTC (permalink / raw)
To: Joe Perches
Cc: linux-kernel, Adrian Hunter, Alex Elder, Artem Bityutskiy,
Christoph Hellwig, Harvey Harrison, Huang Ying, Ingo Molnar,
Jeff Garzik, Laurent Pinchart, Matt Mackall,
Mauro Carvalho Chehab, Neil Brown, xfs-masters, Abhijith Das,
cluster-devel
Hi,
Provided this gives identical output and people are happy with the
general concept, then:
Acked-by: Steven Whitehouse <swhiteho@redhat.com>
Looks like a nice cleanup,
Steve.
On Mon, 2009-09-28 at 22:01 -0700, Joe Perches wrote:
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> fs/gfs2/sys.c | 16 +++-------------
> 1 files changed, 3 insertions(+), 13 deletions(-)
>
> diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
> index 4463297..56901be 100644
> --- a/fs/gfs2/sys.c
> +++ b/fs/gfs2/sys.c
> @@ -85,11 +85,7 @@ static ssize_t uuid_show(struct gfs2_sbd *sdp, char *buf)
> buf[0] = '\0';
> if (!gfs2_uuid_valid(uuid))
> return 0;
> - return snprintf(buf, PAGE_SIZE, "%02X%02X%02X%02X-%02X%02X-"
> - "%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X\n",
> - uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5],
> - uuid[6], uuid[7], uuid[8], uuid[9], uuid[10], uuid[11],
> - uuid[12], uuid[13], uuid[14], uuid[15]);
> + return snprintf(buf, PAGE_SIZE, "%pUX\n", uuid);
> }
>
> static ssize_t freeze_show(struct gfs2_sbd *sdp, char *buf)
> @@ -573,14 +569,8 @@ static int gfs2_uevent(struct kset *kset, struct kobject *kobj,
> add_uevent_var(env, "LOCKPROTO=%s", sdp->sd_proto_name);
> if (!sdp->sd_args.ar_spectator)
> add_uevent_var(env, "JOURNALID=%u", sdp->sd_lockstruct.ls_jid);
> - if (gfs2_uuid_valid(uuid)) {
> - add_uevent_var(env, "UUID=%02X%02X%02X%02X-%02X%02X-%02X%02X-"
> - "%02X%02X-%02X%02X%02X%02X%02X%02X",
> - uuid[0], uuid[1], uuid[2], uuid[3], uuid[4],
> - uuid[5], uuid[6], uuid[7], uuid[8], uuid[9],
> - uuid[10], uuid[11], uuid[12], uuid[13],
> - uuid[14], uuid[15]);
> - }
> + if (gfs2_uuid_valid(uuid))
> + add_uevent_var(env, "UUID=%pUX", uuid);
> return 0;
> }
>
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Cluster-devel] Re: [PATCH 7/9] fs/gfs2/sys.c: Use %pUX to print UUIDs
@ 2009-09-29 8:50 ` Steven Whitehouse
0 siblings, 0 replies; 27+ messages in thread
From: Steven Whitehouse @ 2009-09-29 8:50 UTC (permalink / raw)
To: cluster-devel.redhat.com
Hi,
Provided this gives identical output and people are happy with the
general concept, then:
Acked-by: Steven Whitehouse <swhiteho@redhat.com>
Looks like a nice cleanup,
Steve.
On Mon, 2009-09-28 at 22:01 -0700, Joe Perches wrote:
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> fs/gfs2/sys.c | 16 +++-------------
> 1 files changed, 3 insertions(+), 13 deletions(-)
>
> diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
> index 4463297..56901be 100644
> --- a/fs/gfs2/sys.c
> +++ b/fs/gfs2/sys.c
> @@ -85,11 +85,7 @@ static ssize_t uuid_show(struct gfs2_sbd *sdp, char *buf)
> buf[0] = '\0';
> if (!gfs2_uuid_valid(uuid))
> return 0;
> - return snprintf(buf, PAGE_SIZE, "%02X%02X%02X%02X-%02X%02X-"
> - "%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X\n",
> - uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5],
> - uuid[6], uuid[7], uuid[8], uuid[9], uuid[10], uuid[11],
> - uuid[12], uuid[13], uuid[14], uuid[15]);
> + return snprintf(buf, PAGE_SIZE, "%pUX\n", uuid);
> }
>
> static ssize_t freeze_show(struct gfs2_sbd *sdp, char *buf)
> @@ -573,14 +569,8 @@ static int gfs2_uevent(struct kset *kset, struct kobject *kobj,
> add_uevent_var(env, "LOCKPROTO=%s", sdp->sd_proto_name);
> if (!sdp->sd_args.ar_spectator)
> add_uevent_var(env, "JOURNALID=%u", sdp->sd_lockstruct.ls_jid);
> - if (gfs2_uuid_valid(uuid)) {
> - add_uevent_var(env, "UUID=%02X%02X%02X%02X-%02X%02X-%02X%02X-"
> - "%02X%02X-%02X%02X%02X%02X%02X%02X",
> - uuid[0], uuid[1], uuid[2], uuid[3], uuid[4],
> - uuid[5], uuid[6], uuid[7], uuid[8], uuid[9],
> - uuid[10], uuid[11], uuid[12], uuid[13],
> - uuid[14], uuid[15]);
> - }
> + if (gfs2_uuid_valid(uuid))
> + add_uevent_var(env, "UUID=%pUX", uuid);
> return 0;
> }
>
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 8/9] fs/ubifs: Use %pUX to print UUIDs
2009-09-29 5:01 ` Joe Perches
@ 2009-09-29 12:32 ` Artem Bityutskiy
-1 siblings, 0 replies; 27+ messages in thread
From: Artem Bityutskiy @ 2009-09-29 12:32 UTC (permalink / raw)
To: Joe Perches
Cc: linux-kernel, Adrian Hunter, Alex Elder, Artem Bityutskiy,
Christoph Hellwig, Harvey Harrison, Huang Ying, Ingo Molnar,
Jeff Garzik, Laurent Pinchart, Matt Mackall,
Mauro Carvalho Chehab, Neil Brown, Steven Whitehouse,
xfs-masters, linux-mtd
On 09/29/2009 08:01 AM, Joe Perches wrote:
> Signed-off-by: Joe Perches<joe@perches.com>
> ---
> fs/ubifs/debug.c | 9 ++-------
> fs/ubifs/super.c | 7 +------
> 2 files changed, 3 insertions(+), 13 deletions(-)
Looks OK,
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 8/9] fs/ubifs: Use %pUX to print UUIDs
@ 2009-09-29 12:32 ` Artem Bityutskiy
0 siblings, 0 replies; 27+ messages in thread
From: Artem Bityutskiy @ 2009-09-29 12:32 UTC (permalink / raw)
To: Joe Perches
Cc: Steven Whitehouse, Artem Bityutskiy, Matt Mackall, Huang Ying,
linux-kernel, xfs-masters, Jeff Garzik, Neil Brown,
Laurent Pinchart, linux-mtd, Alex Elder, Ingo Molnar,
Adrian Hunter, Christoph Hellwig, Mauro Carvalho Chehab,
Harvey Harrison
On 09/29/2009 08:01 AM, Joe Perches wrote:
> Signed-off-by: Joe Perches<joe@perches.com>
> ---
> fs/ubifs/debug.c | 9 ++-------
> fs/ubifs/super.c | 7 +------
> 2 files changed, 3 insertions(+), 13 deletions(-)
Looks OK,
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 0/9] Add vsprintf extension %pU to print UUID/GUIDs and use it
2009-09-29 5:57 ` [PATCH 0/9] Add vsprintf extension %pU to print UUID/GUIDs and use it Huang Ying
@ 2009-10-01 0:07 ` Laurent Pinchart
2009-10-01 0:20 ` Joe Perches
2009-10-10 5:50 ` Huang Ying
0 siblings, 2 replies; 27+ messages in thread
From: Laurent Pinchart @ 2009-10-01 0:07 UTC (permalink / raw)
To: Huang Ying
Cc: Joe Perches, linux-kernel, Adrian Hunter, Alex Elder,
Artem Bityutskiy, Christoph Hellwig, Harvey Harrison,
Ingo Molnar, Jeff Garzik, Matt Mackall, Mauro Carvalho Chehab,
Neil Brown, Steven Whitehouse, xfs-masters, Andi Kleen, Greg KH
On Tuesday 29 September 2009 07:57:32 Huang Ying wrote:
> Hi, Joe,
>
> Thanks for the patch. I think that is a good idea.
>
> For your patch. I think you need a changelog for each patch.
>
> It seems that the binary representation of UUID can be little-endian
> (used by most kernel components) or big-endian (defined by RFC4122, used
> in network?). Maybe we should consider about that.
I think that's what the 'r' option is supposed to handle. Maybe you could use
'b' and 'l' options instead, to specify the endianness explicitly.
> In fact, I find there are many different UUID/GUID definitions in
> kernel, such as that in efi, many file systems, some drivers, etc. It
> seems that every kernel components need UUID/GUID has its own
> definition, so I think we should unify all the UUID/GUID definitions in
> kernel too. The file attached is a draft unified UUID/GUID definition,
> with byte-order issue in mind.
>
> Any comment?
Not much, it would help if you could show where those functions would be used.
I would also use the 'le' and 'be' prefixes (as in le16, be32) instead of 'l'
and 'b', making it leuuid and beuuid, or maybe uuid_le and uuid_be.
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 6/9] drivers/media/video/uvc: Use %pUr to print UUIDs
2009-09-29 5:01 ` [PATCH 6/9] drivers/media/video/uvc: Use %pUr " Joe Perches
@ 2009-10-01 0:20 ` Laurent Pinchart
2009-10-01 0:24 ` Joe Perches
0 siblings, 1 reply; 27+ messages in thread
From: Laurent Pinchart @ 2009-10-01 0:20 UTC (permalink / raw)
To: Joe Perches
Cc: linux-kernel, Adrian Hunter, Alex Elder, Artem Bityutskiy,
Christoph Hellwig, Harvey Harrison, Huang Ying, Ingo Molnar,
Jeff Garzik, Matt Mackall, Mauro Carvalho Chehab, Neil Brown,
Steven Whitehouse, xfs-masters, linux-media
Hi Joe,
thanks for the patch. A few comments below.
On Tuesday 29 September 2009 07:01:08 Joe Perches wrote:
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> drivers/media/video/uvc/uvc_ctrl.c | 69 ++++++++++++++++------------------
> drivers/media/video/uvc/uvc_driver.c | 7 +--
> drivers/media/video/uvc/uvcvideo.h | 10 -----
> 3 files changed, 35 insertions(+), 51 deletions(-)
>
> diff --git a/drivers/media/video/uvc/uvc_ctrl.c
> b/drivers/media/video/uvc/uvc_ctrl.c index c3225a5..2959e46 100644
> --- a/drivers/media/video/uvc/uvc_ctrl.c
> +++ b/drivers/media/video/uvc/uvc_ctrl.c
> @@ -1093,8 +1093,8 @@ int uvc_xu_ctrl_query(struct uvc_video_chain *chain,
>
> if (!found) {
> uvc_trace(UVC_TRACE_CONTROL,
> - "Control " UVC_GUID_FORMAT "/%u not found.\n",
> - UVC_GUID_ARGS(entity->extension.guidExtensionCode),
> + "Control %pUr/%u not found.\n",
> + entity->extension.guidExtensionCode,
> xctrl->selector);
Could you try to cut long statements in as few lines as possible ? This one
would become
uvc_trace(UVC_TRACE_CONTROL, "Control %pUr/%u not found.\n",
entity->extension.guidExtensionCode, xctrl->selector);
There are a few others that should be changed as well. If you prefer I can
apply the patch through my tree (after the printk patch goes in of course)
and handle that myself.
[snip]
> flags = info->flags;
> if (((flags & UVC_CONTROL_GET_CUR) && !(inf & (1 << 0))) ||
> ((flags & UVC_CONTROL_SET_CUR) && !(inf & (1 << 1)))) {
> - uvc_trace(UVC_TRACE_CONTROL, "Control "
> - UVC_GUID_FORMAT "/%u flags don't match "
> - "supported operations.\n",
> - UVC_GUID_ARGS(info->entity), info->selector);
> + uvc_trace(UVC_TRACE_CONTROL,
> + "Control %pUr/%u flags don't match supported operations.\n",
> + info->entity, info->selector);
This doesn't fit the 80 columns limit. Please run checkpatch.pl on your patches.
[snip]
> diff --git a/drivers/media/video/uvc/uvc_driver.c
> b/drivers/media/video/uvc/uvc_driver.c index 8756be5..647d0a2 100644
> --- a/drivers/media/video/uvc/uvc_driver.c
> +++ b/drivers/media/video/uvc/uvc_driver.c
> @@ -328,11 +328,10 @@ static int uvc_parse_format(struct uvc_device *dev,
> sizeof format->name);
> format->fcc = fmtdesc->fcc;
> } else {
> - uvc_printk(KERN_INFO, "Unknown video format "
> - UVC_GUID_FORMAT "\n",
> - UVC_GUID_ARGS(&buffer[5]));
> + uvc_printk(KERN_INFO, "Unknown video format %pUr\n",
> + &buffer[5]);
> snprintf(format->name, sizeof format->name,
> - UVC_GUID_FORMAT, UVC_GUID_ARGS(&buffer[5]));
> + "%pUr", &Buffer[5]);
Should be &buffer[5], not &Buffer[5]. You haven't compiled the patch, have
you ? :-)
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 0/9] Add vsprintf extension %pU to print UUID/GUIDs and use it
2009-10-01 0:07 ` Laurent Pinchart
@ 2009-10-01 0:20 ` Joe Perches
2009-10-10 5:50 ` Huang Ying
1 sibling, 0 replies; 27+ messages in thread
From: Joe Perches @ 2009-10-01 0:20 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Huang Ying, linux-kernel, Adrian Hunter, Alex Elder,
Artem Bityutskiy, Christoph Hellwig, Harvey Harrison,
Ingo Molnar, Jeff Garzik, Matt Mackall, Mauro Carvalho Chehab,
Neil Brown, Steven Whitehouse, xfs-masters, Andi Kleen, Greg KH
On Thu, 2009-10-01 at 02:07 +0200, Laurent Pinchart wrote:
> On Tuesday 29 September 2009 07:57:32 Huang Ying wrote:
> > It seems that the binary representation of UUID can be little-endian
> > (used by most kernel components) or big-endian (defined by RFC4122, used
> > in network?). Maybe we should consider about that.
> I think that's what the 'r' option is supposed to handle. Maybe you could use
> 'b' and 'l' options instead, to specify the endianness explicitly.
or %pUbe and $pUle.
I've no objections, whatever's clearer to most people.
> > In fact, I find there are many different UUID/GUID definitions in
> > kernel, such as that in efi, many file systems, some drivers, etc. It
> > seems that every kernel components need UUID/GUID has its own
> > definition, so I think we should unify all the UUID/GUID definitions in
> > kernel too. The file attached is a draft unified UUID/GUID definition,
> > with byte-order issue in mind.
> >
> > Any comment?
>
> Not much, it would help if you could show where those functions would be used.
>
> I would also use the 'le' and 'be' prefixes (as in le16, be32) instead of 'l'
> and 'b', making it leuuid and beuuid, or maybe uuid_le and uuid_be.
A reply might take awhile.
I believe Ying is on vacation for a week or so.
Here is the list that Ying sent me:
GUID in Linux kernel
arch/ia64/*.c: efi_guid_t
arch/x86/kernel/efi.c: efi_guid_t
fs/partitions/efi.[ch]: efi_guid_t
drivers/firmware/efivars.c: efi_guid_t
fs/partitions/ldm.[ch]: u8 [16], ldm_parse_guid,
memcmp, memcpy
fs/ntfs/layout.h: GUID
fs/cifs/cifs*.[ch]: u8 [16], memcpy
drivers/platform/x86/*wmi.c: u8[16], wmi_parse_guid
drivers/media/video/uvc/uvc*.[ch]: u8[16], constants, format
(bin-»ascii),struct initialize(!!)
drivers/net/usb/zaurus.c: u8[16]
drivers/staging/hv/*.c: hv_guid initializing,
drivers/char/ipmi/ipmi_msghandler.c: u8[16] show (sysfs)
Not standard uuid
fs/squashfs/*.[ch]: __le16
include/linux/firewire.h: unsigned long long
drivers/firewire/*.[ch]:
drivers/ieee1394/*.[ch]:
drivers/scsi/mpt2sas/mpi/mpi2_cnfg.h: u8[24]
drivers/infiniband/*.[ch]: __be64
UUID in Linux kernel
arch/arm/*/sharpsl_param.[ch]: u8[16]
arch/ia64/*/perfmon.[ch]: pfm_uuid_t=u8[16] cmp, format
arch/ia64/sn/kernel/io_acpi_init.c: acpi_vendor_uuid initializing
arch/x86/kernel/tboot.c: u8[16]
initializing,cmp
include/linux/tboot.h:
include/acpi/actbl1.h: u8[16]
include/acpi/acpi/acrestyp.h acpi_uuid=struct {u8[16]},
acpi_vendor_uuid,u8[16]
drivers/acpi/acpica/*.[ch]
drivers/acpi/pci_root.c
drivers/pnp/pnpacpi/*.[ch]
include/linux/ext2_fs.h: u8[16]
include/linux/ext3_fs.h:
fs/ext3/*.[ch]
drivers/ext4/ext4.h:
drivers/ext4/super.c:
include/linux/nfsd/nfsfh.h: u8[16]
fs/nfsd/*.c
include/linux/wlp.h: wlp_uuid=struct{u8[16]}
drivers/uwb/wlp/*.[ch]
include/linux/jbd2.h: u8[16]
include/linux/jbd.h:
include/linux/gfs2_ondisk.h: u8[16]
fs/gfs2/*.[ch]
include/linux/nilfs2_fs.h: u8[16]
fs/jfs/*.[ch]: u8[16] access
component
fs/ubifs/*.[ch]: u8[16] generate!!!
fs/xfs/support/uuid.[ch]: uuid_t=struct{u8[16]}
fs/xfs/*.[ch]
fs/ocfs2/*.[ch]: u8[16]
drivers/char/random.c: u8[16]
generate_random_uuid
include/linux/reiserfs_fs.h: u8[16]
fs/reiserfs/objectid.c:
fs/btrfs/*.[ch]: u8[16]
fs/afs/*.[ch]: afs_uuid=struct{u32,u16,xxx}
unmarshall(!!!), generate (DEC ver1 mode)
drivers/md/md.[ch]: u8[16]
generate(get_random_bytes)
drivers/md/drivers.[ch]:
Not standard UUID
include/linux/dm-ioctl.h: u8[129]
include/linux/dm-log-userspace.h:
drivers/md/dm-*.[ch]:
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 6/9] drivers/media/video/uvc: Use %pUr to print UUIDs
2009-10-01 0:20 ` Laurent Pinchart
@ 2009-10-01 0:24 ` Joe Perches
0 siblings, 0 replies; 27+ messages in thread
From: Joe Perches @ 2009-10-01 0:24 UTC (permalink / raw)
To: Laurent Pinchart
Cc: linux-kernel, Adrian Hunter, Alex Elder, Artem Bityutskiy,
Christoph Hellwig, Harvey Harrison, Huang Ying, Ingo Molnar,
Jeff Garzik, Matt Mackall, Mauro Carvalho Chehab, Neil Brown,
Steven Whitehouse, xfs-masters, linux-media
On Thu, 2009-10-01 at 02:20 +0200, Laurent Pinchart wrote:
> > flags = info->flags;
> > if (((flags & UVC_CONTROL_GET_CUR) && !(inf & (1 << 0))) ||
> > ((flags & UVC_CONTROL_SET_CUR) && !(inf & (1 << 1)))) {
> > - uvc_trace(UVC_TRACE_CONTROL, "Control "
> > - UVC_GUID_FORMAT "/%u flags don't match "
> > - "supported operations.\n",
> > - UVC_GUID_ARGS(info->entity), info->selector);
> > + uvc_trace(UVC_TRACE_CONTROL,
> > + "Control %pUr/%u flags don't match supported operations.\n",
> > + info->entity, info->selector);
>
> This doesn't fit the 80 columns limit. Please run checkpatch.pl on your patches.
Intentional. Strings shouldn't be broken across lines unnecessarily.
> > snprintf(format->name, sizeof format->name,
> > - UVC_GUID_FORMAT, UVC_GUID_ARGS(&buffer[5]));
> > + "%pUr", &Buffer[5]);
>
> Should be &buffer[5], not &Buffer[5]. You haven't compiled the patch, have
> you ? :-)
Unintentional. Did compile allyesconfig.
cheers, Joe
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 1/9] lib/vsprintf.c: Add %pU to print UUID/GUIDs
2009-09-29 5:01 ` [PATCH 1/9] lib/vsprintf.c: Add %pU to print UUID/GUIDs Joe Perches
@ 2009-10-01 7:10 ` Geert Uytterhoeven
2009-10-01 7:26 ` Joe Perches
0 siblings, 1 reply; 27+ messages in thread
From: Geert Uytterhoeven @ 2009-10-01 7:10 UTC (permalink / raw)
To: Joe Perches
Cc: linux-kernel, Adrian Hunter, Alex Elder, Artem Bityutskiy,
Christoph Hellwig, Harvey Harrison, Huang Ying, Ingo Molnar,
Jeff Garzik, Laurent Pinchart, Matt Mackall,
Mauro Carvalho Chehab, Neil Brown, Steven Whitehouse,
xfs-masters, David S. Miller
On Tue, Sep 29, 2009 at 07:01, Joe Perches <joe@perches.com> wrote:
> UUID/GUIDs are somewhat common in kernel source.
>
> Standardize the printed style of UUID/GUIDs by using
> another extension to %p.
>
> %pU: 01020304-0506-0708-090a-0b0c0d0e0f10
> %pUr: 04030201-0605-0807-090a-0b0c0d0e0f10
> %pU[r]X:Use upper case hex
To me, it looks a bit strange to have the options after the `U', combined with
the variable-length nature.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 1/9] lib/vsprintf.c: Add %pU to print UUID/GUIDs
2009-10-01 7:10 ` Geert Uytterhoeven
@ 2009-10-01 7:26 ` Joe Perches
2009-10-01 8:55 ` Geert Uytterhoeven
0 siblings, 1 reply; 27+ messages in thread
From: Joe Perches @ 2009-10-01 7:26 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: linux-kernel, Adrian Hunter, Alex Elder, Artem Bityutskiy,
Christoph Hellwig, Harvey Harrison, Huang Ying, Ingo Molnar,
Jeff Garzik, Laurent Pinchart, Matt Mackall,
Mauro Carvalho Chehab, Neil Brown, Steven Whitehouse,
xfs-masters, David S. Miller
On Thu, 2009-10-01 at 09:10 +0200, Geert Uytterhoeven wrote:
> > Standardize the printed style of UUID/GUIDs by using
> > another extension to %p.
> >
> > %pU: 01020304-0506-0708-090a-0b0c0d0e0f10
> > %pUr: 04030201-0605-0807-090a-0b0c0d0e0f10
> > %pU[r]X:Use upper case hex
>
> To me, it looks a bit strange to have the options after the `U', combined with
> the variable-length nature.
I think the whole %p<foo> mechanism is strange and takes
a bit of getting used to.
You're free to suggest alternatives.
Keep in mind expansion for future different types and that
<foo> must be alphanumeric chars only.
cheers, Joe
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 1/9] lib/vsprintf.c: Add %pU to print UUID/GUIDs
2009-10-01 7:26 ` Joe Perches
@ 2009-10-01 8:55 ` Geert Uytterhoeven
2009-10-07 0:07 ` Joe Perches
0 siblings, 1 reply; 27+ messages in thread
From: Geert Uytterhoeven @ 2009-10-01 8:55 UTC (permalink / raw)
To: Joe Perches
Cc: linux-kernel, Adrian Hunter, Alex Elder, Artem Bityutskiy,
Christoph Hellwig, Harvey Harrison, Huang Ying, Ingo Molnar,
Jeff Garzik, Laurent Pinchart, Matt Mackall,
Mauro Carvalho Chehab, Neil Brown, Steven Whitehouse,
xfs-masters, David S. Miller
On Thu, Oct 1, 2009 at 09:26, Joe Perches <joe@perches.com> wrote:
> On Thu, 2009-10-01 at 09:10 +0200, Geert Uytterhoeven wrote:
>> > Standardize the printed style of UUID/GUIDs by using
>> > another extension to %p.
>> >
>> > %pU: 01020304-0506-0708-090a-0b0c0d0e0f10
>> > %pUr: 04030201-0605-0807-090a-0b0c0d0e0f10
>> > %pU[r]X:Use upper case hex
>>
>> To me, it looks a bit strange to have the options after the `U', combined with
>> the variable-length nature.
>
> I think the whole %p<foo> mechanism is strange and takes
> a bit of getting used to.
>
> You're free to suggest alternatives.
>
> Keep in mind expansion for future different types and that
> <foo> must be alphanumeric chars only.
`r' is reverse endianness?
So what about
%pUb: lower case big endian
%pUl: lower case little endian
%pUB: upper case big endian
%pUL: upper case little endian
?
That way it's fixed length, and easier to parse.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 1/9] lib/vsprintf.c: Add %pU to print UUID/GUIDs
2009-10-01 8:55 ` Geert Uytterhoeven
@ 2009-10-07 0:07 ` Joe Perches
0 siblings, 0 replies; 27+ messages in thread
From: Joe Perches @ 2009-10-07 0:07 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: linux-kernel, Adrian Hunter, Alex Elder, Artem Bityutskiy,
Christoph Hellwig, Harvey Harrison, Huang Ying, Ingo Molnar,
Jeff Garzik, Laurent Pinchart, Matt Mackall,
Mauro Carvalho Chehab, Neil Brown, Steven Whitehouse,
xfs-masters, David S. Miller
On Thu, 2009-10-01 at 10:55 +0200, Geert Uytterhoeven wrote:
> On Thu, Oct 1, 2009 at 09:26, Joe Perches <joe@perches.com> wrote:
> > On Thu, 2009-10-01 at 09:10 +0200, Geert Uytterhoeven wrote:
> >> > Standardize the printed style of UUID/GUIDs by using
> >> > another extension to %p.
> >> > %pU: 01020304-0506-0708-090a-0b0c0d0e0f10
> >> > %pUr: 04030201-0605-0807-090a-0b0c0d0e0f10
> >> > %pU[r]X:Use upper case hex
> >> To me, it looks a bit strange to have the options after the `U', combined with
> >> the variable-length nature.
> > I think the whole %p<foo> mechanism is strange and takes
> > a bit of getting used to.
> > You're free to suggest alternatives.
> `r' is reverse endianness?
> So what about
> %pUb: lower case big endian
> %pUl: lower case little endian
> %pUB: upper case big endian
> %pUL: upper case little endian
> That way it's fixed length, and easier to parse.
Thanks Geert.
That's OK with me.
%pU now defaults to %pUb and I'll resubmit it later.
Anyone else?
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 0/9] Add vsprintf extension %pU to print UUID/GUIDs and use it
2009-10-01 0:07 ` Laurent Pinchart
2009-10-01 0:20 ` Joe Perches
@ 2009-10-10 5:50 ` Huang Ying
1 sibling, 0 replies; 27+ messages in thread
From: Huang Ying @ 2009-10-10 5:50 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Joe Perches, linux-kernel, Adrian Hunter, Alex Elder,
Artem Bityutskiy, Christoph Hellwig, Harvey Harrison,
Ingo Molnar, Jeff Garzik, Matt Mackall, Mauro Carvalho Chehab,
Neil Brown, Steven Whitehouse, xfs-masters, Andi Kleen, Greg KH
On Thu, 2009-10-01 at 08:07 +0800, Laurent Pinchart wrote:
> On Tuesday 29 September 2009 07:57:32 Huang Ying wrote:
> > Hi, Joe,
> >
> > Thanks for the patch. I think that is a good idea.
> >
> > For your patch. I think you need a changelog for each patch.
> >
> > It seems that the binary representation of UUID can be little-endian
> > (used by most kernel components) or big-endian (defined by RFC4122, used
> > in network?). Maybe we should consider about that.
>
> I think that's what the 'r' option is supposed to handle. Maybe you could use
> 'b' and 'l' options instead, to specify the endianness explicitly.
Yes. Thanks for you reminding.
> > In fact, I find there are many different UUID/GUID definitions in
> > kernel, such as that in efi, many file systems, some drivers, etc. It
> > seems that every kernel components need UUID/GUID has its own
> > definition, so I think we should unify all the UUID/GUID definitions in
> > kernel too. The file attached is a draft unified UUID/GUID definition,
> > with byte-order issue in mind.
> >
> > Any comment?
>
> Not much, it would help if you could show where those functions would be used.
>
> I would also use the 'le' and 'be' prefixes (as in le16, be32) instead of 'l'
> and 'b', making it leuuid and beuuid, or maybe uuid_le and uuid_be.
Yes. It seems 'be' and 'le' is better than 'b' an 'l'.
Best Regards,
Huang Ying
^ permalink raw reply [flat|nested] 27+ messages in thread
end of thread, other threads:[~2009-10-10 5:50 UTC | newest]
Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-29 5:01 [PATCH 0/9] Add vsprintf extension %pU to print UUID/GUIDs and use it Joe Perches
2009-09-29 5:01 ` [PATCH 1/9] lib/vsprintf.c: Add %pU to print UUID/GUIDs Joe Perches
2009-10-01 7:10 ` Geert Uytterhoeven
2009-10-01 7:26 ` Joe Perches
2009-10-01 8:55 ` Geert Uytterhoeven
2009-10-07 0:07 ` Joe Perches
2009-09-29 5:01 ` [PATCH 2/9] efi.h: Use %pUr to print UUIDs Joe Perches
2009-09-29 5:01 ` [PATCH 3/9] random.c: Use %pU " Joe Perches
2009-09-29 5:01 ` [PATCH 4/9] drivers/firmware/dmi_scan.c: Use %pUX " Joe Perches
2009-09-29 5:01 ` [PATCH 5/9] drivers/md/md.c: Use %pU " Joe Perches
2009-09-29 5:01 ` [PATCH 6/9] drivers/media/video/uvc: Use %pUr " Joe Perches
2009-10-01 0:20 ` Laurent Pinchart
2009-10-01 0:24 ` Joe Perches
2009-09-29 5:01 ` [PATCH 7/9] fs/gfs2/sys.c: Use %pUX " Joe Perches
2009-09-29 5:01 ` [Cluster-devel] " Joe Perches
2009-09-29 8:50 ` Steven Whitehouse
2009-09-29 8:50 ` [Cluster-devel] " Steven Whitehouse
2009-09-29 5:01 ` [PATCH 8/9] fs/ubifs: " Joe Perches
2009-09-29 5:01 ` Joe Perches
2009-09-29 12:32 ` Artem Bityutskiy
2009-09-29 12:32 ` Artem Bityutskiy
2009-09-29 5:01 ` [PATCH 9/9] fs/xfs/xfs_log_recover.c: Use %pU " Joe Perches
2009-09-29 5:01 ` Joe Perches
2009-09-29 5:57 ` [PATCH 0/9] Add vsprintf extension %pU to print UUID/GUIDs and use it Huang Ying
2009-10-01 0:07 ` Laurent Pinchart
2009-10-01 0:20 ` Joe Perches
2009-10-10 5:50 ` Huang Ying
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.