aboutsummaryrefslogtreecommitdiff
path: root/util-linux/mount.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-07-24 15:54:42 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-07-24 15:54:42 +0000
commit990d0f63eeb502c8762076e5c5499196e09cba55 (patch)
tree30a2091a8159b1694d65f9952e2aba2667d7dc11 /util-linux/mount.c
parentbcb66ec22e82f6b1ab93f3aec917269393a5b464 (diff)
downloadbusybox-w32-990d0f63eeb502c8762076e5c5499196e09cba55.tar.gz
busybox-w32-990d0f63eeb502c8762076e5c5499196e09cba55.tar.bz2
busybox-w32-990d0f63eeb502c8762076e5c5499196e09cba55.zip
Replace index_in_[sub]str_array with index_in_[sub]strings,
which scans thru "abc\0def\0123\0\0" type strings. Saves 250 bytes. text data bss dec hex filename 781266 1328 11844 794438 c1f46 busybox_old 781010 1328 11844 794182 c1e46 busybox_unstripped
Diffstat (limited to '')
-rw-r--r--util-linux/mount.c76
1 files changed, 36 insertions, 40 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 4dd1a85a2..7ee24ca14 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -888,33 +888,31 @@ static int nfsmount(struct mntent *mp, int vfsflags, char *filteropts)
888 if (filteropts) for (opt = strtok(filteropts, ","); opt; opt = strtok(NULL, ",")) { 888 if (filteropts) for (opt = strtok(filteropts, ","); opt; opt = strtok(NULL, ",")) {
889 char *opteq = strchr(opt, '='); 889 char *opteq = strchr(opt, '=');
890 if (opteq) { 890 if (opteq) {
891 static const char *const options[] = { 891 static const char options[] =
892 /* 0 */ "rsize", 892 /* 0 */ "rsize\0"
893 /* 1 */ "wsize", 893 /* 1 */ "wsize\0"
894 /* 2 */ "timeo", 894 /* 2 */ "timeo\0"
895 /* 3 */ "retrans", 895 /* 3 */ "retrans\0"
896 /* 4 */ "acregmin", 896 /* 4 */ "acregmin\0"
897 /* 5 */ "acregmax", 897 /* 5 */ "acregmax\0"
898 /* 6 */ "acdirmin", 898 /* 6 */ "acdirmin\0"
899 /* 7 */ "acdirmax", 899 /* 7 */ "acdirmax\0"
900 /* 8 */ "actimeo", 900 /* 8 */ "actimeo\0"
901 /* 9 */ "retry", 901 /* 9 */ "retry\0"
902 /* 10 */ "port", 902 /* 10 */ "port\0"
903 /* 11 */ "mountport", 903 /* 11 */ "mountport\0"
904 /* 12 */ "mounthost", 904 /* 12 */ "mounthost\0"
905 /* 13 */ "mountprog", 905 /* 13 */ "mountprog\0"
906 /* 14 */ "mountvers", 906 /* 14 */ "mountvers\0"
907 /* 15 */ "nfsprog", 907 /* 15 */ "nfsprog\0"
908 /* 16 */ "nfsvers", 908 /* 16 */ "nfsvers\0"
909 /* 17 */ "vers", 909 /* 17 */ "vers\0"
910 /* 18 */ "proto", 910 /* 18 */ "proto\0"
911 /* 19 */ "namlen", 911 /* 19 */ "namlen\0"
912 /* 20 */ "addr", 912 /* 20 */ "addr\0";
913 NULL
914 };
915 int val = xatoi_u(opteq + 1); 913 int val = xatoi_u(opteq + 1);
916 *opteq = '\0'; 914 *opteq = '\0';
917 switch (index_in_str_array(options, opt)) { 915 switch (index_in_strings(options, opt)) {
918 case 0: // "rsize" 916 case 0: // "rsize"
919 data.rsize = val; 917 data.rsize = val;
920 break; 918 break;
@@ -993,26 +991,24 @@ static int nfsmount(struct mntent *mp, int vfsflags, char *filteropts)
993 } 991 }
994 } 992 }
995 else { 993 else {
996 static const char *const options[] = { 994 static const char options[] =
997 "bg", 995 "bg\0"
998 "fg", 996 "fg\0"
999 "soft", 997 "soft\0"
1000 "hard", 998 "hard\0"
1001 "intr", 999 "intr\0"
1002 "posix", 1000 "posix\0"
1003 "cto", 1001 "cto\0"
1004 "ac", 1002 "ac\0"
1005 "tcp", 1003 "tcp\0"
1006 "udp", 1004 "udp\0"
1007 "lock", 1005 "lock\0";
1008 NULL
1009 };
1010 int val = 1; 1006 int val = 1;
1011 if (!strncmp(opt, "no", 2)) { 1007 if (!strncmp(opt, "no", 2)) {
1012 val = 0; 1008 val = 0;
1013 opt += 2; 1009 opt += 2;
1014 } 1010 }
1015 switch (index_in_str_array(options, opt)) { 1011 switch (index_in_strings(options, opt)) {
1016 case 0: // "bg" 1012 case 0: // "bg"
1017 bg = val; 1013 bg = val;
1018 break; 1014 break;