summaryrefslogtreecommitdiff
path: root/sys/compat
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2001-05-14 13:28:24 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2001-05-14 13:28:24 +0000
commit995b695f2b06ee188ae993334bc83e25a3bc3fd0 (patch)
tree4e9dd1175963150f3333bc4515116450a9d370b2 /sys/compat
parent21e55531a498e82f6643babf57257f1ebe43fb71 (diff)
use fo_stat in fileops instead of huge switch statements.
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/common/vfs_syscalls_43.c23
-rw-r--r--sys/compat/netbsd/netbsd_stat.c22
-rw-r--r--sys/compat/osf1/osf1_descrip.c23
3 files changed, 6 insertions, 62 deletions
diff --git a/sys/compat/common/vfs_syscalls_43.c b/sys/compat/common/vfs_syscalls_43.c
index 0a5aa07e8b6..91e03cf4076 100644
--- a/sys/compat/common/vfs_syscalls_43.c
+++ b/sys/compat/common/vfs_syscalls_43.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_syscalls_43.c,v 1.13 2001/05/14 12:11:53 art Exp $ */
+/* $OpenBSD: vfs_syscalls_43.c,v 1.14 2001/05/14 13:28:22 art Exp $ */
/* $NetBSD: vfs_syscalls_43.c,v 1.4 1996/03/14 19:31:52 christos Exp $ */
/*
@@ -199,26 +199,7 @@ compat_43_sys_fstat(p, v, retval)
if ((u_int)fd >= fdp->fd_nfiles ||
(fp = fdp->fd_ofiles[fd]) == NULL)
return (EBADF);
- switch (fp->f_type) {
-
- case DTYPE_VNODE:
- error = vn_statfile(fp, &ub, p);
- break;
-
- case DTYPE_SOCKET:
- error = soo_stat(fp, &ub, p);
- break;
-
-#ifndef OLD_PIPE
- case DTYPE_PIPE:
- error = pipe_stat(fp, &ub, p);
- break;
-#endif
-
- default:
- panic("ofstat");
- /*NOTREACHED*/
- }
+ error = (*fp->f_ops->fo_stat)(fp, &ub, p);
cvtstat(&ub, &oub);
if (error == 0)
error = copyout((caddr_t)&oub, (caddr_t)SCARG(uap, sb),
diff --git a/sys/compat/netbsd/netbsd_stat.c b/sys/compat/netbsd/netbsd_stat.c
index a3735bf6a20..e8a82fe9210 100644
--- a/sys/compat/netbsd/netbsd_stat.c
+++ b/sys/compat/netbsd/netbsd_stat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: netbsd_stat.c,v 1.9 2001/05/14 12:11:53 art Exp $ */
+/* $OpenBSD: netbsd_stat.c,v 1.10 2001/05/14 13:28:22 art Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -195,26 +195,8 @@ netbsd_sys___fstat13(p, v, retval)
if ((u_int)fd >= fdp->fd_nfiles ||
(fp = fdp->fd_ofiles[fd]) == NULL)
return (EBADF);
- switch (fp->f_type) {
- case DTYPE_VNODE:
- error = vn_statfile(fp, &sb, p);
- break;
-
- case DTYPE_SOCKET:
- error = soo_stat(fp, &sb, p);
- break;
-
-#ifndef OLD_PIPE
- case DTYPE_PIPE:
- error = pipe_stat(fp, &sb, p);
- break;
-#endif
-
- default:
- panic("netbsd_sys___fstat13");
- /*NOTREACHED*/
- }
+ error = (*fp->f_ops->fo_stat)(fp, &ub, p);
if (error)
return (error);
openbsd_to_netbsd_stat(&sb, &nsb);
diff --git a/sys/compat/osf1/osf1_descrip.c b/sys/compat/osf1/osf1_descrip.c
index e5302d41554..784f4ec7511 100644
--- a/sys/compat/osf1/osf1_descrip.c
+++ b/sys/compat/osf1/osf1_descrip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: osf1_descrip.c,v 1.5 2001/05/14 12:11:54 art Exp $ */
+/* $OpenBSD: osf1_descrip.c,v 1.6 2001/05/14 13:28:23 art Exp $ */
/* $NetBSD: osf1_descrip.c,v 1.5 1999/06/26 01:24:41 cgd Exp $ */
/*
@@ -249,26 +249,7 @@ osf1_sys_fstat(p, v, retval)
(fp->f_iflags & FIF_WANTCLOSE) != 0) */
return (EBADF);
- switch (fp->f_type) {
-
- case DTYPE_VNODE:
- error = vn_statfile(fp, &ub, p);
- break;
-
- case DTYPE_SOCKET:
- error = soo_stat(fp, &ub, p);
- break;
-
-#ifndef OLD_PIPE
- case DTYPE_PIPE:
- error = pipe_stat(fp, &sb, p);
- break;
-#endif
-
- default:
- panic("osf1_sys_fstat");
- /*NOTREACHED*/
- }
+ error = (*fp->f_ops->fo_stat)(fp, &ub, p);
osf1_cvt_stat_from_native(&ub, &oub);
if (error == 0)
error = copyout((caddr_t)&oub, (caddr_t)SCARG(uap, sb),