Beispiel #1
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 = NULL;
	zfs_onexit_t *zo;

    fp = getf(fd);
    if (fp == NULL)
        return EBADF;

#ifdef __APPLE__
    *minorp = zfsdev_getminor((dev_t)current_proc());
#else
    *minorp = zfsdev_getminor(fp->f_file);
#endif
    return (zfs_onexit_minor_to_state(*minorp, &zo));
}
Beispiel #2
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;

	fp = getf(fd);
	if (fp == NULL)
		return (SET_ERROR(EBADF));

	*minorp = zfsdev_getminor(fp->f_file);
	return (zfs_onexit_minor_to_state(*minorp, &zo));
}
Beispiel #3
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 = NULL;
	zfs_onexit_t *zo;
	int error;

    fp = getf(fd);
    if (fp == NULL)
        return EBADF;

    *minorp = zfsdev_getminor(fp->f_file);
    return (zfs_onexit_minor_to_state(*minorp, &zo));
}