提交 35b20c1f 编写于 作者: J John Ferlan

secret: Rename loadSecrets

Rename to secretLoadAllConfigs and add the 'driver->configDir' as
a parameter.
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
上级 fa9ca7fd
...@@ -428,17 +428,17 @@ secretLoad(virSecretObjPtr *list, ...@@ -428,17 +428,17 @@ secretLoad(virSecretObjPtr *list,
} }
static int static int
loadSecrets(virSecretObjPtr *dest) secretLoadAllConfigs(virSecretObjPtr *dest,
const char *configDir)
{ {
DIR *dir = NULL; DIR *dir = NULL;
struct dirent *de; struct dirent *de;
virSecretObjPtr list = NULL; virSecretObjPtr list = NULL;
if (!(dir = opendir(driver->configDir))) { if (!(dir = opendir(configDir))) {
if (errno == ENOENT) if (errno == ENOENT)
return 0; return 0;
virReportSystemError(errno, _("cannot open '%s'"), virReportSystemError(errno, _("cannot open '%s'"), configDir);
driver->configDir);
return -1; return -1;
} }
...@@ -452,13 +452,13 @@ loadSecrets(virSecretObjPtr *dest) ...@@ -452,13 +452,13 @@ loadSecrets(virSecretObjPtr *dest)
if (!virFileHasSuffix(de->d_name, ".xml")) if (!virFileHasSuffix(de->d_name, ".xml"))
continue; continue;
if (!(path = virFileBuildPath(driver->configDir, de->d_name, NULL))) if (!(path = virFileBuildPath(configDir, de->d_name, NULL)))
continue; continue;
/* Copy the .xml file name, but use suffix ".base64" instead */ /* Copy the .xml file name, but use suffix ".base64" instead */
if (VIR_STRDUP(base64name, de->d_name) < 0 || if (VIR_STRDUP(base64name, de->d_name) < 0 ||
!virFileStripSuffix(base64name, ".xml") || !virFileStripSuffix(base64name, ".xml") ||
!(base64path = virFileBuildPath(driver->configDir, !(base64path = virFileBuildPath(configDir,
base64name, ".base64"))) { base64name, ".base64"))) {
VIR_FREE(path); VIR_FREE(path);
VIR_FREE(base64name); VIR_FREE(base64name);
...@@ -1074,7 +1074,7 @@ secretStateInitialize(bool privileged, ...@@ -1074,7 +1074,7 @@ secretStateInitialize(bool privileged,
goto error; goto error;
VIR_FREE(base); VIR_FREE(base);
if (loadSecrets(&driver->secrets) < 0) if (secretLoadAllConfigs(&driver->secrets, driver->configDir) < 0)
goto error; goto error;
secretDriverUnlock(); secretDriverUnlock();
...@@ -1097,7 +1097,7 @@ secretStateReload(void) ...@@ -1097,7 +1097,7 @@ secretStateReload(void)
secretDriverLock(); secretDriverLock();
if (loadSecrets(&new_secrets) < 0) if (secretLoadAllConfigs(&new_secrets, driver->configDir) < 0)
goto end; goto end;
/* Keep ephemeral secrets from current state. /* Keep ephemeral secrets from current state.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册