zfs_onexit_add_cb: make action_handle point to a uintptr_t

Avoid assuming than a uint64_t can hold a pointer and reduce the
number of casts in the process.

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Signed-off-by: Brooks Davis <brooks.davis@sri.com>
Closes #14131
This commit is contained in:
Brooks Davis 2022-10-27 23:20:05 +01:00 committed by Brian Behlendorf
parent d96303cb07
commit 250b2bac78
3 changed files with 4 additions and 4 deletions

View File

@ -54,7 +54,7 @@ extern void zfs_onexit_destroy(zfs_onexit_t *zo);
extern zfs_file_t *zfs_onexit_fd_hold(int fd, minor_t *minorp);
extern void zfs_onexit_fd_rele(zfs_file_t *);
extern int zfs_onexit_add_cb(minor_t minor, void (*func)(void *), void *data,
uint64_t *action_handle);
uintptr_t *action_handle);
#ifdef __cplusplus
}

View File

@ -1001,7 +1001,7 @@ zfs_onexit_fd_rele(zfs_file_t *fp)
int
zfs_onexit_add_cb(minor_t minor, void (*func)(void *), void *data,
uint64_t *action_handle)
uintptr_t *action_handle)
{
(void) minor, (void) func, (void) data, (void) action_handle;
return (0);

View File

@ -151,7 +151,7 @@ zfs_onexit_minor_to_state(minor_t minor, zfs_onexit_t **zo)
*/
int
zfs_onexit_add_cb(minor_t minor, void (*func)(void *), void *data,
uint64_t *action_handle)
uintptr_t *action_handle)
{
zfs_onexit_t *zo;
zfs_onexit_action_node_t *ap;
@ -170,7 +170,7 @@ zfs_onexit_add_cb(minor_t minor, void (*func)(void *), void *data,
list_insert_tail(&zo->zo_actions, ap);
mutex_exit(&zo->zo_lock);
if (action_handle)
*action_handle = (uint64_t)(uintptr_t)ap;
*action_handle = (uintptr_t)ap;
return (0);
}