btrfs: [] on the end of a struct field is a variable length array.
[haiku.git] / headers / private / storage / MutablePartition.h
blob61df51b7b94565e320a0b41cf44ebc863b686fe8
1 /*
2 * Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef _MUTABLE_PARTITION_H
6 #define _MUTABLE_PARTITION_H
8 #include <List.h>
9 #include <Partition.h>
12 struct user_partition_data;
15 class BMutablePartition {
16 public:
17 void UninitializeContents();
19 off_t Offset() const;
20 void SetOffset(off_t offset);
22 off_t Size() const;
23 void SetSize(off_t size);
25 off_t ContentSize() const;
26 void SetContentSize(off_t size);
28 off_t BlockSize() const;
29 void SetBlockSize(off_t blockSize);
31 uint32 Status() const;
32 void SetStatus(uint32 status);
34 uint32 Flags() const;
35 void SetFlags(uint32 flags);
36 void ClearFlags(uint32 flags);
38 dev_t VolumeID() const;
39 void SetVolumeID(dev_t volumeID);
41 int32 Index() const;
43 const char* Name() const;
44 status_t SetName(const char* name);
46 const char* ContentName() const;
47 status_t SetContentName(const char* name);
49 const char* Type() const;
50 status_t SetType(const char* type);
52 const char* ContentType() const;
53 status_t SetContentType(const char* type);
55 const char* Parameters() const;
56 status_t SetParameters(const char* parameters);
58 const char* ContentParameters() const;
59 status_t SetContentParameters(const char* parameters);
61 status_t CreateChild(int32 index,
62 BMutablePartition** child);
63 status_t CreateChild(int32 index, const char* type,
64 const char* name, const char* parameters,
65 BMutablePartition** child);
66 status_t DeleteChild(int32 index);
67 status_t DeleteChild(BMutablePartition* child);
68 void DeleteAllChildren();
70 BMutablePartition* Parent() const;
71 BMutablePartition* ChildAt(int32 index) const;
72 int32 CountChildren() const;
73 int32 IndexOfChild(BMutablePartition* child) const;
75 void SetChangeFlags(uint32 flags);
76 uint32 ChangeFlags() const;
77 void Changed(uint32 flags, uint32 clearFlags = 0);
79 // for the partitioning system managing the parent
80 void* ChildCookie() const;
81 void SetChildCookie(void* cookie);
83 private:
84 BMutablePartition(
85 BPartition::Delegate* delegate);
86 ~BMutablePartition();
88 status_t Init(const user_partition_data* partitionData,
89 BMutablePartition* parent);
91 const user_partition_data* PartitionData() const;
93 private:
94 friend class BPartition::Delegate;
96 BPartition::Delegate* GetDelegate() const;
98 BPartition::Delegate* fDelegate;
99 user_partition_data* fData;
100 BMutablePartition* fParent;
101 BList fChildren;
102 uint32 fChangeFlags;
103 void* fChildCookie;
107 #endif // _MUTABLE_PARTITION_H