From: Peter Korsgaard <jacmet@uclibc.org>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] makedevs: fix cases where (start != 0)
Date: Tue, 22 Feb 2011 23:31:01 +0100 [thread overview]
Message-ID: <87tyfvn1lm.fsf@macbook.be.48ers.dk> (raw)
In-Reply-To: <4D63E496.8020704@gmail.com> (Thomas De Schampheleire's message of "Tue, 22 Feb 2011 17:30:14 +0100")
>>>>> "Thomas" == Thomas De Schampheleire <patrickdepinguin+buildroot@gmail.com> writes:
Thomas> The makedevs script did not always generate the requested set of device names / minor number series.
Thomas> * If start != 0, then requesting (count) devices would generate only (count - start)
Thomas> * If start != 0 && increment != 1, then requesting minors starting with (minor) would generate minors starting with (minor + (start * (increment - 1)))
Thomas> This patch fixes the code and updates the usage text with extra examples.
Good catch, thanks!
Thomas> full_name_inc = xmalloc(strlen(full_name) + 8);
Thomas> - for (i = start; i < count; i++) {
Thomas> + for (i = start; i < start + count; i++) {
Thomas> sprintf(full_name_inc, "%s%d", full_name, i);
Thomas> - rdev = makedev(major, minor + (i * increment - start));
Thomas> + rdev = makedev(major, minor + ((i - start) * increment));
It looks like the logic would be simplified some by using:
for (i=0; i < count; i++) {
Care to rework the patch to do that instead?
You could argue if it makes more sense to use start or minor in the
makedevs call - They should be the same, but perhaps it would be cleaner
to use the same everywhere instead of this mix.
--
Bye, Peter Korsgaard
next prev parent reply other threads:[~2011-02-22 22:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-22 16:30 [Buildroot] [PATCH] makedevs: fix cases where (start != 0) Thomas De Schampheleire
2011-02-22 22:31 ` Peter Korsgaard [this message]
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=87tyfvn1lm.fsf@macbook.be.48ers.dk \
--to=jacmet@uclibc.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox