probe-file.c (1f3736c9c833e40ac4d3a8dc6d661e341df8a259) probe-file.c (4a0f65c102ec3a718b4a0b90981232b6cb019477)
1/*
2 * probe-file.c : operate ftrace k/uprobe events files
3 *
4 * Written by Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 670 unchanged lines hidden (view full) ---

679 pr_debug("Cache committed: %d\n", ret);
680 if (ret < 0)
681 break;
682 }
683out:
684 return ret;
685}
686
1/*
2 * probe-file.c : operate ftrace k/uprobe events files
3 *
4 * Written by Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 670 unchanged lines hidden (view full) ---

679 pr_debug("Cache committed: %d\n", ret);
680 if (ret < 0)
681 break;
682 }
683out:
684 return ret;
685}
686
687static bool probe_cache_entry__compare(struct probe_cache_entry *entry,
688 struct strfilter *filter)
689{
690 char buf[128], *ptr = entry->spev;
691
692 if (entry->pev.event) {
693 snprintf(buf, 128, "%s:%s", entry->pev.group, entry->pev.event);
694 ptr = buf;
695 }
696 return strfilter__compare(filter, ptr);
697}
698
699int probe_cache__filter_purge(struct probe_cache *pcache,
700 struct strfilter *filter)
701{
702 struct probe_cache_entry *entry, *tmp;
703
704 list_for_each_entry_safe(entry, tmp, &pcache->entries, node) {
705 if (probe_cache_entry__compare(entry, filter)) {
706 pr_info("Removed cached event: %s\n", entry->spev);
707 list_del_init(&entry->node);
708 probe_cache_entry__delete(entry);
709 }
710 }
711 return 0;
712}
713
687static int probe_cache__show_entries(struct probe_cache *pcache,
688 struct strfilter *filter)
689{
690 struct probe_cache_entry *entry;
714static int probe_cache__show_entries(struct probe_cache *pcache,
715 struct strfilter *filter)
716{
717 struct probe_cache_entry *entry;
691 char buf[128], *ptr;
692
693 list_for_each_entry(entry, &pcache->entries, node) {
718
719 list_for_each_entry(entry, &pcache->entries, node) {
694 if (entry->pev.event) {
695 ptr = buf;
696 snprintf(buf, 128, "%s:%s",
697 entry->pev.group, entry->pev.event);
698 } else
699 ptr = entry->spev;
700 if (strfilter__compare(filter, ptr))
720 if (probe_cache_entry__compare(entry, filter))
701 printf("%s\n", entry->spev);
702 }
703 return 0;
704}
705
706/* Show all cached probes */
707int probe_cache__show_all_caches(struct strfilter *filter)
708{

--- 29 unchanged lines hidden ---
721 printf("%s\n", entry->spev);
722 }
723 return 0;
724}
725
726/* Show all cached probes */
727int probe_cache__show_all_caches(struct strfilter *filter)
728{

--- 29 unchanged lines hidden ---