vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / kernel / file_systems / ext2 / InodeAllocator.h
blob75ae7adffc64d25802e9134868d34f8e0090f437
1 /*
2 * Copyright 2001-2010, Haiku Inc. All rights reserved.
3 * This file may be used under the terms of the MIT License.
5 * Authors:
6 * Janito V. Ferreira Filho
7 */
8 #ifndef INODEALLOCATOR_H
9 #define INODEALLOCATOR_H
11 #include <lock.h>
13 #include "ext2.h"
14 #include "Transaction.h"
17 class Inode;
18 class Volume;
21 class InodeAllocator {
22 public:
23 InodeAllocator(Volume* volume);
24 virtual ~InodeAllocator();
26 virtual status_t New(Transaction& transaction, Inode* parent,
27 int32 mode, ino_t& id);
28 virtual status_t Free(Transaction& transaction, ino_t id,
29 bool isDirectory);
31 private:
32 status_t _Allocate(Transaction& transaction,
33 uint32 preferredBlockGroup, bool isDirectory,
34 ino_t& id);
35 status_t _AllocateInGroup(Transaction& transaction,
36 uint32 blockGroup, bool isDirectory,
37 ino_t& id, uint32 numInodes);
38 status_t _MarkInBitmap(Transaction& transaction,
39 fsblock_t bitmapBlock, uint32 blockGroup,
40 uint32 numInodes, uint32& pos);
41 status_t _UnmarkInBitmap(Transaction& transaction,
42 fsblock_t bitmapBlock, uint32 numInodes, ino_t id);
43 status_t _InitGroup(Transaction& transaction,
44 ext2_block_group* group, fsblock_t bitmapBlock,
45 uint32 numInodes);
48 Volume* fVolume;
49 mutex fLock;
52 #endif // INODEALLOCATOR_H