summaryrefslogtreecommitdiffstats
path: root/sys/kern/sys_generic.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-11-16 14:47:04 +0000
committerphk <phk@FreeBSD.org>2004-11-16 14:47:04 +0000
commitd37a7160dbb78a3b9e787c41c7495bee445e3fcc (patch)
tree0de1dfadbbcbb4a09bb04b9d02827d733f0a0b1b /sys/kern/sys_generic.c
parent815ab9f6946fe2955741aab8d7f65ef9b3d440ed (diff)
downloadFreeBSD-src-d37a7160dbb78a3b9e787c41c7495bee445e3fcc.zip
FreeBSD-src-d37a7160dbb78a3b9e787c41c7495bee445e3fcc.tar.gz
Polish code to correctly reflect structure.
Diffstat (limited to 'sys/kern/sys_generic.c')
-rw-r--r--sys/kern/sys_generic.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c
index e3b4afd..6f2d551 100644
--- a/sys/kern/sys_generic.c
+++ b/sys/kern/sys_generic.c
@@ -535,38 +535,29 @@ ioctl(struct thread *td, struct ioctl_args *uap)
bzero(data, size);
}
- switch (com) {
-
- case FIONBIO:
+ if (com == FIONBIO) {
FILE_LOCK(fp);
if ((tmp = *(int *)data))
fp->f_flag |= FNONBLOCK;
else
fp->f_flag &= ~FNONBLOCK;
FILE_UNLOCK(fp);
- error = fo_ioctl(fp, FIONBIO, &tmp, td->td_ucred, td);
- break;
-
- case FIOASYNC:
+ data = (void *)&tmp;
+ } else if (com == FIOASYNC) {
FILE_LOCK(fp);
if ((tmp = *(int *)data))
fp->f_flag |= FASYNC;
else
fp->f_flag &= ~FASYNC;
FILE_UNLOCK(fp);
- error = fo_ioctl(fp, FIOASYNC, &tmp, td->td_ucred, td);
- break;
-
- default:
- error = fo_ioctl(fp, com, data, td->td_ucred, td);
- /*
- * Copy any data to user, size was
- * already set and checked above.
- */
- if (error == 0 && (com&IOC_OUT) && size)
- error = copyout(data, uap->data, (u_int)size);
- break;
+ data = (void *)&tmp;
}
+
+ error = fo_ioctl(fp, com, data, td->td_ucred, td);
+
+ if (error == 0 && (com & IOC_OUT))
+ error = copyout(data, uap->data, (u_int)size);
+
if (memp != NULL)
free(memp, M_IOCTLOPS);
fdrop(fp, td);
OpenPOWER on IntegriCloud