xref: /haiku/headers/private/shared/AutoDeleterDrivers.h (revision 410ed2fbba58819ac21e27d3676739728416761d)
1 /*
2  * Copyright 2020, Haiku, Inc.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _AUTO_DELETER_DRIVERS_H
6 #define _AUTO_DELETER_DRIVERS_H
7 
8 
9 #include <AutoDeleter.h>
10 #include <driver_settings.h>
11 #if defined(_KERNEL_MODE) && !defined(_BOOT_MODE)
12 #include <vfs.h>
13 #include <fs/fd.h>
14 #endif
15 
16 
17 namespace BPrivate {
18 
19 
20 typedef CObjectDeleter<void, status_t, unload_driver_settings> DriverSettingsUnloader;
21 
22 #if defined(_KERNEL_MODE) && !defined(_BOOT_MODE)
23 
24 typedef CObjectDeleter<struct vnode, void, vfs_put_vnode> VnodePutter;
25 typedef CObjectDeleter<file_descriptor, void, put_fd> DescriptorPutter;
26 
27 #endif
28 
29 
30 }
31 
32 
33 using ::BPrivate::DriverSettingsUnloader;
34 
35 #if defined(_KERNEL_MODE) && !defined(_BOOT_MODE)
36 
37 using ::BPrivate::VnodePutter;
38 using ::BPrivate::DescriptorPutter;
39 
40 #endif
41 
42 
43 #endif	// _AUTO_DELETER_DRIVERS_H
44