diff options
Diffstat (limited to 'sys')
31 files changed, 742 insertions, 330 deletions
diff --git a/sys/adosfs/advfsops.c b/sys/adosfs/advfsops.c index 5d92af575d5..b5dcf3fbe24 100644 --- a/sys/adosfs/advfsops.c +++ b/sys/adosfs/advfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: advfsops.c,v 1.14 1998/08/21 23:03:15 csapuntz Exp $ */ +/* $OpenBSD: advfsops.c,v 1.15 1999/05/31 17:34:44 millert Exp $ */ /* $NetBSD: advfsops.c,v 1.24 1996/12/22 10:10:12 cgd Exp $ */ /* @@ -149,6 +149,7 @@ adosfs_mount(mp, path, data, ndp, p) (void)copyinstr(args.fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1, &size); bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size); + bcopy(&args, &mp->mnt_stat.mount_info.adosfs_args, sizeof(args)); return (0); } @@ -325,7 +326,6 @@ adosfs_statfs(mp, sbp, p) struct adosfsmount *amp; amp = VFSTOADOSFS(mp); - sbp->f_type = 0; sbp->f_bsize = amp->bsize; sbp->f_iosize = amp->dbsize; sbp->f_blocks = amp->numblks; @@ -334,9 +334,10 @@ adosfs_statfs(mp, sbp, p) sbp->f_files = 0; /* who knows */ sbp->f_ffree = 0; /* " " */ if (sbp != &mp->mnt_stat) { - sbp->f_type = mp->mnt_vfc->vfc_typenum; bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN); bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN); + bcopy(&mp->mnt_stat.mount_info.adosfs_args, + &sbp->mount_info.adosfs_args, sizeof(struct adosfs_args)); } strncpy(sbp->f_fstypename, mp->mnt_vfc->vfc_name, MFSNAMELEN); return (0); diff --git a/sys/compat/bsdos/syscalls.master b/sys/compat/bsdos/syscalls.master index 09d51e08eed..fe90384f933 100644 --- a/sys/compat/bsdos/syscalls.master +++ b/sys/compat/bsdos/syscalls.master @@ -1,4 +1,4 @@ - $OpenBSD: syscalls.master,v 1.3 1997/11/13 18:35:21 deraadt Exp $ + $OpenBSD: syscalls.master,v 1.4 1999/05/31 17:34:44 millert Exp $ ; OpenBSD COMPAT_BSDOS system call name/number "master" file. ; (See syscalls.conf to see what it is processed into.) @@ -63,8 +63,8 @@ 15 NOARGS { int sys_chmod(char *path, int mode); } 16 NOARGS { int sys_chown(char *path, int uid, int gid); } 17 NOARGS { int sys_obreak(char *nsize); } break -18 NOARGS { int sys_getfsstat(struct statfs *buf, long bufsize, \ - int flags); } +18 NOARGS { int sys_ogetfsstat(struct ostatfs *buf, \ + long bufsize, int flags); } 19 NOARGS { long compat_43_sys_lseek(int fd, long offset, \ int whence); } olseek 20 NOARGS { pid_t sys_getpid(void); } @@ -276,8 +276,8 @@ #endif 156 NOARGS { int compat_43_sys_getdirentries(int fd, char *buf, \ u_int count, long *basep); } ogetdirentries -157 NOARGS { int sys_statfs(char *path, struct statfs *buf); } -158 NOARGS { int sys_fstatfs(int fd, struct statfs *buf); } +157 NOARGS { int sys_ostatfs(char *path, struct ostatfs *buf); } +158 NOARGS { int sys_ofstatfs(int fd, struct ostatfs *buf); } 159 UNIMPL 160 UNIMPL #ifdef NFSCLIENT diff --git a/sys/compat/freebsd/freebsd_file.c b/sys/compat/freebsd/freebsd_file.c index 52d8c6cfe99..79d9f4f4039 100644 --- a/sys/compat/freebsd/freebsd_file.c +++ b/sys/compat/freebsd/freebsd_file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: freebsd_file.c,v 1.6 1997/06/17 11:11:07 deraadt Exp $ */ +/* $OpenBSD: freebsd_file.c,v 1.7 1999/05/31 17:34:44 millert Exp $ */ /* $NetBSD: freebsd_file.c,v 1.3 1996/05/03 17:03:09 christos Exp $ */ /* @@ -43,6 +43,7 @@ #include <sys/filedesc.h> #include <sys/ioctl.h> #include <sys/kernel.h> +#include <sys/vnode.h> #include <sys/mount.h> #include <sys/malloc.h> @@ -56,6 +57,27 @@ const char freebsd_emul_path[] = "/emul/freebsd"; static char * convert_from_freebsd_mount_type __P((int)); +void statfs_to_freebsd_statfs __P((struct proc *, struct mount *, struct statfs *, struct freebsd_statfs *)); + +struct freebsd_statfs { + long f_spare2; /* placeholder */ + long f_bsize; /* fundamental file system block size */ + long f_iosize; /* optimal transfer block size */ + long f_blocks; /* total data blocks in file system */ + long f_bfree; /* free blocks in fs */ + long f_bavail; /* free blocks avail to non-superuser */ + long f_files; /* total file nodes in file system */ + long f_ffree; /* free file nodes in fs */ + fsid_t f_fsid; /* file system id */ + uid_t f_owner; /* user that mounted the filesystem */ + int f_type; /* type of filesystem */ + int f_flags; /* copy of mount exported flags */ + long f_syncwrites; /* count of sync writes since mount */ + long f_asyncwrites; /* count of async writes since mount */ + char f_fstypename[MFSNAMELEN]; /* fs type name */ + char f_mntonname[MNAMELEN]; /* directory on which mounted */ + char f_mntfromname[MNAMELEN];/* mounted filesystem */ +}; static char * convert_from_freebsd_mount_type(type) @@ -508,20 +530,171 @@ freebsd_sys_rmdir(p, v, retval) return sys_rmdir(p, uap, retval); } +/* + * Convert struct statfs -> struct freebsd_statfs + */ +void +statfs_to_freebsd_statfs(p, mp, sp, fsp) + struct proc *p; + struct mount *mp; + struct statfs *sp; + struct freebsd_statfs *fsp; +{ + fsp->f_bsize = sp->f_bsize; + fsp->f_iosize = sp->f_iosize; + fsp->f_blocks = sp->f_blocks; + fsp->f_bfree = sp->f_bfree; + fsp->f_bavail = sp->f_bavail; + fsp->f_files = sp->f_files; + fsp->f_ffree = sp->f_ffree; + /* Don't let non-root see filesystem id (for NFS security) */ + if (suser(p->p_ucred, &p->p_acflag)) + fsp->f_fsid.val[0] = fsp->f_fsid.val[1] = 0; + else + bcopy(&sp->f_fsid, &fsp->f_fsid, sizeof(fsp->f_fsid)); + fsp->f_owner = sp->f_owner; + fsp->f_type = mp->mnt_vfc->vfc_typenum; + fsp->f_flags = sp->f_flags; + fsp->f_syncwrites = sp->f_syncwrites; + fsp->f_asyncwrites = sp->f_asyncwrites; + bcopy(sp->f_fstypename, fsp->f_fstypename, MFSNAMELEN); + bcopy(sp->f_mntonname, fsp->f_mntonname, MNAMELEN); + bcopy(sp->f_mntfromname, fsp->f_mntfromname, MNAMELEN); +} + +/* + * Get filesystem statistics. + */ +/* ARGSUSED */ int freebsd_sys_statfs(p, v, retval) struct proc *p; void *v; register_t *retval; { - struct freebsd_sys_stat_args /* { + register struct freebsd_sys_statfs_args /* { syscallarg(char *) path; - syscallarg(struct statfs *) buf; + syscallarg(struct freebsd_statfs *) buf; } */ *uap = v; + register struct mount *mp; + register struct statfs *sp; + struct freebsd_statfs fsb; + int error; + struct nameidata nd; caddr_t sg = stackgap_init(p->p_emul); FREEBSD_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path)); - return sys_statfs(p, uap, retval); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p); + if ((error = namei(&nd)) != 0) + return (error); + mp = nd.ni_vp->v_mount; + sp = &mp->mnt_stat; + vrele(nd.ni_vp); + if ((error = VFS_STATFS(mp, sp, p)) != 0) + return (error); + sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; + + statfs_to_freebsd_statfs(p, mp, sp, &fsb); + return (copyout((caddr_t)&fsb, (caddr_t)SCARG(uap, buf), sizeof(fsb))); +} + +/* + * Get filesystem statistics. + */ +/* ARGSUSED */ +int +freebsd_sys_fstatfs(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + register struct freebsd_sys_fstatfs_args /* { + syscallarg(int) fd; + syscallarg(struct freebsd_statfs *) buf; + } */ *uap = v; + struct file *fp; + struct mount *mp; + register struct statfs *sp; + struct freebsd_statfs fsb; + int error; + + if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0) + return (error); + mp = ((struct vnode *)fp->f_data)->v_mount; + sp = &mp->mnt_stat; + if ((error = VFS_STATFS(mp, sp, p)) != 0) + return (error); + sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; + + statfs_to_freebsd_statfs(p, mp, sp, &fsb); + return (copyout((caddr_t)&fsb, (caddr_t)SCARG(uap, buf), sizeof(fsb))); +} + +/* + * Get statistics on all filesystems. + */ +int +freebsd_sys_getfsstat(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + register struct freebsd_sys_getfsstat_args /* { + syscallarg(struct freebsd_statfs *) buf; + syscallarg(long) bufsize; + syscallarg(int) flags; + } */ *uap = v; + register struct mount *mp, *nmp; + register struct statfs *sp; + struct freebsd_statfs fsb; + caddr_t sfsp; + long count, maxcount; + int error, flags = SCARG(uap, flags); + + maxcount = SCARG(uap, bufsize) / sizeof(struct freebsd_statfs); + sfsp = (caddr_t)SCARG(uap, buf); + count = 0; + simple_lock(&mountlist_slock); + for (mp = mountlist.cqh_first; mp != (void *)&mountlist; mp = nmp) { + if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock, p)) { + nmp = mp->mnt_list.cqe_next; + continue; + } + if (sfsp && count < maxcount) { + sp = &mp->mnt_stat; + + /* Refresh stats unless MNT_NOWAIT is specified */ + if (flags != MNT_NOWAIT && + flags != MNT_LAZY && + (flags == MNT_WAIT || + flags == 0) && + (error = VFS_STATFS(mp, sp, p))) { + simple_lock(&mountlist_slock); + nmp = mp->mnt_list.cqe_next; + vfs_unbusy(mp, p); + continue; + } + sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; + + statfs_to_freebsd_statfs(p, mp, sp, &fsb); + error = copyout((caddr_t)&fsb, sfsp, sizeof(fsb)); + if (error) { + vfs_unbusy(mp, p); + return (error); + } + sfsp += sizeof(fsb); + } + count++; + simple_lock(&mountlist_slock); + nmp = mp->mnt_list.cqe_next; + vfs_unbusy(mp, p); + } + simple_unlock(&mountlist_slock); + if (sfsp && count > maxcount) + *retval = maxcount; + else + *retval = count; + return (0); } #ifdef NFSCLIENT diff --git a/sys/compat/freebsd/freebsd_syscall.h b/sys/compat/freebsd/freebsd_syscall.h index b4e0ee61f2a..3334bac653c 100644 --- a/sys/compat/freebsd/freebsd_syscall.h +++ b/sys/compat/freebsd/freebsd_syscall.h @@ -1,4 +1,4 @@ -/* $OpenBSD: freebsd_syscall.h,v 1.8 1999/02/10 08:07:30 deraadt Exp $ */ +/* $OpenBSD: freebsd_syscall.h,v 1.9 1999/05/31 17:34:45 millert Exp $ */ /* * System call numbers. @@ -59,7 +59,7 @@ /* syscall: "break" ret: "int" args: "char *" */ #define FREEBSD_SYS_break 17 -/* syscall: "getfsstat" ret: "int" args: "struct statfs *" "long" "int" */ +/* syscall: "getfsstat" ret: "int" args: "struct freebsd_statfs *" "long" "int" */ #define FREEBSD_SYS_getfsstat 18 /* syscall: "olseek" ret: "long" args: "int" "long" "int" */ @@ -445,10 +445,10 @@ /* syscall: "ogetdirentries" ret: "int" args: "int" "char *" "u_int" "long *" */ #define FREEBSD_SYS_ogetdirentries 156 -/* syscall: "statfs" ret: "int" args: "char *" "struct statfs *" */ +/* syscall: "statfs" ret: "int" args: "char *" "struct freebsd_statfs *" */ #define FREEBSD_SYS_statfs 157 -/* syscall: "fstatfs" ret: "int" args: "int" "struct statfs *" */ +/* syscall: "fstatfs" ret: "int" args: "int" "struct freebsd_statfs *" */ #define FREEBSD_SYS_fstatfs 158 /* syscall: "getfh" ret: "int" args: "char *" "fhandle_t *" */ diff --git a/sys/compat/freebsd/freebsd_syscallargs.h b/sys/compat/freebsd/freebsd_syscallargs.h index 4772cd575cd..067f68ddbfa 100644 --- a/sys/compat/freebsd/freebsd_syscallargs.h +++ b/sys/compat/freebsd/freebsd_syscallargs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: freebsd_syscallargs.h,v 1.9 1999/02/10 08:07:30 deraadt Exp $ */ +/* $OpenBSD: freebsd_syscallargs.h,v 1.10 1999/05/31 17:34:45 millert Exp $ */ /* * System call argument lists. @@ -50,6 +50,12 @@ struct freebsd_sys_chown_args { syscallarg(int) gid; }; +struct freebsd_sys_getfsstat_args { + syscallarg(struct freebsd_statfs *) buf; + syscallarg(long) bufsize; + syscallarg(int) flags; +}; + struct freebsd_sys_mount_args { syscallarg(int) type; syscallarg(char *) path; @@ -156,7 +162,12 @@ struct freebsd_sys_rmdir_args { struct freebsd_sys_statfs_args { syscallarg(char *) path; - syscallarg(struct statfs *) buf; + syscallarg(struct freebsd_statfs *) buf; +}; + +struct freebsd_sys_fstatfs_args { + syscallarg(int) fd; + syscallarg(struct freebsd_statfs *) buf; }; struct freebsd_sys_getfh_args { @@ -226,7 +237,7 @@ int freebsd_sys_mknod __P((struct proc *, void *, register_t *)); int freebsd_sys_chmod __P((struct proc *, void *, register_t *)); int freebsd_sys_chown __P((struct proc *, void *, register_t *)); int sys_obreak __P((struct proc *, void *, register_t *)); -int sys_getfsstat __P((struct proc *, void *, register_t *)); +int freebsd_sys_getfsstat __P((struct proc *, void *, register_t *)); int compat_43_sys_lseek __P((struct proc *, void *, register_t *)); int sys_getpid __P((struct proc *, void *, register_t *)); int freebsd_sys_mount __P((struct proc *, void *, register_t *)); @@ -362,7 +373,7 @@ int sys_nfssvc __P((struct proc *, void *, register_t *)); #endif int compat_43_sys_getdirentries __P((struct proc *, void *, register_t *)); int freebsd_sys_statfs __P((struct proc *, void *, register_t *)); -int sys_fstatfs __P((struct proc *, void *, register_t *)); +int freebsd_sys_fstatfs __P((struct proc *, void *, register_t *)); #ifdef NFSCLIENT int freebsd_sys_getfh __P((struct proc *, void *, register_t *)); #else diff --git a/sys/compat/freebsd/freebsd_syscalls.c b/sys/compat/freebsd/freebsd_syscalls.c index 1408dbefb64..42475b9de0a 100644 --- a/sys/compat/freebsd/freebsd_syscalls.c +++ b/sys/compat/freebsd/freebsd_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: freebsd_syscalls.c,v 1.8 1999/02/10 08:07:30 deraadt Exp $ */ +/* $OpenBSD: freebsd_syscalls.c,v 1.9 1999/05/31 17:34:45 millert Exp $ */ /* * System call names. diff --git a/sys/compat/freebsd/freebsd_sysent.c b/sys/compat/freebsd/freebsd_sysent.c index 3486d30da3b..b1ba0282f31 100644 --- a/sys/compat/freebsd/freebsd_sysent.c +++ b/sys/compat/freebsd/freebsd_sysent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: freebsd_sysent.c,v 1.9 1999/02/10 08:07:30 deraadt Exp $ */ +/* $OpenBSD: freebsd_sysent.c,v 1.10 1999/05/31 17:34:45 millert Exp $ */ /* * System call switch table. @@ -54,8 +54,8 @@ struct sysent freebsd_sysent[] = { freebsd_sys_chown }, /* 16 = chown */ { 1, s(struct sys_obreak_args), sys_obreak }, /* 17 = break */ - { 3, s(struct sys_getfsstat_args), - sys_getfsstat }, /* 18 = getfsstat */ + { 3, s(struct freebsd_sys_getfsstat_args), + freebsd_sys_getfsstat }, /* 18 = getfsstat */ { 3, s(struct compat_43_sys_lseek_args), compat_43_sys_lseek }, /* 19 = olseek */ { 0, 0, @@ -349,8 +349,8 @@ struct sysent freebsd_sysent[] = { compat_43_sys_getdirentries }, /* 156 = ogetdirentries */ { 2, s(struct freebsd_sys_statfs_args), freebsd_sys_statfs }, /* 157 = statfs */ - { 2, s(struct sys_fstatfs_args), - sys_fstatfs }, /* 158 = fstatfs */ + { 2, s(struct freebsd_sys_fstatfs_args), + freebsd_sys_fstatfs }, /* 158 = fstatfs */ { 0, 0, sys_nosys }, /* 159 = unimplemented */ { 0, 0, diff --git a/sys/compat/freebsd/syscalls.master b/sys/compat/freebsd/syscalls.master index 0c9ddf97465..d6f0df89b23 100644 --- a/sys/compat/freebsd/syscalls.master +++ b/sys/compat/freebsd/syscalls.master @@ -1,4 +1,4 @@ - $OpenBSD: syscalls.master,v 1.9 1999/02/10 08:05:08 deraadt Exp $ + $OpenBSD: syscalls.master,v 1.10 1999/05/31 17:34:45 millert Exp $ ; $NetBSD: syscalls.master,v 1.3 1995/10/10 18:28:40 mycroft Exp $ ; from: @(#)syscalls.master 8.2 (Berkeley) 1/13/94 @@ -70,8 +70,8 @@ 15 STD { int freebsd_sys_chmod(char *path, int mode); } 16 STD { int freebsd_sys_chown(char *path, int uid, int gid); } 17 NOARGS { int sys_obreak(char *nsize); } break -18 NOARGS { int sys_getfsstat(struct statfs *buf, long bufsize, \ - int flags); } +18 STD { int freebsd_sys_getfsstat(struct freebsd_statfs *buf,\ + long bufsize, int flags); } 19 NOARGS { long compat_43_sys_lseek(int fd, long offset, \ int whence); } olseek 20 NOARGS { pid_t sys_getpid(void); } @@ -287,8 +287,9 @@ 156 NOARGS { int compat_43_sys_getdirentries(int fd, char *buf, \ u_int count, long *basep); } ogetdirentries 157 STD { int freebsd_sys_statfs(char *path, \ - struct statfs *buf); } -158 NOARGS { int sys_fstatfs(int fd, struct statfs *buf); } + struct freebsd_statfs *buf); } +158 STD { int freebsd_sys_fstatfs(int fd, \ + struct freebsd_statfs *buf); } 159 UNIMPL 160 UNIMPL #ifdef NFSCLIENT diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index e6898adf982..3f0136ea255 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: linux_misc.c,v 1.20 1999/02/10 08:01:52 deraadt Exp $ */ +/* $OpenBSD: linux_misc.c,v 1.21 1999/05/31 17:34:46 millert Exp $ */ /* $NetBSD: linux_misc.c,v 1.27 1996/05/20 01:59:21 fvdl Exp $ */ /* @@ -287,7 +287,29 @@ bsd_to_linux_statfs(bsp, lsp) struct linux_statfs *lsp; { - lsp->l_ftype = bsp->f_type; + /* + * Convert BSD filesystem names to Linux filesystem type numbers + * where possible. Linux statfs uses a value of -1 to indicate + * an unsupported field. + */ + if (!strcmp(bsp->f_fstypename, MOUNT_FFS) || + !strcmp(bsp->f_fstypename, MOUNT_MFS)) + lsp->l_ftype = 0x11954; + else if (!strcmp(bsp->f_fstypename, MOUNT_NFS)) + lsp->l_ftype = 0x6969; + else if (!strcmp(bsp->f_fstypename, MOUNT_MSDOS)) + lsp->l_ftype = 0x4d44; + else if (!strcmp(bsp->f_fstypename, MOUNT_PROCFS)) + lsp->l_ftype = 0x9fa0; + else if (!strcmp(bsp->f_fstypename, MOUNT_EXT2FS)) + lsp->l_ftype = 0xef53; + else if (!strcmp(bsp->f_fstypename, MOUNT_CD9660)) + lsp->l_ftype = 0x9660; + else if (!strcmp(bsp->f_fstypename, MOUNT_NCPFS)) + lsp->l_ftype = 0x6969; + else + lsp->l_ftype = -1; + lsp->l_fbsize = bsp->f_bsize; lsp->l_fblocks = bsp->f_blocks; lsp->l_fbfree = bsp->f_bfree; diff --git a/sys/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c index c647aa70370..a8a00c2ffd5 100644 --- a/sys/isofs/cd9660/cd9660_vfsops.c +++ b/sys/isofs/cd9660/cd9660_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd9660_vfsops.c,v 1.15 1998/09/06 20:31:31 millert Exp $ */ +/* $OpenBSD: cd9660_vfsops.c,v 1.16 1999/05/31 17:34:46 millert Exp $ */ /* $NetBSD: cd9660_vfsops.c,v 1.26 1997/06/13 15:38:58 pk Exp $ */ /*- @@ -206,6 +206,7 @@ cd9660_mount(mp, path, data, ndp, p) (void)copyinstr(args.fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1, &size); bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size); + bcopy(&args, &mp->mnt_stat.mount_info.iso_args, sizeof(args)); (void)cd9660_statfs(mp, &mp->mnt_stat, p); return (0); } @@ -564,11 +565,6 @@ cd9660_statfs(mp, sbp, p) isomp = VFSTOISOFS(mp); -#ifdef COMPAT_09 - sbp->f_type = 5; -#else - sbp->f_type = 0; -#endif sbp->f_bsize = isomp->logical_block_size; sbp->f_iosize = sbp->f_bsize; /* XXX */ sbp->f_blocks = isomp->volume_space_size; @@ -580,6 +576,8 @@ cd9660_statfs(mp, sbp, p) bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN); bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN); + bcopy(&mp->mnt_stat.mount_info.iso_args, + &sbp->mount_info.iso_args, sizeof(struct iso_args)); } /* Use the first spare for flags: */ sbp->f_spare[0] = isomp->im_flags; diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c index b8e88982db8..e3e3482e214 100644 --- a/sys/kern/init_sysent.c +++ b/sys/kern/init_sysent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init_sysent.c,v 1.37 1999/05/22 21:25:51 weingart Exp $ */ +/* $OpenBSD: init_sysent.c,v 1.38 1999/05/31 17:34:47 millert Exp $ */ /* * System call switch table. @@ -77,8 +77,8 @@ struct sysent sysent[] = { sys_chown }, /* 16 = chown */ { 1, s(struct sys_obreak_args), sys_obreak }, /* 17 = break */ - { 3, s(struct sys_getfsstat_args), - sys_getfsstat }, /* 18 = getfsstat */ + { 3, s(struct sys_ogetfsstat_args), + sys_ogetfsstat }, /* 18 = ogetfsstat */ { 3, s(struct compat_43_sys_lseek_args), compat_43(sys_lseek) }, /* 19 = compat_43 olseek */ { 0, 0, @@ -370,10 +370,10 @@ struct sysent sysent[] = { #endif { 4, s(struct compat_43_sys_getdirentries_args), compat_43(sys_getdirentries) }, /* 156 = compat_43 ogetdirentries */ - { 2, s(struct sys_statfs_args), - sys_statfs }, /* 157 = statfs */ - { 2, s(struct sys_fstatfs_args), - sys_fstatfs }, /* 158 = fstatfs */ + { 2, s(struct sys_ostatfs_args), + sys_ostatfs }, /* 157 = ostatfs */ + { 2, s(struct sys_ofstatfs_args), + sys_ofstatfs }, /* 158 = ofstatfs */ { 0, 0, sys_nosys }, /* 159 = unimplemented */ { 0, 0, @@ -685,5 +685,11 @@ struct sysent sysent[] = { { 0, 0, sys_nosys }, /* 259 = unimplemented */ #endif + { 3, s(struct sys_getfsstat_args), + sys_getfsstat }, /* 260 = getfsstat */ + { 2, s(struct sys_statfs_args), + sys_statfs }, /* 261 = statfs */ + { 2, s(struct sys_fstatfs_args), + sys_fstatfs }, /* 262 = fstatfs */ }; diff --git a/sys/kern/syscalls.c b/sys/kern/syscalls.c index b918a0d242a..60b518fe2fe 100644 --- a/sys/kern/syscalls.c +++ b/sys/kern/syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: syscalls.c,v 1.37 1999/05/22 21:25:51 weingart Exp $ */ +/* $OpenBSD: syscalls.c,v 1.38 1999/05/31 17:34:47 millert Exp $ */ /* * System call names. @@ -26,7 +26,7 @@ char *syscallnames[] = { "chmod", /* 15 = chmod */ "chown", /* 16 = chown */ "break", /* 17 = break */ - "getfsstat", /* 18 = getfsstat */ + "ogetfsstat", /* 18 = ogetfsstat */ "compat_43_olseek", /* 19 = compat_43 olseek */ "getpid", /* 20 = getpid */ "mount", /* 21 = mount */ @@ -177,8 +177,8 @@ char *syscallnames[] = { "#155 (unimplemented)", /* 155 = unimplemented */ #endif "compat_43_ogetdirentries", /* 156 = compat_43 ogetdirentries */ - "statfs", /* 157 = statfs */ - "fstatfs", /* 158 = fstatfs */ + "ostatfs", /* 157 = ostatfs */ + "ofstatfs", /* 158 = ofstatfs */ "#159 (unimplemented)", /* 159 = unimplemented */ "#160 (unimplemented)", /* 160 = unimplemented */ #if defined(NFSCLIENT) || defined(NFSSERVER) @@ -354,4 +354,7 @@ char *syscallnames[] = { #else "#259 (unimplemented)", /* 259 = unimplemented */ #endif + "getfsstat", /* 260 = getfsstat */ + "statfs", /* 261 = statfs */ + "fstatfs", /* 262 = fstatfs */ }; diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index 0eaf5345051..58e865bef0f 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -1,4 +1,4 @@ -; $OpenBSD: syscalls.master,v 1.35 1999/05/22 21:23:40 weingart Exp $ +; $OpenBSD: syscalls.master,v 1.36 1999/05/31 17:34:47 millert Exp $ ; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $ ; @(#)syscalls.master 8.2 (Berkeley) 1/13/94 @@ -70,7 +70,7 @@ 16 STD { int sys_chown(const char *path, uid_t uid, \ gid_t gid); } 17 STD { int sys_obreak(char *nsize); } break -18 STD { int sys_getfsstat(struct statfs *buf, long bufsize, \ +18 STD { int sys_ogetfsstat(struct statfs *buf, long bufsize, \ int flags); } 19 COMPAT_43 { long sys_lseek(int fd, long offset, int whence); } \ olseek @@ -290,9 +290,9 @@ #endif 156 COMPAT_43 { int sys_getdirentries(int fd, char *buf, \ int count, long *basep); } ogetdirentries -157 STD { int sys_statfs(const char *path, \ - struct statfs *buf); } -158 STD { int sys_fstatfs(int fd, struct statfs *buf); } +157 STD { int sys_ostatfs(const char *path, \ + struct ostatfs *buf); } +158 STD { int sys_ofstatfs(int fd, struct ostatfs *buf); } 159 UNIMPL 160 UNIMPL #if defined(NFSCLIENT) || defined(NFSSERVER) @@ -514,3 +514,8 @@ #else 259 UNIMPL #endif +260 STD { int sys_getfsstat(struct statfs *buf, size_t bufsize, \ + int flags); } +261 STD { int sys_statfs(const char *path, \ + struct statfs *buf); } +262 STD { int sys_fstatfs(int fd, struct statfs *buf); } diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 4df9a385a12..a44fa140711 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_subr.c,v 1.38 1999/05/06 15:59:40 mickey Exp $ */ +/* $OpenBSD: vfs_subr.c,v 1.39 1999/05/31 17:34:48 millert Exp $ */ /* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */ /* @@ -222,7 +222,6 @@ vfs_rootmountalloc(fstypename, devname, mpp) mp->mnt_flag = MNT_RDONLY; mp->mnt_vnodecovered = NULLVP; vfsp->vfc_refcount++; - mp->mnt_stat.f_type = vfsp->vfc_typenum; mp->mnt_flag |= vfsp->vfc_flags & MNT_VISFLAGMASK; strncpy(mp->mnt_stat.f_fstypename, vfsp->vfc_name, MFSNAMELEN); mp->mnt_stat.f_mntonname[0] = '/'; diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 46eca31aab0..f2f2892bb74 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_syscalls.c,v 1.56 1999/02/26 04:51:17 art Exp $ */ +/* $OpenBSD: vfs_syscalls.c,v 1.57 1999/05/31 17:34:48 millert Exp $ */ /* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */ /* @@ -70,6 +70,7 @@ int usermount = 0; /* sysctl: by default, users may not mount */ static int change_dir __P((struct nameidata *, struct proc *)); void checkdirs __P((struct vnode *)); +void statfs_to_ostatfs __P((struct proc *, struct mount *, struct statfs *, struct ostatfs *)); /* * Redirection info so we don't have to include the union fs routines in @@ -248,7 +249,6 @@ sys_mount(p, v, retval) vfs_busy(mp, LK_NOWAIT, 0, p); mp->mnt_op = vfsp->vfc_vfsops; mp->mnt_vfc = vfsp; - mp->mnt_stat.f_type = vfsp->vfc_typenum; mp->mnt_flag |= (vfsp->vfc_flags & MNT_VISFLAGMASK); strncpy(mp->mnt_stat.f_fstypename, vfsp->vfc_name, MFSNAMELEN); mp->mnt_vnodecovered = vp; @@ -643,15 +643,15 @@ sys_getfsstat(p, v, retval) { register struct sys_getfsstat_args /* { syscallarg(struct statfs *) buf; - syscallarg(long) bufsize; + syscallarg(size_t) bufsize; syscallarg(int) flags; } */ *uap = v; register struct mount *mp, *nmp; register struct statfs *sp; - caddr_t sfsp; - long count, maxcount, error; struct statfs sb; - int flags = SCARG(uap, flags); + caddr_t sfsp; + size_t count, maxcount; + int error, flags = SCARG(uap, flags); maxcount = SCARG(uap, bufsize) / sizeof(struct statfs); sfsp = (caddr_t)SCARG(uap, buf); @@ -2360,3 +2360,174 @@ getvnode(fdp, fd, fpp) *fpp = fp; return (0); } + +/* + * At some point (before 2.6 is released), these will move to + * sys/compat/vfs_syscalls_25.c + */ + +/* + * Convert struct statfs -> struct ostatfs + */ +void +statfs_to_ostatfs(p, mp, sp, osp) + struct proc *p; + struct mount *mp; + struct statfs *sp; + struct ostatfs *osp; +{ +#if defined(COMPAT_09) || defined(COMPAT_43) + osp->f_type = mp->mnt_vfc->vfc_typenum; +#else + osp->f_type = 0; +#endif + osp->f_flags = mp->mnt_flag & 0xffff; + osp->f_bsize = sp->f_bsize; + osp->f_iosize = sp->f_iosize; + osp->f_blocks = sp->f_blocks; + osp->f_bfree = sp->f_bfree; + osp->f_bavail = sp->f_bavail; + osp->f_files = sp->f_files; + osp->f_ffree = sp->f_ffree; + /* Don't let non-root see filesystem id (for NFS security) */ + if (suser(p->p_ucred, &p->p_acflag)) + osp->f_fsid.val[0] = osp->f_fsid.val[1] = 0; + else + bcopy(&sp->f_fsid, &osp->f_fsid, sizeof(osp->f_fsid)); + osp->f_owner = sp->f_owner; + osp->f_syncwrites = sp->f_syncwrites; + osp->f_asyncwrites = sp->f_asyncwrites; + bcopy(sp->f_fstypename, osp->f_fstypename, MFSNAMELEN); + bcopy(sp->f_mntonname, osp->f_mntonname, MNAMELEN); + bcopy(sp->f_mntfromname, osp->f_mntfromname, MNAMELEN); +} + +/* + * Get filesystem statistics. + */ +/* ARGSUSED */ +int +sys_ostatfs(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + register struct sys_ostatfs_args /* { + syscallarg(char *) path; + syscallarg(struct ostatfs *) buf; + } */ *uap = v; + register struct mount *mp; + register struct statfs *sp; + struct ostatfs osb; + int error; + struct nameidata nd; + + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p); + if ((error = namei(&nd)) != 0) + return (error); + mp = nd.ni_vp->v_mount; + sp = &mp->mnt_stat; + vrele(nd.ni_vp); + if ((error = VFS_STATFS(mp, sp, p)) != 0) + return (error); + + statfs_to_ostatfs(p, mp, sp, &osb); + return (copyout((caddr_t)&osb, (caddr_t)SCARG(uap, buf), sizeof(osb))); +} + +/* + * Get filesystem statistics. + */ +/* ARGSUSED */ +int +sys_ofstatfs(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + register struct sys_ofstatfs_args /* { + syscallarg(int) fd; + syscallarg(struct ostatfs *) buf; + } */ *uap = v; + struct file *fp; + struct mount *mp; + register struct statfs *sp; + struct ostatfs osb; + int error; + + if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0) + return (error); + mp = ((struct vnode *)fp->f_data)->v_mount; + sp = &mp->mnt_stat; + if ((error = VFS_STATFS(mp, sp, p)) != 0) + return (error); + + statfs_to_ostatfs(p, mp, sp, &osb); + return (copyout((caddr_t)&osb, (caddr_t)SCARG(uap, buf), sizeof(osb))); +} + +/* + * Get statistics on all filesystems. + */ +int +sys_ogetfsstat(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + register struct sys_ogetfsstat_args /* { + syscallarg(struct ostatfs *) buf; + syscallarg(long) bufsize; + syscallarg(int) flags; + } */ *uap = v; + register struct mount *mp, *nmp; + register struct statfs *sp; + struct ostatfs osb; + caddr_t sfsp; + long count, maxcount; + int error, flags = SCARG(uap, flags); + + maxcount = SCARG(uap, bufsize) / sizeof(struct ostatfs); + sfsp = (caddr_t)SCARG(uap, buf); + count = 0; + simple_lock(&mountlist_slock); + for (mp = mountlist.cqh_first; mp != (void *)&mountlist; mp = nmp) { + if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock, p)) { + nmp = mp->mnt_list.cqe_next; + continue; + } + if (sfsp && count < maxcount) { + sp = &mp->mnt_stat; + + /* Refresh stats unless MNT_NOWAIT is specified */ + if (flags != MNT_NOWAIT && + flags != MNT_LAZY && + (flags == MNT_WAIT || + flags == 0) && + (error = VFS_STATFS(mp, sp, p))) { + simple_lock(&mountlist_slock); + nmp = mp->mnt_list.cqe_next; + vfs_unbusy(mp, p); + continue; + } + + statfs_to_ostatfs(p, mp, sp, &osb); + error = copyout((caddr_t)&osb, sfsp, sizeof(osb)); + if (error) { + vfs_unbusy(mp, p); + return (error); + } + sfsp += sizeof(osb); + } + count++; + simple_lock(&mountlist_slock); + nmp = mp->mnt_list.cqe_next; + vfs_unbusy(mp, p); + } + simple_unlock(&mountlist_slock); + if (sfsp && count > maxcount) + *retval = maxcount; + else + *retval = count; + return (0); +} diff --git a/sys/miscfs/fdesc/fdesc_vfsops.c b/sys/miscfs/fdesc/fdesc_vfsops.c index 358ad6892ee..7a171afddee 100644 --- a/sys/miscfs/fdesc/fdesc_vfsops.c +++ b/sys/miscfs/fdesc/fdesc_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fdesc_vfsops.c,v 1.6 1998/02/08 22:41:37 tholo Exp $ */ +/* $OpenBSD: fdesc_vfsops.c,v 1.7 1999/05/31 17:34:49 millert Exp $ */ /* $NetBSD: fdesc_vfsops.c,v 1.21 1996/02/09 22:40:07 christos Exp $ */ /* @@ -213,11 +213,6 @@ fdesc_statfs(mp, sbp, p) if (fdp->fd_nfiles < lim) freefd += (lim - fdp->fd_nfiles); -#ifdef COMPAT_09 - sbp->f_type = 6; -#else - sbp->f_type = 0; -#endif sbp->f_bsize = DEV_BSIZE; sbp->f_iosize = DEV_BSIZE; sbp->f_blocks = 2; /* 1K to keep df happy */ @@ -226,7 +221,6 @@ fdesc_statfs(mp, sbp, p) sbp->f_files = lim + 1; /* Allow for "." */ sbp->f_ffree = freefd; /* See comments above */ if (sbp != &mp->mnt_stat) { - sbp->f_type = mp->mnt_vfc->vfc_typenum; bcopy(&mp->mnt_stat.f_fsid, &sbp->f_fsid, sizeof(sbp->f_fsid)); bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN); bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN); diff --git a/sys/miscfs/kernfs/kernfs_vfsops.c b/sys/miscfs/kernfs/kernfs_vfsops.c index 7a74578173f..87d26d9813f 100644 --- a/sys/miscfs/kernfs/kernfs_vfsops.c +++ b/sys/miscfs/kernfs/kernfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kernfs_vfsops.c,v 1.11 1999/02/26 03:44:16 art Exp $ */ +/* $OpenBSD: kernfs_vfsops.c,v 1.12 1999/05/31 17:34:49 millert Exp $ */ /* $NetBSD: kernfs_vfsops.c,v 1.26 1996/04/22 01:42:27 christos Exp $ */ /* @@ -250,9 +250,6 @@ kernfs_statfs(mp, sbp, p) printf("kernfs_statfs(mp = %p)\n", mp); #endif -#ifdef COMPAT_09 - sbp->f_type = 7; -#endif sbp->f_flags = 0; #if defined(UVM) sbp->f_bsize = uvmexp.pagesize; @@ -268,7 +265,6 @@ kernfs_statfs(mp, sbp, p) sbp->f_files = desiredvnodes; sbp->f_ffree = desiredvnodes - numvnodes; if (sbp != &mp->mnt_stat) { - sbp->f_type = mp->mnt_vfc->vfc_typenum; bcopy(&mp->mnt_stat.f_fsid, &sbp->f_fsid, sizeof(sbp->f_fsid)); bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN); bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN); diff --git a/sys/miscfs/nullfs/null_vfsops.c b/sys/miscfs/nullfs/null_vfsops.c index 5e641e3ad43..f59d83c1d37 100644 --- a/sys/miscfs/nullfs/null_vfsops.c +++ b/sys/miscfs/nullfs/null_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: null_vfsops.c,v 1.9 1998/08/06 23:38:39 csapuntz Exp $ */ +/* $OpenBSD: null_vfsops.c,v 1.10 1999/05/31 17:34:49 millert Exp $ */ /* $NetBSD: null_vfsops.c,v 1.11 1996/05/10 22:50:56 jtk Exp $ */ /* @@ -309,7 +309,6 @@ nullfs_statfs(mp, sbp, p) return (error); /* now copy across the "interesting" information and fake the rest */ - sbp->f_type = mstat.f_type; sbp->f_flags = mstat.f_flags; sbp->f_bsize = mstat.f_bsize; sbp->f_iosize = mstat.f_iosize; diff --git a/sys/miscfs/portal/portal_vfsops.c b/sys/miscfs/portal/portal_vfsops.c index 5e6cb876637..b2eb51f50dd 100644 --- a/sys/miscfs/portal/portal_vfsops.c +++ b/sys/miscfs/portal/portal_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: portal_vfsops.c,v 1.6 1998/02/08 22:41:39 tholo Exp $ */ +/* $OpenBSD: portal_vfsops.c,v 1.7 1999/05/31 17:34:50 millert Exp $ */ /* $NetBSD: portal_vfsops.c,v 1.14 1996/02/09 22:40:41 christos Exp $ */ /* @@ -226,11 +226,6 @@ portal_statfs(mp, sbp, p) struct proc *p; { -#ifdef COMPAT_09 - sbp->f_type = 12; -#else - sbp->f_type = 0; -#endif sbp->f_bsize = DEV_BSIZE; sbp->f_iosize = DEV_BSIZE; sbp->f_blocks = 2; /* 1K to keep df happy */ @@ -239,7 +234,6 @@ portal_statfs(mp, sbp, p) sbp->f_files = 1; /* Allow for "." */ sbp->f_ffree = 0; /* See comments above */ if (sbp != &mp->mnt_stat) { - sbp->f_type = mp->mnt_vfc->vfc_typenum; bcopy(&mp->mnt_stat.f_fsid, &sbp->f_fsid, sizeof(sbp->f_fsid)); bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN); bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN); diff --git a/sys/miscfs/procfs/procfs_vfsops.c b/sys/miscfs/procfs/procfs_vfsops.c index 8ed90970b04..618007642f6 100644 --- a/sys/miscfs/procfs/procfs_vfsops.c +++ b/sys/miscfs/procfs/procfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: procfs_vfsops.c,v 1.9 1999/02/26 03:47:46 art Exp $ */ +/* $OpenBSD: procfs_vfsops.c,v 1.10 1999/05/31 17:34:50 millert Exp $ */ /* $NetBSD: procfs_vfsops.c,v 1.25 1996/02/09 22:40:53 christos Exp $ */ /* @@ -163,11 +163,6 @@ procfs_statfs(mp, sbp, p) #else vmtotal(&vmtotals); #endif -#ifdef COMPAT_09 - sbp->f_type = 10; -#else - sbp->f_type = 0; -#endif sbp->f_bsize = PAGE_SIZE; sbp->f_iosize = PAGE_SIZE; sbp->f_blocks = vmtotals.t_vm; diff --git a/sys/miscfs/umapfs/umap_vfsops.c b/sys/miscfs/umapfs/umap_vfsops.c index 992fd5a4d35..d2409287f88 100644 --- a/sys/miscfs/umapfs/umap_vfsops.c +++ b/sys/miscfs/umapfs/umap_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umap_vfsops.c,v 1.13 1999/03/18 08:34:18 art Exp $ */ +/* $OpenBSD: umap_vfsops.c,v 1.14 1999/05/31 17:34:50 millert Exp $ */ /* $NetBSD: umap_vfsops.c,v 1.9 1996/02/09 22:41:05 christos Exp $ */ /* @@ -351,7 +351,6 @@ umapfs_statfs(mp, sbp, p) return (error); /* now copy across the "interesting" information and fake the rest */ - sbp->f_type = mstat.f_type; sbp->f_flags = mstat.f_flags; sbp->f_bsize = mstat.f_bsize; sbp->f_iosize = mstat.f_iosize; diff --git a/sys/miscfs/union/union_vfsops.c b/sys/miscfs/union/union_vfsops.c index 8032397c2d0..3b0743343d8 100644 --- a/sys/miscfs/union/union_vfsops.c +++ b/sys/miscfs/union/union_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: union_vfsops.c,v 1.8 1998/02/08 22:41:42 tholo Exp $ */ +/* $OpenBSD: union_vfsops.c,v 1.9 1999/05/31 17:34:50 millert Exp $ */ /* $NetBSD: union_vfsops.c,v 1.10 1995/06/18 14:47:47 cgd Exp $ */ /* @@ -431,7 +431,6 @@ union_statfs(mp, sbp, p) /* now copy across the "interesting" information and fake the rest */ #if 0 - sbp->f_type = mstat.f_type; sbp->f_flags = mstat.f_flags; sbp->f_bsize = mstat.f_bsize; sbp->f_iosize = mstat.f_iosize; @@ -447,7 +446,6 @@ union_statfs(mp, sbp, p) if (error) return (error); - sbp->f_type = 0; sbp->f_flags = mstat.f_flags; sbp->f_bsize = mstat.f_bsize; sbp->f_iosize = mstat.f_iosize; @@ -470,7 +468,6 @@ union_statfs(mp, sbp, p) sbp->f_ffree += mstat.f_ffree; if (sbp != &mp->mnt_stat) { - sbp->f_type = mp->mnt_vfc->vfc_typenum; bcopy(&mp->mnt_stat.f_fsid, &sbp->f_fsid, sizeof(sbp->f_fsid)); bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN); bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN); diff --git a/sys/msdosfs/msdosfs_vfsops.c b/sys/msdosfs/msdosfs_vfsops.c index a1edd0159b9..fdc71dc7f12 100644 --- a/sys/msdosfs/msdosfs_vfsops.c +++ b/sys/msdosfs/msdosfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: msdosfs_vfsops.c,v 1.17 1999/05/01 23:47:21 deraadt Exp $ */ +/* $OpenBSD: msdosfs_vfsops.c,v 1.18 1999/05/31 17:34:51 millert Exp $ */ /* $NetBSD: msdosfs_vfsops.c,v 1.48 1997/10/18 02:54:57 briggs Exp $ */ /*- @@ -242,6 +242,7 @@ msdosfs_mount(mp, path, data, ndp, p) (void) copyinstr(args.fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1, &size); bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size); + bcopy(&args, &mp->mnt_stat.mount_info.msdosfs_args, sizeof(args)); #ifdef MSDOSFS_DEBUG printf("msdosfs_mount(): mp %x, pmp %x, inusemap %x\n", mp, pmp, pmp->pm_inusemap); #endif @@ -678,11 +679,6 @@ msdosfs_statfs(mp, sbp, p) struct msdosfsmount *pmp; pmp = VFSTOMSDOSFS(mp); -#ifdef COMPAT_09 - sbp->f_type = 4; -#else - sbp->f_type = 0; -#endif sbp->f_bsize = pmp->pm_bpcluster; sbp->f_iosize = pmp->pm_bpcluster; sbp->f_blocks = pmp->pm_nmbrofclusters; @@ -693,6 +689,8 @@ msdosfs_statfs(mp, sbp, p) if (sbp != &mp->mnt_stat) { bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN); bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN); + bcopy(&mp->mnt_stat.mount_info.msdosfs_args, + &sbp->mount_info.msdosfs_args, sizeof(struct msdosfs_args)); } strncpy(sbp->f_fstypename, mp->mnt_vfc->vfc_name, MFSNAMELEN); return (0); diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c index 7bb452ae54e..e14a96f4fb9 100644 --- a/sys/nfs/nfs_vfsops.c +++ b/sys/nfs/nfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_vfsops.c,v 1.25 1998/08/19 22:26:56 csapuntz Exp $ */ +/* $OpenBSD: nfs_vfsops.c,v 1.26 1999/05/31 17:34:52 millert Exp $ */ /* $NetBSD: nfs_vfsops.c,v 1.46.4.1 1996/05/25 22:40:35 fvdl Exp $ */ /* @@ -144,11 +144,6 @@ nfs_statfs(mp, sbp, p) goto nfsmout; } nfsm_dissect(sfp, struct nfs_statfs *, NFSX_STATFS(v3)); -#ifdef COMPAT_09 - sbp->f_type = 2; -#else - sbp->f_type = 0; -#endif sbp->f_flags = nmp->nm_flag; sbp->f_iosize = min(nmp->nm_rsize, nmp->nm_wsize); if (v3) { @@ -174,6 +169,8 @@ nfs_statfs(mp, sbp, p) if (sbp != &mp->mnt_stat) { bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN); bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN); + bcopy(&mp->mnt_stat.mount_info.nfs_args, + &sbp->mount_info.nfs_args, sizeof(struct nfs_args)); } strncpy(&sbp->f_fstypename[0], mp->mnt_vfc->vfc_name, MFSNAMELEN); nfsm_reqdone; @@ -695,14 +692,10 @@ mountnfs(argp, mp, nam, pth, hst, vpp) nmp->nm_acdirmin = NFS_MINATTRTIMO; nmp->nm_acdirmax = NFS_MAXATTRTIMO; bcopy((caddr_t)argp->fh, (caddr_t)nmp->nm_fh, argp->fhsize); -#ifdef COMPAT_09 - mp->mnt_stat.f_type = 2; -#else - mp->mnt_stat.f_type = 0; -#endif strncpy(&mp->mnt_stat.f_fstypename[0], mp->mnt_vfc->vfc_name, MFSNAMELEN); bcopy(hst, mp->mnt_stat.f_mntfromname, MNAMELEN); bcopy(pth, mp->mnt_stat.f_mntonname, MNAMELEN); + bcopy(argp, &mp->mnt_stat.mount_info.nfs_args, sizeof(*argp)); nmp->nm_nam = nam; nfs_decode_args(nmp, argp); @@ -715,7 +708,7 @@ mountnfs(argp, mp, nam, pth, hst, vpp) * the first request, in case the server is not responding. */ if (nmp->nm_sotype == SOCK_DGRAM && - (error = nfs_connect(nmp, (struct nfsreq *)0))) + (error = nfs_connect(nmp, (struct nfsreq *)0))) goto bad; /* diff --git a/sys/sys/mount.h b/sys/sys/mount.h index f183c31f41f..e80d6c25d39 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mount.h,v 1.28 1999/05/06 15:59:48 mickey Exp $ */ +/* $OpenBSD: mount.h,v 1.29 1999/05/31 17:34:52 millert Exp $ */ /* $NetBSD: mount.h,v 1.48 1996/02/18 11:55:47 fvdl Exp $ */ /* @@ -60,13 +60,220 @@ struct fid { }; /* + * Export arguments for local filesystem mount calls. + */ +struct export_args { + int ex_flags; /* export related flags */ + uid_t ex_root; /* mapping for root uid */ + struct ucred ex_anon; /* mapping for anonymous user */ + struct sockaddr *ex_addr; /* net address to which exported */ + int ex_addrlen; /* and the net address length */ + struct sockaddr *ex_mask; /* mask of valid bits in saddr */ + int ex_masklen; /* and the smask length */ +}; + +/* + * Arguments to mount UFS-based filesystems + */ +struct ufs_args { + char *fspec; /* block special device to mount */ + struct export_args export; /* network export information */ +}; + +/* + * Arguments to mount MFS + */ +struct mfs_args { + char *fspec; /* name to export for statfs */ + struct export_args export; /* if exported MFSes are supported */ + caddr_t base; /* base of file system in memory */ + u_long size; /* size of file system */ +}; + +/* + * Arguments to mount ISO 9660 filesystems. + */ +struct iso_args { + char *fspec; /* block special device to mount */ + struct export_args export; /* network export info */ + int flags; /* mounting flags, see below */ +}; +#define ISOFSMNT_NORRIP 0x00000001 /* disable Rock Ridge Ext.*/ +#define ISOFSMNT_GENS 0x00000002 /* enable generation numbers */ +#define ISOFSMNT_EXTATT 0x00000004 /* enable extended attributes */ + +/* + * Arguments to mount NFS + */ +#define NFS_ARGSVERSION 4 /* change when nfs_args changes */ +struct nfs_args { + int version; /* args structure version number */ + struct sockaddr *addr; /* file server address */ + int addrlen; /* length of address */ + int sotype; /* Socket type */ + int proto; /* and Protocol */ + u_char *fh; /* File handle to be mounted */ + int fhsize; /* Size, in bytes, of fh */ + int flags; /* flags */ + int wsize; /* write size in bytes */ + int rsize; /* read size in bytes */ + int readdirsize; /* readdir size in bytes */ + int timeo; /* initial timeout in .1 secs */ + int retrans; /* times to retry send */ + int maxgrouplist; /* Max. size of group list */ + int readahead; /* # of blocks to readahead */ + int leaseterm; /* Term (sec) of lease */ + int deadthresh; /* Retrans threshold */ + char *hostname; /* server's name */ + int acregmin; /* Attr cache file recently modified */ + int acregmax; /* ac file not recently modified */ + int acdirmin; /* ac for dir recently modified */ + int acdirmax; /* ac for dir not recently modified */ +}; +/* NFS args version 3 (for backwards compatibility) */ +struct nfs_args3 { + int version; /* args structure version number */ + struct sockaddr *addr; /* file server address */ + int addrlen; /* length of address */ + int sotype; /* Socket type */ + int proto; /* and Protocol */ + u_char *fh; /* File handle to be mounted */ + int fhsize; /* Size, in bytes, of fh */ + int flags; /* flags */ + int wsize; /* write size in bytes */ + int rsize; /* read size in bytes */ + int readdirsize; /* readdir size in bytes */ + int timeo; /* initial timeout in .1 secs */ + int retrans; /* times to retry send */ + int maxgrouplist; /* Max. size of group list */ + int readahead; /* # of blocks to readahead */ + int leaseterm; /* Term (sec) of lease */ + int deadthresh; /* Retrans threshold */ + char *hostname; /* server's name */ +}; + +/* + * NFS mount option flags + */ +#ifndef _KERNEL +#define NFSMNT_RESVPORT 0x00000000 /* always use reserved ports */ +#endif /* ! _KERNEL */ +#define NFSMNT_SOFT 0x00000001 /* soft mount (hard is default) */ +#define NFSMNT_WSIZE 0x00000002 /* set write size */ +#define NFSMNT_RSIZE 0x00000004 /* set read size */ +#define NFSMNT_TIMEO 0x00000008 /* set initial timeout */ +#define NFSMNT_RETRANS 0x00000010 /* set number of request retries */ +#define NFSMNT_MAXGRPS 0x00000020 /* set maximum grouplist size */ +#define NFSMNT_INT 0x00000040 /* allow interrupts on hard mount */ +#define NFSMNT_NOCONN 0x00000080 /* Don't Connect the socket */ +#define NFSMNT_NQNFS 0x00000100 /* Use Nqnfs protocol */ +#define NFSMNT_NFSV3 0x00000200 /* Use NFS Version 3 protocol */ +#define NFSMNT_KERB 0x00000400 /* Use Kerberos authentication */ +#define NFSMNT_DUMBTIMR 0x00000800 /* Don't estimate rtt dynamically */ +#define NFSMNT_LEASETERM 0x00001000 /* set lease term (nqnfs) */ +#define NFSMNT_READAHEAD 0x00002000 /* set read ahead */ +#define NFSMNT_DEADTHRESH 0x00004000 /* set dead server retry thresh */ +#ifdef _KERNEL /* Coming soon to a system call near you! */ +#define NFSMNT_NOAC 0x00008000 /* disable attribute cache */ +#endif /* _KERNEL */ +#define NFSMNT_RDIRPLUS 0x00010000 /* Use Readdirplus for V3 */ +#define NFSMNT_READDIRSIZE 0x00020000 /* Set readdir size */ + +/* Flags valid only in mount syscall arguments */ +#define NFSMNT_ACREGMIN 0x00040000 /* acregmin field valid */ +#define NFSMNT_ACREGMAX 0x00080000 /* acregmax field valid */ +#define NFSMNT_ACDIRMIN 0x00100000 /* acdirmin field valid */ +#define NFSMNT_ACDIRMAX 0x00200000 /* acdirmax field valid */ + +/* Flags valid only in kernel */ +#define NFSMNT_INTERNAL 0xfffc0000 /* Bits set internally */ +#define NFSMNT_HASWRITEVERF 0x00040000 /* Has write verifier for V3 */ +#define NFSMNT_GOTPATHCONF 0x00080000 /* Got the V3 pathconf info */ +#define NFSMNT_GOTFSINFO 0x00100000 /* Got the V3 fsinfo */ +#define NFSMNT_MNTD 0x00200000 /* Mnt server for mnt point */ +#define NFSMNT_DISMINPROG 0x00400000 /* Dismount in progress */ +#define NFSMNT_DISMNT 0x00800000 /* Dismounted */ +#define NFSMNT_SNDLOCK 0x01000000 /* Send socket lock */ +#define NFSMNT_WANTSND 0x02000000 /* Want above */ +#define NFSMNT_RCVLOCK 0x04000000 /* Rcv socket lock */ +#define NFSMNT_WANTRCV 0x08000000 /* Want above */ +#define NFSMNT_WAITAUTH 0x10000000 /* Wait for authentication */ +#define NFSMNT_HASAUTH 0x20000000 /* Has authenticator */ +#define NFSMNT_WANTAUTH 0x40000000 /* Wants an authenticator */ +#define NFSMNT_AUTHERR 0x80000000 /* Authentication error */ + +/* + * Arguments to mount MSDOS filesystems. + */ +struct msdosfs_args { + char *fspec; /* blocks special holding the fs to mount */ + struct export_args export; /* network export information */ + uid_t uid; /* uid that owns msdosfs files */ + gid_t gid; /* gid that owns msdosfs files */ + mode_t mask; /* mask to be applied for msdosfs perms */ + int flags; /* see below */ +}; + +/* + * Msdosfs mount options: + */ +#define MSDOSFSMNT_SHORTNAME 1 /* Force old DOS short names only */ +#define MSDOSFSMNT_LONGNAME 2 /* Force Win'95 long names */ +#define MSDOSFSMNT_NOWIN95 4 /* Completely ignore Win95 entries */ +#define MSDOSFSMNT_GEMDOSFS 8 /* This is a gemdos-flavour */ + +/* + * Arguments to mount amigados filesystems. + */ +struct adosfs_args { + char *fspec; /* blocks special holding the fs to mount */ + struct export_args export; /* network export information */ + uid_t uid; /* uid that owns adosfs files */ + gid_t gid; /* gid that owns adosfs files */ + mode_t mask; /* mask to be applied for adosfs perms */ +}; + +/* * file system statistics */ #define MFSNAMELEN 16 /* length of fs type name, including nul */ #define MNAMELEN 90 /* length of buffer for returned name */ +/* per-filesystem mount options */ +union mount_info { + struct ufs_args ufs_args; + struct mfs_args mfs_args; + struct nfs_args nfs_args; + struct iso_args iso_args; + struct msdosfs_args msdosfs_args; + struct adosfs_args adosfs_args; + char __align[160]; /* 64-bit alignment and room to grow */ +}; + +/* new statfs structure with mount options */ struct statfs { + u_int32_t f_flags; /* copy of mount flags */ + u_int32_t f_bsize; /* fundamental file system block size */ + u_int32_t f_iosize; /* optimal transfer block size */ + u_int32_t f_blocks; /* total data blocks in file system */ + u_int32_t f_bfree; /* free blocks in fs */ + u_int32_t f_bavail; /* free blocks avail to non-superuser */ + u_int32_t f_files; /* total file nodes in file system */ + u_int32_t f_ffree; /* free file nodes in fs */ + fsid_t f_fsid; /* file system id */ + uid_t f_owner; /* user that mounted the file system */ + u_int32_t f_syncwrites; /* count of sync writes since mount */ + u_int32_t f_asyncwrites; /* count of async writes since mount */ + u_int32_t f_spare[4]; /* spare for later */ + char f_fstypename[MFSNAMELEN]; /* fs type name */ + char f_mntonname[MNAMELEN]; /* directory on which mounted */ + char f_mntfromname[MNAMELEN]; /* mounted file system */ + union mount_info mount_info; /* per-filesystem mount options */ +}; + +/* old (pre-2.6) statfs structure */ +struct ostatfs { short f_type; /* type of file system (unused; zero) */ short f_flags; /* copy of mount flags */ long f_bsize; /* fundamental file system block size */ @@ -78,8 +285,8 @@ struct statfs { long f_ffree; /* free file nodes in fs */ fsid_t f_fsid; /* file system id */ uid_t f_owner; /* user that mounted the file system */ - long f_syncwrites; /* count of sync writes since mount */ - long f_asyncwrites; /* count of async writes since mount */ + long f_syncwrites; /* count of sync writes since mount */ + long f_asyncwrites; /* count of async writes since mount */ long f_spare[2]; /* spare for later */ char f_fstypename[MFSNAMELEN]; /* fs type name */ char f_mntonname[MNAMELEN]; /* directory on which mounted */ @@ -310,180 +517,6 @@ struct netexport { }; #endif /* _KERNEL */ -/* - * Export arguments for local filesystem mount calls. - */ -struct export_args { - int ex_flags; /* export related flags */ - uid_t ex_root; /* mapping for root uid */ - struct ucred ex_anon; /* mapping for anonymous user */ - struct sockaddr *ex_addr; /* net address to which exported */ - int ex_addrlen; /* and the net address length */ - struct sockaddr *ex_mask; /* mask of valid bits in saddr */ - int ex_masklen; /* and the smask length */ -}; - -/* - * Arguments to mount UFS-based filesystems - */ -struct ufs_args { - char *fspec; /* block special device to mount */ - struct export_args export; /* network export information */ -}; - -/* - * Arguments to mount MFS - */ -struct mfs_args { - char *fspec; /* name to export for statfs */ - struct export_args export; /* if exported MFSes are supported */ - caddr_t base; /* base of file system in memory */ - u_long size; /* size of file system */ -}; - -/* - * Arguments to mount ISO 9660 filesystems. - */ -struct iso_args { - char *fspec; /* block special device to mount */ - struct export_args export; /* network export info */ - int flags; /* mounting flags, see below */ -}; -#define ISOFSMNT_NORRIP 0x00000001 /* disable Rock Ridge Ext.*/ -#define ISOFSMNT_GENS 0x00000002 /* enable generation numbers */ -#define ISOFSMNT_EXTATT 0x00000004 /* enable extended attributes */ - -/* - * Arguments to mount NFS - */ -#define NFS_ARGSVERSION 4 /* change when nfs_args changes */ -struct nfs_args { - int version; /* args structure version number */ - struct sockaddr *addr; /* file server address */ - int addrlen; /* length of address */ - int sotype; /* Socket type */ - int proto; /* and Protocol */ - u_char *fh; /* File handle to be mounted */ - int fhsize; /* Size, in bytes, of fh */ - int flags; /* flags */ - int wsize; /* write size in bytes */ - int rsize; /* read size in bytes */ - int readdirsize; /* readdir size in bytes */ - int timeo; /* initial timeout in .1 secs */ - int retrans; /* times to retry send */ - int maxgrouplist; /* Max. size of group list */ - int readahead; /* # of blocks to readahead */ - int leaseterm; /* Term (sec) of lease */ - int deadthresh; /* Retrans threshold */ - char *hostname; /* server's name */ - int acregmin; /* Attr cache file recently modified */ - int acregmax; /* ac file not recently modified */ - int acdirmin; /* ac for dir recently modified */ - int acdirmax; /* ac for dir not recently modified */ -}; -/* NFS args version 3 (for backwards compatibility) */ -struct nfs_args3 { - int version; /* args structure version number */ - struct sockaddr *addr; /* file server address */ - int addrlen; /* length of address */ - int sotype; /* Socket type */ - int proto; /* and Protocol */ - u_char *fh; /* File handle to be mounted */ - int fhsize; /* Size, in bytes, of fh */ - int flags; /* flags */ - int wsize; /* write size in bytes */ - int rsize; /* read size in bytes */ - int readdirsize; /* readdir size in bytes */ - int timeo; /* initial timeout in .1 secs */ - int retrans; /* times to retry send */ - int maxgrouplist; /* Max. size of group list */ - int readahead; /* # of blocks to readahead */ - int leaseterm; /* Term (sec) of lease */ - int deadthresh; /* Retrans threshold */ - char *hostname; /* server's name */ -}; - -/* - * NFS mount option flags - */ -#ifndef _KERNEL -#define NFSMNT_RESVPORT 0x00000000 /* always use reserved ports */ -#endif /* ! _KERNEL */ -#define NFSMNT_SOFT 0x00000001 /* soft mount (hard is default) */ -#define NFSMNT_WSIZE 0x00000002 /* set write size */ -#define NFSMNT_RSIZE 0x00000004 /* set read size */ -#define NFSMNT_TIMEO 0x00000008 /* set initial timeout */ -#define NFSMNT_RETRANS 0x00000010 /* set number of request retries */ -#define NFSMNT_MAXGRPS 0x00000020 /* set maximum grouplist size */ -#define NFSMNT_INT 0x00000040 /* allow interrupts on hard mount */ -#define NFSMNT_NOCONN 0x00000080 /* Don't Connect the socket */ -#define NFSMNT_NQNFS 0x00000100 /* Use Nqnfs protocol */ -#define NFSMNT_NFSV3 0x00000200 /* Use NFS Version 3 protocol */ -#define NFSMNT_KERB 0x00000400 /* Use Kerberos authentication */ -#define NFSMNT_DUMBTIMR 0x00000800 /* Don't estimate rtt dynamically */ -#define NFSMNT_LEASETERM 0x00001000 /* set lease term (nqnfs) */ -#define NFSMNT_READAHEAD 0x00002000 /* set read ahead */ -#define NFSMNT_DEADTHRESH 0x00004000 /* set dead server retry thresh */ -#ifdef _KERNEL /* Coming soon to a system call near you! */ -#define NFSMNT_NOAC 0x00008000 /* disable attribute cache */ -#endif /* _KERNEL */ -#define NFSMNT_RDIRPLUS 0x00010000 /* Use Readdirplus for V3 */ -#define NFSMNT_READDIRSIZE 0x00020000 /* Set readdir size */ - -/* Flags valid only in mount syscall arguments */ -#define NFSMNT_ACREGMIN 0x00040000 /* acregmin field valid */ -#define NFSMNT_ACREGMAX 0x00080000 /* acregmax field valid */ -#define NFSMNT_ACDIRMIN 0x00100000 /* acdirmin field valid */ -#define NFSMNT_ACDIRMAX 0x00200000 /* acdirmax field valid */ - -/* Flags valid only in kernel */ -#define NFSMNT_INTERNAL 0xfffc0000 /* Bits set internally */ -#define NFSMNT_HASWRITEVERF 0x00040000 /* Has write verifier for V3 */ -#define NFSMNT_GOTPATHCONF 0x00080000 /* Got the V3 pathconf info */ -#define NFSMNT_GOTFSINFO 0x00100000 /* Got the V3 fsinfo */ -#define NFSMNT_MNTD 0x00200000 /* Mnt server for mnt point */ -#define NFSMNT_DISMINPROG 0x00400000 /* Dismount in progress */ -#define NFSMNT_DISMNT 0x00800000 /* Dismounted */ -#define NFSMNT_SNDLOCK 0x01000000 /* Send socket lock */ -#define NFSMNT_WANTSND 0x02000000 /* Want above */ -#define NFSMNT_RCVLOCK 0x04000000 /* Rcv socket lock */ -#define NFSMNT_WANTRCV 0x08000000 /* Want above */ -#define NFSMNT_WAITAUTH 0x10000000 /* Wait for authentication */ -#define NFSMNT_HASAUTH 0x20000000 /* Has authenticator */ -#define NFSMNT_WANTAUTH 0x40000000 /* Wants an authenticator */ -#define NFSMNT_AUTHERR 0x80000000 /* Authentication error */ - -/* - * Arguments to mount MSDOS filesystems. - */ -struct msdosfs_args { - char *fspec; /* blocks special holding the fs to mount */ - struct export_args export; /* network export information */ - uid_t uid; /* uid that owns msdosfs files */ - gid_t gid; /* gid that owns msdosfs files */ - mode_t mask; /* mask to be applied for msdosfs perms */ - int flags; /* see below */ -}; - -/* - * Msdosfs mount options: - */ -#define MSDOSFSMNT_SHORTNAME 1 /* Force old DOS short names only */ -#define MSDOSFSMNT_LONGNAME 2 /* Force Win'95 long names */ -#define MSDOSFSMNT_NOWIN95 4 /* Completely ignore Win95 entries */ -#define MSDOSFSMNT_GEMDOSFS 8 /* This is a gemdos-flavour */ - -/* - * Arguments to mount amigados filesystems. - */ -struct adosfs_args { - char *fspec; /* blocks special holding the fs to mount */ - struct export_args export; /* network export information */ - uid_t uid; /* uid that owns msdosfs files */ - gid_t gid; /* gid that owns msdosfs files */ - mode_t mask; /* mask to be applied for msdosfs perms */ -}; - #ifdef _KERNEL /* * exported vnode operations @@ -523,7 +556,7 @@ int vfs_unregister __P((struct vfsconf *)); __BEGIN_DECLS int fstatfs __P((int, struct statfs *)); int getfh __P((const char *, fhandle_t *)); -int getfsstat __P((struct statfs *, long, int)); +int getfsstat __P((struct statfs *, size_t, int)); int getmntinfo __P((struct statfs **, int)); int mount __P((const char *, const char *, int, void *)); int statfs __P((const char *, struct statfs *)); diff --git a/sys/sys/syscall.h b/sys/sys/syscall.h index 69326ba30fe..36fe020c2c4 100644 --- a/sys/sys/syscall.h +++ b/sys/sys/syscall.h @@ -1,4 +1,4 @@ -/* $OpenBSD: syscall.h,v 1.36 1999/05/22 21:25:51 weingart Exp $ */ +/* $OpenBSD: syscall.h,v 1.37 1999/05/31 17:34:52 millert Exp $ */ /* * System call numbers. @@ -58,8 +58,8 @@ /* syscall: "break" ret: "int" args: "char *" */ #define SYS_break 17 -/* syscall: "getfsstat" ret: "int" args: "struct statfs *" "long" "int" */ -#define SYS_getfsstat 18 +/* syscall: "ogetfsstat" ret: "int" args: "struct statfs *" "long" "int" */ +#define SYS_ogetfsstat 18 /* 19 is compat_43 olseek */ @@ -410,11 +410,11 @@ /* 156 is compat_43 ogetdirentries */ -/* syscall: "statfs" ret: "int" args: "const char *" "struct statfs *" */ -#define SYS_statfs 157 +/* syscall: "ostatfs" ret: "int" args: "const char *" "struct ostatfs *" */ +#define SYS_ostatfs 157 -/* syscall: "fstatfs" ret: "int" args: "int" "struct statfs *" */ -#define SYS_fstatfs 158 +/* syscall: "ofstatfs" ret: "int" args: "int" "struct ostatfs *" */ +#define SYS_ofstatfs 158 /* syscall: "getfh" ret: "int" args: "const char *" "fhandle_t *" */ #define SYS_getfh 161 @@ -602,4 +602,13 @@ /* syscall: "msgctl" ret: "int" args: "int" "int" "struct msqid_ds *" */ #define SYS_msgctl 259 -#define SYS_MAXSYSCALL 260 +/* syscall: "getfsstat" ret: "int" args: "struct statfs *" "size_t" "int" */ +#define SYS_getfsstat 260 + +/* syscall: "statfs" ret: "int" args: "const char *" "struct statfs *" */ +#define SYS_statfs 261 + +/* syscall: "fstatfs" ret: "int" args: "int" "struct statfs *" */ +#define SYS_fstatfs 262 + +#define SYS_MAXSYSCALL 263 diff --git a/sys/sys/syscallargs.h b/sys/sys/syscallargs.h index 4e2945c79bc..a6dda3d969c 100644 --- a/sys/sys/syscallargs.h +++ b/sys/sys/syscallargs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: syscallargs.h,v 1.37 1999/05/22 21:25:51 weingart Exp $ */ +/* $OpenBSD: syscallargs.h,v 1.38 1999/05/31 17:34:53 millert Exp $ */ /* * System call argument lists. @@ -85,7 +85,7 @@ struct sys_obreak_args { syscallarg(char *) nsize; }; -struct sys_getfsstat_args { +struct sys_ogetfsstat_args { syscallarg(struct statfs *) buf; syscallarg(long) bufsize; syscallarg(int) flags; @@ -685,14 +685,14 @@ struct compat_43_sys_getdirentries_args { syscallarg(long *) basep; }; -struct sys_statfs_args { +struct sys_ostatfs_args { syscallarg(const char *) path; - syscallarg(struct statfs *) buf; + syscallarg(struct ostatfs *) buf; }; -struct sys_fstatfs_args { +struct sys_ofstatfs_args { syscallarg(int) fd; - syscallarg(struct statfs *) buf; + syscallarg(struct ostatfs *) buf; }; struct sys_getfh_args { @@ -1044,6 +1044,22 @@ struct sys_msgctl_args { syscallarg(struct msqid_ds *) buf; }; +struct sys_getfsstat_args { + syscallarg(struct statfs *) buf; + syscallarg(size_t) bufsize; + syscallarg(int) flags; +}; + +struct sys_statfs_args { + syscallarg(const char *) path; + syscallarg(struct statfs *) buf; +}; + +struct sys_fstatfs_args { + syscallarg(int) fd; + syscallarg(struct statfs *) buf; +}; + /* * System call prototypes. */ @@ -1064,7 +1080,7 @@ int sys_mknod __P((struct proc *, void *, register_t *)); int sys_chmod __P((struct proc *, void *, register_t *)); int sys_chown __P((struct proc *, void *, register_t *)); int sys_obreak __P((struct proc *, void *, register_t *)); -int sys_getfsstat __P((struct proc *, void *, register_t *)); +int sys_ogetfsstat __P((struct proc *, void *, register_t *)); int compat_43_sys_lseek __P((struct proc *, void *, register_t *)); int sys_getpid __P((struct proc *, void *, register_t *)); int sys_mount __P((struct proc *, void *, register_t *)); @@ -1199,8 +1215,8 @@ int sys_nfssvc __P((struct proc *, void *, register_t *)); #else #endif int compat_43_sys_getdirentries __P((struct proc *, void *, register_t *)); -int sys_statfs __P((struct proc *, void *, register_t *)); -int sys_fstatfs __P((struct proc *, void *, register_t *)); +int sys_ostatfs __P((struct proc *, void *, register_t *)); +int sys_ofstatfs __P((struct proc *, void *, register_t *)); #if defined(NFSCLIENT) || defined(NFSSERVER) int sys_getfh __P((struct proc *, void *, register_t *)); #else @@ -1313,3 +1329,6 @@ int sys_shmctl __P((struct proc *, void *, register_t *)); int sys_msgctl __P((struct proc *, void *, register_t *)); #else #endif +int sys_getfsstat __P((struct proc *, void *, register_t *)); +int sys_statfs __P((struct proc *, void *, register_t *)); +int sys_fstatfs __P((struct proc *, void *, register_t *)); diff --git a/sys/ufs/ext2fs/ext2fs_vfsops.c b/sys/ufs/ext2fs/ext2fs_vfsops.c index da9a7612165..0f3c9ec8484 100644 --- a/sys/ufs/ext2fs/ext2fs_vfsops.c +++ b/sys/ufs/ext2fs/ext2fs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_vfsops.c,v 1.9 1998/02/08 22:41:48 tholo Exp $ */ +/* $OpenBSD: ext2fs_vfsops.c,v 1.10 1999/05/31 17:34:53 millert Exp $ */ /* $NetBSD: ext2fs_vfsops.c,v 1.1 1997/06/11 09:34:07 bouyer Exp $ */ /* @@ -307,6 +307,7 @@ ext2fs_mount(mp, path, data, ndp, p) ump = VFSTOUFS(mp); fs = ump->um_e2fs; (void) copyinstr(path, fs->e2fs_fsmnt, sizeof(fs->e2fs_fsmnt) - 1, &size); + bcopy(&args, &mp->mnt_stat.mount_info.ufs_args, sizeof(args)); bzero(fs->e2fs_fsmnt + size, sizeof(fs->e2fs_fsmnt) - size); bcopy(fs->e2fs_fsmnt, mp->mnt_stat.f_mntonname, MNAMELEN); (void) copyinstr(args.fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1, @@ -704,11 +705,6 @@ ext2fs_statfs(mp, sbp, p) fs = ump->um_e2fs; if (fs->e2fs.e2fs_magic != E2FS_MAGIC) panic("ext2fs_statfs"); -#ifdef COMPAT_09 - sbp->f_type = 1; -#else - sbp->f_type = 0; -#endif /* * Compute the overhead (FS structures) @@ -730,9 +726,10 @@ ext2fs_statfs(mp, sbp, p) sbp->f_files = fs->e2fs.e2fs_icount; sbp->f_ffree = fs->e2fs.e2fs_ficount; if (sbp != &mp->mnt_stat) { - sbp->f_type = mp->mnt_vfc->vfc_typenum; bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN); bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN); + bcopy(&mp->mnt_stat.mount_info.ufs_args, + &sbp->mount_info.ufs_args, sizeof(struct ufs_args)); } strncpy(sbp->f_fstypename, mp->mnt_vfc->vfc_name, MFSNAMELEN); return (0); diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 5128ae5758d..4d602845535 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_vfsops.c,v 1.22 1998/12/05 18:57:07 csapuntz Exp $ */ +/* $OpenBSD: ffs_vfsops.c,v 1.23 1999/05/31 17:34:54 millert Exp $ */ /* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */ /* @@ -331,6 +331,7 @@ ffs_mount(mp, path, data, ndp, p) * * This code is common to root and non-root mounts */ + bcopy(&args, &mp->mnt_stat.mount_info.ufs_args, sizeof(args)); (void)VFS_STATFS(mp, &mp->mnt_stat, p); success: @@ -822,11 +823,6 @@ ffs_statfs(mp, sbp, p) fs = ump->um_fs; if (fs->fs_magic != FS_MAGIC) panic("ffs_statfs"); -#ifdef COMPAT_09 - sbp->f_type = 1; -#else - sbp->f_type = 0; -#endif sbp->f_bsize = fs->fs_fsize; sbp->f_iosize = fs->fs_bsize; sbp->f_blocks = fs->fs_dsize; @@ -836,9 +832,10 @@ ffs_statfs(mp, sbp, p) sbp->f_files = fs->fs_ncg * fs->fs_ipg - ROOTINO; sbp->f_ffree = fs->fs_cstotal.cs_nifree; if (sbp != &mp->mnt_stat) { - sbp->f_type = mp->mnt_vfc->vfc_typenum; bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN); bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN); + bcopy(&mp->mnt_stat.mount_info.ufs_args, + &sbp->mount_info.ufs_args, sizeof(struct ufs_args)); } strncpy(sbp->f_fstypename, mp->mnt_vfc->vfc_name, MFSNAMELEN); return (0); diff --git a/sys/ufs/lfs/lfs_vfsops.c b/sys/ufs/lfs/lfs_vfsops.c index f8016625009..e7b0a450204 100644 --- a/sys/ufs/lfs/lfs_vfsops.c +++ b/sys/ufs/lfs/lfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lfs_vfsops.c,v 1.10 1999/01/11 05:12:39 millert Exp $ */ +/* $OpenBSD: lfs_vfsops.c,v 1.11 1999/05/31 17:34:55 millert Exp $ */ /* $NetBSD: lfs_vfsops.c,v 1.11 1996/03/25 12:53:35 pk Exp $ */ /* @@ -202,6 +202,7 @@ lfs_mount(mp, path, data, ndp, p) (void) copyinstr(args.fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1, &size); bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size); + bcopy(&args, &mp->mnt_stat.mount_info.ufs_args, sizeof(args)); return (0); } @@ -431,6 +432,8 @@ lfs_statfs(mp, sbp, p) if (sbp != &mp->mnt_stat) { bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN); bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN); + bcopy(&mp->mnt_stat.mount_info.ufs_args, + &sbp->mount_info.ufs_args, sizeof(struct ufs_args)); } strncpy(sbp->f_fstypename, mp->mnt_vfc->vfc_name, MFSNAMELEN); return (0); diff --git a/sys/ufs/mfs/mfs_vfsops.c b/sys/ufs/mfs/mfs_vfsops.c index 831715431f9..cb01fc418d7 100644 --- a/sys/ufs/mfs/mfs_vfsops.c +++ b/sys/ufs/mfs/mfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mfs_vfsops.c,v 1.7 1999/03/09 00:17:05 art Exp $ */ +/* $OpenBSD: mfs_vfsops.c,v 1.8 1999/05/31 17:34:55 millert Exp $ */ /* $NetBSD: mfs_vfsops.c,v 1.10 1996/02/09 22:31:28 christos Exp $ */ /* @@ -230,6 +230,7 @@ mfs_mount(mp, path, data, ndp, p) (void) copyinstr(args.fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1, &size); bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size); + bcopy(&args, &mp->mnt_stat.mount_info.mfs_args, sizeof(args)); return (0); } @@ -298,11 +299,9 @@ mfs_statfs(mp, sbp, p) int error; error = ffs_statfs(mp, sbp, p); -#ifdef COMPAT_09 - sbp->f_type = mp->mnt_vfc->vfc_typenum; -#else - sbp->f_type = 0; -#endif strncpy(&sbp->f_fstypename[0], mp->mnt_vfc->vfc_name, MFSNAMELEN); + if (sbp != &mp->mnt_stat) + bcopy(&mp->mnt_stat.mount_info.mfs_args, + &sbp->mount_info.mfs_args, sizeof(struct mfs_args)); return (error); } |