提交 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; ...@@ -2402,7 +2402,7 @@ virKeycodeValueTranslate;
# util/virkmod.h # util/virkmod.h
virKModIsBlacklisted; virKModIsProhibited;
virKModLoad; virKModLoad;
virKModUnload; virKModUnload;
......
...@@ -897,7 +897,7 @@ virFileNBDDeviceFindUnused(void) ...@@ -897,7 +897,7 @@ virFileNBDDeviceFindUnused(void)
static bool static bool
virFileNBDLoadDriver(void) virFileNBDLoadDriver(void)
{ {
if (virKModIsBlacklisted(NBD_DRIVER)) { if (virKModIsProhibited(NBD_DRIVER)) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Failed to load nbd module: " _("Failed to load nbd module: "
"administratively prohibited")); "administratively prohibited"));
......
...@@ -112,32 +112,32 @@ virKModUnload(const char *module) ...@@ -112,32 +112,32 @@ virKModUnload(const char *module)
/** /**
* virKModIsBlacklisted: * virKModIsProhibited:
* @module: Name of the module to check for on the blacklist * @module: Name of the module to check
* *
* Search the output of the configuration data for the module being * Determine if loading of @module is prohibited by admin
* blacklisted. * configuration.
* *
* returns true when found blacklisted, false otherwise. * returns true when found prohibited, false otherwise.
*/ */
bool bool
virKModIsBlacklisted(const char *module) virKModIsProhibited(const char *module)
{ {
size_t i; size_t i;
g_autofree char *drvblklst = NULL; g_autofree char *drvmatch = NULL;
g_autofree char *outbuf = 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 */ /* modprobe will convert all '-' into '_', so we need to as well */
for (i = 0; i < drvblklst[i]; i++) for (i = 0; i < drvmatch[i]; i++)
if (drvblklst[i] == '-') if (drvmatch[i] == '-')
drvblklst[i] = '_'; drvmatch[i] = '_';
if (doModprobe("-c", NULL, &outbuf, NULL) < 0) if (doModprobe("-c", NULL, &outbuf, NULL) < 0)
return false; return false;
if (strstr(outbuf, drvblklst)) if (strstr(outbuf, drvmatch))
return true; return true;
return false; return false;
......
...@@ -27,5 +27,5 @@ char *virKModLoad(const char *) ...@@ -27,5 +27,5 @@ char *virKModLoad(const char *)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
char *virKModUnload(const char *) char *virKModUnload(const char *)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
bool virKModIsBlacklisted(const char *) bool virKModIsProhibited(const char *)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
...@@ -1023,10 +1023,10 @@ virPCIProbeStubDriver(virPCIStubDriver driver) ...@@ -1023,10 +1023,10 @@ virPCIProbeStubDriver(virPCIStubDriver driver)
} }
cleanup: 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 * otherwise, report a more generic failure message
*/ */
if (virKModIsBlacklisted(drvname)) { if (virKModIsProhibited(drvname)) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to load PCI stub module %s: " _("Failed to load PCI stub module %s: "
"administratively prohibited"), "administratively prohibited"),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册