Debian Codegraph @

src/udev/udev-trace.h

raw
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #if HAVE_SYS_SDT_H
5 #define SDT_USE_VARIADIC
6 #include <sys/sdt.h>
7
8 #include "device-private.h"
9 #include "device-util.h"
10 #include "errno-util.h"
11 #include "udev-forward.h"
12
13 /* Each trace point can have different number of additional arguments. Note that when the macro is used only
14 * additional arguments are listed in the macro invocation!
15 *
16 * Default arguments for each trace point are as follows:
17 * - arg0 - action
18 * - arg1 - sysname
19 * - arg2 - syspath
20 * - arg3 - subsystem
21 */
22 #define DEVICE_TRACE_POINT(name, dev, ...) \
23 do { \
24 PROTECT_ERRNO; \
25 const char *_n = NULL, *_p = NULL, *_s = NULL; \
26 sd_device *_d = (dev); \
27 sd_device_action_t _a = _SD_DEVICE_ACTION_INVALID; \
28 (void) sd_device_get_action(_d, &_a); \
29 (void) sd_device_get_sysname(_d, &_n); \
30 (void) sd_device_get_syspath(_d, &_p); \
31 (void) sd_device_get_subsystem(_d, &_s); \
32 STAP_PROBEV(udev, name, device_action_to_string(_a), _n, _p, _s __VA_OPT__(,) __VA_ARGS__);\
33 } while (false);
34 #else
35 #define DEVICE_TRACE_POINT(name, dev, ...) ((void) 0)
36 #endif