Lines Matching refs:arg
382 static void free_arg(struct print_arg *arg) in free_arg() argument
384 if (!arg) in free_arg()
387 switch (arg->type) { in free_arg()
389 if (arg->atom.atom) in free_arg()
390 free(arg->atom.atom); in free_arg()
399 free(arg); in free_arg()
1022 process_arg_token(struct event *event, struct print_arg *arg,
1026 process_arg(struct event *event, struct print_arg *arg, char **tok) in process_arg() argument
1034 return process_arg_token(event, arg, tok, type); in process_arg()
1040 struct print_arg *arg, *left, *right; in process_cond() local
1044 arg = malloc_or_die(sizeof(*arg)); in process_cond()
1045 memset(arg, 0, sizeof(*arg)); in process_cond()
1051 arg->type = PRINT_OP; in process_cond()
1052 arg->op.left = left; in process_cond()
1053 arg->op.right = right; in process_cond()
1060 arg->op.op = token; in process_cond()
1064 top->op.right = arg; in process_cond()
1073 free_arg(arg); in process_cond()
1080 struct print_arg *arg; in process_array() local
1084 arg = malloc_or_die(sizeof(*arg)); in process_array()
1085 memset(arg, 0, sizeof(*arg)); in process_array()
1088 type = process_arg(event, arg, &token); in process_array()
1092 top->op.right = arg; in process_array()
1102 free_arg(arg); in process_array()
1158 static void set_op_prio(struct print_arg *arg) in set_op_prio() argument
1162 if (!arg->op.left || arg->op.left->type == PRINT_NULL) { in set_op_prio()
1163 arg->op.prio = 0; in set_op_prio()
1167 arg->op.prio = get_op_prio(arg->op.op); in set_op_prio()
1171 process_op(struct event *event, struct print_arg *arg, char **tok) in process_op() argument
1180 if (arg->type == PRINT_OP && !arg->op.left) { in process_op()
1199 arg->op.left = left; in process_op()
1202 arg->op.right = right; in process_op()
1210 *left = *arg; in process_op()
1212 arg->type = PRINT_OP; in process_op()
1213 arg->op.op = token; in process_op()
1214 arg->op.left = left; in process_op()
1215 arg->op.prio = 0; in process_op()
1217 type = process_cond(event, arg, tok); in process_op()
1238 *left = *arg; in process_op()
1240 arg->type = PRINT_OP; in process_op()
1241 arg->op.op = token; in process_op()
1242 arg->op.left = left; in process_op()
1244 set_op_prio(arg); in process_op()
1252 if ((strcmp(arg->op.op, "*") == 0) && in process_op()
1259 *arg = *left; in process_op()
1260 free(arg); in process_op()
1267 arg->op.right = right; in process_op()
1272 *left = *arg; in process_op()
1274 arg->type = PRINT_OP; in process_op()
1275 arg->op.op = token; in process_op()
1276 arg->op.left = left; in process_op()
1278 arg->op.prio = 0; in process_op()
1279 type = process_array(event, arg, tok); in process_op()
1294 if (prio > arg->op.prio) in process_op()
1295 return process_op(event, arg, tok); in process_op()
1304 process_entry(struct event *event __unused, struct print_arg *arg, in process_entry() argument
1318 arg->type = PRINT_FIELD; in process_entry()
1319 arg->field.name = field; in process_entry()
1322 arg->field.field = find_any_field(event, arg->field.name); in process_entry()
1323 arg->field.field->flags |= FIELD_IS_FLAG; in process_entry()
1326 arg->field.field = find_any_field(event, arg->field.name); in process_entry()
1327 arg->field.field->flags |= FIELD_IS_SYMBOLIC; in process_entry()
1341 static char *arg_eval (struct print_arg *arg);
1343 static long long arg_num_eval(struct print_arg *arg) in arg_num_eval() argument
1348 switch (arg->type) { in arg_num_eval()
1350 val = strtoll(arg->atom.atom, NULL, 0); in arg_num_eval()
1353 val = arg_num_eval(arg->typecast.item); in arg_num_eval()
1356 switch (arg->op.op[0]) { in arg_num_eval()
1358 left = arg_num_eval(arg->op.left); in arg_num_eval()
1359 right = arg_num_eval(arg->op.right); in arg_num_eval()
1360 if (arg->op.op[1]) in arg_num_eval()
1366 left = arg_num_eval(arg->op.left); in arg_num_eval()
1367 right = arg_num_eval(arg->op.right); in arg_num_eval()
1368 if (arg->op.op[1]) in arg_num_eval()
1374 left = arg_num_eval(arg->op.left); in arg_num_eval()
1375 right = arg_num_eval(arg->op.right); in arg_num_eval()
1376 switch (arg->op.op[1]) { in arg_num_eval()
1387 die("unknown op '%s'", arg->op.op); in arg_num_eval()
1391 left = arg_num_eval(arg->op.left); in arg_num_eval()
1392 right = arg_num_eval(arg->op.right); in arg_num_eval()
1393 switch (arg->op.op[1]) { in arg_num_eval()
1404 die("unknown op '%s'", arg->op.op); in arg_num_eval()
1408 left = arg_num_eval(arg->op.left); in arg_num_eval()
1409 right = arg_num_eval(arg->op.right); in arg_num_eval()
1411 if (arg->op.op[1] != '=') in arg_num_eval()
1412 die("unknown op '%s'", arg->op.op); in arg_num_eval()
1417 left = arg_num_eval(arg->op.left); in arg_num_eval()
1418 right = arg_num_eval(arg->op.right); in arg_num_eval()
1420 switch (arg->op.op[1]) { in arg_num_eval()
1425 die("unknown op '%s'", arg->op.op); in arg_num_eval()
1429 die("unknown op '%s'", arg->op.op); in arg_num_eval()
1437 die("invalid eval type %d", arg->type); in arg_num_eval()
1443 static char *arg_eval (struct print_arg *arg) in arg_eval() argument
1448 switch (arg->type) { in arg_eval()
1450 return arg->atom.atom; in arg_eval()
1452 return arg_eval(arg->typecast.item); in arg_eval()
1454 val = arg_num_eval(arg); in arg_eval()
1462 die("invalid eval type %d", arg->type); in arg_eval()
1473 struct print_arg *arg = NULL; in process_fields() local
1484 arg = malloc_or_die(sizeof(*arg)); in process_fields()
1487 type = process_arg(event, arg, &token); in process_fields()
1494 value = arg_eval(arg); in process_fields()
1498 type = process_arg(event, arg, &token); in process_fields()
1502 value = arg_eval(arg); in process_fields()
1504 free_arg(arg); in process_fields()
1505 arg = NULL; in process_fields()
1518 free_arg(arg); in process_fields()
1525 process_flags(struct event *event, struct print_arg *arg, char **tok) in process_flags() argument
1531 memset(arg, 0, sizeof(*arg)); in process_flags()
1532 arg->type = PRINT_FLAGS; in process_flags()
1543 arg->flags.field = field; in process_flags()
1547 arg->flags.delim = token; in process_flags()
1554 type = process_fields(event, &arg->flags.flags, &token); in process_flags()
1568 process_symbols(struct event *event, struct print_arg *arg, char **tok) in process_symbols() argument
1574 memset(arg, 0, sizeof(*arg)); in process_symbols()
1575 arg->type = PRINT_SYMBOL; in process_symbols()
1586 arg->symbol.field = field; in process_symbols()
1588 type = process_fields(event, &arg->symbol.symbols, &token); in process_symbols()
1602 process_paren(struct event *event, struct print_arg *arg, char **tok) in process_paren() argument
1608 type = process_arg(event, arg, &token); in process_paren()
1614 type = process_op(event, arg, &token); in process_paren()
1637 if (arg->type != PRINT_ATOM) in process_paren()
1642 arg->type = PRINT_TYPE; in process_paren()
1643 arg->typecast.type = arg->atom.atom; in process_paren()
1644 arg->typecast.item = item_arg; in process_paren()
1655 process_str(struct event *event __unused, struct print_arg *arg, char **tok) in process_str() argument
1666 arg->type = PRINT_STRING; in process_str()
1667 arg->string.string = token; in process_str()
1668 arg->string.offset = -1; in process_str()
1683 process_arg_token(struct event *event, struct print_arg *arg, in process_arg_token() argument
1695 type = process_entry(event, arg, &token); in process_arg_token()
1699 type = process_flags(event, arg, &token); in process_arg_token()
1703 type = process_symbols(event, arg, &token); in process_arg_token()
1706 type = process_str(event, arg, &token); in process_arg_token()
1723 arg->type = PRINT_ATOM; in process_arg_token()
1724 arg->atom.atom = atom; in process_arg_token()
1729 arg->type = PRINT_ATOM; in process_arg_token()
1730 arg->atom.atom = token; in process_arg_token()
1736 type = process_paren(event, arg, &token); in process_arg_token()
1741 arg->type = PRINT_OP; in process_arg_token()
1742 arg->op.op = token; in process_arg_token()
1743 arg->op.left = NULL; in process_arg_token()
1744 type = process_op(event, arg, &token); in process_arg_token()
1760 struct print_arg *arg; in event_read_print_args() local
1771 arg = malloc_or_die(sizeof(*arg)); in event_read_print_args()
1772 memset(arg, 0, sizeof(*arg)); in event_read_print_args()
1774 type = process_arg(event, arg, &token); in event_read_print_args()
1777 free_arg(arg); in event_read_print_args()
1781 *list = arg; in event_read_print_args()
1785 type = process_op(event, arg, &token); in event_read_print_args()
1786 list = &arg->next; in event_read_print_args()
1792 *list = arg; in event_read_print_args()
1793 list = &arg->next; in event_read_print_args()
2058 struct event *event, struct print_arg *arg) in eval_num_arg() argument
2064 switch (arg->type) { in eval_num_arg()
2069 return strtoull(arg->atom.atom, NULL, 0); in eval_num_arg()
2071 if (!arg->field.field) { in eval_num_arg()
2072 arg->field.field = find_any_field(event, arg->field.name); in eval_num_arg()
2073 if (!arg->field.field) in eval_num_arg()
2074 die("field %s not found", arg->field.name); in eval_num_arg()
2077 val = read_size(data + arg->field.field->offset, in eval_num_arg()
2078 arg->field.field->size); in eval_num_arg()
2084 return eval_num_arg(data, size, event, arg->typecast.item); in eval_num_arg()
2089 if (strcmp(arg->op.op, "[") == 0) { in eval_num_arg()
2094 if (arg->op.left->type != PRINT_FIELD) in eval_num_arg()
2096 larg = arg->op.left; in eval_num_arg()
2103 right = eval_num_arg(data, size, event, arg->op.right); in eval_num_arg()
2109 left = eval_num_arg(data, size, event, arg->op.left); in eval_num_arg()
2110 right = eval_num_arg(data, size, event, arg->op.right); in eval_num_arg()
2111 switch (arg->op.op[0]) { in eval_num_arg()
2113 if (arg->op.op[1]) in eval_num_arg()
2119 if (arg->op.op[1]) in eval_num_arg()
2125 switch (arg->op.op[1]) { in eval_num_arg()
2136 die("unknown op '%s'", arg->op.op); in eval_num_arg()
2140 switch (arg->op.op[1]) { in eval_num_arg()
2151 die("unknown op '%s'", arg->op.op); in eval_num_arg()
2155 if (arg->op.op[1] != '=') in eval_num_arg()
2156 die("unknown op '%s'", arg->op.op); in eval_num_arg()
2166 die("unknown op '%s'", arg->op.op); in eval_num_arg()
2216 struct event *event, struct print_arg *arg) in print_str_arg() argument
2223 switch (arg->type) { in print_str_arg()
2228 printf("%s", arg->atom.atom); in print_str_arg()
2231 if (!arg->field.field) { in print_str_arg()
2232 arg->field.field = find_any_field(event, arg->field.name); in print_str_arg()
2233 if (!arg->field.field) in print_str_arg()
2234 die("field %s not found", arg->field.name); in print_str_arg()
2236 str = malloc_or_die(arg->field.field->size + 1); in print_str_arg()
2237 memcpy(str, data + arg->field.field->offset, in print_str_arg()
2238 arg->field.field->size); in print_str_arg()
2239 str[arg->field.field->size] = 0; in print_str_arg()
2244 val = eval_num_arg(data, size, event, arg->flags.field); in print_str_arg()
2246 for (flag = arg->flags.flags; flag; flag = flag->next) { in print_str_arg()
2253 if (print && arg->flags.delim) in print_str_arg()
2254 printf("%s", arg->flags.delim); in print_str_arg()
2262 val = eval_num_arg(data, size, event, arg->symbol.field); in print_str_arg()
2263 for (flag = arg->symbol.symbols; flag; flag = flag->next) { in print_str_arg()
2277 if (arg->string.offset == -1) { in print_str_arg()
2280 f = find_any_field(event, arg->string.string); in print_str_arg()
2281 arg->string.offset = f->offset; in print_str_arg()
2283 str_offset = *(int *)(data + arg->string.offset); in print_str_arg()
2292 if (arg->op.op[0] != '?') in print_str_arg()
2294 val = eval_num_arg(data, size, event, arg->op.left); in print_str_arg()
2296 print_str_arg(data, size, event, arg->op.right->op.left); in print_str_arg()
2298 print_str_arg(data, size, event, arg->op.right->op.right); in print_str_arg()
2309 struct print_arg *args, *arg, **next; in make_bprint_args() local
2329 arg = args; in make_bprint_args()
2330 arg->next = NULL; in make_bprint_args()
2331 next = &arg->next; in make_bprint_args()
2333 arg->type = PRINT_ATOM; in make_bprint_args()
2334 arg->atom.atom = malloc_or_die(32); in make_bprint_args()
2335 sprintf(arg->atom.atom, "%lld", ip); in make_bprint_args()
2378 arg = malloc_or_die(sizeof(*arg)); in make_bprint_args()
2379 arg->next = NULL; in make_bprint_args()
2380 arg->type = PRINT_ATOM; in make_bprint_args()
2381 arg->atom.atom = malloc_or_die(32); in make_bprint_args()
2382 sprintf(arg->atom.atom, "%lld", val); in make_bprint_args()
2383 *next = arg; in make_bprint_args()
2384 next = &arg->next; in make_bprint_args()
2387 arg = malloc_or_die(sizeof(*arg)); in make_bprint_args()
2388 arg->next = NULL; in make_bprint_args()
2389 arg->type = PRINT_STRING; in make_bprint_args()
2390 arg->string.string = strdup(bptr); in make_bprint_args()
2392 *next = arg; in make_bprint_args()
2393 next = &arg->next; in make_bprint_args()
2465 struct print_arg *arg = print_fmt->args; in pretty_print() local
2483 arg = args; in pretty_print()
2546 if (!arg) in pretty_print()
2559 val = eval_num_arg(data, size, event, arg); in pretty_print()
2560 arg = arg->next; in pretty_print()
2587 if (!arg) in pretty_print()
2590 print_str_arg(data, size, event, arg); in pretty_print()
2591 arg = arg->next; in pretty_print()
3015 struct print_arg *arg, **list; in parse_ftrace_file() local
3066 arg = malloc_or_die(sizeof(*arg)); in parse_ftrace_file()
3067 memset(arg, 0, sizeof(*arg)); in parse_ftrace_file()
3068 *list = arg; in parse_ftrace_file()
3069 list = &arg->next; in parse_ftrace_file()
3070 arg->type = PRINT_FIELD; in parse_ftrace_file()
3071 arg->field.name = field->name; in parse_ftrace_file()
3072 arg->field.field = field; in parse_ftrace_file()