haiku/headers/private/storage/MutablePartition.h
PulkoMandy e3d5904751 Disk Device Manager: generate a name for nameless volumes
This will give the same result as fs_stat_dev, so the filesystems will
have the same name everywhere.

Change-Id: Ic684142efaeb2c16b393f3f3e5c9c3010a054b30
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5636
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-09-21 16:14:32 +00:00

108 lines
2.7 KiB
C++

/*
* Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#ifndef _MUTABLE_PARTITION_H
#define _MUTABLE_PARTITION_H
#include <List.h>
#include <Partition.h>
struct user_partition_data;
class BMutablePartition {
public:
void UninitializeContents();
off_t Offset() const;
void SetOffset(off_t offset);
off_t Size() const;
void SetSize(off_t size);
off_t ContentSize() const;
void SetContentSize(off_t size);
off_t BlockSize() const;
void SetBlockSize(off_t blockSize);
uint32 Status() const;
void SetStatus(uint32 status);
uint32 Flags() const;
void SetFlags(uint32 flags);
void ClearFlags(uint32 flags);
dev_t VolumeID() const;
void SetVolumeID(dev_t volumeID);
int32 Index() const;
const char* Name() const;
status_t SetName(const char* name);
BString ContentName() const;
status_t SetContentName(const char* name);
const char* Type() const;
status_t SetType(const char* type);
const char* ContentType() const;
status_t SetContentType(const char* type);
const char* Parameters() const;
status_t SetParameters(const char* parameters);
const char* ContentParameters() const;
status_t SetContentParameters(const char* parameters);
status_t CreateChild(int32 index,
BMutablePartition** child);
status_t CreateChild(int32 index, const char* type,
const char* name, const char* parameters,
BMutablePartition** child);
status_t DeleteChild(int32 index);
status_t DeleteChild(BMutablePartition* child);
void DeleteAllChildren();
BMutablePartition* Parent() const;
BMutablePartition* ChildAt(int32 index) const;
int32 CountChildren() const;
int32 IndexOfChild(BMutablePartition* child) const;
void SetChangeFlags(uint32 flags);
uint32 ChangeFlags() const;
void Changed(uint32 flags, uint32 clearFlags = 0);
// for the partitioning system managing the parent
void* ChildCookie() const;
void SetChildCookie(void* cookie);
private:
BMutablePartition(
BPartition::Delegate* delegate);
~BMutablePartition();
status_t Init(const user_partition_data* partitionData,
BMutablePartition* parent);
const user_partition_data* PartitionData() const;
private:
friend class BPartition::Delegate;
BPartition::Delegate* GetDelegate() const;
BPartition::Delegate* fDelegate;
user_partition_data* fData;
BMutablePartition* fParent;
BList fChildren;
uint32 fChangeFlags;
void* fChildCookie;
};
#endif // _MUTABLE_PARTITION_H