From: Cristiano Giuffrida Date: Fri, 26 Sep 2014 14:05:32 +0000 (+0200) Subject: sef: GCOV cleanup. X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=refs%2Fchanges%2F93%2F3093%2F2;p=minix.git sef: GCOV cleanup. Change-Id: I2e5a6ae10f45108a2c112f78e5a0af4f93e0bed1 --- diff --git a/minix/include/minix/sef.h b/minix/include/minix/sef.h index bae2f0b10..6410877f7 100644 --- a/minix/include/minix/sef.h +++ b/minix/include/minix/sef.h @@ -230,12 +230,10 @@ int sef_cb_lu_response_rs_reply(message *m_ptr); /* Callback type definitions. */ typedef void(*sef_cb_signal_handler_t)(int signo); typedef int(*sef_cb_signal_manager_t)(endpoint_t target, int signo); -typedef int(*sef_cb_gcov_t)(message *msg); /* Callback registration helpers. */ void sef_setcb_signal_handler(sef_cb_signal_handler_t cb); void sef_setcb_signal_manager(sef_cb_signal_manager_t cb); -void sef_setcb_gcov(sef_cb_gcov_t cb); /* Predefined callback implementations. */ void sef_cb_signal_handler_null(int signo); @@ -262,6 +260,24 @@ void sef_cb_signal_handler_posix_default(int signo); #define sef_signal_debug_begin sef_debug_begin #define sef_signal_debug_end sef_debug_end +/*===========================================================================* + * SEF GCOV * + *===========================================================================*/ +/* What to intercept. */ +#define INTERCEPT_SEF_GCOV_REQUESTS 1 +#define SEF_GCOV_REQUEST_TYPE COMMON_REQ_GCOV_DATA +#define IS_SEF_GCOV_REQUEST(mp, status) \ + ((mp)->m_type == COMMON_REQ_GCOV_DATA && (mp)->m_source == VFS_PROC_NR) + +/* Callback type definitions. */ +typedef int(*sef_cb_gcov_t)(message *msg); + +/* Callback registration helpers. */ +void sef_setcb_gcov(sef_cb_gcov_t cb); + +/* Macros for predefined callback implementations. */ +#define SEF_CB_GCOV_FLUSH_DEFAULT do_gcov_flush_impl + /*===========================================================================* * SEF Fault Injection * *===========================================================================*/ diff --git a/minix/lib/libsys/sef.c b/minix/lib/libsys/sef.c index 119e8e801..61502d572 100644 --- a/minix/lib/libsys/sef.c +++ b/minix/lib/libsys/sef.c @@ -178,10 +178,9 @@ int sef_receive_status(endpoint_t src, message *m_ptr, int *status_ptr) } #endif -#ifdef USE_COVERAGE +#if INTERCEPT_SEF_GCOV_REQUESTS && USE_COVERAGE /* Intercept GCOV data requests (sent by VFS in vfs/gcov.c). */ - if(m_ptr->m_type == COMMON_REQ_GCOV_DATA && - m_ptr->m_source == VFS_PROC_NR) { + if(IS_SEF_GCOV_REQUEST(m_ptr, status)) { if(do_sef_gcov_request(m_ptr) == OK) { continue; } diff --git a/minix/lib/libsys/sef_gcov.c b/minix/lib/libsys/sef_gcov.c index dc842eb0e..b4b061f53 100644 --- a/minix/lib/libsys/sef_gcov.c +++ b/minix/lib/libsys/sef_gcov.c @@ -4,7 +4,7 @@ #include #include -static sef_cb_gcov_t sef_cb_gcov = do_gcov_flush_impl; +static sef_cb_gcov_t sef_cb_gcov = SEF_CB_GCOV_FLUSH_DEFAULT; /*===========================================================================* * do_sef_gcov_request *