Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 174742
b: refs/heads/master
c: c91d337
h: refs/heads/master
v: v3
  • Loading branch information
Bjorn Helgaas authored and Jesse Barnes committed Nov 4, 2009
1 parent 7062a02 commit c895619
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2840537228fba95e05cab1a6b5719c61982db279
refs/heads/master: c91d3376e5f4277173a22f0ef9989125c318bacb
31 changes: 21 additions & 10 deletions trunk/lib/vsprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,26 +604,37 @@ static char *resource_string(char *buf, char *end, struct resource *res,
#ifndef MEM_RSRC_PRINTK_SIZE
#define MEM_RSRC_PRINTK_SIZE 10
#endif
struct printf_spec num_spec = {
struct printf_spec hex_spec = {
.base = 16,
.precision = -1,
.flags = SPECIAL | SMALL | ZEROPAD,
};
/* room for the actual numbers, the two "0x", -, [, ] and the final zero */
char sym[4*sizeof(resource_size_t) + 8];
struct printf_spec dec_spec = {
.base = 10,
.precision = -1,
.flags = 0,
};
/* room for two actual numbers (decimal or hex), the two "0x", -, [, ]
* and the final zero */
char sym[2*3*sizeof(resource_size_t) + 8];
char *p = sym, *pend = sym + sizeof(sym);
int size = -1;
int size = -1, addr = 0;

if (res->flags & IORESOURCE_IO)
if (res->flags & IORESOURCE_IO) {
size = IO_RSRC_PRINTK_SIZE;
else if (res->flags & IORESOURCE_MEM)
addr = 1;
} else if (res->flags & IORESOURCE_MEM) {
size = MEM_RSRC_PRINTK_SIZE;
addr = 1;
}

*p++ = '[';
num_spec.field_width = size;
p = number(p, pend, res->start, num_spec);
*p++ = '-';
p = number(p, pend, res->end, num_spec);
hex_spec.field_width = size;
p = number(p, pend, res->start, addr ? hex_spec : dec_spec);
if (res->start != res->end) {
*p++ = '-';
p = number(p, pend, res->end, addr ? hex_spec : dec_spec);
}
*p++ = ']';
*p = 0;

Expand Down

0 comments on commit c895619

Please sign in to comment.