return 0;
}
-/**
- * virKModConfig:
- *
- * Get the current kernel module configuration
- *
- * Returns NULL on failure or a pointer to the output which
- * must be VIR_FREE()'d by the caller
- */
-char *
-virKModConfig(void)
-{
- char *outbuf = NULL;
-
- if (doModprobe("-c", NULL, &outbuf, NULL) < 0)
- return NULL;
-
- return outbuf;
-}
-
/**
* virKModLoad:
# define VIR_FROM_THIS VIR_FROM_NONE
-static int
-testKModConfig(const void *args G_GNUC_UNUSED)
-{
- int ret = -1;
- char *outbuf = NULL;
-
- /* This will return the contents of a 'modprobe -c' which can differ
- * from machine to machine - be happy that we get something.
- */
- outbuf = virKModConfig();
- if (!outbuf) {
- if (virFileIsExecutable(MODPROBE)) {
- fprintf(stderr, "Failed to get config\n");
- } else {
- /* modprobe doesn't exist, do not claim error. */
- ret = 0;
- }
- goto cleanup;
- }
- ret = 0;
-
- cleanup:
- VIR_FREE(outbuf);
- return ret;
-}
-
-
static int
checkOutput(virBufferPtr buf, const char *exp_cmd)
{
{
int ret = 0;
- if (virTestRun("config", testKModConfig, NULL) < 0)
- ret = -1;
if (virTestRun("load", testKModLoad, NULL) < 0)
ret = -1;
if (virTestRun("unload", testKModUnload, NULL) < 0)