aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2009-10-26 23:27:04 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2009-10-27 17:12:26 +0100
commit6531f0923bc3c288291aa979a0e06daab964f008 (patch)
treebe107a25d49bc056dacf459a44838ac787306937 /util-linux
parentb35e3a8612ae10391e3f72ba90a4ca9e7180a9d2 (diff)
downloadbusybox-w32-6531f0923bc3c288291aa979a0e06daab964f008.tar.gz
busybox-w32-6531f0923bc3c288291aa979a0e06daab964f008.tar.bz2
busybox-w32-6531f0923bc3c288291aa979a0e06daab964f008.zip
mdev: tiny shrinkage by index_in_strings
text data bss dec hex filename 2633 0 0 2633 a49 util-linux/mdev.o.old 2624 0 0 2624 a40 util-linux/mdev.o Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/mdev.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index 2ac15e762..d0aafac6e 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -526,6 +526,9 @@ int mdev_main(int argc UNUSED_PARAM, char **argv)
526 char *seq; 526 char *seq;
527 char *action; 527 char *action;
528 char *env_path; 528 char *env_path;
529 static const char keywords[] ALIGN1 = "remove\0add\0";
530 enum { OP_remove = 0, OP_add };
531 smalluint op;
529 532
530 /* Hotplug: 533 /* Hotplug:
531 * env ACTION=... DEVPATH=... SUBSYSTEM=... [SEQNUM=...] mdev 534 * env ACTION=... DEVPATH=... SUBSYSTEM=... [SEQNUM=...] mdev
@@ -538,7 +541,7 @@ int mdev_main(int argc UNUSED_PARAM, char **argv)
538 if (!action || !env_path /*|| !subsystem*/) 541 if (!action || !env_path /*|| !subsystem*/)
539 bb_show_usage(); 542 bb_show_usage();
540 fw = getenv("FIRMWARE"); 543 fw = getenv("FIRMWARE");
541 544 op = index_in_strings(keywords, action);
542 /* If it exists, does /dev/mdev.seq match $SEQNUM? 545 /* If it exists, does /dev/mdev.seq match $SEQNUM?
543 * If it does not match, earlier mdev is running 546 * If it does not match, earlier mdev is running
544 * in parallel, and we need to wait */ 547 * in parallel, and we need to wait */
@@ -565,14 +568,14 @@ int mdev_main(int argc UNUSED_PARAM, char **argv)
565 } 568 }
566 569
567 snprintf(temp, PATH_MAX, "/sys%s", env_path); 570 snprintf(temp, PATH_MAX, "/sys%s", env_path);
568 if (strcmp(action, "remove") == 0) { 571 if (op == OP_remove) {
569 /* Ignoring "remove firmware". It was reported 572 /* Ignoring "remove firmware". It was reported
570 * to happen and to cause erroneous deletion 573 * to happen and to cause erroneous deletion
571 * of device nodes. */ 574 * of device nodes. */
572 if (!fw) 575 if (!fw)
573 make_device(temp, 1); 576 make_device(temp, 1);
574 } 577 }
575 else if (strcmp(action, "add") == 0) { 578 else if (op == OP_add) {
576 make_device(temp, 0); 579 make_device(temp, 0);
577 if (ENABLE_FEATURE_MDEV_LOAD_FIRMWARE) { 580 if (ENABLE_FEATURE_MDEV_LOAD_FIRMWARE) {
578 if (fw) 581 if (fw)