1/*
2 * Copyright 2011, Oliver Tappe <zooey@hirschkaefer.de>
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef UTILS_H
6#define UTILS_H
7
8
9#include <AutoDeleter.h>
10
11#include <vfs.h>
12
13
14using BPrivate::AutoDeleter;
15
16
17struct VnodePut
18{
19	inline void operator()(vnode* _vnode)
20	{
21		if (_vnode != NULL)
22			vfs_put_vnode(_vnode);
23	}
24};
25
26struct VnodePutter : AutoDeleter<vnode, VnodePut>
27{
28	VnodePutter() : AutoDeleter<vnode, VnodePut>() {}
29
30	VnodePutter(vnode* _vnode) : AutoDeleter<vnode, VnodePut>(_vnode) {}
31};
32
33
34#endif	// UTILS_H
35