1// KDiskDeviceUserDataWriter.h 2 3#ifndef _K_DISK_DEVICE_USER_DATA_WRITER_H 4#define _K_DISK_DEVICE_USER_DATA_WRITER_H 5 6#include <SupportDefs.h> 7 8struct user_disk_device_data; 9struct user_partition_data; 10 11namespace BPrivate { 12namespace DiskDevice { 13 14class UserDataWriter { 15public: 16 UserDataWriter(); 17 UserDataWriter(user_disk_device_data *buffer, size_t bufferSize); 18 ~UserDataWriter(); 19 20 status_t SetTo(user_disk_device_data *buffer, size_t bufferSize); 21 void Unset(); 22 23 void *AllocateData(size_t size, size_t align = 1); 24 user_partition_data *AllocatePartitionData(size_t childCount); 25 user_disk_device_data *AllocateDeviceData(size_t childCount); 26 27 char *PlaceString(const char *str); 28 29 size_t AllocatedSize() const; 30 31 status_t AddRelocationEntry(void *address); 32 status_t Relocate(void *address); 33 34private: 35 struct RelocationEntryList; 36 37 user_disk_device_data *fBuffer; 38 size_t fBufferSize; 39 size_t fAllocatedSize; 40 RelocationEntryList *fRelocationEntries; 41}; 42 43} // namespace DiskDevice 44} // namespace BPrivate 45 46using BPrivate::DiskDevice::UserDataWriter; 47 48#endif // _K_DISK_DEVICE_USER_DATA_WRITER_H 49