本文整理汇总了C++中Partition::SetMountState方法的典型用法代码示例。如果您正苦于以下问题:C++ Partition::SetMountState方法的具体用法?C++ Partition::SetMountState怎么用?C++ Partition::SetMountState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Partition
的用法示例。
在下文中一共展示了Partition::SetMountState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: root_entry
//.........这里部分代码省略.........
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."));
partition->SetMountState(kNotMounted);
} else
WRITELOG(("Unmounted device %i was not in device list", device));
} else {
WRITELOG(("ERROR: Could not find unmounted device ID in message"));
PRINT_OBJECT(*message);
}
break;
}
// The name of a mount point has changed
case B_ENTRY_MOVED: {
WRITELOG(("*** Received Mount Point Renamed Notification"));
const char *newName;
if (message->FindString("name", &newName) != B_OK) {
WRITELOG(("ERROR: Couldn't find name field in update message"));
PRINT_OBJECT(*message);
break ;
}
//
// When the node monitor reports a move, it gives the
// parent device and inode that moved. The problem is
// that the inode is the inode of root *in* the filesystem,
// which is generally always the same number for every
// filesystem of a type.
//
// What we'd really like is the device that the moved
// volume is mounted on. Find this by using the
// *new* name and directory, and then stat()ing that to