20#include "pedigree/kernel/Service.h"
21#include "pedigree/kernel/ServiceFeatures.h"
22#include "pedigree/kernel/ServiceManager.h"
23#include "pedigree/kernel/machine/Device.h"
24#include "pedigree/kernel/machine/Disk.h"
25#include "pedigree/kernel/panic.h"
26#include "pedigree/kernel/process/OperationBarrier.h"
27#include "pedigree/kernel/processor/types.h"
28#include "pedigree/kernel/utilities/String.h"
29#include "pedigree/kernel/utilities/utility.h"
32#include "PartitionService.h"
34#include "modules/Module.h"
41static bool probeDevice(
Disk* pDev) {
47 if (gptProbeDisk(pDev))
51 if (msdosProbeDisk(pDev))
63 bool hasPartitions =
false;
77 probeDevice(
static_cast<Disk*
>(pDev));
93 Disk* pDisk =
static_cast<Disk*
>(pData);
101 return probeDevice(pDisk);
104 return probeDevice(pDisk);
117 ServiceManager::instance().
addService(
String(
"partition"), pService, pFeatures);
123 NOTICE(
"partition entry() is done");
131 if (device->getSpecificType() !=
String(
"partition"))
137 Disk* physical =
static_cast<Disk*
>(device)->physicalDisk();
138 if (!physical || !physical->tryCloseEndpoint())
139 panic(
"Partition shutdown blocked by a live disk owner");
155MODULE_INFO_RUNTIME_PINNED(
"partition", &entry, &exit,
"diskimage");
157MODULE_INFO_RUNTIME_PINNED(
"partition", &entry, &exit);
158MODULE_OPTIONAL_DEPENDS(
"ata",
"ahci",
"nvme",
"usb-mass-storage",
"virtio-blk",
"virtio-scsi");
Device * getChild(size_t n)
static void foreach(Callback callback, Device *root=0)
@ Disk
A disk device - a block device in UNIX terms.
virtual const String & getSpecificType()
static bool treeLockHeldByCurrentThread()
virtual void getName(String &str)
virtual size_t getNativeBlockSize() const
MUST_USE_RESULT bool tryAcquire(Lease &lease)
bool serve(ServiceFeatures::Type type, void *pData, size_t dataLen)
virtual bool provides(Type service)
void addService(const String &serviceName, Service *s, ServiceFeatures *feats)
void removeService(const String &serviceName)
void EXPORTED_PUBLIC panic(const char *msg) NORETURN