Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools lib traceevent: Rename input arguments of libtraceevent APIs from pevent to tep

Input arguments of libtraceevent APIs are renamed from "struct
tep_handle *pevent" to "struct tep_handle *tep". This makes the API
consistent with the chosen naming convention: tep (trace event parser),
instead of the old pevent.

Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lore.kernel.org/linux-trace-devel/20190401132111.13727-2-tstoyanov@vmware.com
Link: http://lkml.kernel.org/r/20190401164344.465573837@goodmis.org
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Tzvetomir Stoyanov and committed by
Arnaldo Carvalho de Melo
047ff221 55c34ae0

+439 -442
+66 -66
tools/lib/traceevent/event-parse-api.c
··· 92 92 return false; 93 93 } 94 94 95 - unsigned short tep_data2host2(struct tep_handle *pevent, unsigned short data) 95 + unsigned short tep_data2host2(struct tep_handle *tep, unsigned short data) 96 96 { 97 97 unsigned short swap; 98 98 99 - if (!pevent || pevent->host_bigendian == pevent->file_bigendian) 99 + if (!tep || tep->host_bigendian == tep->file_bigendian) 100 100 return data; 101 101 102 102 swap = ((data & 0xffULL) << 8) | ··· 105 105 return swap; 106 106 } 107 107 108 - unsigned int tep_data2host4(struct tep_handle *pevent, unsigned int data) 108 + unsigned int tep_data2host4(struct tep_handle *tep, unsigned int data) 109 109 { 110 110 unsigned int swap; 111 111 112 - if (!pevent || pevent->host_bigendian == pevent->file_bigendian) 112 + if (!tep || tep->host_bigendian == tep->file_bigendian) 113 113 return data; 114 114 115 115 swap = ((data & 0xffULL) << 24) | ··· 121 121 } 122 122 123 123 unsigned long long 124 - tep_data2host8(struct tep_handle *pevent, unsigned long long data) 124 + tep_data2host8(struct tep_handle *tep, unsigned long long data) 125 125 { 126 126 unsigned long long swap; 127 127 128 - if (!pevent || pevent->host_bigendian == pevent->file_bigendian) 128 + if (!tep || tep->host_bigendian == tep->file_bigendian) 129 129 return data; 130 130 131 131 swap = ((data & 0xffULL) << 56) | ··· 142 142 143 143 /** 144 144 * tep_get_header_page_size - get size of the header page 145 - * @pevent: a handle to the tep_handle 145 + * @tep: a handle to the tep_handle 146 146 * 147 147 * This returns size of the header page 148 - * If @pevent is NULL, 0 is returned. 148 + * If @tep is NULL, 0 is returned. 149 149 */ 150 - int tep_get_header_page_size(struct tep_handle *pevent) 150 + int tep_get_header_page_size(struct tep_handle *tep) 151 151 { 152 - if (pevent) 153 - return pevent->header_page_size_size; 152 + if (tep) 153 + return tep->header_page_size_size; 154 154 return 0; 155 155 } 156 156 ··· 170 170 171 171 /** 172 172 * tep_get_cpus - get the number of CPUs 173 - * @pevent: a handle to the tep_handle 173 + * @tep: a handle to the tep_handle 174 174 * 175 175 * This returns the number of CPUs 176 - * If @pevent is NULL, 0 is returned. 176 + * If @tep is NULL, 0 is returned. 177 177 */ 178 - int tep_get_cpus(struct tep_handle *pevent) 178 + int tep_get_cpus(struct tep_handle *tep) 179 179 { 180 - if (pevent) 181 - return pevent->cpus; 180 + if (tep) 181 + return tep->cpus; 182 182 return 0; 183 183 } 184 184 185 185 /** 186 186 * tep_set_cpus - set the number of CPUs 187 - * @pevent: a handle to the tep_handle 187 + * @tep: a handle to the tep_handle 188 188 * 189 189 * This sets the number of CPUs 190 190 */ 191 - void tep_set_cpus(struct tep_handle *pevent, int cpus) 191 + void tep_set_cpus(struct tep_handle *tep, int cpus) 192 192 { 193 - if (pevent) 194 - pevent->cpus = cpus; 193 + if (tep) 194 + tep->cpus = cpus; 195 195 } 196 196 197 197 /** 198 198 * tep_get_long_size - get the size of a long integer on the traced machine 199 - * @pevent: a handle to the tep_handle 199 + * @tep: a handle to the tep_handle 200 200 * 201 201 * This returns the size of a long integer on the traced machine 202 - * If @pevent is NULL, 0 is returned. 202 + * If @tep is NULL, 0 is returned. 203 203 */ 204 - int tep_get_long_size(struct tep_handle *pevent) 204 + int tep_get_long_size(struct tep_handle *tep) 205 205 { 206 - if (pevent) 207 - return pevent->long_size; 206 + if (tep) 207 + return tep->long_size; 208 208 return 0; 209 209 } 210 210 211 211 /** 212 212 * tep_set_long_size - set the size of a long integer on the traced machine 213 - * @pevent: a handle to the tep_handle 213 + * @tep: a handle to the tep_handle 214 214 * @size: size, in bytes, of a long integer 215 215 * 216 216 * This sets the size of a long integer on the traced machine 217 217 */ 218 - void tep_set_long_size(struct tep_handle *pevent, int long_size) 218 + void tep_set_long_size(struct tep_handle *tep, int long_size) 219 219 { 220 - if (pevent) 221 - pevent->long_size = long_size; 220 + if (tep) 221 + tep->long_size = long_size; 222 222 } 223 223 224 224 /** 225 225 * tep_get_page_size - get the size of a memory page on the traced machine 226 - * @pevent: a handle to the tep_handle 226 + * @tep: a handle to the tep_handle 227 227 * 228 228 * This returns the size of a memory page on the traced machine 229 - * If @pevent is NULL, 0 is returned. 229 + * If @tep is NULL, 0 is returned. 230 230 */ 231 - int tep_get_page_size(struct tep_handle *pevent) 231 + int tep_get_page_size(struct tep_handle *tep) 232 232 { 233 - if (pevent) 234 - return pevent->page_size; 233 + if (tep) 234 + return tep->page_size; 235 235 return 0; 236 236 } 237 237 238 238 /** 239 239 * tep_set_page_size - set the size of a memory page on the traced machine 240 - * @pevent: a handle to the tep_handle 240 + * @tep: a handle to the tep_handle 241 241 * @_page_size: size of a memory page, in bytes 242 242 * 243 243 * This sets the size of a memory page on the traced machine 244 244 */ 245 - void tep_set_page_size(struct tep_handle *pevent, int _page_size) 245 + void tep_set_page_size(struct tep_handle *tep, int _page_size) 246 246 { 247 - if (pevent) 248 - pevent->page_size = _page_size; 247 + if (tep) 248 + tep->page_size = _page_size; 249 249 } 250 250 251 251 /** 252 252 * tep_is_file_bigendian - return the endian of the file 253 - * @pevent: a handle to the tep_handle 253 + * @tep: a handle to the tep_handle 254 254 * 255 255 * This returns true if the file is in big endian order 256 - * If @pevent is NULL, false is returned. 256 + * If @tep is NULL, false is returned. 257 257 */ 258 - bool tep_is_file_bigendian(struct tep_handle *pevent) 258 + bool tep_is_file_bigendian(struct tep_handle *tep) 259 259 { 260 - if (pevent) 261 - return pevent->file_bigendian == TEP_BIG_ENDIAN; 260 + if (tep) 261 + return (tep->file_bigendian == TEP_BIG_ENDIAN); 262 262 return false; 263 263 } 264 264 265 265 /** 266 266 * tep_set_file_bigendian - set if the file is in big endian order 267 - * @pevent: a handle to the tep_handle 267 + * @tep: a handle to the tep_handle 268 268 * @endian: non zero, if the file is in big endian order 269 269 * 270 270 * This sets if the file is in big endian order 271 271 */ 272 - void tep_set_file_bigendian(struct tep_handle *pevent, enum tep_endian endian) 272 + void tep_set_file_bigendian(struct tep_handle *tep, enum tep_endian endian) 273 273 { 274 - if (pevent) 275 - pevent->file_bigendian = endian; 274 + if (tep) 275 + tep->file_bigendian = endian; 276 276 } 277 277 278 278 /** 279 279 * tep_is_local_bigendian - return the endian of the saved local machine 280 - * @pevent: a handle to the tep_handle 280 + * @tep: a handle to the tep_handle 281 281 * 282 - * This returns true if the saved local machine in @pevent is big endian. 283 - * If @pevent is NULL, false is returned. 282 + * This returns true if the saved local machine in @tep is big endian. 283 + * If @tep is NULL, false is returned. 284 284 */ 285 - bool tep_is_local_bigendian(struct tep_handle *pevent) 285 + bool tep_is_local_bigendian(struct tep_handle *tep) 286 286 { 287 - if (pevent) 288 - return pevent->host_bigendian == TEP_BIG_ENDIAN; 287 + if (tep) 288 + return (tep->host_bigendian == TEP_BIG_ENDIAN); 289 289 return 0; 290 290 } 291 291 292 292 /** 293 293 * tep_set_local_bigendian - set the stored local machine endian order 294 - * @pevent: a handle to the tep_handle 294 + * @tep: a handle to the tep_handle 295 295 * @endian: non zero, if the local host has big endian order 296 296 * 297 297 * This sets the endian order for the local machine. 298 298 */ 299 - void tep_set_local_bigendian(struct tep_handle *pevent, enum tep_endian endian) 299 + void tep_set_local_bigendian(struct tep_handle *tep, enum tep_endian endian) 300 300 { 301 - if (pevent) 302 - pevent->host_bigendian = endian; 301 + if (tep) 302 + tep->host_bigendian = endian; 303 303 } 304 304 305 305 /** 306 306 * tep_is_latency_format - get if the latency output format is configured 307 - * @pevent: a handle to the tep_handle 307 + * @tep: a handle to the tep_handle 308 308 * 309 309 * This returns true if the latency output format is configured 310 - * If @pevent is NULL, false is returned. 310 + * If @tep is NULL, false is returned. 311 311 */ 312 - bool tep_is_latency_format(struct tep_handle *pevent) 312 + bool tep_is_latency_format(struct tep_handle *tep) 313 313 { 314 - if (pevent) 315 - return pevent->latency_format; 314 + if (tep) 315 + return (tep->latency_format); 316 316 return false; 317 317 } 318 318 319 319 /** 320 320 * tep_set_latency_format - set the latency output format 321 - * @pevent: a handle to the tep_handle 321 + * @tep: a handle to the tep_handle 322 322 * @lat: non zero for latency output format 323 323 * 324 324 * This sets the latency output format 325 325 */ 326 - void tep_set_latency_format(struct tep_handle *pevent, int lat) 326 + void tep_set_latency_format(struct tep_handle *tep, int lat) 327 327 { 328 - if (pevent) 329 - pevent->latency_format = lat; 328 + if (tep) 329 + tep->latency_format = lat; 330 330 } 331 331 332 332 /**
+3 -3
tools/lib/traceevent/event-parse-local.h
··· 92 92 void tep_free_event(struct tep_event *event); 93 93 void tep_free_format_field(struct tep_format_field *field); 94 94 95 - unsigned short tep_data2host2(struct tep_handle *pevent, unsigned short data); 96 - unsigned int tep_data2host4(struct tep_handle *pevent, unsigned int data); 97 - unsigned long long tep_data2host8(struct tep_handle *pevent, unsigned long long data); 95 + unsigned short tep_data2host2(struct tep_handle *tep, unsigned short data); 96 + unsigned int tep_data2host4(struct tep_handle *tep, unsigned int data); 97 + unsigned long long tep_data2host8(struct tep_handle *tep, unsigned long long data); 98 98 99 99 #endif /* _PARSE_EVENTS_INT_H */
+225 -227
tools/lib/traceevent/event-parse.c
··· 200 200 201 201 /** 202 202 * tep_is_pid_registered - return if a pid has a cmdline registered 203 - * @pevent: handle for the pevent 203 + * @tep: a handle to the trace event parser context 204 204 * @pid: The pid to check if it has a cmdline registered with. 205 205 * 206 206 * Returns true if the pid has a cmdline mapped to it 207 207 * false otherwise. 208 208 */ 209 - bool tep_is_pid_registered(struct tep_handle *pevent, int pid) 209 + bool tep_is_pid_registered(struct tep_handle *tep, int pid) 210 210 { 211 211 const struct tep_cmdline *comm; 212 212 struct tep_cmdline key; ··· 214 214 if (!pid) 215 215 return true; 216 216 217 - if (!pevent->cmdlines && cmdline_init(pevent)) 217 + if (!tep->cmdlines && cmdline_init(tep)) 218 218 return false; 219 219 220 220 key.pid = pid; 221 221 222 - comm = bsearch(&key, pevent->cmdlines, pevent->cmdline_count, 223 - sizeof(*pevent->cmdlines), cmdline_cmp); 222 + comm = bsearch(&key, tep->cmdlines, tep->cmdline_count, 223 + sizeof(*tep->cmdlines), cmdline_cmp); 224 224 225 225 if (comm) 226 226 return true; ··· 288 288 return 0; 289 289 } 290 290 291 - static int _tep_register_comm(struct tep_handle *pevent, 291 + static int _tep_register_comm(struct tep_handle *tep, 292 292 const char *comm, int pid, bool override) 293 293 { 294 294 struct cmdline_list *item; 295 295 296 - if (pevent->cmdlines) 297 - return add_new_comm(pevent, comm, pid, override); 296 + if (tep->cmdlines) 297 + return add_new_comm(tep, comm, pid, override); 298 298 299 299 item = malloc(sizeof(*item)); 300 300 if (!item) ··· 309 309 return -1; 310 310 } 311 311 item->pid = pid; 312 - item->next = pevent->cmdlist; 312 + item->next = tep->cmdlist; 313 313 314 - pevent->cmdlist = item; 315 - pevent->cmdline_count++; 314 + tep->cmdlist = item; 315 + tep->cmdline_count++; 316 316 317 317 return 0; 318 318 } 319 319 320 320 /** 321 321 * tep_register_comm - register a pid / comm mapping 322 - * @pevent: handle for the pevent 322 + * @tep: a handle to the trace event parser context 323 323 * @comm: the command line to register 324 324 * @pid: the pid to map the command line to 325 325 * ··· 327 327 * a given pid. The comm is duplicated. If a command with the same pid 328 328 * already exist, -1 is returned and errno is set to EEXIST 329 329 */ 330 - int tep_register_comm(struct tep_handle *pevent, const char *comm, int pid) 330 + int tep_register_comm(struct tep_handle *tep, const char *comm, int pid) 331 331 { 332 - return _tep_register_comm(pevent, comm, pid, false); 332 + return _tep_register_comm(tep, comm, pid, false); 333 333 } 334 334 335 335 /** 336 336 * tep_override_comm - register a pid / comm mapping 337 - * @pevent: handle for the pevent 337 + * @tep: a handle to the trace event parser context 338 338 * @comm: the command line to register 339 339 * @pid: the pid to map the command line to 340 340 * ··· 342 342 * a given pid. The comm is duplicated. If a command with the same pid 343 343 * already exist, the command string is udapted with the new one 344 344 */ 345 - int tep_override_comm(struct tep_handle *pevent, const char *comm, int pid) 345 + int tep_override_comm(struct tep_handle *tep, const char *comm, int pid) 346 346 { 347 - if (!pevent->cmdlines && cmdline_init(pevent)) { 347 + if (!tep->cmdlines && cmdline_init(tep)) { 348 348 errno = ENOMEM; 349 349 return -1; 350 350 } 351 - return _tep_register_comm(pevent, comm, pid, true); 351 + return _tep_register_comm(tep, comm, pid, true); 352 352 } 353 353 354 - int tep_register_trace_clock(struct tep_handle *pevent, const char *trace_clock) 354 + int tep_register_trace_clock(struct tep_handle *tep, const char *trace_clock) 355 355 { 356 - pevent->trace_clock = strdup(trace_clock); 357 - if (!pevent->trace_clock) { 356 + tep->trace_clock = strdup(trace_clock); 357 + if (!tep->trace_clock) { 358 358 errno = ENOMEM; 359 359 return -1; 360 360 } ··· 472 472 473 473 /** 474 474 * tep_set_function_resolver - set an alternative function resolver 475 - * @pevent: handle for the pevent 475 + * @tep: a handle to the trace event parser context 476 476 * @resolver: function to be used 477 477 * @priv: resolver function private state. 478 478 * 479 479 * Some tools may have already a way to resolve kernel functions, allow them to 480 - * keep using it instead of duplicating all the entries inside 481 - * pevent->funclist. 480 + * keep using it instead of duplicating all the entries inside tep->funclist. 482 481 */ 483 - int tep_set_function_resolver(struct tep_handle *pevent, 482 + int tep_set_function_resolver(struct tep_handle *tep, 484 483 tep_func_resolver_t *func, void *priv) 485 484 { 486 485 struct func_resolver *resolver = malloc(sizeof(*resolver)); ··· 490 491 resolver->func = func; 491 492 resolver->priv = priv; 492 493 493 - free(pevent->func_resolver); 494 - pevent->func_resolver = resolver; 494 + free(tep->func_resolver); 495 + tep->func_resolver = resolver; 495 496 496 497 return 0; 497 498 } 498 499 499 500 /** 500 501 * tep_reset_function_resolver - reset alternative function resolver 501 - * @pevent: handle for the pevent 502 + * @tep: a handle to the trace event parser context 502 503 * 503 504 * Stop using whatever alternative resolver was set, use the default 504 505 * one instead. 505 506 */ 506 - void tep_reset_function_resolver(struct tep_handle *pevent) 507 + void tep_reset_function_resolver(struct tep_handle *tep) 507 508 { 508 - free(pevent->func_resolver); 509 - pevent->func_resolver = NULL; 509 + free(tep->func_resolver); 510 + tep->func_resolver = NULL; 510 511 } 511 512 512 513 static struct func_map * ··· 530 531 531 532 /** 532 533 * tep_find_function - find a function by a given address 533 - * @pevent: handle for the pevent 534 + * @tep: a handle to the trace event parser context 534 535 * @addr: the address to find the function with 535 536 * 536 537 * Returns a pointer to the function stored that has the given 537 538 * address. Note, the address does not have to be exact, it 538 539 * will select the function that would contain the address. 539 540 */ 540 - const char *tep_find_function(struct tep_handle *pevent, unsigned long long addr) 541 + const char *tep_find_function(struct tep_handle *tep, unsigned long long addr) 541 542 { 542 543 struct func_map *map; 543 544 544 - map = find_func(pevent, addr); 545 + map = find_func(tep, addr); 545 546 if (!map) 546 547 return NULL; 547 548 ··· 550 551 551 552 /** 552 553 * tep_find_function_address - find a function address by a given address 553 - * @pevent: handle for the pevent 554 + * @tep: a handle to the trace event parser context 554 555 * @addr: the address to find the function with 555 556 * 556 557 * Returns the address the function starts at. This can be used in ··· 558 559 * name and the function offset. 559 560 */ 560 561 unsigned long long 561 - tep_find_function_address(struct tep_handle *pevent, unsigned long long addr) 562 + tep_find_function_address(struct tep_handle *tep, unsigned long long addr) 562 563 { 563 564 struct func_map *map; 564 565 565 - map = find_func(pevent, addr); 566 + map = find_func(tep, addr); 566 567 if (!map) 567 568 return 0; 568 569 ··· 571 572 572 573 /** 573 574 * tep_register_function - register a function with a given address 574 - * @pevent: handle for the pevent 575 + * @tep: a handle to the trace event parser context 575 576 * @function: the function name to register 576 577 * @addr: the address the function starts at 577 578 * @mod: the kernel module the function may be in (NULL for none) ··· 579 580 * This registers a function name with an address and module. 580 581 * The @func passed in is duplicated. 581 582 */ 582 - int tep_register_function(struct tep_handle *pevent, char *func, 583 + int tep_register_function(struct tep_handle *tep, char *func, 583 584 unsigned long long addr, char *mod) 584 585 { 585 586 struct func_list *item = malloc(sizeof(*item)); ··· 587 588 if (!item) 588 589 return -1; 589 590 590 - item->next = pevent->funclist; 591 + item->next = tep->funclist; 591 592 item->func = strdup(func); 592 593 if (!item->func) 593 594 goto out_free; ··· 600 601 item->mod = NULL; 601 602 item->addr = addr; 602 603 603 - pevent->funclist = item; 604 - pevent->func_count++; 604 + tep->funclist = item; 605 + tep->func_count++; 605 606 606 607 return 0; 607 608 ··· 616 617 617 618 /** 618 619 * tep_print_funcs - print out the stored functions 619 - * @pevent: handle for the pevent 620 + * @tep: a handle to the trace event parser context 620 621 * 621 622 * This prints out the stored functions. 622 623 */ 623 - void tep_print_funcs(struct tep_handle *pevent) 624 + void tep_print_funcs(struct tep_handle *tep) 624 625 { 625 626 int i; 626 627 627 - if (!pevent->func_map) 628 - func_map_init(pevent); 628 + if (!tep->func_map) 629 + func_map_init(tep); 629 630 630 - for (i = 0; i < (int)pevent->func_count; i++) { 631 + for (i = 0; i < (int)tep->func_count; i++) { 631 632 printf("%016llx %s", 632 - pevent->func_map[i].addr, 633 - pevent->func_map[i].func); 634 - if (pevent->func_map[i].mod) 635 - printf(" [%s]\n", pevent->func_map[i].mod); 633 + tep->func_map[i].addr, 634 + tep->func_map[i].func); 635 + if (tep->func_map[i].mod) 636 + printf(" [%s]\n", tep->func_map[i].mod); 636 637 else 637 638 printf("\n"); 638 639 } ··· 712 713 713 714 /** 714 715 * tep_register_print_string - register a string by its address 715 - * @pevent: handle for the pevent 716 + * @tep: a handle to the trace event parser context 716 717 * @fmt: the string format to register 717 718 * @addr: the address the string was located at 718 719 * 719 720 * This registers a string by the address it was stored in the kernel. 720 721 * The @fmt passed in is duplicated. 721 722 */ 722 - int tep_register_print_string(struct tep_handle *pevent, const char *fmt, 723 + int tep_register_print_string(struct tep_handle *tep, const char *fmt, 723 724 unsigned long long addr) 724 725 { 725 726 struct printk_list *item = malloc(sizeof(*item)); ··· 728 729 if (!item) 729 730 return -1; 730 731 731 - item->next = pevent->printklist; 732 + item->next = tep->printklist; 732 733 item->addr = addr; 733 734 734 735 /* Strip off quotes and '\n' from the end */ ··· 746 747 if (strcmp(p, "\\n") == 0) 747 748 *p = 0; 748 749 749 - pevent->printklist = item; 750 - pevent->printk_count++; 750 + tep->printklist = item; 751 + tep->printk_count++; 751 752 752 753 return 0; 753 754 ··· 759 760 760 761 /** 761 762 * tep_print_printk - print out the stored strings 762 - * @pevent: handle for the pevent 763 + * @tep: a handle to the trace event parser context 763 764 * 764 765 * This prints the string formats that were stored. 765 766 */ 766 - void tep_print_printk(struct tep_handle *pevent) 767 + void tep_print_printk(struct tep_handle *tep) 767 768 { 768 769 int i; 769 770 770 - if (!pevent->printk_map) 771 - printk_map_init(pevent); 771 + if (!tep->printk_map) 772 + printk_map_init(tep); 772 773 773 - for (i = 0; i < (int)pevent->printk_count; i++) { 774 + for (i = 0; i < (int)tep->printk_count; i++) { 774 775 printf("%016llx %s\n", 775 - pevent->printk_map[i].addr, 776 - pevent->printk_map[i].printk); 776 + tep->printk_map[i].addr, 777 + tep->printk_map[i].printk); 777 778 } 778 779 } 779 780 ··· 1183 1184 } 1184 1185 1185 1186 /** 1186 - * tep_read_token - access to utilities to use the pevent parser 1187 + * tep_read_token - access to utilities to use the tep parser 1187 1188 * @tok: The token to return 1188 1189 * 1189 1190 * This will parse tokens from the string given by ··· 3356 3357 3357 3358 /** 3358 3359 * tep_read_number - read a number from data 3359 - * @pevent: handle for the pevent 3360 + * @tep: a handle to the trace event parser context 3360 3361 * @ptr: the raw data 3361 3362 * @size: the size of the data that holds the number 3362 3363 * 3363 3364 * Returns the number (converted to host) from the 3364 3365 * raw data. 3365 3366 */ 3366 - unsigned long long tep_read_number(struct tep_handle *pevent, 3367 + unsigned long long tep_read_number(struct tep_handle *tep, 3367 3368 const void *ptr, int size) 3368 3369 { 3369 3370 unsigned long long val; ··· 3372 3373 case 1: 3373 3374 return *(unsigned char *)ptr; 3374 3375 case 2: 3375 - return tep_data2host2(pevent, *(unsigned short *)ptr); 3376 + return tep_data2host2(tep, *(unsigned short *)ptr); 3376 3377 case 4: 3377 - return tep_data2host4(pevent, *(unsigned int *)ptr); 3378 + return tep_data2host4(tep, *(unsigned int *)ptr); 3378 3379 case 8: 3379 3380 memcpy(&val, (ptr), sizeof(unsigned long long)); 3380 - return tep_data2host8(pevent, val); 3381 + return tep_data2host8(tep, val); 3381 3382 default: 3382 3383 /* BUG! */ 3383 3384 return 0; ··· 3498 3499 3499 3500 /** 3500 3501 * tep_find_event - find an event by given id 3501 - * @pevent: a handle to the pevent 3502 + * @tep: a handle to the trace event parser context 3502 3503 * @id: the id of the event 3503 3504 * 3504 3505 * Returns an event that has a given @id. 3505 3506 */ 3506 - struct tep_event *tep_find_event(struct tep_handle *pevent, int id) 3507 + struct tep_event *tep_find_event(struct tep_handle *tep, int id) 3507 3508 { 3508 3509 struct tep_event **eventptr; 3509 3510 struct tep_event key; 3510 3511 struct tep_event *pkey = &key; 3511 3512 3512 3513 /* Check cache first */ 3513 - if (pevent->last_event && pevent->last_event->id == id) 3514 - return pevent->last_event; 3514 + if (tep->last_event && tep->last_event->id == id) 3515 + return tep->last_event; 3515 3516 3516 3517 key.id = id; 3517 3518 3518 - eventptr = bsearch(&pkey, pevent->events, pevent->nr_events, 3519 - sizeof(*pevent->events), events_id_cmp); 3519 + eventptr = bsearch(&pkey, tep->events, tep->nr_events, 3520 + sizeof(*tep->events), events_id_cmp); 3520 3521 3521 3522 if (eventptr) { 3522 - pevent->last_event = *eventptr; 3523 + tep->last_event = *eventptr; 3523 3524 return *eventptr; 3524 3525 } 3525 3526 ··· 3528 3529 3529 3530 /** 3530 3531 * tep_find_event_by_name - find an event by given name 3531 - * @pevent: a handle to the pevent 3532 + * @tep: a handle to the trace event parser context 3532 3533 * @sys: the system name to search for 3533 3534 * @name: the name of the event to search for 3534 3535 * ··· 3536 3537 * @sys. If @sys is NULL the first event with @name is returned. 3537 3538 */ 3538 3539 struct tep_event * 3539 - tep_find_event_by_name(struct tep_handle *pevent, 3540 + tep_find_event_by_name(struct tep_handle *tep, 3540 3541 const char *sys, const char *name) 3541 3542 { 3542 3543 struct tep_event *event = NULL; 3543 3544 int i; 3544 3545 3545 - if (pevent->last_event && 3546 - strcmp(pevent->last_event->name, name) == 0 && 3547 - (!sys || strcmp(pevent->last_event->system, sys) == 0)) 3548 - return pevent->last_event; 3546 + if (tep->last_event && 3547 + strcmp(tep->last_event->name, name) == 0 && 3548 + (!sys || strcmp(tep->last_event->system, sys) == 0)) 3549 + return tep->last_event; 3549 3550 3550 - for (i = 0; i < pevent->nr_events; i++) { 3551 - event = pevent->events[i]; 3551 + for (i = 0; i < tep->nr_events; i++) { 3552 + event = tep->events[i]; 3552 3553 if (strcmp(event->name, name) == 0) { 3553 3554 if (!sys) 3554 3555 break; ··· 3556 3557 break; 3557 3558 } 3558 3559 } 3559 - if (i == pevent->nr_events) 3560 + if (i == tep->nr_events) 3560 3561 event = NULL; 3561 3562 3562 - pevent->last_event = event; 3563 + tep->last_event = event; 3563 3564 return event; 3564 3565 } 3565 3566 ··· 5172 5173 5173 5174 /** 5174 5175 * tep_data_latency_format - parse the data for the latency format 5175 - * @pevent: a handle to the pevent 5176 + * @tep: a handle to the trace event parser context 5176 5177 * @s: the trace_seq to write to 5177 5178 * @record: the record to read from 5178 5179 * ··· 5180 5181 * need rescheduling, in hard/soft interrupt, preempt count 5181 5182 * and lock depth) and places it into the trace_seq. 5182 5183 */ 5183 - void tep_data_latency_format(struct tep_handle *pevent, 5184 + void tep_data_latency_format(struct tep_handle *tep, 5184 5185 struct trace_seq *s, struct tep_record *record) 5185 5186 { 5186 5187 static int check_lock_depth = 1; ··· 5195 5196 int softirq; 5196 5197 void *data = record->data; 5197 5198 5198 - lat_flags = parse_common_flags(pevent, data); 5199 - pc = parse_common_pc(pevent, data); 5199 + lat_flags = parse_common_flags(tep, data); 5200 + pc = parse_common_pc(tep, data); 5200 5201 /* lock_depth may not always exist */ 5201 5202 if (lock_depth_exists) 5202 - lock_depth = parse_common_lock_depth(pevent, data); 5203 + lock_depth = parse_common_lock_depth(tep, data); 5203 5204 else if (check_lock_depth) { 5204 - lock_depth = parse_common_lock_depth(pevent, data); 5205 + lock_depth = parse_common_lock_depth(tep, data); 5205 5206 if (lock_depth < 0) 5206 5207 check_lock_depth = 0; 5207 5208 else ··· 5210 5211 5211 5212 /* migrate_disable may not always exist */ 5212 5213 if (migrate_disable_exists) 5213 - migrate_disable = parse_common_migrate_disable(pevent, data); 5214 + migrate_disable = parse_common_migrate_disable(tep, data); 5214 5215 else if (check_migrate_disable) { 5215 - migrate_disable = parse_common_migrate_disable(pevent, data); 5216 + migrate_disable = parse_common_migrate_disable(tep, data); 5216 5217 if (migrate_disable < 0) 5217 5218 check_migrate_disable = 0; 5218 5219 else ··· 5255 5256 5256 5257 /** 5257 5258 * tep_data_type - parse out the given event type 5258 - * @pevent: a handle to the pevent 5259 + * @tep: a handle to the trace event parser context 5259 5260 * @rec: the record to read from 5260 5261 * 5261 5262 * This returns the event id from the @rec. 5262 5263 */ 5263 - int tep_data_type(struct tep_handle *pevent, struct tep_record *rec) 5264 + int tep_data_type(struct tep_handle *tep, struct tep_record *rec) 5264 5265 { 5265 - return trace_parse_common_type(pevent, rec->data); 5266 + return trace_parse_common_type(tep, rec->data); 5266 5267 } 5267 5268 5268 5269 /** 5269 5270 * tep_data_pid - parse the PID from record 5270 - * @pevent: a handle to the pevent 5271 + * @tep: a handle to the trace event parser context 5271 5272 * @rec: the record to parse 5272 5273 * 5273 5274 * This returns the PID from a record. 5274 5275 */ 5275 - int tep_data_pid(struct tep_handle *pevent, struct tep_record *rec) 5276 + int tep_data_pid(struct tep_handle *tep, struct tep_record *rec) 5276 5277 { 5277 - return parse_common_pid(pevent, rec->data); 5278 + return parse_common_pid(tep, rec->data); 5278 5279 } 5279 5280 5280 5281 /** 5281 5282 * tep_data_preempt_count - parse the preempt count from the record 5282 - * @pevent: a handle to the pevent 5283 + * @tep: a handle to the trace event parser context 5283 5284 * @rec: the record to parse 5284 5285 * 5285 5286 * This returns the preempt count from a record. 5286 5287 */ 5287 - int tep_data_preempt_count(struct tep_handle *pevent, struct tep_record *rec) 5288 + int tep_data_preempt_count(struct tep_handle *tep, struct tep_record *rec) 5288 5289 { 5289 - return parse_common_pc(pevent, rec->data); 5290 + return parse_common_pc(tep, rec->data); 5290 5291 } 5291 5292 5292 5293 /** 5293 5294 * tep_data_flags - parse the latency flags from the record 5294 - * @pevent: a handle to the pevent 5295 + * @tep: a handle to the trace event parser context 5295 5296 * @rec: the record to parse 5296 5297 * 5297 5298 * This returns the latency flags from a record. 5298 5299 * 5299 5300 * Use trace_flag_type enum for the flags (see event-parse.h). 5300 5301 */ 5301 - int tep_data_flags(struct tep_handle *pevent, struct tep_record *rec) 5302 + int tep_data_flags(struct tep_handle *tep, struct tep_record *rec) 5302 5303 { 5303 - return parse_common_flags(pevent, rec->data); 5304 + return parse_common_flags(tep, rec->data); 5304 5305 } 5305 5306 5306 5307 /** 5307 5308 * tep_data_comm_from_pid - return the command line from PID 5308 - * @pevent: a handle to the pevent 5309 + * @tep: a handle to the trace event parser context 5309 5310 * @pid: the PID of the task to search for 5310 5311 * 5311 5312 * This returns a pointer to the command line that has the given 5312 5313 * @pid. 5313 5314 */ 5314 - const char *tep_data_comm_from_pid(struct tep_handle *pevent, int pid) 5315 + const char *tep_data_comm_from_pid(struct tep_handle *tep, int pid) 5315 5316 { 5316 5317 const char *comm; 5317 5318 5318 - comm = find_cmdline(pevent, pid); 5319 + comm = find_cmdline(tep, pid); 5319 5320 return comm; 5320 5321 } 5321 5322 ··· 5337 5338 5338 5339 /** 5339 5340 * tep_data_pid_from_comm - return the pid from a given comm 5340 - * @pevent: a handle to the pevent 5341 + * @tep: a handle to the trace event parser context 5341 5342 * @comm: the cmdline to find the pid from 5342 5343 * @next: the cmdline structure to find the next comm 5343 5344 * ··· 5348 5349 * next pid. 5349 5350 * Also, it does a linear search, so it may be slow. 5350 5351 */ 5351 - struct tep_cmdline *tep_data_pid_from_comm(struct tep_handle *pevent, const char *comm, 5352 + struct tep_cmdline *tep_data_pid_from_comm(struct tep_handle *tep, const char *comm, 5352 5353 struct tep_cmdline *next) 5353 5354 { 5354 5355 struct tep_cmdline *cmdline; ··· 5357 5358 * If the cmdlines have not been converted yet, then use 5358 5359 * the list. 5359 5360 */ 5360 - if (!pevent->cmdlines) 5361 - return pid_from_cmdlist(pevent, comm, next); 5361 + if (!tep->cmdlines) 5362 + return pid_from_cmdlist(tep, comm, next); 5362 5363 5363 5364 if (next) { 5364 5365 /* 5365 5366 * The next pointer could have been still from 5366 5367 * a previous call before cmdlines were created 5367 5368 */ 5368 - if (next < pevent->cmdlines || 5369 - next >= pevent->cmdlines + pevent->cmdline_count) 5369 + if (next < tep->cmdlines || 5370 + next >= tep->cmdlines + tep->cmdline_count) 5370 5371 next = NULL; 5371 5372 else 5372 5373 cmdline = next++; 5373 5374 } 5374 5375 5375 5376 if (!next) 5376 - cmdline = pevent->cmdlines; 5377 + cmdline = tep->cmdlines; 5377 5378 5378 - while (cmdline < pevent->cmdlines + pevent->cmdline_count) { 5379 + while (cmdline < tep->cmdlines + tep->cmdline_count) { 5379 5380 if (strcmp(cmdline->comm, comm) == 0) 5380 5381 return cmdline; 5381 5382 cmdline++; ··· 5385 5386 5386 5387 /** 5387 5388 * tep_cmdline_pid - return the pid associated to a given cmdline 5389 + * @tep: a handle to the trace event parser context 5388 5390 * @cmdline: The cmdline structure to get the pid from 5389 5391 * 5390 5392 * Returns the pid for a give cmdline. If @cmdline is NULL, then 5391 5393 * -1 is returned. 5392 5394 */ 5393 - int tep_cmdline_pid(struct tep_handle *pevent, struct tep_cmdline *cmdline) 5395 + int tep_cmdline_pid(struct tep_handle *tep, struct tep_cmdline *cmdline) 5394 5396 { 5395 5397 struct cmdline_list *cmdlist = (struct cmdline_list *)cmdline; 5396 5398 ··· 5402 5402 * If cmdlines have not been created yet, or cmdline is 5403 5403 * not part of the array, then treat it as a cmdlist instead. 5404 5404 */ 5405 - if (!pevent->cmdlines || 5406 - cmdline < pevent->cmdlines || 5407 - cmdline >= pevent->cmdlines + pevent->cmdline_count) 5405 + if (!tep->cmdlines || 5406 + cmdline < tep->cmdlines || 5407 + cmdline >= tep->cmdlines + tep->cmdline_count) 5408 5408 return cmdlist->pid; 5409 5409 5410 5410 return cmdline->pid; ··· 5455 5455 5456 5456 /** 5457 5457 * tep_find_event_by_record - return the event from a given record 5458 - * @pevent: a handle to the pevent 5458 + * @tep: a handle to the trace event parser context 5459 5459 * @record: The record to get the event from 5460 5460 * 5461 5461 * Returns the associated event for a given record, or NULL if non is 5462 5462 * is found. 5463 5463 */ 5464 5464 struct tep_event * 5465 - tep_find_event_by_record(struct tep_handle *pevent, struct tep_record *record) 5465 + tep_find_event_by_record(struct tep_handle *tep, struct tep_record *record) 5466 5466 { 5467 5467 int type; 5468 5468 ··· 5471 5471 return NULL; 5472 5472 } 5473 5473 5474 - type = trace_parse_common_type(pevent, record->data); 5474 + type = trace_parse_common_type(tep, record->data); 5475 5475 5476 - return tep_find_event(pevent, type); 5476 + return tep_find_event(tep, type); 5477 5477 } 5478 5478 5479 5479 /** 5480 5480 * tep_print_event_task - Write the event task comm, pid and CPU 5481 - * @pevent: a handle to the pevent 5481 + * @tep: a handle to the trace event parser context 5482 5482 * @s: the trace_seq to write to 5483 5483 * @event: the handle to the record's event 5484 5484 * @record: The record to get the event from 5485 5485 * 5486 5486 * Writes the tasks comm, pid and CPU to @s. 5487 5487 */ 5488 - void tep_print_event_task(struct tep_handle *pevent, struct trace_seq *s, 5488 + void tep_print_event_task(struct tep_handle *tep, struct trace_seq *s, 5489 5489 struct tep_event *event, 5490 5490 struct tep_record *record) 5491 5491 { ··· 5493 5493 const char *comm; 5494 5494 int pid; 5495 5495 5496 - pid = parse_common_pid(pevent, data); 5497 - comm = find_cmdline(pevent, pid); 5496 + pid = parse_common_pid(tep, data); 5497 + comm = find_cmdline(tep, pid); 5498 5498 5499 - if (pevent->latency_format) { 5500 - trace_seq_printf(s, "%8.8s-%-5d %3d", 5501 - comm, pid, record->cpu); 5502 - } else 5499 + if (tep->latency_format) 5500 + trace_seq_printf(s, "%8.8s-%-5d %3d", comm, pid, record->cpu); 5501 + else 5503 5502 trace_seq_printf(s, "%16s-%-5d [%03d]", comm, pid, record->cpu); 5504 5503 } 5505 5504 5506 5505 /** 5507 5506 * tep_print_event_time - Write the event timestamp 5508 - * @pevent: a handle to the pevent 5507 + * @tep: a handle to the trace event parser context 5509 5508 * @s: the trace_seq to write to 5510 5509 * @event: the handle to the record's event 5511 5510 * @record: The record to get the event from 5512 - * @use_trace_clock: Set to parse according to the @pevent->trace_clock 5511 + * @use_trace_clock: Set to parse according to the @tep->trace_clock 5513 5512 * 5514 5513 * Writes the timestamp of the record into @s. 5515 5514 */ 5516 - void tep_print_event_time(struct tep_handle *pevent, struct trace_seq *s, 5515 + void tep_print_event_time(struct tep_handle *tep, struct trace_seq *s, 5517 5516 struct tep_event *event, 5518 5517 struct tep_record *record, 5519 5518 bool use_trace_clock) ··· 5523 5524 int p; 5524 5525 bool use_usec_format; 5525 5526 5526 - use_usec_format = is_timestamp_in_us(pevent->trace_clock, 5527 - use_trace_clock); 5527 + use_usec_format = is_timestamp_in_us(tep->trace_clock, use_trace_clock); 5528 5528 if (use_usec_format) { 5529 5529 secs = record->ts / NSEC_PER_SEC; 5530 5530 nsecs = record->ts - secs * NSEC_PER_SEC; 5531 5531 } 5532 5532 5533 - if (pevent->latency_format) { 5534 - tep_data_latency_format(pevent, s, record); 5533 + if (tep->latency_format) { 5534 + tep_data_latency_format(tep, s, record); 5535 5535 } 5536 5536 5537 5537 if (use_usec_format) { 5538 - if (pevent->flags & TEP_NSEC_OUTPUT) { 5538 + if (tep->flags & TEP_NSEC_OUTPUT) { 5539 5539 usecs = nsecs; 5540 5540 p = 9; 5541 5541 } else { ··· 5554 5556 5555 5557 /** 5556 5558 * tep_print_event_data - Write the event data section 5557 - * @pevent: a handle to the pevent 5559 + * @tep: a handle to the trace event parser context 5558 5560 * @s: the trace_seq to write to 5559 5561 * @event: the handle to the record's event 5560 5562 * @record: The record to get the event from 5561 5563 * 5562 5564 * Writes the parsing of the record's data to @s. 5563 5565 */ 5564 - void tep_print_event_data(struct tep_handle *pevent, struct trace_seq *s, 5566 + void tep_print_event_data(struct tep_handle *tep, struct trace_seq *s, 5565 5567 struct tep_event *event, 5566 5568 struct tep_record *record) 5567 5569 { ··· 5578 5580 tep_event_info(s, event, record); 5579 5581 } 5580 5582 5581 - void tep_print_event(struct tep_handle *pevent, struct trace_seq *s, 5583 + void tep_print_event(struct tep_handle *tep, struct trace_seq *s, 5582 5584 struct tep_record *record, bool use_trace_clock) 5583 5585 { 5584 5586 struct tep_event *event; 5585 5587 5586 - event = tep_find_event_by_record(pevent, record); 5588 + event = tep_find_event_by_record(tep, record); 5587 5589 if (!event) { 5588 5590 int i; 5589 - int type = trace_parse_common_type(pevent, record->data); 5591 + int type = trace_parse_common_type(tep, record->data); 5590 5592 5591 5593 do_warning("ug! no event found for type %d", type); 5592 5594 trace_seq_printf(s, "[UNKNOWN TYPE %d]", type); ··· 5596 5598 return; 5597 5599 } 5598 5600 5599 - tep_print_event_task(pevent, s, event, record); 5600 - tep_print_event_time(pevent, s, event, record, use_trace_clock); 5601 - tep_print_event_data(pevent, s, event, record); 5601 + tep_print_event_task(tep, s, event, record); 5602 + tep_print_event_time(tep, s, event, record, use_trace_clock); 5603 + tep_print_event_data(tep, s, event, record); 5602 5604 } 5603 5605 5604 5606 static int events_id_cmp(const void *a, const void *b) ··· 6015 6017 6016 6018 /** 6017 6019 * tep_parse_header_page - parse the data stored in the header page 6018 - * @pevent: the handle to the pevent 6020 + * @tep: a handle to the trace event parser context 6019 6021 * @buf: the buffer storing the header page format string 6020 6022 * @size: the size of @buf 6021 6023 * @long_size: the long size to use if there is no header ··· 6025 6027 * 6026 6028 * /sys/kernel/debug/tracing/events/header_page 6027 6029 */ 6028 - int tep_parse_header_page(struct tep_handle *pevent, char *buf, unsigned long size, 6030 + int tep_parse_header_page(struct tep_handle *tep, char *buf, unsigned long size, 6029 6031 int long_size) 6030 6032 { 6031 6033 int ignore; ··· 6035 6037 * Old kernels did not have header page info. 6036 6038 * Sorry but we just use what we find here in user space. 6037 6039 */ 6038 - pevent->header_page_ts_size = sizeof(long long); 6039 - pevent->header_page_size_size = long_size; 6040 - pevent->header_page_data_offset = sizeof(long long) + long_size; 6041 - pevent->old_format = 1; 6040 + tep->header_page_ts_size = sizeof(long long); 6041 + tep->header_page_size_size = long_size; 6042 + tep->header_page_data_offset = sizeof(long long) + long_size; 6043 + tep->old_format = 1; 6042 6044 return -1; 6043 6045 } 6044 6046 init_input_buf(buf, size); 6045 6047 6046 - parse_header_field("timestamp", &pevent->header_page_ts_offset, 6047 - &pevent->header_page_ts_size, 1); 6048 - parse_header_field("commit", &pevent->header_page_size_offset, 6049 - &pevent->header_page_size_size, 1); 6050 - parse_header_field("overwrite", &pevent->header_page_overwrite, 6048 + parse_header_field("timestamp", &tep->header_page_ts_offset, 6049 + &tep->header_page_ts_size, 1); 6050 + parse_header_field("commit", &tep->header_page_size_offset, 6051 + &tep->header_page_size_size, 1); 6052 + parse_header_field("overwrite", &tep->header_page_overwrite, 6051 6053 &ignore, 0); 6052 - parse_header_field("data", &pevent->header_page_data_offset, 6053 - &pevent->header_page_data_size, 1); 6054 + parse_header_field("data", &tep->header_page_data_offset, 6055 + &tep->header_page_data_size, 1); 6054 6056 6055 6057 return 0; 6056 6058 } ··· 6256 6258 6257 6259 /** 6258 6260 * tep_parse_format - parse the event format 6259 - * @pevent: the handle to the pevent 6261 + * @tep: a handle to the trace event parser context 6260 6262 * @eventp: returned format 6261 6263 * @buf: the buffer storing the event format string 6262 6264 * @size: the size of @buf ··· 6269 6271 * 6270 6272 * /sys/kernel/debug/tracing/events/.../.../format 6271 6273 */ 6272 - enum tep_errno tep_parse_format(struct tep_handle *pevent, 6274 + enum tep_errno tep_parse_format(struct tep_handle *tep, 6273 6275 struct tep_event **eventp, 6274 6276 const char *buf, 6275 6277 unsigned long size, const char *sys) 6276 6278 { 6277 - return __parse_event(pevent, eventp, buf, size, sys); 6279 + return __parse_event(tep, eventp, buf, size, sys); 6278 6280 } 6279 6281 6280 6282 /** 6281 6283 * tep_parse_event - parse the event format 6282 - * @pevent: the handle to the pevent 6284 + * @tep: a handle to the trace event parser context 6283 6285 * @buf: the buffer storing the event format string 6284 6286 * @size: the size of @buf 6285 6287 * @sys: the system the event belongs to ··· 6291 6293 * 6292 6294 * /sys/kernel/debug/tracing/events/.../.../format 6293 6295 */ 6294 - enum tep_errno tep_parse_event(struct tep_handle *pevent, const char *buf, 6296 + enum tep_errno tep_parse_event(struct tep_handle *tep, const char *buf, 6295 6297 unsigned long size, const char *sys) 6296 6298 { 6297 6299 struct tep_event *event = NULL; 6298 - return __parse_event(pevent, &event, buf, size, sys); 6300 + return __parse_event(tep, &event, buf, size, sys); 6299 6301 } 6300 6302 6301 6303 int get_field_val(struct trace_seq *s, struct tep_format_field *field, ··· 6535 6537 6536 6538 /** 6537 6539 * tep_register_print_function - register a helper function 6538 - * @pevent: the handle to the pevent 6540 + * @tep: a handle to the trace event parser context 6539 6541 * @func: the function to process the helper function 6540 6542 * @ret_type: the return type of the helper function 6541 6543 * @name: the name of the helper function ··· 6548 6550 * The @parameters is a variable list of tep_func_arg_type enums that 6549 6551 * must end with TEP_FUNC_ARG_VOID. 6550 6552 */ 6551 - int tep_register_print_function(struct tep_handle *pevent, 6553 + int tep_register_print_function(struct tep_handle *tep, 6552 6554 tep_func_handler func, 6553 6555 enum tep_func_arg_type ret_type, 6554 6556 char *name, ...) ··· 6560 6562 va_list ap; 6561 6563 int ret; 6562 6564 6563 - func_handle = find_func_handler(pevent, name); 6565 + func_handle = find_func_handler(tep, name); 6564 6566 if (func_handle) { 6565 6567 /* 6566 6568 * This is most like caused by the users own ··· 6568 6570 * system defaults. 6569 6571 */ 6570 6572 pr_stat("override of function helper '%s'", name); 6571 - remove_func_handler(pevent, name); 6573 + remove_func_handler(tep, name); 6572 6574 } 6573 6575 6574 6576 func_handle = calloc(1, sizeof(*func_handle)); ··· 6615 6617 } 6616 6618 va_end(ap); 6617 6619 6618 - func_handle->next = pevent->func_handlers; 6619 - pevent->func_handlers = func_handle; 6620 + func_handle->next = tep->func_handlers; 6621 + tep->func_handlers = func_handle; 6620 6622 6621 6623 return 0; 6622 6624 out_free: ··· 6627 6629 6628 6630 /** 6629 6631 * tep_unregister_print_function - unregister a helper function 6630 - * @pevent: the handle to the pevent 6632 + * @tep: a handle to the trace event parser context 6631 6633 * @func: the function to process the helper function 6632 6634 * @name: the name of the helper function 6633 6635 * ··· 6635 6637 * 6636 6638 * Returns 0 if the handler was removed successully, -1 otherwise. 6637 6639 */ 6638 - int tep_unregister_print_function(struct tep_handle *pevent, 6640 + int tep_unregister_print_function(struct tep_handle *tep, 6639 6641 tep_func_handler func, char *name) 6640 6642 { 6641 6643 struct tep_function_handler *func_handle; 6642 6644 6643 - func_handle = find_func_handler(pevent, name); 6645 + func_handle = find_func_handler(tep, name); 6644 6646 if (func_handle && func_handle->func == func) { 6645 - remove_func_handler(pevent, name); 6647 + remove_func_handler(tep, name); 6646 6648 return 0; 6647 6649 } 6648 6650 return -1; ··· 6673 6675 6674 6676 /** 6675 6677 * tep_register_event_handler - register a way to parse an event 6676 - * @pevent: the handle to the pevent 6678 + * @tep: a handle to the trace event parser context 6677 6679 * @id: the id of the event to register 6678 6680 * @sys_name: the system name the event belongs to 6679 6681 * @event_name: the name of the event ··· 6694 6696 * negative TEP_ERRNO_... in case of an error 6695 6697 * 6696 6698 */ 6697 - int tep_register_event_handler(struct tep_handle *pevent, int id, 6699 + int tep_register_event_handler(struct tep_handle *tep, int id, 6698 6700 const char *sys_name, const char *event_name, 6699 6701 tep_event_handler_func func, void *context) 6700 6702 { 6701 6703 struct tep_event *event; 6702 6704 struct event_handler *handle; 6703 6705 6704 - event = search_event(pevent, id, sys_name, event_name); 6706 + event = search_event(tep, id, sys_name, event_name); 6705 6707 if (event == NULL) 6706 6708 goto not_found; 6707 6709 ··· 6736 6738 } 6737 6739 6738 6740 handle->func = func; 6739 - handle->next = pevent->handlers; 6740 - pevent->handlers = handle; 6741 + handle->next = tep->handlers; 6742 + tep->handlers = handle; 6741 6743 handle->context = context; 6742 6744 6743 6745 return TEP_REGISTER_SUCCESS; ··· 6764 6766 6765 6767 /** 6766 6768 * tep_unregister_event_handler - unregister an existing event handler 6767 - * @pevent: the handle to the pevent 6769 + * @tep: a handle to the trace event parser context 6768 6770 * @id: the id of the event to unregister 6769 6771 * @sys_name: the system name the handler belongs to 6770 6772 * @event_name: the name of the event handler ··· 6778 6780 * 6779 6781 * Returns 0 if handler was removed successfully, -1 if event was not found. 6780 6782 */ 6781 - int tep_unregister_event_handler(struct tep_handle *pevent, int id, 6783 + int tep_unregister_event_handler(struct tep_handle *tep, int id, 6782 6784 const char *sys_name, const char *event_name, 6783 6785 tep_event_handler_func func, void *context) 6784 6786 { ··· 6786 6788 struct event_handler *handle; 6787 6789 struct event_handler **next; 6788 6790 6789 - event = search_event(pevent, id, sys_name, event_name); 6791 + event = search_event(tep, id, sys_name, event_name); 6790 6792 if (event == NULL) 6791 6793 goto not_found; 6792 6794 ··· 6800 6802 } 6801 6803 6802 6804 not_found: 6803 - for (next = &pevent->handlers; *next; next = &(*next)->next) { 6805 + for (next = &tep->handlers; *next; next = &(*next)->next) { 6804 6806 handle = *next; 6805 6807 if (handle_matches(handle, id, sys_name, event_name, 6806 6808 func, context)) ··· 6817 6819 } 6818 6820 6819 6821 /** 6820 - * tep_alloc - create a pevent handle 6822 + * tep_alloc - create a tep handle 6821 6823 */ 6822 6824 struct tep_handle *tep_alloc(void) 6823 6825 { ··· 6831 6833 return pevent; 6832 6834 } 6833 6835 6834 - void tep_ref(struct tep_handle *pevent) 6836 + void tep_ref(struct tep_handle *tep) 6835 6837 { 6836 - pevent->ref_count++; 6838 + tep->ref_count++; 6837 6839 } 6838 6840 6839 6841 int tep_get_ref(struct tep_handle *tep) ··· 6883 6885 } 6884 6886 6885 6887 /** 6886 - * tep_free - free a pevent handle 6887 - * @pevent: the pevent handle to free 6888 + * tep_free - free a tep handle 6889 + * @tep: the tep handle to free 6888 6890 */ 6889 - void tep_free(struct tep_handle *pevent) 6891 + void tep_free(struct tep_handle *tep) 6890 6892 { 6891 6893 struct cmdline_list *cmdlist, *cmdnext; 6892 6894 struct func_list *funclist, *funcnext; ··· 6895 6897 struct event_handler *handle; 6896 6898 int i; 6897 6899 6898 - if (!pevent) 6900 + if (!tep) 6899 6901 return; 6900 6902 6901 - cmdlist = pevent->cmdlist; 6902 - funclist = pevent->funclist; 6903 - printklist = pevent->printklist; 6903 + cmdlist = tep->cmdlist; 6904 + funclist = tep->funclist; 6905 + printklist = tep->printklist; 6904 6906 6905 - pevent->ref_count--; 6906 - if (pevent->ref_count) 6907 + tep->ref_count--; 6908 + if (tep->ref_count) 6907 6909 return; 6908 6910 6909 - if (pevent->cmdlines) { 6910 - for (i = 0; i < pevent->cmdline_count; i++) 6911 - free(pevent->cmdlines[i].comm); 6912 - free(pevent->cmdlines); 6911 + if (tep->cmdlines) { 6912 + for (i = 0; i < tep->cmdline_count; i++) 6913 + free(tep->cmdlines[i].comm); 6914 + free(tep->cmdlines); 6913 6915 } 6914 6916 6915 6917 while (cmdlist) { ··· 6919 6921 cmdlist = cmdnext; 6920 6922 } 6921 6923 6922 - if (pevent->func_map) { 6923 - for (i = 0; i < (int)pevent->func_count; i++) { 6924 - free(pevent->func_map[i].func); 6925 - free(pevent->func_map[i].mod); 6924 + if (tep->func_map) { 6925 + for (i = 0; i < (int)tep->func_count; i++) { 6926 + free(tep->func_map[i].func); 6927 + free(tep->func_map[i].mod); 6926 6928 } 6927 - free(pevent->func_map); 6929 + free(tep->func_map); 6928 6930 } 6929 6931 6930 6932 while (funclist) { ··· 6935 6937 funclist = funcnext; 6936 6938 } 6937 6939 6938 - while (pevent->func_handlers) { 6939 - func_handler = pevent->func_handlers; 6940 - pevent->func_handlers = func_handler->next; 6940 + while (tep->func_handlers) { 6941 + func_handler = tep->func_handlers; 6942 + tep->func_handlers = func_handler->next; 6941 6943 free_func_handle(func_handler); 6942 6944 } 6943 6945 6944 - if (pevent->printk_map) { 6945 - for (i = 0; i < (int)pevent->printk_count; i++) 6946 - free(pevent->printk_map[i].printk); 6947 - free(pevent->printk_map); 6946 + if (tep->printk_map) { 6947 + for (i = 0; i < (int)tep->printk_count; i++) 6948 + free(tep->printk_map[i].printk); 6949 + free(tep->printk_map); 6948 6950 } 6949 6951 6950 6952 while (printklist) { ··· 6954 6956 printklist = printknext; 6955 6957 } 6956 6958 6957 - for (i = 0; i < pevent->nr_events; i++) 6958 - tep_free_event(pevent->events[i]); 6959 + for (i = 0; i < tep->nr_events; i++) 6960 + tep_free_event(tep->events[i]); 6959 6961 6960 - while (pevent->handlers) { 6961 - handle = pevent->handlers; 6962 - pevent->handlers = handle->next; 6962 + while (tep->handlers) { 6963 + handle = tep->handlers; 6964 + tep->handlers = handle->next; 6963 6965 free_handler(handle); 6964 6966 } 6965 6967 6966 - free(pevent->trace_clock); 6967 - free(pevent->events); 6968 - free(pevent->sort_events); 6969 - free(pevent->func_resolver); 6968 + free(tep->trace_clock); 6969 + free(tep->events); 6970 + free(tep->sort_events); 6971 + free(tep->func_resolver); 6970 6972 6971 - free(pevent); 6973 + free(tep); 6972 6974 } 6973 6975 6974 - void tep_unref(struct tep_handle *pevent) 6976 + void tep_unref(struct tep_handle *tep) 6975 6977 { 6976 - tep_free(pevent); 6978 + tep_free(tep); 6977 6979 }
+61 -62
tools/lib/traceevent/event-parse.h
··· 64 64 struct tep_event *event, 65 65 void *context); 66 66 67 - typedef int (*tep_plugin_load_func)(struct tep_handle *pevent); 68 - typedef int (*tep_plugin_unload_func)(struct tep_handle *pevent); 67 + typedef int (*tep_plugin_load_func)(struct tep_handle *tep); 68 + typedef int (*tep_plugin_unload_func)(struct tep_handle *tep); 69 69 70 70 struct tep_plugin_option { 71 71 struct tep_plugin_option *next; ··· 85 85 * TEP_PLUGIN_LOADER: (required) 86 86 * The function name to initialized the plugin. 87 87 * 88 - * int TEP_PLUGIN_LOADER(struct tep_handle *pevent) 88 + * int TEP_PLUGIN_LOADER(struct tep_handle *tep) 89 89 * 90 90 * TEP_PLUGIN_UNLOADER: (optional) 91 91 * The function called just before unloading 92 92 * 93 - * int TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) 93 + * int TEP_PLUGIN_UNLOADER(struct tep_handle *tep) 94 94 * 95 95 * TEP_PLUGIN_OPTIONS: (optional) 96 96 * Plugin options that can be set before loading ··· 393 393 394 394 #define INVALID_PLUGIN_LIST_OPTION ((char **)((unsigned long)-1)) 395 395 396 - struct tep_plugin_list *tep_load_plugins(struct tep_handle *pevent); 396 + struct tep_plugin_list *tep_load_plugins(struct tep_handle *tep); 397 397 void tep_unload_plugins(struct tep_plugin_list *plugin_list, 398 - struct tep_handle *pevent); 398 + struct tep_handle *tep); 399 399 char **tep_plugin_list_options(void); 400 400 void tep_plugin_free_options_list(char **list); 401 401 int tep_plugin_add_options(const char *name, ··· 410 410 unsigned long long *addrp, char **modp); 411 411 void tep_set_flag(struct tep_handle *tep, int flag); 412 412 void tep_clear_flag(struct tep_handle *tep, enum tep_flag flag); 413 - bool tep_check_flags(struct tep_handle *tep, enum tep_flag flags); 413 + bool tep_test_flag(struct tep_handle *tep, enum tep_flag flags); 414 414 415 415 static inline int tep_is_bigendian(void) 416 416 { ··· 430 430 TRACE_FLAG_SOFTIRQ = 0x10, 431 431 }; 432 432 433 - int tep_set_function_resolver(struct tep_handle *pevent, 433 + int tep_set_function_resolver(struct tep_handle *tep, 434 434 tep_func_resolver_t *func, void *priv); 435 - void tep_reset_function_resolver(struct tep_handle *pevent); 436 - int tep_register_comm(struct tep_handle *pevent, const char *comm, int pid); 437 - int tep_override_comm(struct tep_handle *pevent, const char *comm, int pid); 438 - int tep_register_trace_clock(struct tep_handle *pevent, const char *trace_clock); 439 - int tep_register_function(struct tep_handle *pevent, char *name, 435 + void tep_reset_function_resolver(struct tep_handle *tep); 436 + int tep_register_comm(struct tep_handle *tep, const char *comm, int pid); 437 + int tep_override_comm(struct tep_handle *tep, const char *comm, int pid); 438 + int tep_register_trace_clock(struct tep_handle *tep, const char *trace_clock); 439 + int tep_register_function(struct tep_handle *tep, char *name, 440 440 unsigned long long addr, char *mod); 441 - int tep_register_print_string(struct tep_handle *pevent, const char *fmt, 441 + int tep_register_print_string(struct tep_handle *tep, const char *fmt, 442 442 unsigned long long addr); 443 - bool tep_is_pid_registered(struct tep_handle *pevent, int pid); 443 + bool tep_is_pid_registered(struct tep_handle *tep, int pid); 444 444 445 - void tep_print_event_task(struct tep_handle *pevent, struct trace_seq *s, 445 + void tep_print_event_task(struct tep_handle *tep, struct trace_seq *s, 446 446 struct tep_event *event, 447 447 struct tep_record *record); 448 - void tep_print_event_time(struct tep_handle *pevent, struct trace_seq *s, 448 + void tep_print_event_time(struct tep_handle *tep, struct trace_seq *s, 449 449 struct tep_event *event, 450 450 struct tep_record *record, 451 451 bool use_trace_clock); 452 - void tep_print_event_data(struct tep_handle *pevent, struct trace_seq *s, 452 + void tep_print_event_data(struct tep_handle *tep, struct trace_seq *s, 453 453 struct tep_event *event, 454 454 struct tep_record *record); 455 - void tep_print_event(struct tep_handle *pevent, struct trace_seq *s, 455 + void tep_print_event(struct tep_handle *tep, struct trace_seq *s, 456 456 struct tep_record *record, bool use_trace_clock); 457 457 458 - int tep_parse_header_page(struct tep_handle *pevent, char *buf, unsigned long size, 458 + int tep_parse_header_page(struct tep_handle *tep, char *buf, unsigned long size, 459 459 int long_size); 460 460 461 - enum tep_errno tep_parse_event(struct tep_handle *pevent, const char *buf, 461 + enum tep_errno tep_parse_event(struct tep_handle *tep, const char *buf, 462 462 unsigned long size, const char *sys); 463 - enum tep_errno tep_parse_format(struct tep_handle *pevent, 463 + enum tep_errno tep_parse_format(struct tep_handle *tep, 464 464 struct tep_event **eventp, 465 465 const char *buf, 466 466 unsigned long size, const char *sys); ··· 492 492 TEP_REGISTER_SUCCESS_OVERWRITE, 493 493 }; 494 494 495 - int tep_register_event_handler(struct tep_handle *pevent, int id, 495 + int tep_register_event_handler(struct tep_handle *tep, int id, 496 496 const char *sys_name, const char *event_name, 497 497 tep_event_handler_func func, void *context); 498 - int tep_unregister_event_handler(struct tep_handle *pevent, int id, 498 + int tep_unregister_event_handler(struct tep_handle *tep, int id, 499 499 const char *sys_name, const char *event_name, 500 500 tep_event_handler_func func, void *context); 501 - int tep_register_print_function(struct tep_handle *pevent, 501 + int tep_register_print_function(struct tep_handle *tep, 502 502 tep_func_handler func, 503 503 enum tep_func_arg_type ret_type, 504 504 char *name, ...); 505 - int tep_unregister_print_function(struct tep_handle *pevent, 505 + int tep_unregister_print_function(struct tep_handle *tep, 506 506 tep_func_handler func, char *name); 507 507 508 508 struct tep_format_field *tep_find_common_field(struct tep_event *event, const char *name); 509 509 struct tep_format_field *tep_find_field(struct tep_event *event, const char *name); 510 510 struct tep_format_field *tep_find_any_field(struct tep_event *event, const char *name); 511 511 512 - const char *tep_find_function(struct tep_handle *pevent, unsigned long long addr); 512 + const char *tep_find_function(struct tep_handle *tep, unsigned long long addr); 513 513 unsigned long long 514 - tep_find_function_address(struct tep_handle *pevent, unsigned long long addr); 515 - unsigned long long tep_read_number(struct tep_handle *pevent, const void *ptr, int size); 514 + tep_find_function_address(struct tep_handle *tep, unsigned long long addr); 515 + unsigned long long tep_read_number(struct tep_handle *tep, const void *ptr, int size); 516 516 int tep_read_number_field(struct tep_format_field *field, const void *data, 517 517 unsigned long long *value); 518 518 519 519 struct tep_event *tep_get_first_event(struct tep_handle *tep); 520 520 int tep_get_events_count(struct tep_handle *tep); 521 - struct tep_event *tep_find_event(struct tep_handle *pevent, int id); 521 + struct tep_event *tep_find_event(struct tep_handle *tep, int id); 522 522 523 523 struct tep_event * 524 - tep_find_event_by_name(struct tep_handle *pevent, const char *sys, const char *name); 524 + tep_find_event_by_name(struct tep_handle *tep, const char *sys, const char *name); 525 525 struct tep_event * 526 - tep_find_event_by_record(struct tep_handle *pevent, struct tep_record *record); 526 + tep_find_event_by_record(struct tep_handle *tep, struct tep_record *record); 527 527 528 - void tep_data_latency_format(struct tep_handle *pevent, 528 + void tep_data_latency_format(struct tep_handle *tep, 529 529 struct trace_seq *s, struct tep_record *record); 530 - int tep_data_type(struct tep_handle *pevent, struct tep_record *rec); 531 - int tep_data_pid(struct tep_handle *pevent, struct tep_record *rec); 532 - int tep_data_preempt_count(struct tep_handle *pevent, struct tep_record *rec); 533 - int tep_data_flags(struct tep_handle *pevent, struct tep_record *rec); 534 - const char *tep_data_comm_from_pid(struct tep_handle *pevent, int pid); 530 + int tep_data_type(struct tep_handle *tep, struct tep_record *rec); 531 + int tep_data_pid(struct tep_handle *tep, struct tep_record *rec); 532 + int tep_data_preempt_count(struct tep_handle *tep, struct tep_record *rec); 533 + int tep_data_flags(struct tep_handle *tep, struct tep_record *rec); 534 + const char *tep_data_comm_from_pid(struct tep_handle *tep, int pid); 535 535 struct tep_cmdline; 536 - struct tep_cmdline *tep_data_pid_from_comm(struct tep_handle *pevent, const char *comm, 536 + struct tep_cmdline *tep_data_pid_from_comm(struct tep_handle *tep, const char *comm, 537 537 struct tep_cmdline *next); 538 - int tep_cmdline_pid(struct tep_handle *pevent, struct tep_cmdline *cmdline); 538 + int tep_cmdline_pid(struct tep_handle *tep, struct tep_cmdline *cmdline); 539 539 540 540 void tep_print_field(struct trace_seq *s, void *data, 541 541 struct tep_format_field *field); ··· 543 543 int size __maybe_unused, struct tep_event *event); 544 544 void tep_event_info(struct trace_seq *s, struct tep_event *event, 545 545 struct tep_record *record); 546 - int tep_strerror(struct tep_handle *pevent, enum tep_errno errnum, 546 + int tep_strerror(struct tep_handle *tep, enum tep_errno errnum, 547 547 char *buf, size_t buflen); 548 548 549 - struct tep_event **tep_list_events(struct tep_handle *tep, 550 - enum tep_event_sort_type); 549 + struct tep_event **tep_list_events(struct tep_handle *tep, enum tep_event_sort_type); 551 550 struct tep_event **tep_list_events_copy(struct tep_handle *tep, 552 551 enum tep_event_sort_type); 553 552 struct tep_format_field **tep_event_common_fields(struct tep_event *event); ··· 556 557 TEP_LITTLE_ENDIAN = 0, 557 558 TEP_BIG_ENDIAN 558 559 }; 559 - int tep_get_cpus(struct tep_handle *pevent); 560 - void tep_set_cpus(struct tep_handle *pevent, int cpus); 561 - int tep_get_long_size(struct tep_handle *pevent); 562 - void tep_set_long_size(struct tep_handle *pevent, int long_size); 563 - int tep_get_page_size(struct tep_handle *pevent); 564 - void tep_set_page_size(struct tep_handle *pevent, int _page_size); 565 - bool tep_is_file_bigendian(struct tep_handle *pevent); 566 - void tep_set_file_bigendian(struct tep_handle *pevent, enum tep_endian endian); 567 - bool tep_is_local_bigendian(struct tep_handle *pevent); 568 - void tep_set_local_bigendian(struct tep_handle *pevent, enum tep_endian endian); 569 - bool tep_is_latency_format(struct tep_handle *pevent); 570 - void tep_set_latency_format(struct tep_handle *pevent, int lat); 571 - int tep_get_header_page_size(struct tep_handle *pevent); 560 + int tep_get_cpus(struct tep_handle *tep); 561 + void tep_set_cpus(struct tep_handle *tep, int cpus); 562 + int tep_get_long_size(struct tep_handle *tep); 563 + void tep_set_long_size(struct tep_handle *tep, int long_size); 564 + int tep_get_page_size(struct tep_handle *tep); 565 + void tep_set_page_size(struct tep_handle *tep, int _page_size); 566 + bool tep_is_file_bigendian(struct tep_handle *tep); 567 + void tep_set_file_bigendian(struct tep_handle *tep, enum tep_endian endian); 568 + bool tep_is_local_bigendian(struct tep_handle *tep); 569 + void tep_set_local_bigendian(struct tep_handle *tep, enum tep_endian endian); 570 + bool tep_is_latency_format(struct tep_handle *tep); 571 + void tep_set_latency_format(struct tep_handle *tep, int lat); 572 + int tep_get_header_page_size(struct tep_handle *tep); 572 573 int tep_get_header_timestamp_size(struct tep_handle *tep); 573 574 bool tep_is_old_format(struct tep_handle *tep); 574 575 void tep_set_print_raw(struct tep_handle *tep, int print_raw); 575 576 void tep_set_test_filters(struct tep_handle *tep, int test_filters); 576 577 577 578 struct tep_handle *tep_alloc(void); 578 - void tep_free(struct tep_handle *pevent); 579 - void tep_ref(struct tep_handle *pevent); 580 - void tep_unref(struct tep_handle *pevent); 579 + void tep_free(struct tep_handle *tep); 580 + void tep_ref(struct tep_handle *tep); 581 + void tep_unref(struct tep_handle *tep); 581 582 int tep_get_ref(struct tep_handle *tep); 582 583 583 584 /* access to the internal parser */ ··· 589 590 unsigned long long tep_get_input_buf_ptr(void); 590 591 591 592 /* for debugging */ 592 - void tep_print_funcs(struct tep_handle *pevent); 593 - void tep_print_printk(struct tep_handle *pevent); 593 + void tep_print_funcs(struct tep_handle *tep); 594 + void tep_print_printk(struct tep_handle *tep); 594 595 595 596 /* ----------------------- filtering ----------------------- */ 596 597 ··· 723 724 char error_buffer[TEP_FILTER_ERROR_BUFSZ]; 724 725 }; 725 726 726 - struct tep_event_filter *tep_filter_alloc(struct tep_handle *pevent); 727 + struct tep_event_filter *tep_filter_alloc(struct tep_handle *tep); 727 728 728 729 /* for backward compatibility */ 729 730 #define FILTER_NONE TEP_ERRNO__NO_FILTER
+4 -4
tools/lib/traceevent/event-plugin.c
··· 419 419 } 420 420 421 421 struct tep_plugin_list* 422 - tep_load_plugins(struct tep_handle *pevent) 422 + tep_load_plugins(struct tep_handle *tep) 423 423 { 424 424 struct tep_plugin_list *list = NULL; 425 425 426 - load_plugins(pevent, ".so", load_plugin, &list); 426 + load_plugins(tep, ".so", load_plugin, &list); 427 427 return list; 428 428 } 429 429 430 430 void 431 - tep_unload_plugins(struct tep_plugin_list *plugin_list, struct tep_handle *pevent) 431 + tep_unload_plugins(struct tep_plugin_list *plugin_list, struct tep_handle *tep) 432 432 { 433 433 tep_plugin_unload_func func; 434 434 struct tep_plugin_list *list; ··· 438 438 plugin_list = list->next; 439 439 func = dlsym(list->handle, TEP_PLUGIN_UNLOADER_NAME); 440 440 if (func) 441 - func(pevent); 441 + func(tep); 442 442 dlclose(list->handle); 443 443 free(list->name); 444 444 free(list);
+4 -4
tools/lib/traceevent/parse-filter.c
··· 164 164 165 165 /** 166 166 * tep_filter_alloc - create a new event filter 167 - * @pevent: The pevent that this filter is associated with 167 + * @tep: The tep that this filter is associated with 168 168 */ 169 - struct tep_event_filter *tep_filter_alloc(struct tep_handle *pevent) 169 + struct tep_event_filter *tep_filter_alloc(struct tep_handle *tep) 170 170 { 171 171 struct tep_event_filter *filter; 172 172 ··· 175 175 return NULL; 176 176 177 177 memset(filter, 0, sizeof(*filter)); 178 - filter->pevent = pevent; 179 - tep_ref(pevent); 178 + filter->pevent = tep; 179 + tep_ref(tep); 180 180 181 181 return filter; 182 182 }
+4 -4
tools/lib/traceevent/plugin_cfg80211.c
··· 25 25 return val ? (long long) le16toh(*val) : 0; 26 26 } 27 27 28 - int TEP_PLUGIN_LOADER(struct tep_handle *pevent) 28 + int TEP_PLUGIN_LOADER(struct tep_handle *tep) 29 29 { 30 - tep_register_print_function(pevent, 30 + tep_register_print_function(tep, 31 31 process___le16_to_cpup, 32 32 TEP_FUNC_ARG_INT, 33 33 "__le16_to_cpup", ··· 36 36 return 0; 37 37 } 38 38 39 - void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) 39 + void TEP_PLUGIN_UNLOADER(struct tep_handle *tep) 40 40 { 41 - tep_unregister_print_function(pevent, process___le16_to_cpup, 41 + tep_unregister_print_function(tep, process___le16_to_cpup, 42 42 "__le16_to_cpup"); 43 43 }
+4 -4
tools/lib/traceevent/plugin_function.c
··· 164 164 return 0; 165 165 } 166 166 167 - int TEP_PLUGIN_LOADER(struct tep_handle *pevent) 167 + int TEP_PLUGIN_LOADER(struct tep_handle *tep) 168 168 { 169 - tep_register_event_handler(pevent, -1, "ftrace", "function", 169 + tep_register_event_handler(tep, -1, "ftrace", "function", 170 170 function_handler, NULL); 171 171 172 172 tep_plugin_add_options("ftrace", plugin_options); ··· 174 174 return 0; 175 175 } 176 176 177 - void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) 177 + void TEP_PLUGIN_UNLOADER(struct tep_handle *tep) 178 178 { 179 179 int i, x; 180 180 181 - tep_unregister_event_handler(pevent, -1, "ftrace", "function", 181 + tep_unregister_event_handler(tep, -1, "ftrace", "function", 182 182 function_handler, NULL); 183 183 184 184 for (i = 0; i <= cpus; i++) {
+6 -6
tools/lib/traceevent/plugin_hrtimer.c
··· 67 67 return 0; 68 68 } 69 69 70 - int TEP_PLUGIN_LOADER(struct tep_handle *pevent) 70 + int TEP_PLUGIN_LOADER(struct tep_handle *tep) 71 71 { 72 - tep_register_event_handler(pevent, -1, 72 + tep_register_event_handler(tep, -1, 73 73 "timer", "hrtimer_expire_entry", 74 74 timer_expire_handler, NULL); 75 75 76 - tep_register_event_handler(pevent, -1, "timer", "hrtimer_start", 76 + tep_register_event_handler(tep, -1, "timer", "hrtimer_start", 77 77 timer_start_handler, NULL); 78 78 return 0; 79 79 } 80 80 81 - void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) 81 + void TEP_PLUGIN_UNLOADER(struct tep_handle *tep) 82 82 { 83 - tep_unregister_event_handler(pevent, -1, 83 + tep_unregister_event_handler(tep, -1, 84 84 "timer", "hrtimer_expire_entry", 85 85 timer_expire_handler, NULL); 86 86 87 - tep_unregister_event_handler(pevent, -1, "timer", "hrtimer_start", 87 + tep_unregister_event_handler(tep, -1, "timer", "hrtimer_start", 88 88 timer_start_handler, NULL); 89 89 }
+6 -6
tools/lib/traceevent/plugin_jbd2.c
··· 48 48 return jiffies; 49 49 } 50 50 51 - int TEP_PLUGIN_LOADER(struct tep_handle *pevent) 51 + int TEP_PLUGIN_LOADER(struct tep_handle *tep) 52 52 { 53 - tep_register_print_function(pevent, 53 + tep_register_print_function(tep, 54 54 process_jbd2_dev_to_name, 55 55 TEP_FUNC_ARG_STRING, 56 56 "jbd2_dev_to_name", 57 57 TEP_FUNC_ARG_INT, 58 58 TEP_FUNC_ARG_VOID); 59 59 60 - tep_register_print_function(pevent, 60 + tep_register_print_function(tep, 61 61 process_jiffies_to_msecs, 62 62 TEP_FUNC_ARG_LONG, 63 63 "jiffies_to_msecs", ··· 66 66 return 0; 67 67 } 68 68 69 - void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) 69 + void TEP_PLUGIN_UNLOADER(struct tep_handle *tep) 70 70 { 71 - tep_unregister_print_function(pevent, process_jbd2_dev_to_name, 71 + tep_unregister_print_function(tep, process_jbd2_dev_to_name, 72 72 "jbd2_dev_to_name"); 73 73 74 - tep_unregister_print_function(pevent, process_jiffies_to_msecs, 74 + tep_unregister_print_function(tep, process_jiffies_to_msecs, 75 75 "jiffies_to_msecs"); 76 76 }
+14 -14
tools/lib/traceevent/plugin_kmem.c
··· 49 49 return 1; 50 50 } 51 51 52 - int TEP_PLUGIN_LOADER(struct tep_handle *pevent) 52 + int TEP_PLUGIN_LOADER(struct tep_handle *tep) 53 53 { 54 - tep_register_event_handler(pevent, -1, "kmem", "kfree", 54 + tep_register_event_handler(tep, -1, "kmem", "kfree", 55 55 call_site_handler, NULL); 56 56 57 - tep_register_event_handler(pevent, -1, "kmem", "kmalloc", 57 + tep_register_event_handler(tep, -1, "kmem", "kmalloc", 58 58 call_site_handler, NULL); 59 59 60 - tep_register_event_handler(pevent, -1, "kmem", "kmalloc_node", 60 + tep_register_event_handler(tep, -1, "kmem", "kmalloc_node", 61 61 call_site_handler, NULL); 62 62 63 - tep_register_event_handler(pevent, -1, "kmem", "kmem_cache_alloc", 63 + tep_register_event_handler(tep, -1, "kmem", "kmem_cache_alloc", 64 64 call_site_handler, NULL); 65 65 66 - tep_register_event_handler(pevent, -1, "kmem", 66 + tep_register_event_handler(tep, -1, "kmem", 67 67 "kmem_cache_alloc_node", 68 68 call_site_handler, NULL); 69 69 70 - tep_register_event_handler(pevent, -1, "kmem", "kmem_cache_free", 70 + tep_register_event_handler(tep, -1, "kmem", "kmem_cache_free", 71 71 call_site_handler, NULL); 72 72 return 0; 73 73 } 74 74 75 - void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) 75 + void TEP_PLUGIN_UNLOADER(struct tep_handle *tep) 76 76 { 77 - tep_unregister_event_handler(pevent, -1, "kmem", "kfree", 77 + tep_unregister_event_handler(tep, -1, "kmem", "kfree", 78 78 call_site_handler, NULL); 79 79 80 - tep_unregister_event_handler(pevent, -1, "kmem", "kmalloc", 80 + tep_unregister_event_handler(tep, -1, "kmem", "kmalloc", 81 81 call_site_handler, NULL); 82 82 83 - tep_unregister_event_handler(pevent, -1, "kmem", "kmalloc_node", 83 + tep_unregister_event_handler(tep, -1, "kmem", "kmalloc_node", 84 84 call_site_handler, NULL); 85 85 86 - tep_unregister_event_handler(pevent, -1, "kmem", "kmem_cache_alloc", 86 + tep_unregister_event_handler(tep, -1, "kmem", "kmem_cache_alloc", 87 87 call_site_handler, NULL); 88 88 89 - tep_unregister_event_handler(pevent, -1, "kmem", 89 + tep_unregister_event_handler(tep, -1, "kmem", 90 90 "kmem_cache_alloc_node", 91 91 call_site_handler, NULL); 92 92 93 - tep_unregister_event_handler(pevent, -1, "kmem", "kmem_cache_free", 93 + tep_unregister_event_handler(tep, -1, "kmem", "kmem_cache_free", 94 94 call_site_handler, NULL); 95 95 }
+22 -22
tools/lib/traceevent/plugin_kvm.c
··· 445 445 return pte & PT_WRITABLE_MASK; 446 446 } 447 447 448 - int TEP_PLUGIN_LOADER(struct tep_handle *pevent) 448 + int TEP_PLUGIN_LOADER(struct tep_handle *tep) 449 449 { 450 450 init_disassembler(); 451 451 452 - tep_register_event_handler(pevent, -1, "kvm", "kvm_exit", 452 + tep_register_event_handler(tep, -1, "kvm", "kvm_exit", 453 453 kvm_exit_handler, NULL); 454 454 455 - tep_register_event_handler(pevent, -1, "kvm", "kvm_emulate_insn", 455 + tep_register_event_handler(tep, -1, "kvm", "kvm_emulate_insn", 456 456 kvm_emulate_insn_handler, NULL); 457 457 458 - tep_register_event_handler(pevent, -1, "kvm", "kvm_nested_vmexit", 458 + tep_register_event_handler(tep, -1, "kvm", "kvm_nested_vmexit", 459 459 kvm_nested_vmexit_handler, NULL); 460 460 461 - tep_register_event_handler(pevent, -1, "kvm", "kvm_nested_vmexit_inject", 461 + tep_register_event_handler(tep, -1, "kvm", "kvm_nested_vmexit_inject", 462 462 kvm_nested_vmexit_inject_handler, NULL); 463 463 464 - tep_register_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_get_page", 464 + tep_register_event_handler(tep, -1, "kvmmmu", "kvm_mmu_get_page", 465 465 kvm_mmu_get_page_handler, NULL); 466 466 467 - tep_register_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_sync_page", 467 + tep_register_event_handler(tep, -1, "kvmmmu", "kvm_mmu_sync_page", 468 468 kvm_mmu_print_role, NULL); 469 469 470 - tep_register_event_handler(pevent, -1, 470 + tep_register_event_handler(tep, -1, 471 471 "kvmmmu", "kvm_mmu_unsync_page", 472 472 kvm_mmu_print_role, NULL); 473 473 474 - tep_register_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_zap_page", 474 + tep_register_event_handler(tep, -1, "kvmmmu", "kvm_mmu_zap_page", 475 475 kvm_mmu_print_role, NULL); 476 476 477 - tep_register_event_handler(pevent, -1, "kvmmmu", 477 + tep_register_event_handler(tep, -1, "kvmmmu", 478 478 "kvm_mmu_prepare_zap_page", kvm_mmu_print_role, 479 479 NULL); 480 480 481 - tep_register_print_function(pevent, 481 + tep_register_print_function(tep, 482 482 process_is_writable_pte, 483 483 TEP_FUNC_ARG_INT, 484 484 "is_writable_pte", ··· 487 487 return 0; 488 488 } 489 489 490 - void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) 490 + void TEP_PLUGIN_UNLOADER(struct tep_handle *tep) 491 491 { 492 - tep_unregister_event_handler(pevent, -1, "kvm", "kvm_exit", 492 + tep_unregister_event_handler(tep, -1, "kvm", "kvm_exit", 493 493 kvm_exit_handler, NULL); 494 494 495 - tep_unregister_event_handler(pevent, -1, "kvm", "kvm_emulate_insn", 495 + tep_unregister_event_handler(tep, -1, "kvm", "kvm_emulate_insn", 496 496 kvm_emulate_insn_handler, NULL); 497 497 498 - tep_unregister_event_handler(pevent, -1, "kvm", "kvm_nested_vmexit", 498 + tep_unregister_event_handler(tep, -1, "kvm", "kvm_nested_vmexit", 499 499 kvm_nested_vmexit_handler, NULL); 500 500 501 - tep_unregister_event_handler(pevent, -1, "kvm", "kvm_nested_vmexit_inject", 501 + tep_unregister_event_handler(tep, -1, "kvm", "kvm_nested_vmexit_inject", 502 502 kvm_nested_vmexit_inject_handler, NULL); 503 503 504 - tep_unregister_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_get_page", 504 + tep_unregister_event_handler(tep, -1, "kvmmmu", "kvm_mmu_get_page", 505 505 kvm_mmu_get_page_handler, NULL); 506 506 507 - tep_unregister_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_sync_page", 507 + tep_unregister_event_handler(tep, -1, "kvmmmu", "kvm_mmu_sync_page", 508 508 kvm_mmu_print_role, NULL); 509 509 510 - tep_unregister_event_handler(pevent, -1, 510 + tep_unregister_event_handler(tep, -1, 511 511 "kvmmmu", "kvm_mmu_unsync_page", 512 512 kvm_mmu_print_role, NULL); 513 513 514 - tep_unregister_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_zap_page", 514 + tep_unregister_event_handler(tep, -1, "kvmmmu", "kvm_mmu_zap_page", 515 515 kvm_mmu_print_role, NULL); 516 516 517 - tep_unregister_event_handler(pevent, -1, "kvmmmu", 517 + tep_unregister_event_handler(tep, -1, "kvmmmu", 518 518 "kvm_mmu_prepare_zap_page", kvm_mmu_print_role, 519 519 NULL); 520 520 521 - tep_unregister_print_function(pevent, process_is_writable_pte, 521 + tep_unregister_print_function(tep, process_is_writable_pte, 522 522 "is_writable_pte"); 523 523 }
+4 -4
tools/lib/traceevent/plugin_mac80211.c
··· 87 87 return 0; 88 88 } 89 89 90 - int TEP_PLUGIN_LOADER(struct tep_handle *pevent) 90 + int TEP_PLUGIN_LOADER(struct tep_handle *tep) 91 91 { 92 - tep_register_event_handler(pevent, -1, "mac80211", 92 + tep_register_event_handler(tep, -1, "mac80211", 93 93 "drv_bss_info_changed", 94 94 drv_bss_info_changed, NULL); 95 95 return 0; 96 96 } 97 97 98 - void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) 98 + void TEP_PLUGIN_UNLOADER(struct tep_handle *tep) 99 99 { 100 - tep_unregister_event_handler(pevent, -1, "mac80211", 100 + tep_unregister_event_handler(tep, -1, "mac80211", 101 101 "drv_bss_info_changed", 102 102 drv_bss_info_changed, NULL); 103 103 }
+8 -8
tools/lib/traceevent/plugin_sched_switch.c
··· 135 135 return 0; 136 136 } 137 137 138 - int TEP_PLUGIN_LOADER(struct tep_handle *pevent) 138 + int TEP_PLUGIN_LOADER(struct tep_handle *tep) 139 139 { 140 - tep_register_event_handler(pevent, -1, "sched", "sched_switch", 140 + tep_register_event_handler(tep, -1, "sched", "sched_switch", 141 141 sched_switch_handler, NULL); 142 142 143 - tep_register_event_handler(pevent, -1, "sched", "sched_wakeup", 143 + tep_register_event_handler(tep, -1, "sched", "sched_wakeup", 144 144 sched_wakeup_handler, NULL); 145 145 146 - tep_register_event_handler(pevent, -1, "sched", "sched_wakeup_new", 146 + tep_register_event_handler(tep, -1, "sched", "sched_wakeup_new", 147 147 sched_wakeup_handler, NULL); 148 148 return 0; 149 149 } 150 150 151 - void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) 151 + void TEP_PLUGIN_UNLOADER(struct tep_handle *tep) 152 152 { 153 - tep_unregister_event_handler(pevent, -1, "sched", "sched_switch", 153 + tep_unregister_event_handler(tep, -1, "sched", "sched_switch", 154 154 sched_switch_handler, NULL); 155 155 156 - tep_unregister_event_handler(pevent, -1, "sched", "sched_wakeup", 156 + tep_unregister_event_handler(tep, -1, "sched", "sched_wakeup", 157 157 sched_wakeup_handler, NULL); 158 158 159 - tep_unregister_event_handler(pevent, -1, "sched", "sched_wakeup_new", 159 + tep_unregister_event_handler(tep, -1, "sched", "sched_wakeup_new", 160 160 sched_wakeup_handler, NULL); 161 161 }
+4 -4
tools/lib/traceevent/plugin_scsi.c
··· 414 414 return 0; 415 415 } 416 416 417 - int TEP_PLUGIN_LOADER(struct tep_handle *pevent) 417 + int TEP_PLUGIN_LOADER(struct tep_handle *tep) 418 418 { 419 - tep_register_print_function(pevent, 419 + tep_register_print_function(tep, 420 420 process_scsi_trace_parse_cdb, 421 421 TEP_FUNC_ARG_STRING, 422 422 "scsi_trace_parse_cdb", ··· 427 427 return 0; 428 428 } 429 429 430 - void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) 430 + void TEP_PLUGIN_UNLOADER(struct tep_handle *tep) 431 431 { 432 - tep_unregister_print_function(pevent, process_scsi_trace_parse_cdb, 432 + tep_unregister_print_function(tep, process_scsi_trace_parse_cdb, 433 433 "scsi_trace_parse_cdb"); 434 434 }
+4 -4
tools/lib/traceevent/plugin_xen.c
··· 120 120 return 0; 121 121 } 122 122 123 - int TEP_PLUGIN_LOADER(struct tep_handle *pevent) 123 + int TEP_PLUGIN_LOADER(struct tep_handle *tep) 124 124 { 125 - tep_register_print_function(pevent, 125 + tep_register_print_function(tep, 126 126 process_xen_hypercall_name, 127 127 TEP_FUNC_ARG_STRING, 128 128 "xen_hypercall_name", ··· 131 131 return 0; 132 132 } 133 133 134 - void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) 134 + void TEP_PLUGIN_UNLOADER(struct tep_handle *tep) 135 135 { 136 - tep_unregister_print_function(pevent, process_xen_hypercall_name, 136 + tep_unregister_print_function(tep, process_xen_hypercall_name, 137 137 "xen_hypercall_name"); 138 138 }