vl: extract softmmu/datadir.c
Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
4cd2927472
commit
2c65db5e58
@ -21,6 +21,7 @@
|
|||||||
#include "hw/dma/i8257.h"
|
#include "hw/dma/i8257.h"
|
||||||
#include "net/net.h"
|
#include "net/net.h"
|
||||||
#include "qemu/cutils.h"
|
#include "qemu/cutils.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "net/net.h"
|
#include "net/net.h"
|
||||||
|
|
||||||
#define MAX_IDE_BUS 2
|
#define MAX_IDE_BUS 2
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include <libfdt.h>
|
#include <libfdt.h>
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "hw/boards.h"
|
#include "hw/boards.h"
|
||||||
#include "exec/address-spaces.h"
|
#include "exec/address-spaces.h"
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "qemu/units.h"
|
#include "qemu/units.h"
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/units.h"
|
#include "qemu/units.h"
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
#include "hw/arm/boot.h"
|
#include "hw/arm/boot.h"
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "qemu/units.h"
|
#include "qemu/units.h"
|
||||||
#include "qemu/option.h"
|
#include "qemu/option.h"
|
||||||
#include "monitor/qdev.h"
|
#include "monitor/qdev.h"
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "hw/loader.h"
|
#include "hw/loader.h"
|
||||||
#include "elf.h"
|
#include "elf.h"
|
||||||
#include "boot.h"
|
#include "boot.h"
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "hw/hw.h"
|
#include "hw/hw.h"
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "ui/console.h"
|
#include "ui/console.h"
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "ui/console.h"
|
#include "ui/console.h"
|
||||||
#include "ui/pixel_ops.h"
|
#include "ui/pixel_ops.h"
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "elf.h"
|
#include "elf.h"
|
||||||
#include "hw/loader.h"
|
#include "hw/loader.h"
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "qemu/cutils.h"
|
#include "qemu/cutils.h"
|
||||||
#include "qemu/units.h"
|
#include "qemu/units.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "qapi/qmp/qerror.h"
|
#include "qapi/qmp/qerror.h"
|
||||||
#include "qapi/qapi-visit-common.h"
|
#include "qapi/qapi-visit-common.h"
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "qemu/units.h"
|
#include "qemu/units.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "qemu/log.h"
|
#include "qemu/log.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
#include "hw/m68k/mcf.h"
|
#include "hw/m68k/mcf.h"
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu/units.h"
|
#include "qemu/units.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "hw/hw.h"
|
#include "hw/hw.h"
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "qemu/option.h"
|
#include "qemu/option.h"
|
||||||
#include "qemu/config-file.h"
|
#include "qemu/config-file.h"
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "qemu/units.h"
|
#include "qemu/units.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "hw/clock.h"
|
#include "hw/clock.h"
|
||||||
#include "hw/mips/mips.h"
|
#include "hw/mips/mips.h"
|
||||||
#include "hw/mips/cpudevs.h"
|
#include "hw/mips/cpudevs.h"
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu/units.h"
|
#include "qemu/units.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "hw/clock.h"
|
#include "hw/clock.h"
|
||||||
#include "hw/southbridge/piix.h"
|
#include "hw/southbridge/piix.h"
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "hw/clock.h"
|
#include "hw/clock.h"
|
||||||
#include "hw/mips/mips.h"
|
#include "hw/mips/mips.h"
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu/units.h"
|
#include "qemu/units.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "qemu/option.h"
|
#include "qemu/option.h"
|
||||||
#include "qemu/config-file.h"
|
#include "qemu/config-file.h"
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
#include "sysemu/dma.h"
|
#include "sysemu/dma.h"
|
||||||
#include "sysemu/reset.h"
|
#include "sysemu/reset.h"
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "qemu/units.h"
|
#include "qemu/units.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "hw/pci/pci.h"
|
#include "hw/pci/pci.h"
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
#include "hw/pci/pci.h"
|
#include "hw/pci/pci.h"
|
||||||
#include "hw/pci/pci_bridge.h"
|
#include "hw/pci/pci_bridge.h"
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "qemu/units.h"
|
#include "qemu/units.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "e500.h"
|
#include "e500.h"
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "hw/ppc/ppc.h"
|
#include "hw/ppc/ppc.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "qemu/units.h"
|
#include "qemu/units.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "hw/ppc/ppc.h"
|
#include "hw/ppc/ppc.h"
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "qemu/units.h"
|
#include "qemu/units.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "sysemu/qtest.h"
|
#include "sysemu/qtest.h"
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "qemu/units.h"
|
#include "qemu/units.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "hw/ppc/ppc.h"
|
#include "hw/ppc/ppc.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "qemu/units.h"
|
#include "qemu/units.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "net/net.h"
|
#include "net/net.h"
|
||||||
#include "hw/pci/pci.h"
|
#include "hw/pci/pci.h"
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu/units.h"
|
#include "qemu/units.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "hw/boards.h"
|
#include "hw/boards.h"
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "qapi/visitor.h"
|
#include "qapi/visitor.h"
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "qemu/units.h"
|
#include "qemu/units.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "qemu/units.h"
|
#include "qemu/units.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "exec/cpu-defs.h"
|
#include "exec/cpu-defs.h"
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "sysemu/reset.h"
|
#include "sysemu/reset.h"
|
||||||
#include "sysemu/runstate.h"
|
#include "sysemu/runstate.h"
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
#include "qemu/timer.h"
|
#include "qemu/timer.h"
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu/units.h"
|
#include "qemu/units.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "hw/pci/pci.h"
|
#include "hw/pci/pci.h"
|
||||||
#include "hw/pci/pci_bridge.h"
|
#include "hw/pci/pci_bridge.h"
|
||||||
|
@ -108,27 +108,6 @@ void qemu_progress_end(void);
|
|||||||
void qemu_progress_print(float delta, int max);
|
void qemu_progress_print(float delta, int max);
|
||||||
const char *qemu_get_vm_name(void);
|
const char *qemu_get_vm_name(void);
|
||||||
|
|
||||||
#define QEMU_FILE_TYPE_BIOS 0
|
|
||||||
#define QEMU_FILE_TYPE_KEYMAP 1
|
|
||||||
/**
|
|
||||||
* qemu_find_file:
|
|
||||||
* @type: QEMU_FILE_TYPE_BIOS (for BIOS, VGA BIOS)
|
|
||||||
* or QEMU_FILE_TYPE_KEYMAP (for keymaps).
|
|
||||||
* @name: Relative or absolute file name
|
|
||||||
*
|
|
||||||
* If @name exists on disk as an absolute path, or a path relative
|
|
||||||
* to the current directory, then returns @name unchanged.
|
|
||||||
* Otherwise searches for @name file in the data directories, either
|
|
||||||
* configured at build time (DATADIR) or registered with the -L command
|
|
||||||
* line option.
|
|
||||||
*
|
|
||||||
* The caller must use g_free() to free the returned data when it is
|
|
||||||
* no longer required.
|
|
||||||
*
|
|
||||||
* Returns: a path that can access @name, or NULL if no matching file exists.
|
|
||||||
*/
|
|
||||||
char *qemu_find_file(int type, const char *name);
|
|
||||||
|
|
||||||
/* OS specific functions */
|
/* OS specific functions */
|
||||||
void os_setup_early_signal_handling(void);
|
void os_setup_early_signal_handling(void);
|
||||||
int os_parse_cmd_args(int index, const char *optarg);
|
int os_parse_cmd_args(int index, const char *optarg);
|
||||||
|
28
include/qemu/datadir.h
Normal file
28
include/qemu/datadir.h
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#ifndef QEMU_DATADIR_H
|
||||||
|
#define QEMU_DATADIR_H
|
||||||
|
|
||||||
|
#define QEMU_FILE_TYPE_BIOS 0
|
||||||
|
#define QEMU_FILE_TYPE_KEYMAP 1
|
||||||
|
/**
|
||||||
|
* qemu_find_file:
|
||||||
|
* @type: QEMU_FILE_TYPE_BIOS (for BIOS, VGA BIOS)
|
||||||
|
* or QEMU_FILE_TYPE_KEYMAP (for keymaps).
|
||||||
|
* @name: Relative or absolute file name
|
||||||
|
*
|
||||||
|
* If @name exists on disk as an absolute path, or a path relative
|
||||||
|
* to the current directory, then returns @name unchanged.
|
||||||
|
* Otherwise searches for @name file in the data directories, either
|
||||||
|
* configured at build time (DATADIR) or registered with the -L command
|
||||||
|
* line option.
|
||||||
|
*
|
||||||
|
* The caller must use g_free() to free the returned data when it is
|
||||||
|
* no longer required.
|
||||||
|
*
|
||||||
|
* Returns: a path that can access @name, or NULL if no matching file exists.
|
||||||
|
*/
|
||||||
|
char *qemu_find_file(int type, const char *name);
|
||||||
|
void qemu_add_default_firmwarepath(void);
|
||||||
|
void qemu_add_data_dir(char *path);
|
||||||
|
void qemu_list_data_dirs(void);
|
||||||
|
|
||||||
|
#endif
|
@ -13,8 +13,6 @@ extern const char *qemu_name;
|
|||||||
extern QemuUUID qemu_uuid;
|
extern QemuUUID qemu_uuid;
|
||||||
extern bool qemu_uuid_set;
|
extern bool qemu_uuid_set;
|
||||||
|
|
||||||
void qemu_add_data_dir(char *path);
|
|
||||||
|
|
||||||
void qemu_add_exit_notifier(Notifier *notify);
|
void qemu_add_exit_notifier(Notifier *notify);
|
||||||
void qemu_remove_exit_notifier(Notifier *notify);
|
void qemu_remove_exit_notifier(Notifier *notify);
|
||||||
|
|
||||||
|
129
softmmu/datadir.c
Normal file
129
softmmu/datadir.c
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
/*
|
||||||
|
* QEMU firmware and keymap file search
|
||||||
|
*
|
||||||
|
* Copyright (c) 2003-2020 QEMU contributors
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
|
#include "qemu/cutils.h"
|
||||||
|
#include "trace.h"
|
||||||
|
|
||||||
|
static const char *data_dir[16];
|
||||||
|
static int data_dir_idx;
|
||||||
|
|
||||||
|
char *qemu_find_file(int type, const char *name)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
const char *subdir;
|
||||||
|
char *buf;
|
||||||
|
|
||||||
|
/* Try the name as a straight path first */
|
||||||
|
if (access(name, R_OK) == 0) {
|
||||||
|
trace_load_file(name, name);
|
||||||
|
return g_strdup(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case QEMU_FILE_TYPE_BIOS:
|
||||||
|
subdir = "";
|
||||||
|
break;
|
||||||
|
case QEMU_FILE_TYPE_KEYMAP:
|
||||||
|
subdir = "keymaps/";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < data_dir_idx; i++) {
|
||||||
|
buf = g_strdup_printf("%s/%s%s", data_dir[i], subdir, name);
|
||||||
|
if (access(buf, R_OK) == 0) {
|
||||||
|
trace_load_file(name, buf);
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
g_free(buf);
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void qemu_add_data_dir(char *path)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (path == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (data_dir_idx == ARRAY_SIZE(data_dir)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (i = 0; i < data_dir_idx; i++) {
|
||||||
|
if (strcmp(data_dir[i], path) == 0) {
|
||||||
|
g_free(path); /* duplicate */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
data_dir[data_dir_idx++] = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Find a likely location for support files using the location of the binary.
|
||||||
|
* When running from the build tree this will be "$bindir/pc-bios".
|
||||||
|
* Otherwise, this is CONFIG_QEMU_DATADIR (possibly relocated).
|
||||||
|
*
|
||||||
|
* The caller must use g_free() to free the returned data when it is
|
||||||
|
* no longer required.
|
||||||
|
*/
|
||||||
|
static char *find_datadir(void)
|
||||||
|
{
|
||||||
|
g_autofree char *dir = NULL;
|
||||||
|
|
||||||
|
dir = g_build_filename(qemu_get_exec_dir(), "pc-bios", NULL);
|
||||||
|
if (g_file_test(dir, G_FILE_TEST_IS_DIR)) {
|
||||||
|
return g_steal_pointer(&dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
return get_relocated_path(CONFIG_QEMU_DATADIR);
|
||||||
|
}
|
||||||
|
|
||||||
|
void qemu_add_default_firmwarepath(void)
|
||||||
|
{
|
||||||
|
char **dirs;
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
/* add configured firmware directories */
|
||||||
|
dirs = g_strsplit(CONFIG_QEMU_FIRMWAREPATH, G_SEARCHPATH_SEPARATOR_S, 0);
|
||||||
|
for (i = 0; dirs[i] != NULL; i++) {
|
||||||
|
qemu_add_data_dir(get_relocated_path(dirs[i]));
|
||||||
|
}
|
||||||
|
g_strfreev(dirs);
|
||||||
|
|
||||||
|
/* try to find datadir relative to the executable path */
|
||||||
|
qemu_add_data_dir(find_datadir());
|
||||||
|
}
|
||||||
|
|
||||||
|
void qemu_list_data_dirs(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < data_dir_idx; i++) {
|
||||||
|
printf("%s\n", data_dir[i]);
|
||||||
|
}
|
||||||
|
}
|
@ -3,6 +3,7 @@ specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: [files(
|
|||||||
'balloon.c',
|
'balloon.c',
|
||||||
'cpus.c',
|
'cpus.c',
|
||||||
'cpu-throttle.c',
|
'cpu-throttle.c',
|
||||||
|
'datadir.c',
|
||||||
'physmem.c',
|
'physmem.c',
|
||||||
'ioport.c',
|
'ioport.c',
|
||||||
'memory.c',
|
'memory.c',
|
||||||
|
95
softmmu/vl.c
95
softmmu/vl.c
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "qemu/units.h"
|
#include "qemu/units.h"
|
||||||
#include "hw/boards.h"
|
#include "hw/boards.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
@ -128,8 +129,6 @@ typedef struct BlockdevOptionsQueueEntry {
|
|||||||
typedef QSIMPLEQ_HEAD(, BlockdevOptionsQueueEntry) BlockdevOptionsQueue;
|
typedef QSIMPLEQ_HEAD(, BlockdevOptionsQueueEntry) BlockdevOptionsQueue;
|
||||||
|
|
||||||
static const char *cpu_option;
|
static const char *cpu_option;
|
||||||
static const char *data_dir[16];
|
|
||||||
static int data_dir_idx;
|
|
||||||
static const char *mem_path;
|
static const char *mem_path;
|
||||||
static const char *boot_order;
|
static const char *boot_order;
|
||||||
static const char *boot_once;
|
static const char *boot_once;
|
||||||
@ -1994,59 +1993,6 @@ static void parse_display(const char *p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char *qemu_find_file(int type, const char *name)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
const char *subdir;
|
|
||||||
char *buf;
|
|
||||||
|
|
||||||
/* Try the name as a straight path first */
|
|
||||||
if (access(name, R_OK) == 0) {
|
|
||||||
trace_load_file(name, name);
|
|
||||||
return g_strdup(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (type) {
|
|
||||||
case QEMU_FILE_TYPE_BIOS:
|
|
||||||
subdir = "";
|
|
||||||
break;
|
|
||||||
case QEMU_FILE_TYPE_KEYMAP:
|
|
||||||
subdir = "keymaps/";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < data_dir_idx; i++) {
|
|
||||||
buf = g_strdup_printf("%s/%s%s", data_dir[i], subdir, name);
|
|
||||||
if (access(buf, R_OK) == 0) {
|
|
||||||
trace_load_file(name, buf);
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
g_free(buf);
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void qemu_add_data_dir(char *path)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (path == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (data_dir_idx == ARRAY_SIZE(data_dir)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (i = 0; i < data_dir_idx; i++) {
|
|
||||||
if (strcmp(data_dir[i], path) == 0) {
|
|
||||||
g_free(path); /* duplicate */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
data_dir[data_dir_idx++] = path;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool nonempty_str(const char *str)
|
static inline bool nonempty_str(const char *str)
|
||||||
{
|
{
|
||||||
return str && *str;
|
return str && *str;
|
||||||
@ -3187,26 +3133,6 @@ static void create_default_memdev(MachineState *ms, const char *path)
|
|||||||
&error_fatal);
|
&error_fatal);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Find a likely location for support files using the location of the binary.
|
|
||||||
* When running from the build tree this will be "$bindir/pc-bios".
|
|
||||||
* Otherwise, this is CONFIG_QEMU_DATADIR (possibly relocated).
|
|
||||||
*
|
|
||||||
* The caller must use g_free() to free the returned data when it is
|
|
||||||
* no longer required.
|
|
||||||
*/
|
|
||||||
static char *find_datadir(void)
|
|
||||||
{
|
|
||||||
g_autofree char *dir = NULL;
|
|
||||||
|
|
||||||
dir = g_build_filename(qemu_get_exec_dir(), "pc-bios", NULL);
|
|
||||||
if (g_file_test(dir, G_FILE_TEST_IS_DIR)) {
|
|
||||||
return g_steal_pointer(&dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
return get_relocated_path(CONFIG_QEMU_DATADIR);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void qemu_validate_options(void)
|
static void qemu_validate_options(void)
|
||||||
{
|
{
|
||||||
QemuOpts *machine_opts = qemu_get_machine_opts();
|
QemuOpts *machine_opts = qemu_get_machine_opts();
|
||||||
@ -3266,9 +3192,6 @@ static void qemu_process_sugar_options(void)
|
|||||||
|
|
||||||
static void qemu_process_early_options(void)
|
static void qemu_process_early_options(void)
|
||||||
{
|
{
|
||||||
char **dirs;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
#ifdef CONFIG_SECCOMP
|
#ifdef CONFIG_SECCOMP
|
||||||
QemuOptsList *olist = qemu_find_opts_err("sandbox", NULL);
|
QemuOptsList *olist = qemu_find_opts_err("sandbox", NULL);
|
||||||
if (olist) {
|
if (olist) {
|
||||||
@ -3306,21 +3229,11 @@ static void qemu_process_early_options(void)
|
|||||||
qemu_set_log(0);
|
qemu_set_log(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add configured firmware directories */
|
qemu_add_default_firmwarepath();
|
||||||
dirs = g_strsplit(CONFIG_QEMU_FIRMWAREPATH, G_SEARCHPATH_SEPARATOR_S, 0);
|
|
||||||
for (i = 0; dirs[i] != NULL; i++) {
|
|
||||||
qemu_add_data_dir(get_relocated_path(dirs[i]));
|
|
||||||
}
|
|
||||||
g_strfreev(dirs);
|
|
||||||
|
|
||||||
/* try to find datadir relative to the executable path */
|
|
||||||
qemu_add_data_dir(find_datadir());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qemu_process_help_options(void)
|
static void qemu_process_help_options(void)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check for -cpu help and -device help before we call select_machine(),
|
* Check for -cpu help and -device help before we call select_machine(),
|
||||||
* which will return an error if the architecture has no default machine
|
* which will return an error if the architecture has no default machine
|
||||||
@ -3339,9 +3252,7 @@ static void qemu_process_help_options(void)
|
|||||||
|
|
||||||
/* -L help lists the data directories and exits. */
|
/* -L help lists the data directories and exits. */
|
||||||
if (list_data_dirs) {
|
if (list_data_dirs) {
|
||||||
for (i = 0; i < data_dir_idx; i++) {
|
qemu_list_data_dirs();
|
||||||
printf("%s\n", data_dir[i]);
|
|
||||||
}
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include <wordexp.h>
|
#include <wordexp.h>
|
||||||
|
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "sysemu/qtest.h"
|
#include "sysemu/qtest.h"
|
||||||
#include "sysemu/runstate.h"
|
#include "sysemu/runstate.h"
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
#include "qemu/datadir.h"
|
||||||
#include "keymaps.h"
|
#include "keymaps.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "qemu/ctype.h"
|
#include "qemu/ctype.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user