AutoDeleter: add delarations for common types and destructors
Change-Id: I74b75a54038d5af370696302f33b5c0abab4820c Reviewed-on: https://review.haiku-os.org/c/haiku/+/3481 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
parent
84b1893b73
commit
553f3f2309
1
headers/build/private/shared/AutoDeleterDrivers.h
Normal file
1
headers/build/private/shared/AutoDeleterDrivers.h
Normal file
@ -0,0 +1 @@
|
||||
#include <../private/shared/AutoDeleterDrivers.h>
|
1
headers/build/private/shared/AutoDeleterOS.h
Normal file
1
headers/build/private/shared/AutoDeleterOS.h
Normal file
@ -0,0 +1 @@
|
||||
#include <../private/shared/AutoDeleterOS.h>
|
1
headers/build/private/shared/AutoDeleterPosix.h
Normal file
1
headers/build/private/shared/AutoDeleterPosix.h
Normal file
@ -0,0 +1 @@
|
||||
#include <../private/shared/AutoDeleterPosix.h>
|
43
headers/private/shared/AutoDeleterDrivers.h
Normal file
43
headers/private/shared/AutoDeleterDrivers.h
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright 2020, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _AUTO_DELETER_DRIVERS_H
|
||||
#define _AUTO_DELETER_DRIVERS_H
|
||||
|
||||
|
||||
#include <AutoDeleter.h>
|
||||
#include <driver_settings.h>
|
||||
#if defined(_KERNEL_MODE) && !defined(_BOOT_MODE)
|
||||
#include <vfs.h>
|
||||
#include <fs/fd.h>
|
||||
#endif
|
||||
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
|
||||
typedef CObjectDeleter<void, status_t, unload_driver_settings> DriverSettingsUnloader;
|
||||
|
||||
#if defined(_KERNEL_MODE) && !defined(_BOOT_MODE)
|
||||
|
||||
typedef CObjectDeleter<struct vnode, void, vfs_put_vnode> VnodePutter;
|
||||
typedef CObjectDeleter<file_descriptor, void, put_fd> DescriptorPutter;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
using ::BPrivate::DriverSettingsUnloader;
|
||||
|
||||
#if defined(_KERNEL_MODE) && !defined(_BOOT_MODE)
|
||||
|
||||
using ::BPrivate::VnodePutter;
|
||||
using ::BPrivate::DescriptorPutter;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif // _AUTO_DELETER_DRIVERS_H
|
29
headers/private/shared/AutoDeleterOS.h
Normal file
29
headers/private/shared/AutoDeleterOS.h
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2020, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _AUTO_DELETER_OS_H
|
||||
#define _AUTO_DELETER_OS_H
|
||||
|
||||
|
||||
#include <AutoDeleter.h>
|
||||
#include <OS.h>
|
||||
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
|
||||
typedef HandleDeleter<area_id, status_t, delete_area> AreaDeleter;
|
||||
typedef HandleDeleter<sem_id, status_t, delete_sem> SemDeleter;
|
||||
typedef HandleDeleter<port_id, status_t, delete_port> PortDeleter;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
using ::BPrivate::AreaDeleter;
|
||||
using ::BPrivate::SemDeleter;
|
||||
using ::BPrivate::PortDeleter;
|
||||
|
||||
|
||||
#endif // _AUTO_DELETER_OS_H
|
31
headers/private/shared/AutoDeleterPosix.h
Normal file
31
headers/private/shared/AutoDeleterPosix.h
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2020, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _AUTO_DELETER_POSIX_H
|
||||
#define _AUTO_DELETER_POSIX_H
|
||||
|
||||
|
||||
#include <AutoDeleter.h>
|
||||
#include <stdio.h>
|
||||
#include <dirent.h>
|
||||
#include <fs_attr.h>
|
||||
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
|
||||
typedef CObjectDeleter<FILE, int, fclose> FileCloser;
|
||||
typedef CObjectDeleter<DIR, int, closedir> DirCloser;
|
||||
typedef CObjectDeleter<DIR, int, fs_close_attr_dir> AttrDirCloser;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
using ::BPrivate::FileCloser;
|
||||
using ::BPrivate::DirCloser;
|
||||
using ::BPrivate::AttrDirCloser;
|
||||
|
||||
|
||||
#endif // _AUTO_DELETER_POSIX_H
|
Loading…
Reference in New Issue
Block a user