Make UEFI boot-platform build again
[haiku.git] / headers / private / kernel / disk_device_manager / KDiskSystem.h
blob1f1da9b749eceddf6fa00f7167fa08ec315b274c
1 /*
2 * Copyright 2003-2011, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Ingo Weinhold <ingo_weinhold@gmx.de>
7 */
8 #ifndef _K_DISK_DEVICE_SYSTEM_H
9 #define _K_DISK_DEVICE_SYSTEM_H
12 #include "disk_device_manager.h"
15 struct user_disk_system_info;
18 namespace BPrivate {
19 namespace DiskDevice {
22 class KPartition;
25 //! \brief Common ancestor for disk system add-on wrappers
26 class KDiskSystem {
27 public:
28 KDiskSystem(const char *name);
29 virtual ~KDiskSystem();
31 virtual status_t Init();
33 // void SetID(disk_system_id id);
34 disk_system_id ID() const;
36 const char* Name() const;
37 const char* ShortName() const;
38 const char* PrettyName() const;
39 uint32 Flags() const;
41 bool IsFileSystem() const;
42 bool IsPartitioningSystem() const;
44 void GetInfo(user_disk_system_info* info);
46 // manager will be locked
47 status_t Load(); // load/unload -- can be nested
48 void Unload(); //
49 bool IsLoaded() const;
51 // Scanning
52 // Device must be write locked.
54 virtual float Identify(KPartition* partition, void** cookie);
55 virtual status_t Scan(KPartition* partition, void* cookie);
56 virtual void FreeIdentifyCookie(KPartition* partition,
57 void* cookie);
58 virtual void FreeCookie(KPartition* partition);
59 virtual void FreeContentCookie(KPartition* partition);
61 // Writing
62 // Device should not be locked, but all affected partitions are marked
63 // busy, meaning that no one else is allowed to modify it (and we only,
64 // if we get a write lock).
66 virtual status_t Defragment(KPartition* partition,
67 disk_job_id job);
68 virtual status_t Repair(KPartition* partition, bool checkOnly,
69 disk_job_id job);
70 virtual status_t Resize(KPartition* partition, off_t size,
71 disk_job_id job);
72 virtual status_t ResizeChild(KPartition* child, off_t size,
73 disk_job_id job);
74 virtual status_t Move(KPartition* partition, off_t offset,
75 disk_job_id job);
76 virtual status_t MoveChild(KPartition* child, off_t offset,
77 disk_job_id job);
78 virtual status_t SetName(KPartition* partition, const char* name,
79 disk_job_id job);
80 virtual status_t SetContentName(KPartition* partition,
81 const char* name, disk_job_id job);
82 virtual status_t SetType(KPartition* partition, const char* type,
83 disk_job_id job);
84 virtual status_t SetParameters(KPartition* partition,
85 const char* parameters, disk_job_id job);
86 virtual status_t SetContentParameters(KPartition* partition,
87 const char* parameters, disk_job_id job);
88 virtual status_t Initialize(KPartition* partition,
89 const char* name, const char* parameters,
90 disk_job_id job);
91 virtual status_t Uninitialize(KPartition* partition,
92 disk_job_id job);
93 virtual status_t CreateChild(KPartition* partition, off_t offset,
94 off_t size, const char* type,
95 const char* name, const char* parameters,
96 disk_job_id job, KPartition** child = NULL,
97 partition_id childID = -1);
98 virtual status_t DeleteChild(KPartition* child, disk_job_id job);
100 protected:
101 virtual status_t LoadModule();
102 virtual void UnloadModule();
104 status_t SetShortName(const char* name);
105 status_t SetPrettyName(const char* name);
106 void SetFlags(uint32 flags);
108 static int32 _NextID();
110 private:
111 disk_system_id fID;
112 char* fName;
113 char* fShortName;
114 char* fPrettyName;
115 uint32 fFlags;
116 int32 fLoadCounter;
118 static int32 fNextID;
122 } // namespace DiskDevice
123 } // namespace BPrivate
125 using BPrivate::DiskDevice::KDiskSystem;
127 #endif // _K_DISK_DEVICE_SYSTEM_H