22 #include "pedigree/kernel/Log.h" 23 #include "pedigree/kernel/Service.h" 24 #include "pedigree/kernel/ServiceFeatures.h" 25 #include "pedigree/kernel/ServiceManager.h" 26 #include "pedigree/kernel/machine/Device.h" 27 #include "pedigree/kernel/utilities/assert.h" 28 #include "pedigree/kernel/utilities/new" 32 void cdi_cpp_disk_register(
struct cdi_storage_device* device);
34 int cdi_storage_read(
struct cdi_storage_device* device, uint64_t pos,
size_t size,
void* dest);
35 int cdi_storage_write(
struct cdi_storage_device* device, uint64_t pos,
size_t size,
void* src);
38 CdiDisk::CdiDisk(
Disk* pDev,
struct cdi_storage_device* device) :
39 Disk(pDev), m_Device(device), m_Cache()
41 setSpecificType(
String(
"CDI Disk"));
44 CdiDisk::CdiDisk(
struct cdi_storage_device *device) :
45 Disk(), m_Device(device), m_Cache()
47 setSpecificType(
String(
"CDI Disk"));
59 NOTICE(
"Asking if the partition provider supports touch");
62 NOTICE(
"It does, attempting to inform the partitioner of our presence...");
66 reinterpret_cast<void*>(static_cast<Disk*>(
this)),
67 sizeof(*static_cast<Disk*>(
this))))
79 ERROR(
"FileDisk: Couldn't tell the partition service about the new disk presence");
85 ERROR(
"FileDisk: Partition service doesn't appear to support touch");
95 assert( (location % 512) == 0 );
96 uintptr_t buff = m_Cache.lookup(location);
99 buff = m_Cache.insert(location);
100 if (cdi_storage_read(m_Device, location, 512, reinterpret_cast<void*>(buff)) != 0)
103 m_Cache.markNoLongerEditing(location);
110 assert( (location % 512) == 0 );
111 uintptr_t buff = m_Cache.lookup(location);
115 if (cdi_storage_write(m_Device, location, 512, reinterpret_cast<void*>(buff)) != 0)
119 void cdi_cpp_disk_register(
struct cdi_storage_device* device)
virtual void write(uint64_t location)
static void addToRoot(Device *device)
virtual bool provides(Type service)
Service * getService(const String &serviceName)
virtual bool serve(ServiceFeatures::Type type, void *pData, size_t dataLen)=0
ServiceFeatures * enumerateOperations(const String &serviceName)
virtual uintptr_t read(uint64_t location)