1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-31 21:17:54 +03:00

secret: Rename loadSecrets

Rename to secretLoadAllConfigs and add the 'driver->configDir' as
a parameter.

Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
John Ferlan 2016-02-25 06:47:59 -05:00
parent fa9ca7fd3c
commit 35b20c1f7c

View File

@ -428,17 +428,17 @@ secretLoad(virSecretObjPtr *list,
}
static int
loadSecrets(virSecretObjPtr *dest)
secretLoadAllConfigs(virSecretObjPtr *dest,
const char *configDir)
{
DIR *dir = NULL;
struct dirent *de;
virSecretObjPtr list = NULL;
if (!(dir = opendir(driver->configDir))) {
if (!(dir = opendir(configDir))) {
if (errno == ENOENT)
return 0;
virReportSystemError(errno, _("cannot open '%s'"),
driver->configDir);
virReportSystemError(errno, _("cannot open '%s'"), configDir);
return -1;
}
@ -452,13 +452,13 @@ loadSecrets(virSecretObjPtr *dest)
if (!virFileHasSuffix(de->d_name, ".xml"))
continue;
if (!(path = virFileBuildPath(driver->configDir, de->d_name, NULL)))
if (!(path = virFileBuildPath(configDir, de->d_name, NULL)))
continue;
/* Copy the .xml file name, but use suffix ".base64" instead */
if (VIR_STRDUP(base64name, de->d_name) < 0 ||
!virFileStripSuffix(base64name, ".xml") ||
!(base64path = virFileBuildPath(driver->configDir,
!(base64path = virFileBuildPath(configDir,
base64name, ".base64"))) {
VIR_FREE(path);
VIR_FREE(base64name);
@ -1074,7 +1074,7 @@ secretStateInitialize(bool privileged,
goto error;
VIR_FREE(base);
if (loadSecrets(&driver->secrets) < 0)
if (secretLoadAllConfigs(&driver->secrets, driver->configDir) < 0)
goto error;
secretDriverUnlock();
@ -1097,7 +1097,7 @@ secretStateReload(void)
secretDriverLock();
if (loadSecrets(&new_secrets) < 0)
if (secretLoadAllConfigs(&new_secrets, driver->configDir) < 0)
goto end;
/* Keep ephemeral secrets from current state.