aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Macy <[email protected]>2019-10-16 18:43:52 -0700
committerBrian Behlendorf <[email protected]>2019-10-16 18:43:52 -0700
commit08f530c6996a41c1050a11fc5b02b31a6b68fe45 (patch)
tree562b0632edee2a6353e486f2b4da62ccf1e23954
parent0e939e434a254224907cc379a0e7039984221500 (diff)
Make zfsdev_getminor signature cross platform
Only pass the file descriptor to make zfsdev_get_miror() portable. Reviewed-by: George Melikov <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Matt Macy <[email protected]> Closes #9466
-rw-r--r--include/sys/zfs_ioctl.h2
-rw-r--r--module/os/linux/zfs/zfs_ioctl_os.c10
-rw-r--r--module/os/linux/zfs/zfs_onexit_os.c7
-rw-r--r--module/zfs/fm.c7
4 files changed, 10 insertions, 16 deletions
diff --git a/include/sys/zfs_ioctl.h b/include/sys/zfs_ioctl.h
index daa1560f3..48788477a 100644
--- a/include/sys/zfs_ioctl.h
+++ b/include/sys/zfs_ioctl.h
@@ -546,7 +546,7 @@ typedef struct zfsdev_state {
} zfsdev_state_t;
extern void *zfsdev_get_state(minor_t minor, enum zfsdev_state_type which);
-extern int zfsdev_getminor(struct file *filp, minor_t *minorp);
+extern int zfsdev_getminor(int fd, minor_t *minorp);
extern minor_t zfsdev_minor_alloc(void);
extern uint_t zfs_fsyncer_key;
diff --git a/module/os/linux/zfs/zfs_ioctl_os.c b/module/os/linux/zfs/zfs_ioctl_os.c
index 9b562cab3..4e672cca2 100644
--- a/module/os/linux/zfs/zfs_ioctl_os.c
+++ b/module/os/linux/zfs/zfs_ioctl_os.c
@@ -175,14 +175,18 @@ zfsdev_ioctl(struct file *filp, unsigned cmd, unsigned long arg)
}
int
-zfsdev_getminor(struct file *filp, minor_t *minorp)
+zfsdev_getminor(int fd, minor_t *minorp)
{
zfsdev_state_t *zs, *fpd;
+ file_t *fp;
- ASSERT(filp != NULL);
ASSERT(!MUTEX_HELD(&zfsdev_state_lock));
+ fp = getf(fd);
- fpd = filp->private_data;
+ if (fp == NULL)
+ return (SET_ERROR(EBADF));
+
+ fpd = fp->f_file->private_data;
if (fpd == NULL)
return (SET_ERROR(EBADF));
diff --git a/module/os/linux/zfs/zfs_onexit_os.c b/module/os/linux/zfs/zfs_onexit_os.c
index 0c33de7fe..95dbe8dbe 100644
--- a/module/os/linux/zfs/zfs_onexit_os.c
+++ b/module/os/linux/zfs/zfs_onexit_os.c
@@ -40,15 +40,10 @@
int
zfs_onexit_fd_hold(int fd, minor_t *minorp)
{
- file_t *fp;
zfs_onexit_t *zo = NULL;
int error;
- fp = getf(fd);
- if (fp == NULL)
- return (SET_ERROR(EBADF));
-
- error = zfsdev_getminor(fp->f_file, minorp);
+ error = zfsdev_getminor(fd, minorp);
if (error) {
zfs_onexit_fd_rele(fd);
return (error);
diff --git a/module/zfs/fm.c b/module/zfs/fm.c
index 98a844820..722855492 100644
--- a/module/zfs/fm.c
+++ b/module/zfs/fm.c
@@ -582,14 +582,9 @@ zfs_zevent_minor_to_state(minor_t minor, zfs_zevent_t **ze)
int
zfs_zevent_fd_hold(int fd, minor_t *minorp, zfs_zevent_t **ze)
{
- file_t *fp;
int error;
- fp = getf(fd);
- if (fp == NULL)
- return (SET_ERROR(EBADF));
-
- error = zfsdev_getminor(fp->f_file, minorp);
+ error = zfsdev_getminor(fd, minorp);
if (error == 0)
error = zfs_zevent_minor_to_state(*minorp, ze);