diff mbox series

[2/2] kernel-shark: Treat all tracing headers as library headers

Message ID 20210726094141.191579-2-y.karadz@gmail.com (mailing list archive)
State Accepted
Headers show
Series [1/2] kernel-shark: Cleanup in CMakeLists.txt | expand

Commit Message

Yordan Karadzhov July 26, 2021, 9:41 a.m. UTC
The CMake scripts used to discover all tracing libraries are modified
such that the full path to the header is determined. Later there is
no need to add that part when the headers are included. Using angular
brackets ('<' and '>') denotes that it is a library header and not a
local one.

1. Note that this patch actually fixes a build failure, caused by the
following commit in libtracefs:
880885d (libtracefs: Remove "traceevent/" from referencing libtraceevent headers)
It seems that so far the discovery of the headers was working more or
less by chance.

2. Note that after applying the patch you may need to clean the Cmake
cache (running cmake_clean.sh).

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 build/FindTraceCmd.cmake     | 2 +-
 build/FindTraceEvent.cmake   | 2 +-
 build/FindTraceFS.cmake      | 2 +-
 src/KsAdvFilteringDialog.cpp | 2 +-
 src/libkshark-tepdata.c      | 3 +--
 src/plugins/sched_events.c   | 2 +-
 6 files changed, 6 insertions(+), 7 deletions(-)

Comments

Steven Rostedt July 26, 2021, 1:59 p.m. UTC | #1
On Mon, 26 Jul 2021 12:41:41 +0300
"Yordan Karadzhov (VMware)" <y.karadz@gmail.com> wrote:

> 1. Note that this patch actually fixes a build failure, caused by the
> following commit in libtracefs:
> 880885d (libtracefs: Remove "traceevent/" from referencing libtraceevent headers)
> It seems that so far the discovery of the headers was working more or
> less by chance.

Yep, it was "by chance", that we just happened to include the headers
in the main directory in the same paths as were added in the files. But
if we ever changed those paths, the files would not be updated and the
compile would break.

Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

to both patches.

Thanks Yordan.

-- Steve
diff mbox series

Patch

diff --git a/build/FindTraceCmd.cmake b/build/FindTraceCmd.cmake
index 23eefed..602eac5 100644
--- a/build/FindTraceCmd.cmake
+++ b/build/FindTraceCmd.cmake
@@ -42,7 +42,7 @@  pkg_check_modules(PC_TraceCmd QUIET libtracecmd)
 set(TraceCmd_VERSION     ${PC_TraceCmd_VERSION})
 set(TraceCmd_DEFINITIONS ${PC_TraceCmd_CFLAGS_OTHER})
 
-find_path(TraceCmd_INCLUDE_DIR NAMES trace-cmd/trace-cmd.h
+find_path(TraceCmd_INCLUDE_DIR NAMES trace-cmd.h
                                HINTS ${PC_TraceCmd_INCLUDE_DIRS}
                                      ${PC_TraceCmd_INCLUDEDIR})
 
diff --git a/build/FindTraceEvent.cmake b/build/FindTraceEvent.cmake
index ae391b6..668a5de 100644
--- a/build/FindTraceEvent.cmake
+++ b/build/FindTraceEvent.cmake
@@ -42,7 +42,7 @@  pkg_check_modules(PC_TraceEvent QUIET libtraceevent)
 set(TraceEvent_VERSION     ${PC_TraceEvent_VERSION})
 set(TraceEvent_DEFINITIONS ${PC_TraceEvent_CFLAGS_OTHER})
 
-find_path(TraceEvent_INCLUDE_DIR  NAMES traceevent/event-parse.h
+find_path(TraceEvent_INCLUDE_DIR  NAMES event-parse.h
                                   HINTS ${PC_TraceEvent_INCLUDE_DIRS}
                                         ${PC_TraceEvent_INCLUDEDIR})
 
diff --git a/build/FindTraceFS.cmake b/build/FindTraceFS.cmake
index 82fa012..251b506 100644
--- a/build/FindTraceFS.cmake
+++ b/build/FindTraceFS.cmake
@@ -42,7 +42,7 @@  pkg_check_modules(PC_TraceFS QUIET libtracefs)
 set(TraceFS_VERSION     ${PC_TraceFS_VERSION})
 set(TraceFS_DEFINITIONS ${PC_TraceFS_CFLAGS_OTHER})
 
-find_path(TraceFS_INCLUDE_DIR  NAMES tracefs/tracefs.h
+find_path(TraceFS_INCLUDE_DIR  NAMES tracefs.h
                                HINTS ${PC_TraceFS_INCLUDE_DIRS}
                                      ${PC_TraceFS_INCLUDEDIR})
 
diff --git a/src/KsAdvFilteringDialog.cpp b/src/KsAdvFilteringDialog.cpp
index 2fdb624..f01467d 100644
--- a/src/KsAdvFilteringDialog.cpp
+++ b/src/KsAdvFilteringDialog.cpp
@@ -10,7 +10,7 @@ 
  */
 
 // trace-cmd
-#include "trace-cmd/trace-cmd.h"
+#include <trace-cmd.h>
 
 // KernelShark
 #include "libkshark.h"
diff --git a/src/libkshark-tepdata.c b/src/libkshark-tepdata.c
index acc554b..865ca82 100644
--- a/src/libkshark-tepdata.c
+++ b/src/libkshark-tepdata.c
@@ -21,8 +21,7 @@ 
 #include <string.h>
 
 // trace-cmd
-#include "trace-cmd/trace-cmd.h"
-#include "tracefs/tracefs.h"
+#include <trace-cmd.h>
 
 // KernelShark
 #include "libkshark.h"
diff --git a/src/plugins/sched_events.c b/src/plugins/sched_events.c
index 659ecc3..83c2520 100644
--- a/src/plugins/sched_events.c
+++ b/src/plugins/sched_events.c
@@ -14,7 +14,7 @@ 
 #include <stdio.h>
 
 // trace-cmd
-#include "trace-cmd/trace-cmd.h"
+#include <trace-cmd.h>
 
 // KernelShark
 #include "plugins/sched_events.h"