aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/zfs_onexit.c
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2010-08-26 11:44:39 -0700
committerBrian Behlendorf <[email protected]>2010-08-31 13:41:50 -0700
commit325f023544bbec6a478882c442e15304ee379759 (patch)
treee41ddbab7f373fc7fd43390c4ba05ea722729e68 /module/zfs/zfs_onexit.c
parent47d0ed1e6f8a8ee67492ec63173a27df8e4ca059 (diff)
Add linux kernel device support
This branch contains the majority of the changes required to cleanly intergrate with Linux style special devices (/dev/zfs). Mainly this means dropping all the Solaris style callbacks and replacing them with the Linux equivilants. This patch also adds the onexit infrastructure needed to track some minimal state between ioctls. Under Linux it would be easy to do this simply using the file->private_data. But under Solaris they apparent need to pass the file descriptor as part of the ioctl data and then perform a lookup in the kernel. Once again to keep code change to a minimum I've implemented the Solaris solution. Signed-off-by: Brian Behlendorf <[email protected]>
Diffstat (limited to 'module/zfs/zfs_onexit.c')
-rw-r--r--module/zfs/zfs_onexit.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/module/zfs/zfs_onexit.c b/module/zfs/zfs_onexit.c
index 9706de2b4..2f60b5e4d 100644
--- a/module/zfs/zfs_onexit.c
+++ b/module/zfs/zfs_onexit.c
@@ -42,9 +42,10 @@
*
* These cleanup callbacks are intended to allow for the accumulation
* of kernel state across multiple ioctls. User processes participate
- * by opening ZFS_DEV with O_EXCL. This causes the ZFS driver to do a
- * clone-open, generating a unique minor number. The process then passes
- * along that file descriptor to each ioctl that might have a cleanup operation.
+ * simply by opening ZFS_DEV. This causes the ZFS driver to do create
+ * some private data for the file descriptor and generating a unique
+ * minor number. The process then passes along that file descriptor to
+ * each ioctl that might have a cleanup operation.
*
* Consumers of the onexit routines should call zfs_onexit_fd_hold() early
* on to validate the given fd and add a reference to its file table entry.
@@ -106,7 +107,7 @@ zfs_onexit_destroy(zfs_onexit_t *zo)
static int
zfs_onexit_minor_to_state(minor_t minor, zfs_onexit_t **zo)
{
- *zo = zfsdev_get_soft_state(minor, ZSST_CTLDEV);
+ *zo = zfsdev_get_state(minor, ZST_ONEXIT);
if (*zo == NULL)
return (EBADF);
@@ -129,7 +130,7 @@ zfs_onexit_fd_hold(int fd, minor_t *minorp)
if (fp == NULL)
return (EBADF);
- *minorp = getminor(fp->f_vnode->v_rdev);
+ *minorp = zfsdev_getminor(fp->f_file);
return (zfs_onexit_minor_to_state(*minorp, &zo));
}