linux/kernel/trace/trace_output.c

// SPDX-License-Identifier: GPL-2.0
/*
 * trace_output.c
 *
 * Copyright (C) 2008 Red Hat Inc, Steven Rostedt <[email protected]>
 *
 */
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/ftrace.h>
#include <linux/kprobes.h>
#include <linux/sched/clock.h>
#include <linux/sched/mm.h>
#include <linux/idr.h>

#include "trace_output.h"

/* must be a power of 2 */
#define EVENT_HASHSIZE

DECLARE_RWSEM();

static struct hlist_head event_hash[EVENT_HASHSIZE] __read_mostly;

enum print_line_t trace_print_bputs_msg_only(struct trace_iterator *iter)
{}

enum print_line_t trace_print_bprintk_msg_only(struct trace_iterator *iter)
{}

enum print_line_t trace_print_printk_msg_only(struct trace_iterator *iter)
{}

const char *
trace_print_flags_seq(struct trace_seq *p, const char *delim,
		      unsigned long flags,
		      const struct trace_print_flags *flag_array)
{}
EXPORT_SYMBOL();

const char *
trace_print_symbols_seq(struct trace_seq *p, unsigned long val,
			const struct trace_print_flags *symbol_array)
{}
EXPORT_SYMBOL();

#if BITS_PER_LONG == 32
const char *
trace_print_flags_seq_u64(struct trace_seq *p, const char *delim,
		      unsigned long long flags,
		      const struct trace_print_flags_u64 *flag_array)
{
	unsigned long long mask;
	const char *str;
	const char *ret = trace_seq_buffer_ptr(p);
	int i, first = 1;

	for (i = 0;  flag_array[i].name && flags; i++) {

		mask = flag_array[i].mask;
		if ((flags & mask) != mask)
			continue;

		str = flag_array[i].name;
		flags &= ~mask;
		if (!first && delim)
			trace_seq_puts(p, delim);
		else
			first = 0;
		trace_seq_puts(p, str);
	}

	/* check for left over flags */
	if (flags) {
		if (!first && delim)
			trace_seq_puts(p, delim);
		trace_seq_printf(p, "0x%llx", flags);
	}

	trace_seq_putc(p, 0);

	return ret;
}
EXPORT_SYMBOL(trace_print_flags_seq_u64);

const char *
trace_print_symbols_seq_u64(struct trace_seq *p, unsigned long long val,
			 const struct trace_print_flags_u64 *symbol_array)
{
	int i;
	const char *ret = trace_seq_buffer_ptr(p);

	for (i = 0;  symbol_array[i].name; i++) {

		if (val != symbol_array[i].mask)
			continue;

		trace_seq_puts(p, symbol_array[i].name);
		break;
	}

	if (ret == (const char *)(trace_seq_buffer_ptr(p)))
		trace_seq_printf(p, "0x%llx", val);

	trace_seq_putc(p, 0);

	return ret;
}
EXPORT_SYMBOL(trace_print_symbols_seq_u64);
#endif

const char *
trace_print_bitmask_seq(struct trace_seq *p, void *bitmask_ptr,
			unsigned int bitmask_size)
{}
EXPORT_SYMBOL_GPL();

/**
 * trace_print_hex_seq - print buffer as hex sequence
 * @p: trace seq struct to write to
 * @buf: The buffer to print
 * @buf_len: Length of @buf in bytes
 * @concatenate: Print @buf as single hex string or with spacing
 *
 * Prints the passed buffer as a hex sequence either as a whole,
 * single hex string if @concatenate is true or with spacing after
 * each byte in case @concatenate is false.
 */
const char *
trace_print_hex_seq(struct trace_seq *p, const unsigned char *buf, int buf_len,
		    bool concatenate)
{}
EXPORT_SYMBOL();

const char *
trace_print_array_seq(struct trace_seq *p, const void *buf, int count,
		      size_t el_size)
{}
EXPORT_SYMBOL();

const char *
trace_print_hex_dump_seq(struct trace_seq *p, const char *prefix_str,
			 int prefix_type, int rowsize, int groupsize,
			 const void *buf, size_t len, bool ascii)
{}
EXPORT_SYMBOL();

int trace_raw_output_prep(struct trace_iterator *iter,
			  struct trace_event *trace_event)
{}
EXPORT_SYMBOL();

void trace_event_printf(struct trace_iterator *iter, const char *fmt, ...)
{}
EXPORT_SYMBOL();

static __printf(3, 0)
int trace_output_raw(struct trace_iterator *iter, char *name,
		     char *fmt, va_list ap)
{}

