mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
util: rename method to virKModIsProhibited
This new naming matches the terminology used in the error messages that the callers report. Reviewed-by: Peter Krempa <pkrempa@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
bec026145d
commit
e8645610c8
@ -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"),
|
||||
|
Loading…
Reference in New Issue
Block a user