summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorThomas De Schampheleire <patrickdepinguin+buildroot@gmail.com>2011-02-23 17:44:41 +0100
committerPeter Korsgaard <jacmet@sunsite.dk>2011-02-23 23:37:36 +0100
commita85971a68b6661327e21f44ce50925b220997dbb (patch)
treeecdffabb47dba84c6d007f105fbda0a9fc5f7910 /package
parentd17c1652808829bfc354683854c7170b90f7f127 (diff)
makedevs: fix cases where (start != 0)
The makedevs script did not always generate the requested set of device names / minor number series. * If start != 0, then requesting (count) devices would generate only (count - start) * If start != 0 && increment != 1, then requesting minors starting with (minor) would generate minors starting with (minor + (start * (increment - 1))) This patch fixes the code and updates the usage text with extra examples. Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Diffstat (limited to 'package')
-rw-r--r--package/makedevs/makedevs.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/package/makedevs/makedevs.c b/package/makedevs/makedevs.c
index a0e745037..79cfc609b 100644
--- a/package/makedevs/makedevs.c
+++ b/package/makedevs/makedevs.c
@@ -345,14 +345,22 @@ void bb_show_usage(void)
fprintf(stderr, "/dev/null c 666 0 0 1 3 0 0 -\n");
fprintf(stderr, "/dev/zero c 666 0 0 1 5 0 0 -\n");
fprintf(stderr, "/dev/hda b 640 0 0 3 0 0 0 -\n");
- fprintf(stderr, "/dev/hda b 640 0 0 3 1 1 1 15\n\n");
+ fprintf(stderr, "/dev/hda b 640 0 0 3 1 1 1 15\n");
+ fprintf(stderr, "/dev/rtp b 640 0 0 250 0 0 1 5\n");
+ fprintf(stderr, "/dev/gps b 640 0 0 251 0 1 1 5\n");
+ fprintf(stderr, "/dev/uio b 640 0 0 252 0 1 2 5\n");
+ fprintf(stderr, "/dev/uio b 640 0 0 252 1 6 2 5\n\n");
fprintf(stderr, "Will Produce:\n");
fprintf(stderr, "/dev\n");
fprintf(stderr, "/dev/console\n");
fprintf(stderr, "/dev/null\n");
fprintf(stderr, "/dev/zero\n");
fprintf(stderr, "/dev/hda\n");
- fprintf(stderr, "/dev/hda[0-15]\n");
+ fprintf(stderr, "/dev/hda[1-15] with minor numbers [1-15]\n");
+ fprintf(stderr, "/dev/rtp[0-4] with minor numbers [0-4]\n");
+ fprintf(stderr, "/dev/gps[1-5] with minor numbers [0-4]\n");
+ fprintf(stderr, "/dev/uio[1-5] with minor numbers 0,2,4,6,8\n");
+ fprintf(stderr, "/dev/uio[6-10] with minor numbers 1,3,5,7,9\n");
exit(1);
}
@@ -489,9 +497,9 @@ int main(int argc, char **argv)
char *full_name_inc;
full_name_inc = xmalloc(strlen(full_name) + 8);
- for (i = start; i < count; i++) {
- sprintf(full_name_inc, "%s%d", full_name, i);
- rdev = makedev(major, minor + (i * increment - start));
+ for (i = 0; i < count; i++) {
+ sprintf(full_name_inc, "%s%d", full_name, start + i);
+ rdev = makedev(major, minor + i * increment);
if (mknod(full_name_inc, mode, rdev) == -1) {
bb_perror_msg("line %d: Couldnt create node %s", linenum, full_name_inc);
ret = EXIT_FAILURE;