int trace_output_call(struct trace_iterator *iter, char *name, char *fmt, ...)
{}
EXPORT_SYMBOL_GPL();

static inline const char *kretprobed(const char *name, unsigned long addr)
{}

void
trace_seq_print_sym(struct trace_seq *s, unsigned long address, bool offset)
{}

#ifndef CONFIG_64BIT
#define IP_FMT
#else
#define IP_FMT
#endif

static int seq_print_user_ip(struct trace_seq *s, struct mm_struct *mm,
			     unsigned long ip, unsigned long sym_flags)
{}

int
seq_print_ip_sym(struct trace_seq *s, unsigned long ip, unsigned long sym_flags)
{}

/**
 * trace_print_lat_fmt - print the irq, preempt and lockdep fields
 * @s: trace seq struct to write to
 * @entry: The trace entry field from the ring buffer
 *
 * Prints the generic fields of irqs off, in hard or softirq, preempt
 * count.
 */
int trace_print_lat_fmt(struct trace_seq *s, struct trace_entry *entry)
{}

static int
lat_print_generic(struct trace_seq *s, struct trace_entry *entry, int cpu)
{}

#undef MARK
#define MARK
/* trace overhead mark */
static const struct trace_mark {} mark[] =;
#undef MARK

char trace_find_mark(unsigned long long d)
{}

static int
lat_print_timestamp(struct trace_iterator *iter, u64 next_ts)
{}

static void trace_print_time(struct trace_seq *s, struct trace_iterator *iter,
			     unsigned long long ts)
{}

int trace_print_context(struct trace_iterator *iter)
{}

int trace_print_lat_context(struct trace_iterator *iter)
{}

/**
 * ftrace_find_event - find a registered event
 * @type: the type of event to look for
 *
 * Returns an event of type @type otherwise NULL
 * Called with trace_event_read_lock() held.
 */
struct trace_event *ftrace_find_event(int type)
{}

static DEFINE_IDA(trace_event_ida);

static void free_trace_event_type(int type)
{}

static int alloc_trace_event_type(void)
{}

void trace_event_read_lock(void)
{}

void trace_event_read_unlock(void)
{}

/**
 * register_trace_event - register output for an event type
 * @event: the event type to register
 *
 * Event types are stored in a hash and this hash is used to
 * find a way to print an event. If the @event->type is set
 * then it will use that type, otherwise it will assign a
 * type to use.
 *
 * If you assign your own type, please make sure it is added
 * to the trace_type enum in trace.h, to avoid collisions
 * with the dynamic types.
 *
 * Returns the event type number or zero on error.
 */
int register_trace_event(struct trace_event *event)
{}
EXPORT_SYMBOL_GPL();

/*
 * Used by module code with the trace_event_sem held for write.
 */
int __unregister_trace_event(struct trace_event *event)
{}

/**
 * unregister_trace_event - remove a no longer used event
 * @event: the event to remove
 */
int unregister_trace_event(struct trace_event *event)
{}
EXPORT_SYMBOL_GPL();

/*
 * Standard events
 */

static void print_array(struct trace_iterator *iter, void *pos,
			struct ftrace_event_field *field)
{}

static void print_fields(struct trace_iterator *iter, struct trace_event_call *call,
			 struct list_head *head)
{}

enum print_line_t print_event_fields(struct trace_iterator *iter,
				     struct trace_event *event)
{}

enum print_line_t trace_nop_print(struct trace_iterator *iter, int flags,
				  struct trace_event *event)
{}

static void print_fn_trace(struct trace_seq *s, unsigned long ip,
			   unsigned long parent_ip, int flags)
{}

/* TRACE_FN */
static enum print_line_t trace_fn_trace(struct trace_iterator *iter, int flags,
					struct trace_event *event)
{}

static enum print_line_t trace_fn_raw(struct trace_iterator *iter, int flags,
				      struct trace_event *event)
{}

static enum print_line_t trace_fn_hex(struct trace_iterator *iter, int flags,
				      struct trace_event *event)
{}

static enum print_line_t trace_fn_bin(struct trace_iterator *iter, int flags,
				      struct trace_event *event)
{}

static struct trace_event_functions trace_fn_funcs =;

static struct trace_event trace_fn_event =;

/* TRACE_CTX an TRACE_WAKE */
static enum print_line_t trace_ctxwake_print(struct trace_iterator *iter,
					     char *delim)
{}

static enum print_line_t trace_ctx_print(struct trace_iterator *iter, int flags,
					 struct trace_event *event)
{}

static enum print_line_t trace_wake_print(struct trace_iterator *iter,
					  int flags, struct trace_event *event)
{}

