Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags   |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: LGPL-2.1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Copyright (C) 2009, 2010 Red Hat Inc, Steven Rostedt <srostedt@redhat.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #include "event-parse.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include "event-parse-local.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include "event-utils.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  * tep_get_event - returns the event with the given index
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  * @tep: a handle to the tep_handle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  * @index: index of the requested event, in the range 0 .. nr_events
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  * This returns pointer to the element of the events array with the given index
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * If @tep is NULL, or @index is not in the range 0 .. nr_events, NULL is returned.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) struct tep_event *tep_get_event(struct tep_handle *tep, int index)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 	if (tep && tep->events && index < tep->nr_events)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 		return tep->events[index];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  * tep_get_first_event - returns the first event in the events array
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  * @tep: a handle to the tep_handle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  * This returns pointer to the first element of the events array
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  * If @tep is NULL, NULL is returned.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) struct tep_event *tep_get_first_event(struct tep_handle *tep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	return tep_get_event(tep, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  * tep_get_events_count - get the number of defined events
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)  * @tep: a handle to the tep_handle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43)  * This returns number of elements in event array
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44)  * If @tep is NULL, 0 is returned.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) int tep_get_events_count(struct tep_handle *tep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	if (tep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 		return tep->nr_events;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54)  * tep_set_flag - set event parser flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55)  * @tep: a handle to the tep_handle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56)  * @flag: flag, or combination of flags to be set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57)  * can be any combination from enum tep_flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59)  * This sets a flag or combination of flags from enum tep_flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) void tep_set_flag(struct tep_handle *tep, int flag)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	if (tep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 		tep->flags |= flag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68)  * tep_clear_flag - clear event parser flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69)  * @tep: a handle to the tep_handle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70)  * @flag: flag to be cleared
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72)  * This clears a tep flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) void tep_clear_flag(struct tep_handle *tep, enum tep_flag flag)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	if (tep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 		tep->flags &= ~flag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81)  * tep_test_flag - check the state of event parser flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82)  * @tep: a handle to the tep_handle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83)  * @flag: flag to be checked
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85)  * This returns the state of the requested tep flag.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86)  * Returns: true if the flag is set, false otherwise.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) bool tep_test_flag(struct tep_handle *tep, enum tep_flag flag)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	if (tep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 		return tep->flags & flag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) __hidden unsigned short data2host2(struct tep_handle *tep, unsigned short data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	unsigned short swap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	if (!tep || tep->host_bigendian == tep->file_bigendian)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 		return data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	swap = ((data & 0xffULL) << 8) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 		((data & (0xffULL << 8)) >> 8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	return swap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) __hidden unsigned int data2host4(struct tep_handle *tep, unsigned int data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	unsigned int swap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	if (!tep || tep->host_bigendian == tep->file_bigendian)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 		return data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	swap = ((data & 0xffULL) << 24) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 		((data & (0xffULL << 8)) << 8) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 		((data & (0xffULL << 16)) >> 8) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 		((data & (0xffULL << 24)) >> 24);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	return swap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) __hidden  unsigned long long
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) data2host8(struct tep_handle *tep, unsigned long long data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	unsigned long long swap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	if (!tep || tep->host_bigendian == tep->file_bigendian)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 		return data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	swap = ((data & 0xffULL) << 56) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 		((data & (0xffULL << 8)) << 40) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 		((data & (0xffULL << 16)) << 24) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 		((data & (0xffULL << 24)) << 8) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 		((data & (0xffULL << 32)) >> 8) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 		((data & (0xffULL << 40)) >> 24) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 		((data & (0xffULL << 48)) >> 40) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 		((data & (0xffULL << 56)) >> 56);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	return swap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)  * tep_get_header_page_size - get size of the header page
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)  * @tep: a handle to the tep_handle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)  * This returns size of the header page
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)  * If @tep is NULL, 0 is returned.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) int tep_get_header_page_size(struct tep_handle *tep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	if (tep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 		return tep->header_page_size_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)  * tep_get_header_timestamp_size - get size of the timestamp in the header page
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)  * @tep: a handle to the tep_handle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)  * This returns size of the timestamp in the header page
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)  * If @tep is NULL, 0 is returned.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) int tep_get_header_timestamp_size(struct tep_handle *tep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	if (tep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 		return tep->header_page_ts_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)  * tep_get_cpus - get the number of CPUs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)  * @tep: a handle to the tep_handle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)  * This returns the number of CPUs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)  * If @tep is NULL, 0 is returned.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) int tep_get_cpus(struct tep_handle *tep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	if (tep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 		return tep->cpus;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)  * tep_set_cpus - set the number of CPUs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)  * @tep: a handle to the tep_handle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)  * This sets the number of CPUs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) void tep_set_cpus(struct tep_handle *tep, int cpus)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	if (tep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 		tep->cpus = cpus;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)  * tep_get_long_size - get the size of a long integer on the traced machine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)  * @tep: a handle to the tep_handle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)  * This returns the size of a long integer on the traced machine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)  * If @tep is NULL, 0 is returned.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) int tep_get_long_size(struct tep_handle *tep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	if (tep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 		return tep->long_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)  * tep_set_long_size - set the size of a long integer on the traced machine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)  * @tep: a handle to the tep_handle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)  * @size: size, in bytes, of a long integer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)  * This sets the size of a long integer on the traced machine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) void tep_set_long_size(struct tep_handle *tep, int long_size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	if (tep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 		tep->long_size = long_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)  * tep_get_page_size - get the size of a memory page on the traced machine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)  * @tep: a handle to the tep_handle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)  * This returns the size of a memory page on the traced machine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)  * If @tep is NULL, 0 is returned.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) int tep_get_page_size(struct tep_handle *tep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 	if (tep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 		return tep->page_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)  * tep_set_page_size - set the size of a memory page on the traced machine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)  * @tep: a handle to the tep_handle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)  * @_page_size: size of a memory page, in bytes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)  * This sets the size of a memory page on the traced machine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) void tep_set_page_size(struct tep_handle *tep, int _page_size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 	if (tep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 		tep->page_size = _page_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)  * tep_is_file_bigendian - return the endian of the file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253)  * @tep: a handle to the tep_handle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)  * This returns true if the file is in big endian order
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)  * If @tep is NULL, false is returned.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) bool tep_is_file_bigendian(struct tep_handle *tep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 	if (tep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 		return (tep->file_bigendian == TEP_BIG_ENDIAN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 	return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266)  * tep_set_file_bigendian - set if the file is in big endian order
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267)  * @tep: a handle to the tep_handle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)  * @endian: non zero, if the file is in big endian order
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)  * This sets if the file is in big endian order
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) void tep_set_file_bigendian(struct tep_handle *tep, enum tep_endian endian)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 	if (tep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 		tep->file_bigendian = endian;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)  * tep_is_local_bigendian - return the endian of the saved local machine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280)  * @tep: a handle to the tep_handle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282)  * This returns true if the saved local machine in @tep is big endian.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)  * If @tep is NULL, false is returned.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) bool tep_is_local_bigendian(struct tep_handle *tep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 	if (tep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 		return (tep->host_bigendian == TEP_BIG_ENDIAN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293)  * tep_set_local_bigendian - set the stored local machine endian order
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294)  * @tep: a handle to the tep_handle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295)  * @endian: non zero, if the local host has big endian order
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297)  * This sets the endian order for the local machine.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) void tep_set_local_bigendian(struct tep_handle *tep, enum tep_endian endian)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 	if (tep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 		tep->host_bigendian = endian;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306)  * tep_is_old_format - get if an old kernel is used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)  * @tep: a handle to the tep_handle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309)  * This returns true, if an old kernel is used to generate the tracing events or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310)  * false if a new kernel is used. Old kernels did not have header page info.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311)  * If @tep is NULL, false is returned.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) bool tep_is_old_format(struct tep_handle *tep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 	if (tep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 		return tep->old_format;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 	return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321)  * tep_set_test_filters - set a flag to test a filter string
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322)  * @tep: a handle to the tep_handle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323)  * @test_filters: the new value of the test_filters flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325)  * This sets a flag to test a filter string. If this flag is set, when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326)  * tep_filter_add_filter_str() API as called,it will print the filter string
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327)  * instead of adding it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) void tep_set_test_filters(struct tep_handle *tep, int test_filters)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 	if (tep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 		tep->test_filters = test_filters;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) }