summaryrefslogtreecommitdiff
path: root/sys/compat/linux/common/linux_hdio.c
diff options
context:
space:
mode:
authorad <ad@NetBSD.org>2008-03-21 21:54:58 +0000
committerad <ad@NetBSD.org>2008-03-21 21:54:58 +0000
commita9ca7a3734751f09c9dc4e1f645cd528fd403e8c (patch)
treeff26aca94a1a611e6be984fcff411406b466507f /sys/compat/linux/common/linux_hdio.c
parentc743ad71591a886accf44c9e93c1ff677b45a41f (diff)
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
Diffstat (limited to 'sys/compat/linux/common/linux_hdio.c')
-rw-r--r--sys/compat/linux/common/linux_hdio.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/sys/compat/linux/common/linux_hdio.c b/sys/compat/linux/common/linux_hdio.c
index c112d36d203..80437eadb35 100644
--- a/sys/compat/linux/common/linux_hdio.c
+++ b/sys/compat/linux/common/linux_hdio.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_hdio.c,v 1.15 2007/12/20 23:02:54 dsl Exp $ */
+/* $NetBSD: linux_hdio.c,v 1.16 2008/03/21 21:54:58 ad Exp $ */
/*
* Copyright (c) 2000 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_hdio.c,v 1.15 2007/12/20 23:02:54 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_hdio.c,v 1.16 2008/03/21 21:54:58 ad Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -67,24 +67,19 @@ int
linux_ioctl_hdio(struct lwp *l, const struct linux_sys_ioctl_args *uap,
register_t *retval)
{
- struct proc *p = l->l_proc;
u_long com;
int error, error1;
- struct filedesc *fdp;
struct file *fp;
- int (*ioctlf)(struct file *, u_long, void *, struct lwp *);
+ int (*ioctlf)(struct file *, u_long, void *);
struct atareq req;
struct disklabel label, *labp;
struct partinfo partp;
struct linux_hd_geometry hdg;
struct linux_hd_big_geometry hdg_big;
- fdp = p->p_fd;
- if ((fp = fd_getfile(fdp, SCARG(uap, fd))) == NULL)
+ if ((fp = fd_getfile(SCARG(uap, fd))) == NULL)
return (EBADF);
- FILE_USE(fp);
-
com = SCARG(uap, com);
ioctlf = fp->f_ops->fo_ioctl;
retval[0] = error = 0;
@@ -102,7 +97,7 @@ linux_ioctl_hdio(struct lwp *l, const struct linux_sys_ioctl_args *uap,
*/
req.datalen = com == LINUX_HDIO_GET_IDENTITY ? 512 : 142;
req.timeout = 1000;
- error = ioctlf(fp, ATAIOCCOMMAND, &req, l);
+ error = ioctlf(fp, ATAIOCCOMMAND, &req);
if (error != 0)
break;
if (req.retsts != ATACMD_OK)
@@ -112,8 +107,8 @@ linux_ioctl_hdio(struct lwp *l, const struct linux_sys_ioctl_args *uap,
error = linux_machdepioctl(l, uap, retval);
if (error == 0)
break;
- error = ioctlf(fp, DIOCGDEFLABEL, (void *)&label, l);
- error1 = ioctlf(fp, DIOCGPART, (void *)&partp, l);
+ error = ioctlf(fp, DIOCGDEFLABEL, &label);
+ error1 = ioctlf(fp, DIOCGPART, &partp);
if (error != 0 && error1 != 0) {
error = error1;
break;
@@ -130,8 +125,8 @@ linux_ioctl_hdio(struct lwp *l, const struct linux_sys_ioctl_args *uap,
if (error == 0)
break;
case LINUX_HDIO_GETGEO_BIG_RAW:
- error = ioctlf(fp, DIOCGDEFLABEL, (void *)&label, l);
- error1 = ioctlf(fp, DIOCGPART, (void *)&partp, l);
+ error = ioctlf(fp, DIOCGDEFLABEL, &label);
+ error1 = ioctlf(fp, DIOCGPART, &partp);
if (error != 0 && error1 != 0) {
error = error1;
break;
@@ -167,7 +162,7 @@ linux_ioctl_hdio(struct lwp *l, const struct linux_sys_ioctl_args *uap,
error = EINVAL;
}
- FILE_UNUSE(fp, l);
+ fd_putfile(SCARG(uap, fd));
return error;
}