mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
Move zfs_cmd_t copyin/copyout to platform code
FreeBSD needs to cope with multiple version of the zfs_cmd_t structure. Allowing the platform code to pre and post process the cmd structure makes it possible to work with legacy tooling. Reviewed-by: Jorgen Lundman <lundman@lundman.net> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Matt Macy <mmacy@FreeBSD.org> Closes #9624
This commit is contained in:
committed by
Brian Behlendorf
parent
42a826eed3
commit
5142032106
@@ -168,9 +168,25 @@ static long
|
||||
zfsdev_ioctl(struct file *filp, unsigned cmd, unsigned long arg)
|
||||
{
|
||||
uint_t vecnum;
|
||||
zfs_cmd_t *zc;
|
||||
int error, rc;
|
||||
|
||||
vecnum = cmd - ZFS_IOC_FIRST;
|
||||
return (zfsdev_ioctl_common(vecnum, arg));
|
||||
|
||||
zc = kmem_zalloc(sizeof (zfs_cmd_t), KM_SLEEP);
|
||||
|
||||
if (ddi_copyin((void *)(uintptr_t)arg, zc, sizeof (zfs_cmd_t), 0)) {
|
||||
error = -SET_ERROR(EFAULT);
|
||||
goto out;
|
||||
}
|
||||
error = -zfsdev_ioctl_common(vecnum, zc);
|
||||
rc = ddi_copyout(zc, (void *)(uintptr_t)arg, sizeof (zfs_cmd_t), 0);
|
||||
if (error == 0 && rc != 0)
|
||||
error = -SET_ERROR(EFAULT);
|
||||
out:
|
||||
kmem_free(zc, sizeof (zfs_cmd_t));
|
||||
return (error);
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
Reference in New Issue
Block a user