1999-12-14 22:35:36 +00:00
|
|
|
/* $NetBSD: osf1_mount.c,v 1.7 1998/05/20 16:34:29 chs Exp $ */
|
2005-01-05 20:05:52 +00:00
|
|
|
/*-
|
1999-12-14 22:35:36 +00:00
|
|
|
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Author: Chris G. Demetriou
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify and distribute this software and
|
|
|
|
* its documentation is hereby granted, provided that both the copyright
|
|
|
|
* notice and this permission notice appear in all copies of the
|
|
|
|
* software, derivative works or modified versions, and any portions
|
|
|
|
* thereof, and that both notices appear in supporting documentation.
|
|
|
|
*
|
|
|
|
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
|
|
|
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
|
|
|
|
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
|
|
|
*
|
|
|
|
* Carnegie Mellon requests users of this software to return to
|
|
|
|
*
|
|
|
|
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
|
|
|
* School of Computer Science
|
|
|
|
* Carnegie Mellon University
|
|
|
|
* Pittsburgh PA 15213-3890
|
|
|
|
*
|
|
|
|
* any improvements or extensions that they make and grant Carnegie the
|
|
|
|
* rights to redistribute these changes.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* Additional Copyright (c) 1999 by Andrew Gallatin
|
|
|
|
*/
|
|
|
|
|
2003-06-10 17:10:18 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
2002-08-12 01:16:55 +00:00
|
|
|
#include "opt_mac.h"
|
1999-12-14 22:35:36 +00:00
|
|
|
#include "opt_nfs.h"
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/sysproto.h>
|
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/sysctl.h>
|
|
|
|
#include <sys/file.h>
|
|
|
|
#include <sys/filedesc.h>
|
|
|
|
#include <sys/vnode.h>
|
2002-08-12 01:16:55 +00:00
|
|
|
#include <sys/mac.h>
|
1999-12-14 22:35:36 +00:00
|
|
|
#include <sys/malloc.h>
|
|
|
|
#include <sys/mount.h>
|
|
|
|
#include <sys/proc.h>
|
2005-05-22 22:23:37 +00:00
|
|
|
#include <sys/jail.h>
|
1999-12-14 22:35:36 +00:00
|
|
|
#include <sys/mbuf.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <sys/socketvar.h>
|
|
|
|
#include <sys/domain.h>
|
|
|
|
#include <sys/protosw.h>
|
- Implement osf1_emul_find() using kern_alternate_path(). This changes
the semantics in that the returned filename to use is now a kernel
pointer rather than a user space pointer. This required changing the
arguments to the CHECKALT*() macros some and changing the various system
calls that used pathnames to use the kern_foo() functions that can accept
kernel space filename pointers instead of calling the system call
directly.
- Use kern_open(), kern_stat(), kern_lstat(), kern_fstat(), kern_access(),
kern_truncate(), kern_pathconf(), kern_execve(), kern_select(),
kern_setitimer(), kern_getitimer(), kern_statfs(), and kern_fstatfs().
Silence on: alpha@
2005-02-18 18:37:26 +00:00
|
|
|
#include <sys/syscallsubr.h>
|
1999-12-14 22:35:36 +00:00
|
|
|
#include <sys/namei.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <netinet/tcp.h>
|
|
|
|
#include <nfs/xdr_subs.h>
|
|
|
|
#include <nfs/rpcv2.h>
|
|
|
|
#include <nfs/nfsproto.h>
|
2003-11-16 21:53:05 +00:00
|
|
|
#include <rpc/rpcclnt.h>
|
2001-09-20 04:56:42 +00:00
|
|
|
#include <nfsclient/nfs.h>
|
|
|
|
#include <nfsclient/nfsmount.h>
|
|
|
|
#include <nfsclient/nfsargs.h>
|
1999-12-14 22:35:36 +00:00
|
|
|
|
|
|
|
#include <sys/sysent.h>
|
|
|
|
#include <alpha/osf1/osf1_signal.h>
|
|
|
|
#include <alpha/osf1/osf1_proto.h>
|
|
|
|
#include <alpha/osf1/osf1_syscall.h>
|
|
|
|
#include <alpha/osf1/osf1_util.h>
|
|
|
|
#include <alpha/osf1/osf1.h>
|
|
|
|
|
|
|
|
|
2002-03-20 18:58:47 +00:00
|
|
|
void bsd2osf_statfs(struct statfs *, struct osf1_statfs *);
|
|
|
|
int osf1_mount_mfs(struct thread *, struct osf1_mount_args *,
|
|
|
|
struct mount_args *);
|
|
|
|
int osf1_mount_nfs(struct thread *, struct osf1_mount_args *,
|
|
|
|
struct mount_args *);
|
1999-12-14 22:35:36 +00:00
|
|
|
|
|
|
|
#ifdef notanymore
|
|
|
|
static const char *fsnames[OSF1_MOUNT_MAXTYPE+2] = INITMOUNTNAMES;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void
|
|
|
|
bsd2osf_statfs(bsfs, osfs)
|
|
|
|
struct statfs *bsfs;
|
|
|
|
struct osf1_statfs *osfs;
|
|
|
|
{
|
|
|
|
|
|
|
|
#ifdef notanymore
|
|
|
|
bzero(osfs, sizeof (struct osf1_statfs));
|
|
|
|
if (!strncmp(fsnames[MOUNT_UFS], bsfs->f_fstypename, MFSNAMELEN))
|
|
|
|
osfs->f_type = OSF1_MOUNT_UFS;
|
|
|
|
else if (!strncmp(fsnames[MOUNT_NFS], bsfs->f_fstypename, MFSNAMELEN))
|
|
|
|
osfs->f_type = OSF1_MOUNT_NFS;
|
|
|
|
else if (!strncmp(fsnames[MOUNT_MFS], bsfs->f_fstypename, MFSNAMELEN))
|
|
|
|
osfs->f_type = OSF1_MOUNT_MFS;
|
|
|
|
else
|
|
|
|
/* uh oh... XXX = PC, CDFS, PROCFS, etc. */
|
|
|
|
osfs->f_type = OSF1_MOUNT_ADDON;
|
|
|
|
osfs->f_flags = bsfs->f_flags; /* XXX translate */
|
|
|
|
osfs->f_fsize = bsfs->f_bsize;
|
|
|
|
osfs->f_bsize = bsfs->f_iosize;
|
|
|
|
osfs->f_blocks = bsfs->f_blocks;
|
|
|
|
osfs->f_bfree = bsfs->f_bfree;
|
|
|
|
osfs->f_bavail = bsfs->f_bavail;
|
|
|
|
osfs->f_files = bsfs->f_files;
|
|
|
|
osfs->f_ffree = bsfs->f_ffree;
|
|
|
|
bcopy(&bsfs->f_fsid, &osfs->f_fsid,
|
|
|
|
max(sizeof bsfs->f_fsid, sizeof osfs->f_fsid));
|
|
|
|
/* osfs->f_spare zeroed above */
|
|
|
|
bcopy(bsfs->f_mntonname, osfs->f_mntonname,
|
|
|
|
max(sizeof bsfs->f_mntonname, sizeof osfs->f_mntonname));
|
|
|
|
bcopy(bsfs->f_mntfromname, osfs->f_mntfromname,
|
|
|
|
max(sizeof bsfs->f_mntfromname, sizeof osfs->f_mntfromname));
|
|
|
|
/* XXX osfs->f_xxx should be filled in... */
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-09-20 04:56:42 +00:00
|
|
|
osf1_statfs(td, uap)
|
|
|
|
struct thread *td;
|
1999-12-14 22:35:36 +00:00
|
|
|
struct osf1_statfs_args *uap;
|
|
|
|
{
|
|
|
|
struct osf1_statfs osfs;
|
- Implement osf1_emul_find() using kern_alternate_path(). This changes
the semantics in that the returned filename to use is now a kernel
pointer rather than a user space pointer. This required changing the
arguments to the CHECKALT*() macros some and changing the various system
calls that used pathnames to use the kern_foo() functions that can accept
kernel space filename pointers instead of calling the system call
directly.
- Use kern_open(), kern_stat(), kern_lstat(), kern_fstat(), kern_access(),
kern_truncate(), kern_pathconf(), kern_execve(), kern_select(),
kern_setitimer(), kern_getitimer(), kern_statfs(), and kern_fstatfs().
Silence on: alpha@
2005-02-18 18:37:26 +00:00
|
|
|
struct statfs sf;
|
|
|
|
int error;
|
1999-12-14 22:35:36 +00:00
|
|
|
|
- Implement osf1_emul_find() using kern_alternate_path(). This changes
the semantics in that the returned filename to use is now a kernel
pointer rather than a user space pointer. This required changing the
arguments to the CHECKALT*() macros some and changing the various system
calls that used pathnames to use the kern_foo() functions that can accept
kernel space filename pointers instead of calling the system call
directly.
- Use kern_open(), kern_stat(), kern_lstat(), kern_fstat(), kern_access(),
kern_truncate(), kern_pathconf(), kern_execve(), kern_select(),
kern_setitimer(), kern_getitimer(), kern_statfs(), and kern_fstatfs().
Silence on: alpha@
2005-02-18 18:37:26 +00:00
|
|
|
error = kern_statfs(td, uap->path, UIO_USERSPACE, &sf);
|
2002-08-12 01:16:55 +00:00
|
|
|
if (error)
|
|
|
|
return (error);
|
- Implement osf1_emul_find() using kern_alternate_path(). This changes
the semantics in that the returned filename to use is now a kernel
pointer rather than a user space pointer. This required changing the
arguments to the CHECKALT*() macros some and changing the various system
calls that used pathnames to use the kern_foo() functions that can accept
kernel space filename pointers instead of calling the system call
directly.
- Use kern_open(), kern_stat(), kern_lstat(), kern_fstat(), kern_access(),
kern_truncate(), kern_pathconf(), kern_execve(), kern_select(),
kern_setitimer(), kern_getitimer(), kern_statfs(), and kern_fstatfs().
Silence on: alpha@
2005-02-18 18:37:26 +00:00
|
|
|
bsd2osf_statfs(&sf, &osfs);
|
|
|
|
return (copyout(&osfs, uap->buf, min(sizeof osfs, uap->len)));
|
1999-12-14 22:35:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-09-20 04:56:42 +00:00
|
|
|
osf1_fstatfs(td, uap)
|
|
|
|
struct thread *td;
|
1999-12-14 22:35:36 +00:00
|
|
|
struct osf1_fstatfs_args *uap;
|
|
|
|
{
|
|
|
|
struct osf1_statfs osfs;
|
- Implement osf1_emul_find() using kern_alternate_path(). This changes
the semantics in that the returned filename to use is now a kernel
pointer rather than a user space pointer. This required changing the
arguments to the CHECKALT*() macros some and changing the various system
calls that used pathnames to use the kern_foo() functions that can accept
kernel space filename pointers instead of calling the system call
directly.
- Use kern_open(), kern_stat(), kern_lstat(), kern_fstat(), kern_access(),
kern_truncate(), kern_pathconf(), kern_execve(), kern_select(),
kern_setitimer(), kern_getitimer(), kern_statfs(), and kern_fstatfs().
Silence on: alpha@
2005-02-18 18:37:26 +00:00
|
|
|
struct statfs sf;
|
|
|
|
int error;
|
1999-12-14 22:35:36 +00:00
|
|
|
|
- Implement osf1_emul_find() using kern_alternate_path(). This changes
the semantics in that the returned filename to use is now a kernel
pointer rather than a user space pointer. This required changing the
arguments to the CHECKALT*() macros some and changing the various system
calls that used pathnames to use the kern_foo() functions that can accept
kernel space filename pointers instead of calling the system call
directly.
- Use kern_open(), kern_stat(), kern_lstat(), kern_fstat(), kern_access(),
kern_truncate(), kern_pathconf(), kern_execve(), kern_select(),
kern_setitimer(), kern_getitimer(), kern_statfs(), and kern_fstatfs().
Silence on: alpha@
2005-02-18 18:37:26 +00:00
|
|
|
error = kern_fstatfs(td, uap->fd, &sf);
|
2002-01-13 11:58:06 +00:00
|
|
|
if (error)
|
1999-12-14 22:35:36 +00:00
|
|
|
return (error);
|
- Implement osf1_emul_find() using kern_alternate_path(). This changes
the semantics in that the returned filename to use is now a kernel
pointer rather than a user space pointer. This required changing the
arguments to the CHECKALT*() macros some and changing the various system
calls that used pathnames to use the kern_foo() functions that can accept
kernel space filename pointers instead of calling the system call
directly.
- Use kern_open(), kern_stat(), kern_lstat(), kern_fstat(), kern_access(),
kern_truncate(), kern_pathconf(), kern_execve(), kern_select(),
kern_setitimer(), kern_getitimer(), kern_statfs(), and kern_fstatfs().
Silence on: alpha@
2005-02-18 18:37:26 +00:00
|
|
|
bsd2osf_statfs(&sf, &osfs);
|
|
|
|
return (copyout(&osfs, uap->buf, min(sizeof osfs, uap->len)));
|
1999-12-14 22:35:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-09-20 05:15:04 +00:00
|
|
|
osf1_getfsstat(td, uap)
|
|
|
|
struct thread *td;
|
1999-12-14 22:35:36 +00:00
|
|
|
register struct osf1_getfsstat_args *uap;
|
|
|
|
{
|
|
|
|
long count, error, maxcount;
|
|
|
|
caddr_t osf_sfsp;
|
|
|
|
struct mount *mp, *nmp;
|
2005-05-22 22:20:46 +00:00
|
|
|
struct statfs *sp, sb;
|
1999-12-14 22:35:36 +00:00
|
|
|
struct osf1_statfs osfs;
|
|
|
|
|
2002-12-14 01:56:26 +00:00
|
|
|
if (uap->flags & ~OSF1_GETFSSTAT_FLAGS)
|
1999-12-14 22:35:36 +00:00
|
|
|
return (EINVAL);
|
|
|
|
|
2002-12-14 01:56:26 +00:00
|
|
|
maxcount = uap->bufsize / sizeof(struct osf1_statfs);
|
|
|
|
osf_sfsp = (caddr_t)uap->buf;
|
1999-12-14 22:35:36 +00:00
|
|
|
for (count = 0, mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) {
|
|
|
|
nmp = TAILQ_NEXT(mp, mnt_list);
|
|
|
|
if (osf_sfsp && count < maxcount) {
|
2005-05-22 22:20:46 +00:00
|
|
|
if (!prison_check_mount(td->td_ucred, mp))
|
|
|
|
continue;
|
2002-08-12 01:16:55 +00:00
|
|
|
#ifdef MAC
|
2005-05-22 22:20:46 +00:00
|
|
|
if (mac_check_mount_stat(td->td_ucred, mp) != 0)
|
2002-08-12 01:16:55 +00:00
|
|
|
continue;
|
|
|
|
#endif
|
1999-12-14 22:35:36 +00:00
|
|
|
sp = &mp->mnt_stat;
|
|
|
|
/*
|
|
|
|
* If OSF1_MNT_NOWAIT is specified, do not refresh the
|
|
|
|
* fsstat cache. OSF1_MNT_WAIT overrides
|
|
|
|
* OSF1_MNT_NOWAIT.
|
|
|
|
*/
|
2002-12-14 01:56:26 +00:00
|
|
|
if (((uap->flags & OSF1_MNT_NOWAIT) == 0 ||
|
|
|
|
(uap->flags & OSF1_MNT_WAIT)) &&
|
2001-09-20 05:15:04 +00:00
|
|
|
(error = VFS_STATFS(mp, sp, td)))
|
1999-12-14 22:35:36 +00:00
|
|
|
continue;
|
|
|
|
sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
|
2005-05-22 22:20:46 +00:00
|
|
|
if (suser(td)) {
|
|
|
|
bcopy(sp, &sb, sizeof(sb));
|
|
|
|
sb.f_fsid.val[0] = sb.f_fsid.val[1] = 0;
|
|
|
|
sp = &sb;
|
|
|
|
}
|
1999-12-14 22:35:36 +00:00
|
|
|
bsd2osf_statfs(sp, &osfs);
|
|
|
|
if ((error = copyout(&osfs, osf_sfsp,
|
|
|
|
sizeof (struct osf1_statfs))))
|
|
|
|
return (error);
|
|
|
|
osf_sfsp += sizeof (struct osf1_statfs);
|
|
|
|
}
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
if (osf_sfsp && count > maxcount)
|
2001-09-20 04:56:42 +00:00
|
|
|
td->td_retval[0] = maxcount;
|
1999-12-14 22:35:36 +00:00
|
|
|
else
|
2001-09-20 04:56:42 +00:00
|
|
|
td->td_retval[0] = count;
|
1999-12-14 22:35:36 +00:00
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-09-20 05:15:04 +00:00
|
|
|
osf1_unmount(td, uap)
|
|
|
|
struct thread *td;
|
1999-12-14 22:35:36 +00:00
|
|
|
struct osf1_unmount_args *uap;
|
|
|
|
{
|
|
|
|
struct unmount_args a;
|
|
|
|
|
2002-12-14 01:56:26 +00:00
|
|
|
a.path = uap->path;
|
1999-12-14 22:35:36 +00:00
|
|
|
|
2002-12-14 01:56:26 +00:00
|
|
|
if (uap->flags & ~OSF1_UNMOUNT_FLAGS)
|
1999-12-14 22:35:36 +00:00
|
|
|
return (EINVAL);
|
2002-12-14 01:56:26 +00:00
|
|
|
a.flags = 0;
|
|
|
|
if ((uap->flags & OSF1_MNT_FORCE) &&
|
|
|
|
(uap->flags & OSF1_MNT_NOFORCE) == 0)
|
|
|
|
a.flags |= MNT_FORCE;
|
1999-12-14 22:35:36 +00:00
|
|
|
|
2001-09-20 05:15:04 +00:00
|
|
|
return unmount(td, &a);
|
1999-12-14 22:35:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-09-20 05:15:04 +00:00
|
|
|
osf1_mount(td, uap)
|
|
|
|
struct thread *td;
|
1999-12-14 22:35:36 +00:00
|
|
|
struct osf1_mount_args *uap;
|
|
|
|
{
|
|
|
|
int error;
|
|
|
|
struct mount_args a;
|
|
|
|
|
2002-12-14 01:56:26 +00:00
|
|
|
a.path = uap->path;
|
1999-12-14 22:35:36 +00:00
|
|
|
|
2002-12-14 01:56:26 +00:00
|
|
|
if (uap->flags & ~OSF1_MOUNT_FLAGS)
|
1999-12-14 22:35:36 +00:00
|
|
|
return (EINVAL);
|
2002-12-14 01:56:26 +00:00
|
|
|
a.flags = uap->flags; /* XXX - xlate */
|
1999-12-14 22:35:36 +00:00
|
|
|
|
2002-12-14 01:56:26 +00:00
|
|
|
switch (uap->type) {
|
1999-12-14 22:35:36 +00:00
|
|
|
case OSF1_MOUNT_UFS: /* XXX */
|
|
|
|
return (EINVAL);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OSF1_MOUNT_NFS: /* XXX */
|
2001-09-20 05:15:04 +00:00
|
|
|
if ((error = osf1_mount_nfs(td, uap, &a)))
|
1999-12-14 22:35:36 +00:00
|
|
|
return error;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OSF1_MOUNT_MFS: /* XXX */
|
|
|
|
#ifdef notyet
|
2001-09-20 05:15:04 +00:00
|
|
|
if ((error = osf1_mount_mfs(td, uap, &a)))
|
1999-12-14 22:35:36 +00:00
|
|
|
return error;
|
|
|
|
#endif
|
|
|
|
return EINVAL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OSF1_MOUNT_CDFS: /* XXX */
|
|
|
|
return (EINVAL);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OSF1_MOUNT_PROCFS: /* XXX */
|
|
|
|
return (EINVAL);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OSF1_MOUNT_NONE:
|
|
|
|
case OSF1_MOUNT_PC:
|
|
|
|
case OSF1_MOUNT_S5FS:
|
|
|
|
case OSF1_MOUNT_DFS:
|
|
|
|
case OSF1_MOUNT_EFS:
|
|
|
|
case OSF1_MOUNT_MSFS:
|
|
|
|
case OSF1_MOUNT_FFM:
|
|
|
|
case OSF1_MOUNT_FDFS:
|
|
|
|
case OSF1_MOUNT_ADDON:
|
|
|
|
default:
|
|
|
|
return (EINVAL);
|
|
|
|
}
|
|
|
|
|
2001-09-20 05:15:04 +00:00
|
|
|
return mount(td, &a);
|
1999-12-14 22:35:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-09-20 05:15:04 +00:00
|
|
|
osf1_mount_mfs(td, osf_argp, bsd_argp)
|
|
|
|
struct thread *td;
|
1999-12-14 22:35:36 +00:00
|
|
|
struct osf1_mount_args *osf_argp;
|
|
|
|
struct mount_args *bsd_argp;
|
|
|
|
{
|
|
|
|
#ifdef notyet
|
|
|
|
int error, len;
|
|
|
|
caddr_t sg;
|
|
|
|
static const char mfs_name[] = "mfs";
|
|
|
|
struct osf1_mfs_args osf_ma;
|
|
|
|
struct mfs_args bsd_ma;
|
|
|
|
|
|
|
|
sg = stackgap_init();
|
|
|
|
|
2002-12-14 01:56:26 +00:00
|
|
|
if ((error = copyin(osf_argp->data, &osf_ma, sizeof osf_ma)))
|
1999-12-14 22:35:36 +00:00
|
|
|
return error;
|
|
|
|
|
|
|
|
bzero(&bsd_ma, sizeof bsd_ma);
|
|
|
|
bsd_ma.fspec = osf_ma.name;
|
|
|
|
/* XXX export args */
|
|
|
|
bsd_ma.base = osf_ma.base;
|
|
|
|
bsd_ma.size = osf_ma.size;
|
|
|
|
|
2002-12-14 01:56:26 +00:00
|
|
|
bsd_argp->data = stackgap_alloc(&sg, sizeof bsd_ma);
|
|
|
|
if ((error = copyout(&bsd_ma, bsd_argp->data, sizeof bsd_ma)))
|
1999-12-14 22:35:36 +00:00
|
|
|
return error;
|
|
|
|
|
|
|
|
len = strlen(mfs_name) + 1;
|
2002-12-14 01:56:26 +00:00
|
|
|
bsd_argp->type = stackgap_alloc(&sg, len);
|
|
|
|
if ((error = copyout(mfs_name, (void *)bsd_argp->type, len)))
|
1999-12-14 22:35:36 +00:00
|
|
|
return error;
|
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-09-20 05:15:04 +00:00
|
|
|
osf1_mount_nfs(td, osf_argp, bsd_argp)
|
|
|
|
struct thread *td;
|
1999-12-14 22:35:36 +00:00
|
|
|
struct osf1_mount_args *osf_argp;
|
|
|
|
struct mount_args *bsd_argp;
|
|
|
|
{
|
|
|
|
int error, len;
|
|
|
|
caddr_t sg;
|
|
|
|
static const char nfs_name[] = "nfs";
|
|
|
|
struct osf1_nfs_args osf_na;
|
|
|
|
struct nfs_args bsd_na;
|
|
|
|
|
|
|
|
sg = stackgap_init();
|
|
|
|
|
2002-12-14 01:56:26 +00:00
|
|
|
if ((error = copyin(osf_argp->data, &osf_na, sizeof osf_na)))
|
1999-12-14 22:35:36 +00:00
|
|
|
return error;
|
|
|
|
|
|
|
|
bzero(&bsd_na, sizeof bsd_na);
|
|
|
|
bsd_na.addr = (struct sockaddr *)osf_na.addr;
|
|
|
|
bsd_na.addrlen = sizeof (struct sockaddr_in);
|
|
|
|
bsd_na.sotype = SOCK_DGRAM;
|
|
|
|
bsd_na.proto = 0;
|
|
|
|
bsd_na.fh = osf_na.fh;
|
|
|
|
|
|
|
|
if (osf_na.flags & ~OSF1_NFSMNT_FLAGS)
|
|
|
|
return EINVAL;
|
|
|
|
if (osf_na.flags & OSF1_NFSMNT_SOFT)
|
|
|
|
bsd_na.flags |= NFSMNT_SOFT;
|
|
|
|
if (osf_na.flags & OSF1_NFSMNT_WSIZE) {
|
|
|
|
bsd_na.wsize = osf_na.wsize;
|
|
|
|
bsd_na.flags |= NFSMNT_WSIZE;
|
|
|
|
}
|
|
|
|
if (osf_na.flags & OSF1_NFSMNT_RSIZE) {
|
|
|
|
bsd_na.rsize = osf_na.rsize;
|
|
|
|
bsd_na.flags |= NFSMNT_RSIZE;
|
|
|
|
}
|
|
|
|
if (osf_na.flags & OSF1_NFSMNT_TIMEO) {
|
|
|
|
bsd_na.timeo = osf_na.timeo;
|
|
|
|
bsd_na.flags |= NFSMNT_TIMEO;
|
|
|
|
}
|
|
|
|
if (osf_na.flags & OSF1_NFSMNT_RETRANS) {
|
|
|
|
bsd_na.retrans = osf_na.retrans;
|
|
|
|
bsd_na.flags |= NFSMNT_RETRANS;
|
|
|
|
}
|
|
|
|
if (osf_na.flags & OSF1_NFSMNT_HOSTNAME)
|
|
|
|
bsd_na.hostname = osf_na.hostname;
|
|
|
|
if (osf_na.flags & OSF1_NFSMNT_INT)
|
|
|
|
bsd_na.flags |= NFSMNT_INT;
|
|
|
|
if (osf_na.flags & OSF1_NFSMNT_NOCONN)
|
|
|
|
bsd_na.flags |= NFSMNT_NOCONN;
|
|
|
|
|
2002-12-14 01:56:26 +00:00
|
|
|
bsd_argp->data = stackgap_alloc(&sg, sizeof bsd_na);
|
|
|
|
if ((error = copyout(&bsd_na, bsd_argp->data, sizeof bsd_na)))
|
1999-12-14 22:35:36 +00:00
|
|
|
return error;
|
|
|
|
|
|
|
|
len = strlen(nfs_name) + 1;
|
2002-12-14 01:56:26 +00:00
|
|
|
bsd_argp->type = stackgap_alloc(&sg, len);
|
|
|
|
if ((error = copyout(nfs_name, (void *)bsd_argp->type, len)))
|
1999-12-14 22:35:36 +00:00
|
|
|
return error;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|