зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1195166 - AutoMounter: add ignore command to allow volumes to be ignored. r=alchen
--HG-- extra : amend_source : f1f8c08429d8ca614c6c936dc8b20ab227eaac99
This commit is contained in:
Родитель
a5becc7951
Коммит
dfe7f73d62
|
@ -156,6 +156,27 @@ VolumeManager::FindAddVolumeByName(const nsCSubstring& aName)
|
|||
return vol.forget();
|
||||
}
|
||||
|
||||
//static
|
||||
bool
|
||||
VolumeManager::RemoveVolumeByName(const nsCSubstring& aName)
|
||||
{
|
||||
if (!sVolumeManager) {
|
||||
return false;
|
||||
}
|
||||
VolumeArray::size_type numVolumes = NumVolumes();
|
||||
VolumeArray::index_type volIndex;
|
||||
for (volIndex = 0; volIndex < numVolumes; volIndex++) {
|
||||
RefPtr<Volume> vol = GetVolume(volIndex);
|
||||
if (vol->Name().Equals(aName)) {
|
||||
sVolumeManager->mVolumeArray.RemoveElementAt(volIndex);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// No volume found. Return false to indicate this.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//static
|
||||
void VolumeManager::InitConfig()
|
||||
{
|
||||
|
@ -236,6 +257,17 @@ void VolumeManager::InitConfig()
|
|||
}
|
||||
continue;
|
||||
}
|
||||
if (command.EqualsLiteral("ignore")) {
|
||||
// This command is useful to remove volumes which are being tracked by
|
||||
// vold, but for which we have no interest.
|
||||
if (!tokenizer.hasMoreTokens()) {
|
||||
ERR("No vol_name in %s line %d", filename, n);
|
||||
continue;
|
||||
}
|
||||
nsCString volName(tokenizer.nextToken());
|
||||
RemoveVolumeByName(volName);
|
||||
continue;
|
||||
}
|
||||
ERR("Unrecognized command: '%s'", command.get());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,6 +128,7 @@ public:
|
|||
static already_AddRefed<Volume> GetVolume(VolumeArray::index_type aIndex);
|
||||
static already_AddRefed<Volume> FindVolumeByName(const nsCSubstring& aName);
|
||||
static already_AddRefed<Volume> FindAddVolumeByName(const nsCSubstring& aName);
|
||||
static bool RemoveVolumeByName(const nsCSubstring& aName);
|
||||
static void InitConfig();
|
||||
|
||||
static void PostCommand(VolumeCommand* aCommand);
|
||||
|
|
Загрузка…
Ссылка в новой задаче