diff options
| author | dsl <dsl@NetBSD.org> | 2007-07-01 09:54:16 +0000 |
|---|---|---|
| committer | dsl <dsl@NetBSD.org> | 2007-07-01 09:54:16 +0000 |
| commit | bf215415ab327c41ea673a269f0a1e2ebe11fd6d (patch) | |
| tree | 66501b522e054e33c4b8b30f67e12f2b953b9811 /sys/compat/linux | |
| parent | 80f6eff58d51fb626862ef99ac1b68abf9445594 (diff) | |
Fix LINUX_HDIO_GET_IDENTITY so that it returns the entire 512 byte buffer.
Rely on the code in dev/ata/wd.c doing a relay for the short read needed
for LINUX_HDIO_OBSOLETE_IDENTITY.
Diffstat (limited to 'sys/compat/linux')
| -rw-r--r-- | sys/compat/linux/common/linux_hdio.c | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/sys/compat/linux/common/linux_hdio.c b/sys/compat/linux/common/linux_hdio.c index beb451f0a8e..592d01e831d 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.12 2007/03/04 06:01:23 christos Exp $ */ +/* $NetBSD: linux_hdio.c,v 1.13 2007/07/01 09:54:16 dsl Exp $ */ /* * Copyright (c) 2000 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_hdio.c,v 1.12 2007/03/04 06:01:23 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_hdio.c,v 1.13 2007/07/01 09:54:16 dsl Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -68,11 +68,9 @@ linux_ioctl_hdio(struct lwp *l, struct linux_sys_ioctl_args *uap, struct proc *p = l->l_proc; u_long com; int error, error1; - void *sg; struct filedesc *fdp; struct file *fp; int (*ioctlf)(struct file *, u_long, void *, struct lwp *); - struct ataparams *atap, ata; struct atareq req; struct disklabel label, *labp; struct partinfo partp; @@ -92,32 +90,21 @@ linux_ioctl_hdio(struct lwp *l, struct linux_sys_ioctl_args *uap, switch (com) { case LINUX_HDIO_OBSOLETE_IDENTITY: case LINUX_HDIO_GET_IDENTITY: - sg = stackgap_init(p, 0); - atap = stackgap_alloc(p, &sg, DEV_BSIZE); - if (atap == NULL) { - error = ENOMEM; - break; - } - req.flags = ATACMD_READ; req.command = WDCC_IDENTIFY; - req.databuf = (void *)atap; - req.datalen = DEV_BSIZE; - req.timeout = 1000; - error = ioctlf(fp, ATAIOCCOMMAND, (void *)&req, l); - if (error != 0) - break; - if (req.retsts != ATACMD_OK) - return EIO; - error = copyin(atap, &ata, sizeof ata); - if (error != 0) - break; + req.databuf = SCARG(uap, data); /* * 142 is the size of the old structure used by Linux, * which doesn't seem to be defined anywhere anymore. + * The new function should return the entire 512 byte area. */ - error = copyout(&ata, SCARG(uap, data), - com == LINUX_HDIO_GET_IDENTITY ? sizeof ata : 142); + req.datalen = com == LINUX_HDIO_GET_IDENTITY ? 512 : 142; + req.timeout = 1000; + error = ioctlf(fp, ATAIOCCOMMAND, &req, l); + if (error != 0) + break; + if (req.retsts != ATACMD_OK) + error = EIO; break; case LINUX_HDIO_GETGEO: error = linux_machdepioctl(l, uap, retval); |
