[PATCH] Use decimal instead of hex for EDD values

Patrick J. LoPresti
2004-06-02T23:53:29Z

[-- Attachment #1: Type: text/plain, Size: 816 bytes --]

Matt Domsch <Matt_Domsch@dell.com> writes:

> Whatever, scanf works with either representation. Patrick, if
> you're changing the above, feel free to submit a second patch to
> switch these all to %u instead.

OK, the attached patch causes the EDD module to export numeric values
as decimal instead of hex, with two exceptions. I left "version"
alone since 0x21 (for example) actually means version 2.1. And I left
"mbr_signature" alone since hex seems the more natural representation
for something which is literally just a sequence of four bytes.

So this patch changes default_cylinders, default_heads,
default_sectors_per_track, legacy_max_cylinder, legacy_max_head,
legacy_sectors_per_track, and sectors to decimal. It depends upon the
other patch I just sent (renaming the three legacy_* fields).

- Pat

[-- Attachment #2: edd_decimal.txt --]
[-- Type: text/plain, Size: 1697 bytes --]

--- linux-2.6.6-renamed/drivers/firmware/edd.c 2004-06-02 19:17:26.000000000 -0400
+++ linux-2.6.6/drivers/firmware/edd.c 2004-06-02 19:42:25.000000000 -0400
@@ -344,7 +344,7 @@
if (!info || !buf)
return -EINVAL;

- p += snprintf(p, left, "0x%x\n", info->legacy_max_cylinder);
+ p += snprintf(p, left, "%u\n", info->legacy_max_cylinder);
return (p - buf);
}

@@ -359,7 +359,7 @@
if (!info || !buf)
return -EINVAL;

- p += snprintf(p, left, "0x%x\n", info->legacy_max_head);
+ p += snprintf(p, left, "%u\n", info->legacy_max_head);
return (p - buf);
}

@@ -374,7 +374,7 @@
if (!info || !buf)
return -EINVAL;

- p += snprintf(p, left, "0x%x\n", info->legacy_sectors_per_track);
+ p += snprintf(p, left, "%u\n", info->legacy_sectors_per_track);
return (p - buf);
}

@@ -389,7 +389,7 @@
if (!info || !buf)
return -EINVAL;

- p += scnprintf(p, left, "0x%x\n", info->params.num_default_cylinders);
+ p += scnprintf(p, left, "%u\n", info->params.num_default_cylinders);
return (p - buf);
}

@@ -404,7 +404,7 @@
if (!info || !buf)
return -EINVAL;

- p += scnprintf(p, left, "0x%x\n", info->params.num_default_heads);
+ p += scnprintf(p, left, "%u\n", info->params.num_default_heads);
return (p - buf);
}

@@ -419,7 +419,7 @@
if (!info || !buf)
return -EINVAL;

- p += scnprintf(p, left, "0x%x\n", info->params.sectors_per_track);
+ p += scnprintf(p, left, "%u\n", info->params.sectors_per_track);
return (p - buf);
}

@@ -434,7 +434,7 @@
if (!info || !buf)
return -EINVAL;

- p += scnprintf(p, left, "0x%llx\n", info->params.number_of_sectors);
+ p += scnprintf(p, left, "%llu\n", info->params.number_of_sectors);
return (p - buf);
}