From: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org
Subject: [PATCH 04/12] libtracefs: Remove redundant kprobes APIs
Date: Thu, 28 Oct 2021 15:08:59 +0300 [thread overview]
Message-ID: <20211028120907.101847-5-tz.stoyanov@gmail.com> (raw)
In-Reply-To: <20211028120907.101847-1-tz.stoyanov@gmail.com>
The newly introduced API tracefs_kprobe_destroy() can be used to clear a
specific kprobe or all kprobes from the system. These legacy APIs are
removed as redundant:
tracefs_kprobe_clear_all();
tracefs_kprobe_clear_probe();
There is one functionality, missing in the new API - clearing all
kprobes from specific system only. If this is needed,
tracefs_kprobe_destroy() can be extended with that use case.
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
include/tracefs.h | 2 --
src/tracefs-kprobes.c | 62 -------------------------------------------
2 files changed, 64 deletions(-)
diff --git a/include/tracefs.h b/include/tracefs.h
index e7d545c..c7b9179 100644
--- a/include/tracefs.h
+++ b/include/tracefs.h
@@ -262,8 +262,6 @@ int tracefs_kretprobe_raw(const char *system, const char *event,
char **tracefs_kprobes_get(enum tracefs_kprobe_type type);
enum tracefs_kprobe_type tracefs_kprobe_info(const char *group, const char *event,
char **type, char **addr, char **format);
-int tracefs_kprobe_clear_all(bool force);
-int tracefs_kprobe_clear_probe(const char *system, const char *event, bool force);
enum tracefs_hist_key_type {
TRACEFS_HIST_KEY_NORMAL = 0,
diff --git a/src/tracefs-kprobes.c b/src/tracefs-kprobes.c
index 80dc327..1e08b75 100644
--- a/src/tracefs-kprobes.c
+++ b/src/tracefs-kprobes.c
@@ -542,68 +542,6 @@ static int kprobe_clear_probes(const char *group, bool force)
return ret;
}
-/**
- * tracefs_kprobe_clear_all - clear kprobe events
- * @force: Will attempt to disable all kprobe events and clear them
- *
- * Will remove all defined kprobe events. If any of them are enabled,
- * and @force is not set, then it will error with -1 and errno to be
- * EBUSY. If @force is set, then it will attempt to disable all the kprobe
- * events in all instances, and try again.
- *
- * Returns zero on success, -1 otherwise.
- */
-int tracefs_kprobe_clear_all(bool force)
-{
- if (tracefs_instance_file_clear(NULL, KPROBE_EVENTS) == 0)
- return 0;
-
- if (!force)
- return -1;
-
- /* Attempt to disable all kprobe events */
- return kprobe_clear_probes(NULL, force);
-}
-
-/**
- * tracefs_kprobe_clear_all - clear kprobe events
- * @system: System to clear (NULL means default)
- * @event: Name of probe to clear in system (NULL for all probes in system)
- * @force: Will attempt to disable all kprobe events and clear them
- *
- * Will remove the kprobes that match the @system and @event. If @system
- * is NULL, then "kprobes" is used and will ignore all other system
- * groups of kprobes. The @event is NULL then all events under the given
- * @system are removed, otherwise only the event that matches.
- *
- * Returns zero on success, -1 otherwise.
- */
-int tracefs_kprobe_clear_probe(const char *system, const char *event, bool force)
-{
- char **instance_list;
- int ret;
-
- if (!system)
- system = "kprobes";
-
- if (!event)
- return kprobe_clear_probes(system, force);
-
- /*
- * Since we know we are disabling a specific event, try
- * to disable it first before clearing it.
- */
- if (force) {
- instance_list = tracefs_instances(NULL);
- disable_events(system, event, instance_list);
- tracefs_list_free(instance_list);
- }
-
- ret = clear_kprobe(system, event);
-
- return ret < 0 ? -1 : 0;
-}
-
/**
* tracefs_kprobe_destroy - Remove a kprobe or kretprobe from the system
* @kprobe: A kprobe context, describing the kprobe that will be deleted.
--
2.31.1
next prev parent reply other threads:[~2021-10-28 12:09 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-28 12:08 [PATCH 00/12] libtracefs dynamic events support Tzvetomir Stoyanov (VMware)
2021-10-28 12:08 ` [PATCH 01/12] libtracefs: Add new internal APIs for dynamic events Tzvetomir Stoyanov (VMware)
2021-10-28 21:41 ` Steven Rostedt
2021-10-29 2:46 ` Tzvetomir Stoyanov
2021-10-29 3:09 ` Steven Rostedt
2021-10-28 12:08 ` [PATCH 02/12] libtracefs: Rename tracefs_get_kprobes API Tzvetomir Stoyanov (VMware)
2021-10-28 12:08 ` [PATCH 03/12] libtracefs: New kprobes APIs Tzvetomir Stoyanov (VMware)
2021-10-29 2:55 ` Steven Rostedt
2021-10-28 12:08 ` Tzvetomir Stoyanov (VMware) [this message]
2021-10-28 12:09 ` [PATCH 05/12] libtracefs: Reimplement tracefs_kprobes_get API Tzvetomir Stoyanov (VMware)
2021-10-29 3:01 ` Steven Rostedt
2021-10-28 12:09 ` [PATCH 06/12] libtracefs: Change tracefs_kprobe_info API Tzvetomir Stoyanov (VMware)
2021-10-28 12:09 ` [PATCH 07/12] libtracefs: Reimplement kprobe raw APIs Tzvetomir Stoyanov (VMware)
2021-10-28 12:09 ` [PATCH 08/12] libtracefs: Extend kprobes unit test Tzvetomir Stoyanov (VMware)
2021-10-28 12:09 ` [PATCH 09/12] libtracefs: Update kprobes man pages Tzvetomir Stoyanov (VMware)
2021-10-28 12:09 ` [PATCH 10/12] libtracefs: Rename tracefs_synth_init API Tzvetomir Stoyanov (VMware)
2021-10-28 12:09 ` [PATCH 11/12] libtracefs: Use the internal dynamic events API when creating synthetic events Tzvetomir Stoyanov (VMware)
2021-10-28 12:09 ` [PATCH 12/12] libtracefs: Document tracefs_dynevent_list_free() API Tzvetomir Stoyanov (VMware)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211028120907.101847-5-tz.stoyanov@gmail.com \
--to=tz.stoyanov@gmail.com \
--cc=linux-trace-devel@vger.kernel.org \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).