提交 e8645610 编写于 作者: D Daniel P. Berrangé

util: rename method to virKModIsProhibited

This new naming matches the terminology used in the error
messages that the callers report.
Reviewed-by: NPeter Krempa <pkrempa@redhat.com>
Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 bec02614
......@@ -2402,7 +2402,7 @@ virKeycodeValueTranslate;
# util/virkmod.h
virKModIsBlacklisted;
virKModIsProhibited;
virKModLoad;
virKModUnload;
......
......@@ -897,7 +897,7 @@ virFileNBDDeviceFindUnused(void)
static bool
virFileNBDLoadDriver(void)
{
if (virKModIsBlacklisted(NBD_DRIVER)) {
if (virKModIsProhibited(NBD_DRIVER)) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Failed to load nbd module: "
"administratively prohibited"));
......
......@@ -112,32 +112,32 @@ virKModUnload(const char *module)
/**
* virKModIsBlacklisted:
* @module: Name of the module to check for on the blacklist
* virKModIsProhibited:
* @module: Name of the module to check
*
* Search the output of the configuration data for the module being
* blacklisted.
* Determine if loading of @module is prohibited by admin
* configuration.
*
* returns true when found blacklisted, false otherwise.
* returns true when found prohibited, false otherwise.
*/
bool
virKModIsBlacklisted(const char *module)
virKModIsProhibited(const char *module)
{
size_t i;
g_autofree char *drvblklst = NULL;
g_autofree char *drvmatch = NULL;
g_autofree char *outbuf = NULL;
drvblklst = g_strdup_printf("blacklist %s\n", module);
drvmatch = g_strdup_printf("blacklist %s\n", module);
/* modprobe will convert all '-' into '_', so we need to as well */
for (i = 0; i < drvblklst[i]; i++)
if (drvblklst[i] == '-')
drvblklst[i] = '_';
for (i = 0; i < drvmatch[i]; i++)
if (drvmatch[i] == '-')
drvmatch[i] = '_';
if (doModprobe("-c", NULL, &outbuf, NULL) < 0)
return false;
if (strstr(outbuf, drvblklst))
if (strstr(outbuf, drvmatch))
return true;
return false;
......
......@@ -27,5 +27,5 @@ char *virKModLoad(const char *)
ATTRIBUTE_NONNULL(1);
char *virKModUnload(const char *)
ATTRIBUTE_NONNULL(1);
bool virKModIsBlacklisted(const char *)
bool virKModIsProhibited(const char *)
ATTRIBUTE_NONNULL(1);
......@@ -1023,10 +1023,10 @@ virPCIProbeStubDriver(virPCIStubDriver driver)
}
cleanup:
/* If we know failure was because of blacklist, let's report that;
/* If we know failure was because of admin config, let's report that;
* otherwise, report a more generic failure message
*/
if (virKModIsBlacklisted(drvname)) {
if (virKModIsProhibited(drvname)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to load PCI stub module %s: "
"administratively prohibited"),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册