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
This commit is contained in:
Denis Vlasenko 2008-07-19 22:40:30 +00:00
parent 2e157ddf9e
commit c29684afd6

View File

@ -701,7 +701,8 @@ enum {
NFS_MOUNT_TCP = 0x0040, /* 2 */
NFS_MOUNT_VER3 = 0x0080, /* 3 */
NFS_MOUNT_KERBEROS = 0x0100, /* 3 */
NFS_MOUNT_NONLM = 0x0200 /* 3 */
NFS_MOUNT_NONLM = 0x0200, /* 3 */
NFS_MOUNT_NORDIRPLUS = 0x4000
};
@ -896,18 +897,16 @@ get_mountport(struct pmap *pm_mnt,
#if BB_MMU
static int daemonize(void)
{
int fd;
int pid = fork();
if (pid < 0) /* error */
return -errno;
if (pid > 0) /* parent */
return 0;
/* child */
fd = xopen(bb_dev_null, O_RDWR);
dup2(fd, 0);
dup2(fd, 1);
dup2(fd, 2);
while (fd > 2) close(fd--);
close(0);
xopen(bb_dev_null, O_RDWR);
xdup2(0, 1);
xdup2(0, 2);
setsid();
openlog(applet_name, LOG_PID, LOG_DAEMON);
logmode = LOGMODE_SYSLOG;
@ -959,23 +958,25 @@ static int nfsmount(struct mntent *mp, long vfsflags, char *filteropts)
int mountport;
int proto;
#if BB_MMU
int bg = 0;
smallint bg = 0;
#else
enum { bg = 0 };
#endif
int soft;
int intr;
int posix;
int nocto;
int noac;
int nolock;
int retry;
int tcp;
int mountprog;
int mountvers;
int nfsprog;
int nfsvers;
int retval;
/* these all are one-bit really. 4.3.1 likes this combination: */
smallint tcp;
smallint soft;
int intr;
int posix;
int nocto;
int noac;
int nordirplus;
int nolock;
find_kernel_nfs_mount_version();
@ -1036,12 +1037,12 @@ static int nfsmount(struct mntent *mp, long vfsflags, char *filteropts)
* let the kernel decide.
* timeo is filled in after we know whether it'll be TCP or UDP. */
memset(&data, 0, sizeof(data));
data.retrans = 3;
data.acregmin = 3;
data.acregmax = 60;
data.acdirmin = 30;
data.acdirmax = 60;
data.namlen = NAME_MAX;
data.retrans = 3;
data.acregmin = 3;
data.acregmax = 60;
data.acdirmin = 30;
data.acdirmax = 60;
data.namlen = NAME_MAX;
soft = 0;
intr = 0;
@ -1049,6 +1050,7 @@ static int nfsmount(struct mntent *mp, long vfsflags, char *filteropts)
nocto = 0;
nolock = 0;
noac = 0;
nordirplus = 0;
retry = 10000; /* 10000 minutes ~ 1 week */
tcp = 0;
@ -1183,7 +1185,8 @@ static int nfsmount(struct mntent *mp, long vfsflags, char *filteropts)
"ac\0"
"tcp\0"
"udp\0"
"lock\0";
"lock\0"
"rdirplus\0";
int val = 1;
if (!strncmp(opt, "no", 2)) {
val = 0;
@ -1230,6 +1233,9 @@ static int nfsmount(struct mntent *mp, long vfsflags, char *filteropts)
else
bb_error_msg("warning: option nolock is not supported");
break;
case 11: //rdirplus
nordirplus = !val;
break;
default:
bb_error_msg("unknown nfs mount option: %s%s", val ? "" : "no", opt);
goto fail;
@ -1242,7 +1248,8 @@ static int nfsmount(struct mntent *mp, long vfsflags, char *filteropts)
| (intr ? NFS_MOUNT_INTR : 0)
| (posix ? NFS_MOUNT_POSIX : 0)
| (nocto ? NFS_MOUNT_NOCTO : 0)
| (noac ? NFS_MOUNT_NOAC : 0);
| (noac ? NFS_MOUNT_NOAC : 0)
| (nordirplus ? NFS_MOUNT_NORDIRPLUS : 0);
if (nfs_mount_version >= 2)
data.flags |= (tcp ? NFS_MOUNT_TCP : 0);
if (nfs_mount_version >= 3)
@ -1325,6 +1332,7 @@ static int nfsmount(struct mntent *mp, long vfsflags, char *filteropts)
retry_timeout.tv_usec = 0;
total_timeout.tv_sec = 20;
total_timeout.tv_usec = 0;
//FIXME: use monotonic()?
timeout = time(NULL) + 60 * retry;
prevt = 0;
t = 30;
@ -1511,7 +1519,7 @@ static int nfsmount(struct mntent *mp, long vfsflags, char *filteropts)
if (!daemonized) {
daemonized = daemonize();
if (daemonized <= 0) { /* parent or error */
// FIXME: parent doesn't close fsock - ??!
// FIXME: parent doesn't close fsock - ??!
retval = -daemonized;
goto ret;
}