vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / kernel / file_systems / nfs4 / InodeIdMap.h
bloba375c7702d6587f4a2cb25f2ef1b325b1a85230f
1 /*
2 * Copyright 2012,2013 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Paweł Dziepak, pdziepak@quarnos.org
7 */
8 #ifndef INODEIDMAP_H
9 #define INODEIDMAP_H
12 #include <lock.h>
13 #include <SupportDefs.h>
14 #include <util/AutoLock.h>
15 #include <util/AVLTreeMap.h>
17 #include "FileInfo.h"
20 class InodeIdMap {
21 public:
22 inline InodeIdMap();
23 inline ~InodeIdMap();
25 status_t AddName(FileInfo& fileInfo,
26 InodeNames* parent,
27 const char* name, ino_t id);
28 bool RemoveName(ino_t id,
29 InodeNames* parent,
30 const char* name);
31 status_t RemoveEntry(ino_t id);
32 status_t GetFileInfo(FileInfo* fileInfo,
33 ino_t id);
35 private:
36 AVLTreeMap<ino_t, FileInfo> fMap;
37 mutex fLock;
42 inline
43 InodeIdMap::InodeIdMap()
45 mutex_init(&fLock, NULL);
49 inline
50 InodeIdMap::~InodeIdMap()
52 mutex_destroy(&fLock);
56 #endif // INODEIDMAP_H