static int trace_ctxwake_raw(struct trace_iterator *iter, char S)
{}

static enum print_line_t trace_ctx_raw(struct trace_iterator *iter, int flags,
				       struct trace_event *event)
{}

static enum print_line_t trace_wake_raw(struct trace_iterator *iter, int flags,
					struct trace_event *event)
{}


static int trace_ctxwake_hex(struct trace_iterator *iter, char S)
{}

static enum print_line_t trace_ctx_hex(struct trace_iterator *iter, int flags,
				       struct trace_event *event)
{}

static enum print_line_t trace_wake_hex(struct trace_iterator *iter, int flags,
					struct trace_event *event)
{}

static enum print_line_t trace_ctxwake_bin(struct trace_iterator *iter,
					   int flags, struct trace_event *event)
{}

static struct trace_event_functions trace_ctx_funcs =;

static struct trace_event trace_ctx_event =;

static struct trace_event_functions trace_wake_funcs =;

static struct trace_event trace_wake_event =;

/* TRACE_STACK */

static enum print_line_t trace_stack_print(struct trace_iterator *iter,
					   int flags, struct trace_event *event)
{}

static struct trace_event_functions trace_stack_funcs =;

static struct trace_event trace_stack_event =;

/* TRACE_USER_STACK */
static enum print_line_t trace_user_stack_print(struct trace_iterator *iter,
						int flags, struct trace_event *event)
{}

static struct trace_event_functions trace_user_stack_funcs =;

static struct trace_event trace_user_stack_event =;

/* TRACE_HWLAT */
static enum print_line_t
trace_hwlat_print(struct trace_iterator *iter, int flags,
		  struct trace_event *event)
{}

static enum print_line_t
trace_hwlat_raw(struct trace_iterator *iter, int flags,
		struct trace_event *event)
{}

static struct trace_event_functions trace_hwlat_funcs =;

static struct trace_event trace_hwlat_event =;

/* TRACE_OSNOISE */
static enum print_line_t
trace_osnoise_print(struct trace_iterator *iter, int flags,
		    struct trace_event *event)
{}

static enum print_line_t
trace_osnoise_raw(struct trace_iterator *iter, int flags,
		  struct trace_event *event)
{}

static struct trace_event_functions trace_osnoise_funcs =;

static struct trace_event trace_osnoise_event =;

/* TRACE_TIMERLAT */

static char *timerlat_lat_context[] =;
static enum print_line_t
trace_timerlat_print(struct trace_iterator *iter, int flags,
		     struct trace_event *event)
{}

static enum print_line_t
trace_timerlat_raw(struct trace_iterator *iter, int flags,
		   struct trace_event *event)
{}

static struct trace_event_functions trace_timerlat_funcs =;

static struct trace_event trace_timerlat_event =;

/* TRACE_BPUTS */
static enum print_line_t
trace_bputs_print(struct trace_iterator *iter, int flags,
		   struct trace_event *event)
{}


static enum print_line_t
trace_bputs_raw(struct trace_iterator *iter, int flags,
		struct trace_event *event)
{}

static struct trace_event_functions trace_bputs_funcs =;

static struct trace_event trace_bputs_event =;

/* TRACE_BPRINT */
static enum print_line_t
trace_bprint_print(struct trace_iterator *iter, int flags,
		   struct trace_event *event)
{}


static enum print_line_t
trace_bprint_raw(struct trace_iterator *iter, int flags,
		 struct trace_event *event)
{}

static struct trace_event_functions trace_bprint_funcs =;

static struct trace_event trace_bprint_event =;

/* TRACE_PRINT */
static enum print_line_t trace_print_print(struct trace_iterator *iter,
					   int flags, struct trace_event *event)
{}

static enum print_line_t trace_print_raw(struct trace_iterator *iter, int flags,
					 struct trace_event *event)
{}

static struct trace_event_functions trace_print_funcs =;

static struct trace_event trace_print_event =;

static enum print_line_t trace_raw_data(struct trace_iterator *iter, int flags,
					 struct trace_event *event)
{}

static struct trace_event_functions trace_raw_data_funcs =;

static struct trace_event trace_raw_data_event =;

static enum print_line_t
trace_func_repeats_raw(struct trace_iterator *iter, int flags,
			 struct trace_event *event)
{}

static enum print_line_t
trace_func_repeats_print(struct trace_iterator *iter, int flags,
			 struct trace_event *event)
{}

static struct trace_event_functions trace_func_repeats_funcs =;

static struct trace_event trace_func_repeats_event =;

static struct trace_event *events[] __initdata =;

__init int init_events(void)
{}