ANDROID: GKI: allow mm vendor hooks header inclusion from header files
Introduce PROTECT_TRACE_INCLUDE_PATH to allow trace/hooks/mm.h to be included from a header file. When trace/hooks/mm.h is included from a header file PROTECT_TRACE_INCLUDE_PATH should be defined before the inclusion so that the existing TRACE_INCLUDE_PATH gets preserved. Bug: 236578020 Signed-off-by: Suren Baghdasaryan <surenb@google.com> Change-Id: Ia5890ba51675de41ff3ea4ab38bcb458202df5fb
This commit is contained in:
@@ -1,4 +1,13 @@
|
|||||||
/* SPDX-License-Identifier: GPL-2.0 */
|
/* SPDX-License-Identifier: GPL-2.0 */
|
||||||
|
#ifdef PROTECT_TRACE_INCLUDE_PATH
|
||||||
|
#undef PROTECT_TRACE_INCLUDE_PATH
|
||||||
|
|
||||||
|
#include <trace/hooks/save_incpath.h>
|
||||||
|
#include <trace/hooks/mm.h>
|
||||||
|
#include <trace/hooks/restore_incpath.h>
|
||||||
|
|
||||||
|
#else /* PROTECT_TRACE_INCLUDE_PATH */
|
||||||
|
|
||||||
#undef TRACE_SYSTEM
|
#undef TRACE_SYSTEM
|
||||||
#define TRACE_SYSTEM mm
|
#define TRACE_SYSTEM mm
|
||||||
|
|
||||||
@@ -230,3 +239,5 @@ DECLARE_HOOK(android_vh_set_shmem_page_flag,
|
|||||||
|
|
||||||
/* This part must be outside protection */
|
/* This part must be outside protection */
|
||||||
#include <trace/define_trace.h>
|
#include <trace/define_trace.h>
|
||||||
|
|
||||||
|
#endif /* PROTECT_TRACE_INCLUDE_PATH */
|
||||||
|
32
include/trace/hooks/restore_incpath.h
Normal file
32
include/trace/hooks/restore_incpath.h
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-2.0 */
|
||||||
|
/*
|
||||||
|
* Include this file from a header declaring vendor hooks to preserve and later
|
||||||
|
* restore TRACE_INCLUDE_PATH value. Typical usage:
|
||||||
|
*
|
||||||
|
* #ifdef PROTECT_TRACE_INCLUDE_PATH
|
||||||
|
* #undef PROTECT_TRACE_INCLUDE_PATH
|
||||||
|
*
|
||||||
|
* #include <trace/hooks/save_incpath.h>
|
||||||
|
* #include <vendor hooks header>
|
||||||
|
* #include <trace/hooks/restore_incpath.h>
|
||||||
|
*
|
||||||
|
* #else
|
||||||
|
*
|
||||||
|
* <vendor hook definitions>
|
||||||
|
*
|
||||||
|
* #endif
|
||||||
|
*
|
||||||
|
* The header that includes vendor hooks header file should define
|
||||||
|
* PROTECT_TRACE_INCLUDE_PATH before including the vendor hook file like this:
|
||||||
|
*
|
||||||
|
* #define PROTECT_TRACE_INCLUDE_PATH
|
||||||
|
* #include <vendor hooks header>
|
||||||
|
*/
|
||||||
|
#ifdef STORED_TRACE_INCLUDE_PATH
|
||||||
|
# undef TRACE_INCLUDE_PATH
|
||||||
|
# define TRACE_INCLUDE_PATH STORED_TRACE_INCLUDE_PATH
|
||||||
|
# undef STORED_TRACE_INCLUDE_PATH
|
||||||
|
#else
|
||||||
|
# undef TRACE_INCLUDE_PATH
|
||||||
|
#endif
|
||||||
|
|
29
include/trace/hooks/save_incpath.h
Normal file
29
include/trace/hooks/save_incpath.h
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-2.0 */
|
||||||
|
/*
|
||||||
|
* Include this file from a header declaring vendor hooks to preserve and later
|
||||||
|
* restore TRACE_INCLUDE_PATH value. Typical usage:
|
||||||
|
*
|
||||||
|
* #ifdef PROTECT_TRACE_INCLUDE_PATH
|
||||||
|
* #undef PROTECT_TRACE_INCLUDE_PATH
|
||||||
|
*
|
||||||
|
* #include <trace/hooks/save_incpath.h>
|
||||||
|
* #include <vendor hooks header>
|
||||||
|
* #include <trace/hooks/restore_incpath.h>
|
||||||
|
*
|
||||||
|
* #else
|
||||||
|
*
|
||||||
|
* <vendor hook definitions>
|
||||||
|
*
|
||||||
|
* #endif
|
||||||
|
*
|
||||||
|
* The header that includes vendor hooks header file should define
|
||||||
|
* PROTECT_TRACE_INCLUDE_PATH before including the vendor hook file like this:
|
||||||
|
*
|
||||||
|
* #define PROTECT_TRACE_INCLUDE_PATH
|
||||||
|
* #include <vendor hooks header>
|
||||||
|
*/
|
||||||
|
#ifdef TRACE_INCLUDE_PATH
|
||||||
|
#define STORED_TRACE_INCLUDE_PATH TRACE_INCLUDE_PATH
|
||||||
|
#undef TRACE_INCLUDE_PATH
|
||||||
|
#endif
|
||||||
|
|
Reference in New Issue
Block a user