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