Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* Copyright (c) 2020 Facebook */
0003 #undef TRACE_SYSTEM
0004 #define TRACE_SYSTEM bpf_testmod
0005 
0006 #if !defined(_BPF_TESTMOD_EVENTS_H) || defined(TRACE_HEADER_MULTI_READ)
0007 #define _BPF_TESTMOD_EVENTS_H
0008 
0009 #include <linux/tracepoint.h>
0010 #include "bpf_testmod.h"
0011 
0012 TRACE_EVENT(bpf_testmod_test_read,
0013     TP_PROTO(struct task_struct *task, struct bpf_testmod_test_read_ctx *ctx),
0014     TP_ARGS(task, ctx),
0015     TP_STRUCT__entry(
0016         __field(pid_t, pid)
0017         __array(char, comm, TASK_COMM_LEN)
0018         __field(loff_t, off)
0019         __field(size_t, len)
0020     ),
0021     TP_fast_assign(
0022         __entry->pid = task->pid;
0023         memcpy(__entry->comm, task->comm, TASK_COMM_LEN);
0024         __entry->off = ctx->off;
0025         __entry->len = ctx->len;
0026     ),
0027     TP_printk("pid=%d comm=%s off=%llu len=%zu",
0028           __entry->pid, __entry->comm, __entry->off, __entry->len)
0029 );
0030 
0031 /* A bare tracepoint with no event associated with it */
0032 DECLARE_TRACE(bpf_testmod_test_write_bare,
0033     TP_PROTO(struct task_struct *task, struct bpf_testmod_test_write_ctx *ctx),
0034     TP_ARGS(task, ctx)
0035 );
0036 
0037 #undef BPF_TESTMOD_DECLARE_TRACE
0038 #ifdef DECLARE_TRACE_WRITABLE
0039 #define BPF_TESTMOD_DECLARE_TRACE(call, proto, args, size) \
0040     DECLARE_TRACE_WRITABLE(call, PARAMS(proto), PARAMS(args), size)
0041 #else
0042 #define BPF_TESTMOD_DECLARE_TRACE(call, proto, args, size) \
0043     DECLARE_TRACE(call, PARAMS(proto), PARAMS(args))
0044 #endif
0045 
0046 BPF_TESTMOD_DECLARE_TRACE(bpf_testmod_test_writable_bare,
0047     TP_PROTO(struct bpf_testmod_test_writable_ctx *ctx),
0048     TP_ARGS(ctx),
0049     sizeof(struct bpf_testmod_test_writable_ctx)
0050 );
0051 
0052 #endif /* _BPF_TESTMOD_EVENTS_H */
0053 
0054 #undef TRACE_INCLUDE_PATH
0055 #define TRACE_INCLUDE_PATH .
0056 #define TRACE_INCLUDE_FILE bpf_testmod-events
0057 #include <trace/define_trace.h>