Subject: Re: IOCTL implementation and kernel/userland addresses
To: Frank van der Linden <fvdl@NetBSD.org>
From: SODA Noriyuki <soda@sra.co.jp>
List: tech-kern
Date: 02/05/2005 07:17:07
>>>>> On Fri, 4 Feb 2005 21:44:17 +0100,
	Frank van der Linden <fvdl@NetBSD.org> said:

> However, ioctl is and always has been a userspace interface.
> 
> If you want something usable from kernel space, implement a seperate
> function which can be called by both the ioctl code and your code.

Well, there are some places that filesystems are calling VOP_IOCTL(),
are those wrong?

% grep VOP_IOCTL *fs/*/*.c
fs/adosfs/advfsops.c:	error = VOP_IOCTL(devvp, DIOCGDINFO, &dl, FREAD, NOCRED, p);
fs/cd9660/cd9660_vfsops.c:	error = VOP_IOCTL(devvp, DIOCGDINFO, &label, FREAD, FSCRED, p);
fs/cd9660/cd9660_vfsops.c:		error = VOP_IOCTL(devvp, CDIOREADMSADDR, &sess, 0, FSCRED, p);
fs/msdosfs/msdosfs_vfsops.c:		error = VOP_IOCTL(devvp, DIOCGPART, &dpart, FREAD, NOCRED, p);
miscfs/genfs/genfs_vnops.c:			error = VOP_IOCTL(dvp, DIOCCACHESYNC, &l, FWRITE,
ufs/ext2fs/ext2fs_vfsops.c:	if (VOP_IOCTL(devvp, DIOCGPART, &dpart, FREAD, NOCRED, p) != 0)
ufs/ext2fs/ext2fs_vfsops.c:	if (VOP_IOCTL(devvp, DIOCGPART, &dpart, FREAD, cred, p) != 0)
ufs/ffs/ffs_softdep.c:		VOP_IOCTL(ip->i_devvp, DIOCCACHESYNC, &l, FWRITE, p->p_ucred, p);
ufs/ffs/ffs_vfsops.c:	if (VOP_IOCTL(devvp, DIOCGPART, &dpart, FREAD, NOCRED, p) != 0)
ufs/ffs/ffs_vfsops.c:	if ((VOP_IOCTL(devvp, DIOCGPART, &dpart, FREAD, cred, p) == 0) &&
ufs/ffs/ffs_vfsops.c:	if (VOP_IOCTL(devvp, DIOCGPART, &dpart, FREAD, cred, p) != 0)
ufs/ffs/ffs_vfsops.c:	if ((VOP_IOCTL(devvp, DIOCGPART, &dpart, FREAD, cred, p) == 0) &&
ufs/ffs/ffs_vnops.c:		VOP_IOCTL(VTOI(vp)->i_devvp, DIOCCACHESYNC, &l, FWRITE,
ufs/ffs/ffs_vnops.c:		VOP_IOCTL(VTOI(vp)->i_devvp, DIOCCACHESYNC, &i, FWRITE,
ufs/lfs/lfs_vfsops.c:	if (VOP_IOCTL(devvp, DIOCGPART, &dpart, FREAD, cred, p) != 0)
ufs/lfs/lfs_vnops.c:		error = VOP_IOCTL(VTOI(vp)->i_devvp, DIOCCACHESYNC, &l, FWRITE,
--
soda