FreeBSD ZFS
The Zettabyte File System

sys/zfs_onexit.h

Go to the documentation of this file.
00001 /*
00002  * CDDL HEADER START
00003  *
00004  * The contents of this file are subject to the terms of the
00005  * Common Development and Distribution License (the "License").
00006  * You may not use this file except in compliance with the License.
00007  *
00008  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
00009  * or http://www.opensolaris.org/os/licensing.
00010  * See the License for the specific language governing permissions
00011  * and limitations under the License.
00012  *
00013  * When distributing Covered Code, include this CDDL HEADER in each
00014  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
00015  * If applicable, add the following below this CDDL HEADER, with the
00016  * fields enclosed by brackets "[]" replaced with your own identifying
00017  * information: Portions Copyright [yyyy] [name of copyright owner]
00018  *
00019  * CDDL HEADER END
00020  */
00021 
00022 /*
00023  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
00024  */
00025 
00026 #ifndef _SYS_ZFS_ONEXIT_H
00027 #define _SYS_ZFS_ONEXIT_H
00028 
00029 #include <sys/zfs_context.h>
00030 
00031 #ifdef  __cplusplus
00032 extern "C" {
00033 #endif
00034 
00035 #ifdef _KERNEL
00036 
00037 typedef struct zfs_onexit {
00038         kmutex_t        zo_lock;
00039         list_t          zo_actions;
00040 } zfs_onexit_t;
00041 
00042 typedef struct zfs_onexit_action_node {
00043         list_node_t     za_link;
00044         void            (*za_func)(void *);
00045         void            *za_data;
00046 } zfs_onexit_action_node_t;
00047 
00048 extern void zfs_onexit_init(zfs_onexit_t **zo);
00049 extern void zfs_onexit_destroy(zfs_onexit_t *zo);
00050 
00051 #endif
00052 
00053 extern int zfs_onexit_fd_hold(int fd, minor_t *minorp);
00054 extern void zfs_onexit_fd_rele(int fd);
00055 extern int zfs_onexit_add_cb(minor_t minor, void (*func)(void *), void *data,
00056     uint64_t *action_handle);
00057 extern int zfs_onexit_del_cb(minor_t minor, uint64_t action_handle,
00058     boolean_t fire);
00059 extern int zfs_onexit_cb_data(minor_t minor, uint64_t action_handle,
00060     void **data);
00061 
00062 #ifdef  __cplusplus
00063 }
00064 #endif
00065 
00066 #endif  /* _SYS_ZFS_ONEXIT_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines