diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-19 22:40:30 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-19 22:40:30 +0000 |
commit | c29684afd61b841c93517f378aaa1fd7750b038d (patch) | |
tree | e81d504576ca4e4b8338b577e4e4f93381e17fcf | |
parent | 2e157ddf9ecd9d58864425f0e87409ddc218df94 (diff) | |
download | busybox-w32-c29684afd61b841c93517f378aaa1fd7750b038d.tar.gz busybox-w32-c29684afd61b841c93517f378aaa1fd7750b038d.tar.bz2 busybox-w32-c29684afd61b841c93517f378aaa1fd7750b038d.zip |
mount: support nfs mount option nordiplus.
By Octavian Purdila <opurdila AT ixiacom.com>
function old new delta
static.options 272 281 +9
daemonize 130 107 -23
singlemount 4674 4579 -95
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 9/-118) Total: -109 bytes
-rw-r--r-- | util-linux/mount.c | 56 |
1 files changed, 32 insertions, 24 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c index 9f9249f0a..31f433b3c 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
@@ -701,7 +701,8 @@ enum { | |||
701 | NFS_MOUNT_TCP = 0x0040, /* 2 */ | 701 | NFS_MOUNT_TCP = 0x0040, /* 2 */ |
702 | NFS_MOUNT_VER3 = 0x0080, /* 3 */ | 702 | NFS_MOUNT_VER3 = 0x0080, /* 3 */ |
703 | NFS_MOUNT_KERBEROS = 0x0100, /* 3 */ | 703 | NFS_MOUNT_KERBEROS = 0x0100, /* 3 */ |
704 | NFS_MOUNT_NONLM = 0x0200 /* 3 */ | 704 | NFS_MOUNT_NONLM = 0x0200, /* 3 */ |
705 | NFS_MOUNT_NORDIRPLUS = 0x4000 | ||
705 | }; | 706 | }; |
706 | 707 | ||
707 | 708 | ||
@@ -896,18 +897,16 @@ get_mountport(struct pmap *pm_mnt, | |||
896 | #if BB_MMU | 897 | #if BB_MMU |
897 | static int daemonize(void) | 898 | static int daemonize(void) |
898 | { | 899 | { |
899 | int fd; | ||
900 | int pid = fork(); | 900 | int pid = fork(); |
901 | if (pid < 0) /* error */ | 901 | if (pid < 0) /* error */ |
902 | return -errno; | 902 | return -errno; |
903 | if (pid > 0) /* parent */ | 903 | if (pid > 0) /* parent */ |
904 | return 0; | 904 | return 0; |
905 | /* child */ | 905 | /* child */ |
906 | fd = xopen(bb_dev_null, O_RDWR); | 906 | close(0); |
907 | dup2(fd, 0); | 907 | xopen(bb_dev_null, O_RDWR); |
908 | dup2(fd, 1); | 908 | xdup2(0, 1); |
909 | dup2(fd, 2); | 909 | xdup2(0, 2); |
910 | while (fd > 2) close(fd--); | ||
911 | setsid(); | 910 | setsid(); |
912 | openlog(applet_name, LOG_PID, LOG_DAEMON); | 911 | openlog(applet_name, LOG_PID, LOG_DAEMON); |
913 | logmode = LOGMODE_SYSLOG; | 912 | logmode = LOGMODE_SYSLOG; |
@@ -959,23 +958,25 @@ static int nfsmount(struct mntent *mp, long vfsflags, char *filteropts) | |||
959 | int mountport; | 958 | int mountport; |
960 | int proto; | 959 | int proto; |
961 | #if BB_MMU | 960 | #if BB_MMU |
962 | int bg = 0; | 961 | smallint bg = 0; |
963 | #else | 962 | #else |
964 | enum { bg = 0 }; | 963 | enum { bg = 0 }; |
965 | #endif | 964 | #endif |
966 | int soft; | ||
967 | int intr; | ||
968 | int posix; | ||
969 | int nocto; | ||
970 | int noac; | ||
971 | int nolock; | ||
972 | int retry; | 965 | int retry; |
973 | int tcp; | ||
974 | int mountprog; | 966 | int mountprog; |
975 | int mountvers; | 967 | int mountvers; |
976 | int nfsprog; | 968 | int nfsprog; |
977 | int nfsvers; | 969 | int nfsvers; |
978 | int retval; | 970 | int retval; |
971 | /* these all are one-bit really. 4.3.1 likes this combination: */ | ||
972 | smallint tcp; | ||
973 | smallint soft; | ||
974 | int intr; | ||
975 | int posix; | ||
976 | int nocto; | ||
977 | int noac; | ||
978 | int nordirplus; | ||
979 | int nolock; | ||
979 | 980 | ||
980 | find_kernel_nfs_mount_version(); | 981 | find_kernel_nfs_mount_version(); |
981 | 982 | ||
@@ -1036,12 +1037,12 @@ static int nfsmount(struct mntent *mp, long vfsflags, char *filteropts) | |||
1036 | * let the kernel decide. | 1037 | * let the kernel decide. |
1037 | * timeo is filled in after we know whether it'll be TCP or UDP. */ | 1038 | * timeo is filled in after we know whether it'll be TCP or UDP. */ |
1038 | memset(&data, 0, sizeof(data)); | 1039 | memset(&data, 0, sizeof(data)); |
1039 | data.retrans = 3; | 1040 | data.retrans = 3; |
1040 | data.acregmin = 3; | 1041 | data.acregmin = 3; |
1041 | data.acregmax = 60; | 1042 | data.acregmax = 60; |
1042 | data.acdirmin = 30; | 1043 | data.acdirmin = 30; |
1043 | data.acdirmax = 60; | 1044 | data.acdirmax = 60; |
1044 | data.namlen = NAME_MAX; | 1045 | data.namlen = NAME_MAX; |
1045 | 1046 | ||
1046 | soft = 0; | 1047 | soft = 0; |
1047 | intr = 0; | 1048 | intr = 0; |
@@ -1049,6 +1050,7 @@ static int nfsmount(struct mntent *mp, long vfsflags, char *filteropts) | |||
1049 | nocto = 0; | 1050 | nocto = 0; |
1050 | nolock = 0; | 1051 | nolock = 0; |
1051 | noac = 0; | 1052 | noac = 0; |
1053 | nordirplus = 0; | ||
1052 | retry = 10000; /* 10000 minutes ~ 1 week */ | 1054 | retry = 10000; /* 10000 minutes ~ 1 week */ |
1053 | tcp = 0; | 1055 | tcp = 0; |
1054 | 1056 | ||
@@ -1183,7 +1185,8 @@ static int nfsmount(struct mntent *mp, long vfsflags, char *filteropts) | |||
1183 | "ac\0" | 1185 | "ac\0" |
1184 | "tcp\0" | 1186 | "tcp\0" |
1185 | "udp\0" | 1187 | "udp\0" |
1186 | "lock\0"; | 1188 | "lock\0" |
1189 | "rdirplus\0"; | ||
1187 | int val = 1; | 1190 | int val = 1; |
1188 | if (!strncmp(opt, "no", 2)) { | 1191 | if (!strncmp(opt, "no", 2)) { |
1189 | val = 0; | 1192 | val = 0; |
@@ -1230,6 +1233,9 @@ static int nfsmount(struct mntent *mp, long vfsflags, char *filteropts) | |||
1230 | else | 1233 | else |
1231 | bb_error_msg("warning: option nolock is not supported"); | 1234 | bb_error_msg("warning: option nolock is not supported"); |
1232 | break; | 1235 | break; |
1236 | case 11: //rdirplus | ||
1237 | nordirplus = !val; | ||
1238 | break; | ||
1233 | default: | 1239 | default: |
1234 | bb_error_msg("unknown nfs mount option: %s%s", val ? "" : "no", opt); | 1240 | bb_error_msg("unknown nfs mount option: %s%s", val ? "" : "no", opt); |
1235 | goto fail; | 1241 | goto fail; |
@@ -1242,7 +1248,8 @@ static int nfsmount(struct mntent *mp, long vfsflags, char *filteropts) | |||
1242 | | (intr ? NFS_MOUNT_INTR : 0) | 1248 | | (intr ? NFS_MOUNT_INTR : 0) |
1243 | | (posix ? NFS_MOUNT_POSIX : 0) | 1249 | | (posix ? NFS_MOUNT_POSIX : 0) |
1244 | | (nocto ? NFS_MOUNT_NOCTO : 0) | 1250 | | (nocto ? NFS_MOUNT_NOCTO : 0) |
1245 | | (noac ? NFS_MOUNT_NOAC : 0); | 1251 | | (noac ? NFS_MOUNT_NOAC : 0) |
1252 | | (nordirplus ? NFS_MOUNT_NORDIRPLUS : 0); | ||
1246 | if (nfs_mount_version >= 2) | 1253 | if (nfs_mount_version >= 2) |
1247 | data.flags |= (tcp ? NFS_MOUNT_TCP : 0); | 1254 | data.flags |= (tcp ? NFS_MOUNT_TCP : 0); |
1248 | if (nfs_mount_version >= 3) | 1255 | if (nfs_mount_version >= 3) |
@@ -1325,6 +1332,7 @@ static int nfsmount(struct mntent *mp, long vfsflags, char *filteropts) | |||
1325 | retry_timeout.tv_usec = 0; | 1332 | retry_timeout.tv_usec = 0; |
1326 | total_timeout.tv_sec = 20; | 1333 | total_timeout.tv_sec = 20; |
1327 | total_timeout.tv_usec = 0; | 1334 | total_timeout.tv_usec = 0; |
1335 | //FIXME: use monotonic()? | ||
1328 | timeout = time(NULL) + 60 * retry; | 1336 | timeout = time(NULL) + 60 * retry; |
1329 | prevt = 0; | 1337 | prevt = 0; |
1330 | t = 30; | 1338 | t = 30; |
@@ -1511,7 +1519,7 @@ static int nfsmount(struct mntent *mp, long vfsflags, char *filteropts) | |||
1511 | if (!daemonized) { | 1519 | if (!daemonized) { |
1512 | daemonized = daemonize(); | 1520 | daemonized = daemonize(); |
1513 | if (daemonized <= 0) { /* parent or error */ | 1521 | if (daemonized <= 0) { /* parent or error */ |
1514 | // FIXME: parent doesn't close fsock - ??! | 1522 | // FIXME: parent doesn't close fsock - ??! |
1515 | retval = -daemonized; | 1523 | retval = -daemonized; |
1516 | goto ret; | 1524 | goto ret; |
1517 | } | 1525 | } |