vfs: check userland buffers before reading them.
[haiku.git] / src / kits / storage / disk_device / DiskDeviceJobGenerator.h
blobbc00e02b62764e8928d73cc1cb089ee066ad32ae
1 /*
2 * Copyright 2003-2007, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef _DISK_DEVICE_JOB_GENERATOR_H
6 #define _DISK_DEVICE_JOB_GENERATOR_H
8 #include <DiskDeviceDefs.h>
11 class BDiskDevice;
12 class BMutablePartition;
13 class BPartition;
16 namespace BPrivate {
19 class DiskDeviceJob;
20 class DiskDeviceJobQueue;
21 class PartitionReference;
24 class DiskDeviceJobGenerator {
25 public:
26 DiskDeviceJobGenerator(BDiskDevice* device,
27 DiskDeviceJobQueue* jobQueue);
28 ~DiskDeviceJobGenerator();
30 status_t GenerateJobs();
32 private:
33 status_t _AddJob(DiskDeviceJob* job);
35 status_t _GenerateCleanupJobs(BPartition* partition);
36 status_t _GeneratePlacementJobs(BPartition* partition);
37 status_t _GenerateChildPlacementJobs(
38 BPartition* partition);
39 status_t _GenerateRemainingJobs(BPartition* parent,
40 BPartition* partition);
42 BMutablePartition* _GetMutablePartition(BPartition* partition);
44 status_t _GenerateInitializeJob(BPartition* partition);
45 status_t _GenerateUninitializeJob(BPartition* partition);
46 status_t _GenerateSetContentNameJob(
47 BPartition* partition);
48 status_t _GenerateSetContentParametersJob(
49 BPartition* partition);
50 status_t _GenerateDefragmentJob(BPartition* partition);
51 status_t _GenerateRepairJob(BPartition* partition,
52 bool repair);
54 status_t _GenerateCreateChildJob(BPartition* parent,
55 BPartition* partition);
56 status_t _GenerateDeleteChildJob(BPartition* parent,
57 BPartition* partition);
58 status_t _GenerateResizeJob(BPartition* partition);
59 status_t _GenerateMoveJob(BPartition* partition);
60 status_t _GenerateSetNameJob(BPartition* parent,
61 BPartition* partition);
62 status_t _GenerateSetTypeJob(BPartition* parent,
63 BPartition* partition);
64 status_t _GenerateSetParametersJob(BPartition* parent,
65 BPartition* partition);
67 status_t _CollectContentsToMove(BPartition* partition);
68 status_t _PushContentsToMove(BPartition* partition);
70 status_t _GetPartitionReference(BPartition* partition,
71 PartitionReference*& reference);
73 static int _CompareMoveInfoPosition(const void* _a,
74 const void* _b);
76 private:
77 struct MoveInfo;
78 struct PartitionRefInfo;
80 BDiskDevice* fDevice;
81 DiskDeviceJobQueue* fJobQueue;
82 MoveInfo* fMoveInfos;
83 int32 fPartitionCount;
84 PartitionRefInfo* fPartitionRefs;
85 PartitionReference** fContentsToMove;
86 int32 fContentsToMoveCount;
90 } // namespace BPrivate
92 using BPrivate::DiskDeviceJobGenerator;
94 #endif // _DISK_DEVICE_JOB_GENERATOR_H