mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
Move zfs_onexit_fd_hold to platform code
FreeBSD has a very different implementation. Reviewed-by: Ryan Moeller <ryan@ixsystems.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Matt Macy <mmacy@FreeBSD.org> Closes #9442
This commit is contained in:
committed by
Brian Behlendorf
parent
c324701332
commit
cdbba101f4
@@ -111,39 +111,6 @@ zfs_onexit_minor_to_state(minor_t minor, zfs_onexit_t **zo)
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Consumers might need to operate by minor number instead of fd, since
|
||||
* they might be running in another thread (e.g. txg_sync_thread). Callers
|
||||
* of this function must call zfs_onexit_fd_rele() when they're finished
|
||||
* using the minor number.
|
||||
*/
|
||||
int
|
||||
zfs_onexit_fd_hold(int fd, minor_t *minorp)
|
||||
{
|
||||
file_t *fp;
|
||||
zfs_onexit_t *zo;
|
||||
int error;
|
||||
|
||||
fp = getf(fd);
|
||||
if (fp == NULL)
|
||||
return (SET_ERROR(EBADF));
|
||||
|
||||
error = zfsdev_getminor(fp->f_file, minorp);
|
||||
if (error == 0)
|
||||
error = zfs_onexit_minor_to_state(*minorp, &zo);
|
||||
|
||||
if (error)
|
||||
zfs_onexit_fd_rele(fd);
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
void
|
||||
zfs_onexit_fd_rele(int fd)
|
||||
{
|
||||
releasef(fd);
|
||||
}
|
||||
|
||||
/*
|
||||
* Add a callback to be invoked when the calling process exits.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user