| Function report | 
| Source Code: kernel\trace\trace_events_filter.c | Create Date:2022-07-28 12:23:58 | 
| Last Modify:2022-05-22 20:19:57 | Copyright©Brick | 
| home page | Tree | 
| Annotation kernel can get tool activity | Download SCCT | Chinese | 
Name:Without going into a formal proof, this explains the method that is used in* parsing the logical expressions
Proto:static struct prog_entry *predicate_parse(const char *str, int nr_parens, int nr_preds, parse_pred_fn parse_pred, void *data, struct filter_parse_error *pe)
Type:struct prog_entry
Parameter:
| Type | Parameter | Name | 
|---|---|---|
| const char * | str | |
| int | nr_parens | |
| int | nr_preds | |
| parse_pred_fn | parse_pred | |
| void * | data | |
| struct filter_parse_error * | pe | 
| 417 | char * inverts = NULL | 
| 420 | invert = 0 | 
| 423 | N = 0 | 
| 426 | nr_preds += 2 | 
| 428 | op_stack = kmalloc_array - allocate memory for an array.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc). | 
| 431 | prog_stack = kcalloc - allocate memory for an array. The memory is set to zero.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc). | 
| 432 | If Not prog_stack Then | 
| 433 | parse_error(pe, - ENOMEM, 0) | 
| 434 | Go to out_free | 
| 436 | inverts = kmalloc_array - allocate memory for an array.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc). | 
| 437 | If Not inverts Then | 
| 438 | parse_error(pe, - ENOMEM, 0) | 
| 439 | Go to out_free | 
| 443 | prog = prog_stack | 
| 444 | top = 0 | 
| 450 | If Note: isspace() must return false for %NUL-terminator ( * next) Then Continue | 
| 454 | Case next == '(' | 
| 460 | Continue | 
| 461 | Case next == '!' | 
| 462 | If Not Called after a '!' character but "!=" and "!~" are not "not"s Then Break | 
| 465 | Continue | 
| 469 | parse_error(pe, FILT_ERR_TOO_MANY_PREDS, next - str) | 
| 470 | Go to out_free | 
| 477 | If len < 0 Then | 
| 483 | N++ | 
| 485 | ret = -1 | 
| 486 | When 1 cycle | 
| 488 | If Note: isspace() must return false for %NUL-terminator ( * next) Then Continue | 
| 492 | Case next == ')' | 
| 493 | Case next == '\0' | 
| 494 | Break | 
| 495 | Case next == '&' | 
| 496 | Case next == '|' | 
| 503 | Default | 
| 504 | parse_error(pe, FILT_ERR_TOO_MANY_PREDS, next - str) | 
| 506 | Go to out_free | 
| 511 | If top & PROCESS_AND Then | 
| 513 | top &= ~PROCESS_AND | 
| 515 | If next == '&' Then | 
| 516 | top |= PROCESS_AND | 
| 517 | Break | 
| 519 | If top & PROCESS_OR Then | 
| 521 | top &= ~PROCESS_OR | 
| 523 | If next == '|' Then | 
| 524 | top |= PROCESS_OR | 
| 525 | Break | 
| 536 | top-- | 
| 539 | out : | 
| 542 | parse_error(pe, FILT_ERR_TOO_MANY_OPEN, ptr - str) | 
| 543 | Go to out_free | 
| 546 | If Not N Then | 
| 553 | pred = NULL | 
| 554 | target = 1 | 
| 555 | pred = NULL | 
| 556 | target = 0 | 
| 558 | when_to_branch = false | 
| 563 | If when_to_branch == when_to_branch Then target = target | 
| 569 | invert = inverts[i] ^ when_to_branch | 
| 570 | when_to_branch = invert | 
| 580 | Return prog | 
| 581 | out_free : | 
| 584 | If prog_stack Then | 
| Name | Describe | 
|---|---|
| process_preds | 
| Source code conversion tool public plug-in interface | X | 
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |