Lines Matching full:filt
1931 static void addr_filter__free_str(struct addr_filter *filt) in addr_filter__free_str() argument
1933 zfree(&filt->str); in addr_filter__free_str()
1934 filt->action = NULL; in addr_filter__free_str()
1935 filt->sym_from = NULL; in addr_filter__free_str()
1936 filt->sym_to = NULL; in addr_filter__free_str()
1937 filt->filename = NULL; in addr_filter__free_str()
1942 struct addr_filter *filt = zalloc(sizeof(*filt)); in addr_filter__new() local
1944 if (filt) in addr_filter__new()
1945 INIT_LIST_HEAD(&filt->list); in addr_filter__new()
1947 return filt; in addr_filter__new()
1950 static void addr_filter__free(struct addr_filter *filt) in addr_filter__free() argument
1952 if (filt) in addr_filter__free()
1953 addr_filter__free_str(filt); in addr_filter__free()
1954 free(filt); in addr_filter__free()
1958 struct addr_filter *filt) in addr_filters__add() argument
1960 list_add_tail(&filt->list, &filts->head); in addr_filters__add()
1965 struct addr_filter *filt) in addr_filters__del() argument
1967 list_del_init(&filt->list); in addr_filters__del()
1979 struct addr_filter *filt, *n; in addr_filters__exit() local
1981 list_for_each_entry_safe(filt, n, &filts->head, list) { in addr_filters__exit()
1982 addr_filters__del(filts, filt); in addr_filters__exit()
1983 addr_filter__free(filt); in addr_filters__exit()
2023 static int parse_action(struct addr_filter *filt) in parse_action() argument
2025 if (!strcmp(filt->action, "filter")) { in parse_action()
2026 filt->start = true; in parse_action()
2027 filt->range = true; in parse_action()
2028 } else if (!strcmp(filt->action, "start")) { in parse_action()
2029 filt->start = true; in parse_action()
2030 } else if (!strcmp(filt->action, "stop")) { in parse_action()
2031 filt->start = false; in parse_action()
2032 } else if (!strcmp(filt->action, "tracestop")) { in parse_action()
2033 filt->start = false; in parse_action()
2034 filt->range = true; in parse_action()
2035 filt->action += 5; /* Change 'tracestop' to 'stop' */ in parse_action()
2083 static int parse_one_filter(struct addr_filter *filt, const char **filter_inp) in parse_one_filter() argument
2088 filt->str = fstr = strdup(*filter_inp); in parse_one_filter()
2092 err = parse_num_or_str(&fstr, NULL, &filt->action, " "); in parse_one_filter()
2096 err = parse_action(filt); in parse_one_filter()
2100 err = parse_addr_size(&fstr, &filt->addr, &filt->sym_from, in parse_one_filter()
2101 &filt->sym_from_idx); in parse_one_filter()
2109 err = parse_addr_size(&fstr, &filt->size, &filt->sym_to, in parse_one_filter()
2110 &filt->sym_to_idx); in parse_one_filter()
2113 filt->range = true; in parse_one_filter()
2120 err = parse_num_or_str(&fstr, NULL, &filt->filename, " ,"); in parse_one_filter()
2127 *filter_inp += fstr - filt->str; in parse_one_filter()
2132 addr_filter__free_str(filt); in parse_one_filter()
2140 struct addr_filter *filt; in addr_filters__parse_bare_filter() local
2145 filt = addr_filter__new(); in addr_filters__parse_bare_filter()
2146 err = parse_one_filter(filt, &fstr); in addr_filters__parse_bare_filter()
2148 addr_filter__free(filt); in addr_filters__parse_bare_filter()
2152 addr_filters__add(filts, filt); in addr_filters__parse_bare_filter()
2292 static int addr_filter__entire_kernel(struct addr_filter *filt) in addr_filter__entire_kernel() argument
2303 filt->addr = args.start; in addr_filter__entire_kernel()
2304 filt->size = args.size; in addr_filter__entire_kernel()
2309 static int check_end_after_start(struct addr_filter *filt, u64 start, u64 size) in check_end_after_start() argument
2311 if (start + size >= filt->addr) in check_end_after_start()
2314 if (filt->sym_from) { in check_end_after_start()
2316 filt->sym_to, start, filt->sym_from, filt->addr); in check_end_after_start()
2319 filt->sym_to, start, filt->addr); in check_end_after_start()
2325 static int addr_filter__resolve_kernel_syms(struct addr_filter *filt) in addr_filter__resolve_kernel_syms() argument
2336 if (filt->sym_from && !strcmp(filt->sym_from, "*")) in addr_filter__resolve_kernel_syms()
2337 return addr_filter__entire_kernel(filt); in addr_filter__resolve_kernel_syms()
2339 if (filt->sym_from) { in addr_filter__resolve_kernel_syms()
2340 err = find_kern_sym(filt->sym_from, &start, &size, in addr_filter__resolve_kernel_syms()
2341 filt->sym_from_idx); in addr_filter__resolve_kernel_syms()
2344 filt->addr = start; in addr_filter__resolve_kernel_syms()
2345 if (filt->range && !filt->size && !filt->sym_to) { in addr_filter__resolve_kernel_syms()
2346 filt->size = size; in addr_filter__resolve_kernel_syms()
2351 if (filt->sym_to) { in addr_filter__resolve_kernel_syms()
2352 err = find_kern_sym(filt->sym_to, &start, &size, in addr_filter__resolve_kernel_syms()
2353 filt->sym_to_idx); in addr_filter__resolve_kernel_syms()
2357 err = check_end_after_start(filt, start, size); in addr_filter__resolve_kernel_syms()
2360 filt->size = start + size - filt->addr; in addr_filter__resolve_kernel_syms()
2367 filt->sym_to ? filt->sym_to : filt->sym_from); in addr_filter__resolve_kernel_syms()
2466 static int addr_filter__entire_dso(struct addr_filter *filt, struct dso *dso) in addr_filter__entire_dso() argument
2470 filt->filename); in addr_filter__entire_dso()
2474 filt->addr = 0; in addr_filter__entire_dso()
2475 filt->size = dso->data.file_size; in addr_filter__entire_dso()
2480 static int addr_filter__resolve_syms(struct addr_filter *filt) in addr_filter__resolve_syms() argument
2486 if (!filt->sym_from && !filt->sym_to) in addr_filter__resolve_syms()
2489 if (!filt->filename) in addr_filter__resolve_syms()
2490 return addr_filter__resolve_kernel_syms(filt); in addr_filter__resolve_syms()
2492 dso = load_dso(filt->filename); in addr_filter__resolve_syms()
2494 pr_err("Failed to load symbols from: %s\n", filt->filename); in addr_filter__resolve_syms()
2498 if (filt->sym_from && !strcmp(filt->sym_from, "*")) { in addr_filter__resolve_syms()
2499 err = addr_filter__entire_dso(filt, dso); in addr_filter__resolve_syms()
2503 if (filt->sym_from) { in addr_filter__resolve_syms()
2504 err = find_dso_sym(dso, filt->sym_from, &start, &size, in addr_filter__resolve_syms()
2505 filt->sym_from_idx); in addr_filter__resolve_syms()
2508 filt->addr = start; in addr_filter__resolve_syms()
2509 if (filt->range && !filt->size && !filt->sym_to) in addr_filter__resolve_syms()
2510 filt->size = size; in addr_filter__resolve_syms()
2513 if (filt->sym_to) { in addr_filter__resolve_syms()
2514 err = find_dso_sym(dso, filt->sym_to, &start, &size, in addr_filter__resolve_syms()
2515 filt->sym_to_idx); in addr_filter__resolve_syms()
2519 err = check_end_after_start(filt, start, size); in addr_filter__resolve_syms()
2523 filt->size = start + size - filt->addr; in addr_filter__resolve_syms()
2532 static char *addr_filter__to_str(struct addr_filter *filt) in addr_filter__to_str() argument
2540 if (filt->filename) { in addr_filter__to_str()
2542 fn = realpath(filt->filename, filename_buf); in addr_filter__to_str()
2547 if (filt->range) { in addr_filter__to_str()
2549 filt->action, filt->addr, filt->size, at, fn); in addr_filter__to_str()
2552 filt->action, filt->addr, at, fn); in addr_filter__to_str()
2562 struct addr_filter *filt; in parse_addr_filter() local
2578 list_for_each_entry(filt, &filts.head, list) { in parse_addr_filter()
2581 err = addr_filter__resolve_syms(filt); in parse_addr_filter()
2585 new_filter = addr_filter__to_str(filt); in parse_addr_filter()