trace: switch position of headers to what Meson requires

Meson doesn't enjoy the same flexibility we have with Make in choosing
the include path.  In particular the tracing headers are using
$(build_root)/$(<D).

In order to keep the include directives unchanged,
the simplest solution is to generate headers with patterns like
"trace/trace-audio.h" and place forwarding headers in the source tree
such that for example "audio/trace.h" includes "trace/trace-audio.h".

This patch is too ugly to be applied to the Makefiles now.  It's only
a way to separate the changes to the tracing header files from the
Meson rewrite of the tracing logic.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2020-02-04 12:20:10 +01:00
parent 22fb2ab096
commit 243af0225a
96 changed files with 121 additions and 41 deletions

1
.gitignore vendored
View File

@ -146,7 +146,6 @@ docker-src.*
*~
*.ast_raw
*.depend_raw
trace.h
trace.c
trace-ust.h
trace-ust.h

View File

@ -159,8 +159,8 @@ generated-files-$(CONFIG_TRACE_UST) += trace-ust-all.c
generated-files-y += module_block.h
TRACE_HEADERS = trace-root.h $(trace-events-subdirs:%=%/trace.h)
TRACE_SOURCES = trace-root.c $(trace-events-subdirs:%=%/trace.c)
TRACE_HEADERS = trace/trace-root.h
TRACE_SOURCES = trace/trace-root.c
TRACE_DTRACE =
ifdef CONFIG_TRACE_DTRACE
TRACE_HEADERS += trace-dtrace-root.h $(trace-events-subdirs:%=%/trace-dtrace.h)
@ -170,33 +170,37 @@ ifdef CONFIG_TRACE_UST
TRACE_HEADERS += trace-ust-root.h $(trace-events-subdirs:%=%/trace-ust.h)
endif
generated-files-y += $(TRACE_HEADERS)
generated-files-y += $(TRACE_SOURCES)
generated-files-y += $(BUILD_DIR)/trace-events-all
generated-files-y += .git-submodule-status
trace-group-name = $(shell dirname $1 | sed -e 's/[^a-zA-Z0-9]/_/g')
trace-group-suffix = $(shell echo $1 | sed -e 's/[^a-zA-Z0-9]/_/g')
tracetool-y = $(SRC_PATH)/scripts/tracetool.py
tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py")
%/trace.h: %/trace.h-timestamp
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
%/trace.h-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
define __trace_rules
TRACE_HEADERS += trace/trace-$2.h
TRACE_SOURCES += trace/trace-$2.c
trace-obj-y += trace/trace-$2.o
trace/trace-$2.h: trace/trace-$2.h-timestamp
@cmp $$< $$@ >/dev/null 2>&1 || cp $$< $$@
trace/trace-$2.h-timestamp: $(SRC_PATH)/$1/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
$(call quiet-command,$(TRACETOOL) \
--group=$(call trace-group-name,$@) \
--group=$2 \
--format=h \
--backends=$(TRACE_BACKENDS) \
$< > $@,"GEN","$(@:%-timestamp=%)")
$$< > $$@,"GEN","$$(@:%-timestamp=%)")
%/trace.c: %/trace.c-timestamp
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
%/trace.c-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
trace/trace-$2.c: trace/trace-$2.c-timestamp
@cmp $$< $$@ >/dev/null 2>&1 || cp $$< $$@
trace/trace-$2.c-timestamp: $(SRC_PATH)/$1/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
$(call quiet-command,$(TRACETOOL) \
--group=$(call trace-group-name,$@) \
--group=$2 \
--format=c \
--backends=$(TRACE_BACKENDS) \
$< > $@,"GEN","$(@:%-timestamp=%)")
$$< > $$@,"GEN","$$(@:%-timestamp=%)")
endef
%/trace-ust.h: %/trace-ust.h-timestamp
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
@ -222,18 +226,18 @@ tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py")
%/trace-dtrace.o: %/trace-dtrace.dtrace $(tracetool-y)
trace-root.h: trace-root.h-timestamp
trace/trace-root.h: trace/trace-root.h-timestamp
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
trace-root.h-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
trace/trace-root.h-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
$(call quiet-command,$(TRACETOOL) \
--group=root \
--format=h \
--backends=$(TRACE_BACKENDS) \
$< > $@,"GEN","$(@:%-timestamp=%)")
trace-root.c: trace-root.c-timestamp
trace/trace-root.c: trace/trace-root.c-timestamp
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
trace-root.c-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
trace/trace-root.c-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
$(call quiet-command,$(TRACETOOL) \
--group=root \
--format=c \
@ -477,6 +481,12 @@ dummy := $(call unnest-vars,, \
common-obj-m \
trace-obj-y)
dummy := $(foreach DIR,$(trace-events-subdirs),$(eval $(call __trace_rules,$(DIR),$(call trace-group-suffix,$(DIR)))))
generated-files-y += $(TRACE_HEADERS)
generated-files-y += $(TRACE_SOURCES)
include $(SRC_PATH)/tests/Makefile.include
all: $(DOCS) $(if $(BUILD_DOCS),sphinxdocs) $(TOOLS) $(HELPERS-y) recurse-all modules $(vhost-user-json-y)

View File

@ -209,7 +209,6 @@ trace-events-subdirs += util
trace-events-files = $(SRC_PATH)/trace-events $(trace-events-subdirs:%=$(SRC_PATH)/%/trace-events)
trace-obj-y = trace-root.o
trace-obj-y += $(trace-events-subdirs:%=%/trace.o)
trace-obj-$(CONFIG_TRACE_UST) += trace-ust-all.o
trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace-root.o
trace-obj-$(CONFIG_TRACE_DTRACE) += $(trace-events-subdirs:%=%/trace-dtrace.o)

1
accel/kvm/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-accel_kvm.h"

View File

@ -34,7 +34,7 @@
#include "qemu/atomic.h"
#include "qemu/atomic128.h"
#include "translate-all.h"
#include "trace-root.h"
#include "trace/trace-root.h"
#include "trace/mem.h"
#ifdef CONFIG_PLUGIN
#include "qemu/plugin-memory.h"

1
accel/tcg/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-accel_tcg.h"

View File

@ -26,7 +26,7 @@
#include "translate-all.h"
#include "exec/helper-proto.h"
#include "qemu/atomic128.h"
#include "trace-root.h"
#include "trace/trace-root.h"
#include "trace/mem.h"
#undef EAX

1
audio/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-audio.h"

1
authz/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-authz.h"

1
backends/tpm/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-backends_tpm.h"

1
backends/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-backends.h"

1
block/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-block.h"

1
chardev/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-chardev.h"

1
crypto/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-crypto.h"

View File

@ -10,7 +10,7 @@
#include "qemu/osdep.h"
#include "sysemu/block-backend.h"
#include "sysemu/dma.h"
#include "trace-root.h"
#include "trace/trace-root.h"
#include "qemu/thread.h"
#include "qemu/main-loop.h"
#include "sysemu/cpus.h"

2
exec.c
View File

@ -50,7 +50,7 @@
#include "sysemu/hw_accel.h"
#include "exec/address-spaces.h"
#include "sysemu/xen-mapcache.h"
#include "trace-root.h"
#include "trace/trace-root.h"
#ifdef CONFIG_FALLOCATE_PUNCH_HOLE
#include <linux/falloc.h>

View File

@ -30,7 +30,7 @@
#include "qemu/ctype.h"
#include "qemu/cutils.h"
#include "qemu/module.h"
#include "trace-root.h"
#include "trace/trace-root.h"
#ifdef CONFIG_USER_ONLY
#include "qemu.h"
#else

1
hw/9pfs/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_9pfs.h"

1
hw/acpi/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_acpi.h"

1
hw/alpha/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_alpha.h"

1
hw/arm/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_arm.h"

1
hw/audio/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_audio.h"

View File

@ -0,0 +1 @@
#include "trace/trace-hw_block_dataplane.h"

1
hw/block/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_block.h"

1
hw/char/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_char.h"

View File

@ -31,7 +31,7 @@
#include "sysemu/tcg.h"
#include "hw/boards.h"
#include "hw/qdev-properties.h"
#include "trace-root.h"
#include "trace/trace-root.h"
#include "qemu/plugin.h"
CPUInterruptHandler cpu_interrupt_handler;

1
hw/core/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_core.h"

1
hw/display/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_display.h"

1
hw/dma/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_dma.h"

1
hw/gpio/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_gpio.h"

1
hw/hppa/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_hppa.h"

1
hw/hyperv/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_hyperv.h"

1
hw/i2c/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_i2c.h"

1
hw/i386/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_i386.h"

1
hw/i386/xen/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_i386_xen.h"

1
hw/ide/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_ide.h"

1
hw/input/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_input.h"

1
hw/intc/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_intc.h"

1
hw/isa/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_isa.h"

1
hw/mem/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_mem.h"

1
hw/mips/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_mips.h"

1
hw/misc/macio/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_misc_macio.h"

1
hw/misc/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_misc.h"

1
hw/net/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_net.h"

1
hw/nvram/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_nvram.h"

1
hw/pci-host/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_pci_host.h"

1
hw/pci/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_pci.h"

1
hw/ppc/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_ppc.h"

1
hw/rdma/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_rdma.h"

1
hw/rdma/vmw/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_rdma_vmw.h"

1
hw/riscv/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_riscv.h"

1
hw/rtc/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_rtc.h"

1
hw/s390x/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_s390x.h"

1
hw/scsi/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_scsi.h"

1
hw/sd/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_sd.h"

1
hw/sparc/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_sparc.h"

1
hw/sparc64/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_sparc64.h"

1
hw/ssi/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_ssi.h"

1
hw/timer/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_timer.h"

1
hw/tpm/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_tpm.h"

1
hw/usb/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_usb.h"

1
hw/vfio/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_vfio.h"

1
hw/virtio/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_virtio.h"

1
hw/watchdog/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_watchdog.h"

1
hw/xen/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-hw_xen.h"

View File

@ -10,7 +10,7 @@
#ifndef _SYSCALL_TRACE_H_
#define _SYSCALL_TRACE_H_
#include "trace-root.h"
#include "trace/trace-root.h"
/*
* These helpers just provide a common place for the various

1
io/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-io.h"

View File

@ -27,7 +27,7 @@
#include "qemu/job.h"
#include "qapi/qapi-commands-job.h"
#include "qapi/error.h"
#include "trace-root.h"
#include "trace/trace-root.h"
/* Get a job using its ID and acquire its AioContext */
static Job *find_job(const char *id, AioContext **aio_context, Error **errp)

2
job.c
View File

@ -29,7 +29,7 @@
#include "qemu/id.h"
#include "qemu/main-loop.h"
#include "block/aio-wait.h"
#include "trace-root.h"
#include "trace/trace-root.h"
#include "qapi/qapi-events-job.h"
static QLIST_HEAD(, Job) jobs = QLIST_HEAD_INITIALIZER(jobs);

1
linux-user/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-linux_user.h"

1
migration/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-migration.h"

1
monitor/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-monitor.h"

1
nbd/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-nbd.h"

1
net/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-net.h"

1
qapi/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-qapi.h"

1
qom/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-qom.h"

View File

@ -19,10 +19,7 @@ def generate(events, backend, group):
active_events = [e for e in events
if "disable" not in e.properties]
if group == "root":
header = "trace-root.h"
else:
header = "trace.h"
header = "trace-" + group + ".h"
out('/* This file is autogenerated by tracetool, do not edit. */',
'',

View File

@ -28,7 +28,7 @@ def vcpu_transform_args(args):
def generate(events, backend, group):
if group == "root":
header = "trace-root.h"
header = "trace/trace-root.h"
else:
header = "trace.h"

View File

@ -41,7 +41,7 @@ def vcpu_transform_args(args, mode):
def generate(events, backend, group):
if group == "root":
header = "trace-root.h"
header = "trace/trace-root.h"
else:
header = "trace.h"

1
scsi/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-scsi.h"

View File

@ -28,7 +28,7 @@
#include "qemu/atomic.h"
#include "sysemu/kvm.h"
#include "sysemu/balloon.h"
#include "trace-root.h"
#include "trace/trace-root.h"
#include "qapi/error.h"
#include "qapi/qapi-commands-misc.h"
#include "qapi/qmp/qerror.h"

View File

@ -28,7 +28,7 @@
#include "qemu/osdep.h"
#include "cpu.h"
#include "exec/ioport.h"
#include "trace-root.h"
#include "trace/trace-root.h"
#include "exec/memory.h"
#include "exec/address-spaces.h"

View File

@ -24,7 +24,7 @@
#include "qemu/main-loop.h"
#include "qemu/qemu-print.h"
#include "qom/object.h"
#include "trace-root.h"
#include "trace/trace-root.h"
#include "exec/memory-internal.h"
#include "exec/ram_addr.h"

View File

@ -90,7 +90,7 @@
#include "disas/disas.h"
#include "trace-root.h"
#include "trace/trace-root.h"
#include "trace/control.h"
#include "qemu/plugin.h"
#include "qemu/queue.h"

1
target/arm/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-target_arm.h"

1
target/hppa/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-target_hppa.h"

1
target/i386/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-target_i386.h"

1
target/mips/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-target_mips.h"

1
target/ppc/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-target_ppc.h"

1
target/riscv/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-target_riscv.h"

1
target/s390x/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-target_s390x.h"

1
target/sparc/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-target_sparc.h"

View File

@ -9,7 +9,7 @@
#include "qemu/osdep.h"
#include "cpu.h"
#include "trace-root.h"
#include "trace/trace-root.h"
#include "trace/control.h"

View File

@ -27,7 +27,7 @@
#include "qemu/error-report.h"
#include "qemu/config-file.h"
#include "monitor/monitor.h"
#include "trace-root.h"
#include "trace/trace-root.h"
int trace_events_enabled_count;

1
ui/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-ui.h"

1
util/trace.h Normal file
View File

@ -0,0 +1 @@
#include "trace/trace-util.h"