mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-04-26 15:14:42 +00:00
bhyve: Probe grub-bhyve for --cons-dev capability
This commit is contained in:
parent
cf133ed1c6
commit
0cd4cd2904
@ -23,6 +23,7 @@
|
|||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
|
|
||||||
#include "viralloc.h"
|
#include "viralloc.h"
|
||||||
|
#include "virfile.h"
|
||||||
#include "virlog.h"
|
#include "virlog.h"
|
||||||
#include "virstring.h"
|
#include "virstring.h"
|
||||||
#include "cpu/cpu.h"
|
#include "cpu/cpu.h"
|
||||||
@ -104,3 +105,39 @@ virBhyveCapsBuild(void)
|
|||||||
virObjectUnref(caps);
|
virObjectUnref(caps);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
virBhyveProbeGrubCaps(virBhyveGrubCapsFlags *caps)
|
||||||
|
{
|
||||||
|
char *binary, *help;
|
||||||
|
virCommandPtr cmd;
|
||||||
|
int ret, exit;
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
*caps = 0;
|
||||||
|
cmd = NULL;
|
||||||
|
help = NULL;
|
||||||
|
|
||||||
|
binary = virFindFileInPath("grub-bhyve");
|
||||||
|
if (binary == NULL)
|
||||||
|
goto out;
|
||||||
|
if (!virFileIsExecutable(binary))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
cmd = virCommandNew(binary);
|
||||||
|
virCommandAddArg(cmd, "--help");
|
||||||
|
virCommandSetOutputBuffer(cmd, &help);
|
||||||
|
if (virCommandRun(cmd, &exit) < 0) {
|
||||||
|
ret = -1;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strstr(help, "--cons-dev") != NULL)
|
||||||
|
*caps |= BHYVE_GRUB_CAP_CONSDEV;
|
||||||
|
|
||||||
|
out:
|
||||||
|
VIR_FREE(help);
|
||||||
|
virCommandFree(cmd);
|
||||||
|
VIR_FREE(binary);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
@ -26,4 +26,11 @@
|
|||||||
|
|
||||||
virCapsPtr virBhyveCapsBuild(void);
|
virCapsPtr virBhyveCapsBuild(void);
|
||||||
|
|
||||||
|
/* These are bit flags: */
|
||||||
|
typedef enum {
|
||||||
|
BHYVE_GRUB_CAP_CONSDEV = 1,
|
||||||
|
} virBhyveGrubCapsFlags;
|
||||||
|
|
||||||
|
int virBhyveProbeGrubCaps(virBhyveGrubCapsFlags *caps);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user