From: Thomas De Schampheleire <patrickdepinguin+buildroot@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] makedevs: fix cases where (start != 0)
Date: Tue, 22 Feb 2011 17:30:14 +0100 [thread overview]
Message-ID: <4D63E496.8020704@gmail.com> (raw)
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>
diff --git a/package/makedevs/makedevs.c b/package/makedevs/makedevs.c
--- a/package/makedevs/makedevs.c
+++ b/package/makedevs/makedevs.c
@@ -345,14 +345,22 @@
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 @@
char *full_name_inc;
full_name_inc = xmalloc(strlen(full_name) + 8);
- for (i = start; i < count; i++) {
+ for (i = start; i < start + count; i++) {
sprintf(full_name_inc, "%s%d", full_name, i);
- rdev = makedev(major, minor + (i * increment - start));
+ rdev = makedev(major, minor + ((i - start) * 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;
next reply other threads:[~2011-02-22 16:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-22 16:30 Thomas De Schampheleire [this message]
2011-02-22 22:31 ` [Buildroot] [PATCH] makedevs: fix cases where (start != 0) Peter Korsgaard
2011-02-23 7:35 ` Thomas De Schampheleire
2011-02-23 16:44 ` [Buildroot] [PATCH v2] " Thomas De Schampheleire
2011-02-23 22:37 ` Peter Korsgaard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D63E496.8020704@gmail.com \
--to=patrickdepinguin+buildroot@gmail.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.