本文整理汇总了C++中scxcorelib::SCXHandle::FindDiskInfoByID方法的典型用法代码示例。如果您正苦于以下问题:C++ SCXHandle::FindDiskInfoByID方法的具体用法?C++ SCXHandle::FindDiskInfoByID怎么用?C++ SCXHandle::FindDiskInfoByID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scxcorelib::SCXHandle
的用法示例。
在下文中一共展示了SCXHandle::FindDiskInfoByID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindPhysicalDisks
/**
Discover physical disks.
Logical disks are identified by the /etc/mnttab file (by design). Physical
disks discovered will be those "hosting" the logical disks found. If ever
seen in that file, the disk will be discovered. If the disk is removed it
will be marked as offline.
How to identify physical disks from logical disks:
Linux --
Logical disks are named things like /dev/hda0, /dev/hda1 and so on.
The numeric value in the end of the name is the partition/logical ID
of the physical disk. In the example above both logical disks are on
physical disk /dev/hda.
For LVM partitions on Linux have two entries for the same device. An LVM
device entry is stored in the /dev/mapper directory with a name in the form
<logical-volume-group>-<logical-volume>. There is also a device mapper (dm)
device entry stored in the /dev directory in the form dm-<id>. This is a
1-to-1 relationship and the <id> is equal to the device minor ID that both
device entries have in common. Discovery of the physical device(s) that
contain the LVM partition is done by mapping the LVM device to the dm device,
then looking at the dm devices slave entries in Sysfs, and then finally
performing the same conversion from a logical Linux partition name to a
physical drive name that is done for all other partitions.
Solaris --
Logical disks are named things like /dev/dsk/c1t0d0s0, /dev/dsk/c1t0d0s1
and so on. The last letter/numeric pair is the partition/logical ID
of the physical disk. In the example above both logical disks are on
physical disk /dev/dsk/c1t0d0.
HPUX --
Logical disks are logical volumes with names like /dev/vg00/lvol3.
/dev/vg00 in the example name is the volume group name. Using the /etc/lvmtab
file the volume group can be translated to a partition named /dev/disk/disk3_p2
(or /dev/dsk/c2t0d0s2 using a naming standard deprecated as of HPUX 11.3). The
old naming standard works like the one for solaris while the new one identifies
the physical disk as /dev/disk/disk3 in the example above.
AIX --
TODO: Document how disks are enumerated on AIX.
*/
void StatisticalPhysicalDiskEnumeration::FindPhysicalDisks()
{
for (EntityIterator iter=Begin(); iter!=End(); iter++)
{
SCXCoreLib::SCXHandle<StatisticalPhysicalDiskInstance> disk = *iter;
disk->m_online = false;
}
m_deps->RefreshMNTTab();
for (std::vector<MntTabEntry>::const_iterator it = m_deps->GetMNTTab().begin();
it != m_deps->GetMNTTab().end(); it++)
{
if ( ! m_deps->FileSystemIgnored(it->fileSystem) &&
! m_deps->DeviceIgnored(it->device) &&
m_deps->LinkToPhysicalExists(it->fileSystem, it->device, it->mountPoint) )
{
std::map<std::wstring, std::wstring> devices = m_deps->GetPhysicalDevices(it->device);
if (devices.size() == 0)
{
static SCXCoreLib::LogSuppressor suppressor(SCXCoreLib::eError, SCXCoreLib::eTrace);
std::wstringstream out;
out << L"Unable to locate physical devices for: " << it->device;
SCX_LOG(m_log, suppressor.GetSeverity(out.str()), out.str());
continue;
}
for (std::map<std::wstring, std::wstring>::const_iterator dev_it = devices.begin();
dev_it != devices.end(); dev_it++)
{
SCXCoreLib::SCXHandle<StatisticalPhysicalDiskInstance> disk = AddDiskInstance(dev_it->first, dev_it->second);
#if defined(hpux)
if (0 != disk)
{
if (m_pathToRdev.end() == m_pathToRdev.find(disk->m_device))
{
SCXCoreLib::SCXFilePath fp(disk->m_device);
fp.SetFilename(L"");
UpdatePathToRdev(fp.Get());
}
SCXASSERT(m_pathToRdev.end() != m_pathToRdev.find(disk->m_device));
scxlong diskInfoIndex = disk->FindDiskInfoByID(m_pathToRdev.find(disk->m_device)->second);
m_deps->AddDeviceInstance(disk->m_device, L"", diskInfoIndex, m_pathToRdev.find(disk->m_device)->second);
}
#endif
}
}
}
#if defined(sun)
this->UpdateSolarisHelper();
#endif
//.........这里部分代码省略.........