本文整理汇总了C++中Partition::Mounted方法的典型用法代码示例。如果您正苦于以下问题:C++ Partition::Mounted方法的具体用法?C++ Partition::Mounted怎么用?C++ Partition::Mounted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Partition
的用法示例。
在下文中一共展示了Partition::Mounted方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TrackerSettings
static Partition *
UnmountIfMatchingID(Partition *_DEVICE_MAP_ONLY(partition),
void *_DEVICE_MAP_ONLY(castToParams))
{
UnmountDeviceParams *params = (UnmountDeviceParams *)castToParams;
if (partition->VolumeDeviceID() == params->device) {
TTracker *tracker = dynamic_cast<TTracker *>(be_app);
if (tracker && tracker->QueryActiveForDevice(params->device)) {
BString text;
text << "To unmount " << partition->VolumeName() << " some query "
"windows have to be closed. Would you like to close the query "
"windows?";
if ((new BAlert("", text.String(), "Cancel", "Close and unmount", NULL,
B_WIDTH_FROM_LABEL))->Go() == 0)
return partition;
tracker->CloseActiveQueryWindows(params->device);
}
params->result = partition->Unmount();
Device *device = partition->GetDevice();
bool deviceHasMountedPartitions = false;
if (params->result == B_OK && device->Removable()) {
for (int32 sessionIndex = 0; ; sessionIndex++) {
Session *session = device->SessionAt(sessionIndex);
if (!session)
break;
for (int32 partitionIndex = 0; ; partitionIndex++) {
Partition *partition = session->PartitionAt(partitionIndex);
if (!partition)
break;
if (partition->Mounted() == kMounted) {
deviceHasMountedPartitions = true;
break;
}
}
}
if (!deviceHasMountedPartitions
&& TrackerSettings().EjectWhenUnmounting())
params->result = partition->GetDevice()->Eject();
}
return partition;
}
return NULL;
}
示例2: root_entry
void
AutoMounter::MessageReceived(BMessage *message)
{
switch (message->what) {
#if _INCLUDES_CLASS_DEVICE_MAP
case kAutomounterRescan:
RescanDevices();
break;
case kStartPolling:
// PRINT(("starting the automounter\n"));
fScanThread = spawn_thread(AutoMounter::WatchVolumeBinder,
#if DEBUG
"HiroshiLikesAtomountScan", // long story
#else
"AutomountScan",
#endif
B_LOW_PRIORITY, this);
resume_thread(fScanThread);
break;
case kMountVolume:
MountVolume(message);
break;
case kUnmountVolume:
UnmountAndEjectVolume(message);
break;
case kSetAutomounterParams:
{
bool rescanNow = false;
message->FindBool("rescanNow", &rescanNow);
SetParams(message, rescanNow);
WriteSettings();
break;
}
case kMountAllNow:
RescanDevices();
MountAllNow();
break;
case kSuspendAutomounter:
SuspendResume(true);
break;
case kResumeAutomounter:
SuspendResume(false);
break;
case kTryMountingFloppy:
TryMountingFloppy();
break;
case B_NODE_MONITOR:
{
int32 opcode;
if (message->FindInt32("opcode", &opcode) != B_OK)
break;
switch (opcode) {
case B_DEVICE_MOUNTED: {
WRITELOG(("** Received Device Mounted Notification"));
dev_t device;
if (message->FindInt32("new device", &device) == B_OK) {
Partition *partition = FindPartition(device);
if (partition == NULL || partition->Mounted() != kMounted) {
WRITELOG(("Device %i not in device list. Someone mounted it outside "
"of Tracker", device));
//
// This is the worst case. Someone has mounted
// something from outside of tracker.
// Unfortunately, there's no easy way to tell which
// partition was just mounted (or if we even know about the device),
// so stop watching all nodes, rescan to see what is now mounted,
// and start watching again.
//
RescanDevices();
} else
WRITELOG(("Found partition\n"));
} else {
WRITELOG(("ERROR: Could not find mounted device ID in message"));
PRINT_OBJECT(*message);
}
break;
}
case B_DEVICE_UNMOUNTED: {
WRITELOG(("*** Received Device Unmounted Notification"));
dev_t device;
if (message->FindInt32("device", &device) == B_OK) {
Partition *partition = FindPartition(device);
if (partition != 0) {
WRITELOG(("Found device in device list. Updating state to unmounted."));
//.........这里部分代码省略.........