本文整理汇总了C++中BVolume::IsRemovable方法的典型用法代码示例。如果您正苦于以下问题:C++ BVolume::IsRemovable方法的具体用法?C++ BVolume::IsRemovable怎么用?C++ BVolume::IsRemovable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BVolume
的用法示例。
在下文中一共展示了BVolume::IsRemovable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
Feeder::StartWatching()
{
BVolume *volume = new BVolume ;
while (fVolumeRoster.GetNextVolume(volume) != B_BAD_VALUE) {
if ((volume->IsRemovable() && !fMonitorRemovableDevices)
|| !volume->KnowsQuery())
continue ;
AddQuery(volume) ;
volume = new BVolume ;
}
fVolumeRoster.StartWatching(this) ;
}
示例2: settingDeleter
status_t
Settings::ReadSwapSettings()
{
void* settings = load_driver_settings(kVirtualMemorySettings);
if (settings == NULL)
return kErrorSettingsNotFound;
CObjectDeleter<void, status_t> settingDeleter(settings,
&unload_driver_settings);
const char* enabled = get_driver_parameter(settings, "vm", NULL, NULL);
const char* automatic = get_driver_parameter(settings, "swap_auto",
NULL, NULL);
const char* size = get_driver_parameter(settings, "swap_size", NULL, NULL);
const char* volume = get_driver_parameter(settings, "swap_volume_name",
NULL, NULL);
const char* device = get_driver_parameter(settings,
"swap_volume_device", NULL, NULL);
const char* filesystem = get_driver_parameter(settings,
"swap_volume_filesystem", NULL, NULL);
const char* capacity = get_driver_parameter(settings,
"swap_volume_capacity", NULL, NULL);
if (enabled == NULL || automatic == NULL || size == NULL || device == NULL
|| volume == NULL || capacity == NULL || filesystem == NULL)
return kErrorSettingsInvalid;
off_t volCapacity = atoll(capacity);
SetSwapEnabled(get_driver_boolean_parameter(settings,
"vm", true, false));
SetSwapAutomatic(get_driver_boolean_parameter(settings,
"swap_auto", true, false));
SetSwapSize(atoll(size));
int32 bestScore = -1;
dev_t bestVol = -1;
BVolume vol;
fs_info volStat;
BVolumeRoster roster;
while (roster.GetNextVolume(&vol) == B_OK) {
if (!vol.IsPersistent() || vol.IsReadOnly() || vol.IsRemovable()
|| vol.IsShared())
continue;
if (fs_stat_dev(vol.Device(), &volStat) == 0) {
int32 score = 0;
if (strcmp(volume, volStat.volume_name) == 0)
score += 4;
if (strcmp(device, volStat.device_name) == 0)
score += 3;
if (volCapacity == volStat.total_blocks * volStat.block_size)
score += 2;
if (strcmp(filesystem, volStat.fsh_name) == 0)
score += 1;
if (score >= 4 && score > bestScore) {
bestVol = vol.Device();
bestScore = score;
}
}
}
SetSwapVolume(bestVol);
fInitialSettings = fCurrentSettings;
if (bestVol < 0)
return kErrorVolumeNotFound;
return B_OK;
}