From: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org
Subject: [PATCH v2 1/7] libtracefs: tracefs_instance_file_read() get a const file name
Date: Tue, 12 Jan 2021 11:20:18 +0200 [thread overview]
Message-ID: <20210112092024.605705-2-tz.stoyanov@gmail.com> (raw)
In-Reply-To: <20210112092024.605705-1-tz.stoyanov@gmail.com>
The file name input parameter of tracefs_instance_file_read() API should
be a pointer to a constat string, as this file name must not be changed
by the API.
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
Documentation/libtracefs-instances-files.txt | 2 +-
Documentation/libtracefs.txt | 2 +-
include/tracefs.h | 2 +-
src/tracefs-instance.c | 2 +-
utest/tracefs-utest.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Documentation/libtracefs-instances-files.txt b/Documentation/libtracefs-instances-files.txt
index 9b18b73..a9af1f7 100644
--- a/Documentation/libtracefs-instances-files.txt
+++ b/Documentation/libtracefs-instances-files.txt
@@ -18,7 +18,7 @@ bool *tracefs_dir_exists*(struct tracefs_instance pass:[*]_instance_, char pass:
char pass:[*]*tracefs_instance_get_file*(struct tracefs_instance pass:[*]_instance_, const char pass:[*]_file_);
char pass:[*]*tracefs_instance_get_dir*(struct tracefs_instance pass:[*]_instance_);
int *tracefs_instance_file_write*(struct tracefs_instance pass:[*]_instance_, const char pass:[*]_file_, const char pass:[*]_str_);
-char pass:[*]*tracefs_instance_file_read*(struct tracefs_instance pass:[*]_instance_, char pass:[*]_file_, int pass:[*]_psize_);
+char pass:[*]*tracefs_instance_file_read*(struct tracefs_instance pass:[*]_instance_, const char pass:[*]_file_, int pass:[*]_psize_);
--
diff --git a/Documentation/libtracefs.txt b/Documentation/libtracefs.txt
index ddbf783..bf3882f 100644
--- a/Documentation/libtracefs.txt
+++ b/Documentation/libtracefs.txt
@@ -26,7 +26,7 @@ Trace instances:
char pass:[*]*tracefs_instance_get_file*(struct tracefs_instance pass:[*]_instance_, const char pass:[*]_file_);
char pass:[*]*tracefs_instance_get_dir*(struct tracefs_instance pass:[*]_instance_);
int *tracefs_instance_file_write*(struct tracefs_instance pass:[*]_instance_, const char pass:[*]_file_, const char pass:[*]_str_);
- char pass:[*]*tracefs_instance_file_read*(struct tracefs_instance pass:[*]_instance_, char pass:[*]_file_, int pass:[*]_psize_);
+ char pass:[*]*tracefs_instance_file_read*(struct tracefs_instance pass:[*]_instance_, const char pass:[*]_file_, int pass:[*]_psize_);
const char pass:[*]*tracefs_instance_get_name*(struct tracefs_instance pass:[*]_instance_);
int *tracefs_instances_walk*(int (pass:[*]_callback_)(const char pass:[*], void pass:[*]), void pass:[*]_context)_;
bool *tracefs_instance_exists*(const char pass:[*]_name_);
diff --git a/include/tracefs.h b/include/tracefs.h
index 3d70aca..06e2130 100644
--- a/include/tracefs.h
+++ b/include/tracefs.h
@@ -29,7 +29,7 @@ char *tracefs_instance_get_dir(struct tracefs_instance *instance);
int tracefs_instance_file_write(struct tracefs_instance *instance,
const char *file, const char *str);
char *tracefs_instance_file_read(struct tracefs_instance *instance,
- char *file, int *psize);
+ const char *file, int *psize);
int tracefs_instances_walk(int (*callback)(const char *, void *), void *context);
bool tracefs_instance_exists(const char *name);
diff --git a/src/tracefs-instance.c b/src/tracefs-instance.c
index bf3de7c..6dc85ee 100644
--- a/src/tracefs-instance.c
+++ b/src/tracefs-instance.c
@@ -282,7 +282,7 @@ int tracefs_instance_file_write(struct tracefs_instance *instance,
* The return string must be freed by free()
*/
char *tracefs_instance_file_read(struct tracefs_instance *instance,
- char *file, int *psize)
+ const char *file, int *psize)
{
char *buf = NULL;
int size = 0;
diff --git a/utest/tracefs-utest.c b/utest/tracefs-utest.c
index b45a3c6..a8e8f67 100644
--- a/utest/tracefs-utest.c
+++ b/utest/tracefs-utest.c
@@ -181,7 +181,7 @@ static void test_trace_file(void)
tracefs_put_tracing_file(file);
}
-static void test_instance_file_read(struct tracefs_instance *inst, char *fname)
+static void test_instance_file_read(struct tracefs_instance *inst, const char *fname)
{
const char *tdir = tracefs_tracing_dir();
char buf[BUFSIZ];
--
2.29.2
next prev parent reply other threads:[~2021-01-12 9:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-12 9:20 [PATCH v2 0/7] New libtracefs APIs Tzvetomir Stoyanov (VMware)
2021-01-12 9:20 ` Tzvetomir Stoyanov (VMware) [this message]
2021-01-12 9:20 ` [PATCH v2 2/7] libtracefs: New APIs for opening and reading ftrace files Tzvetomir Stoyanov (VMware)
2021-01-12 9:20 ` [PATCH v2 3/7] libtracefs: New APIs for enable / disable tracing Tzvetomir Stoyanov (VMware)
2021-02-19 3:07 ` Steven Rostedt
2021-01-12 9:20 ` [PATCH v2 4/7] libtracefs: Documentation for the new APIs for opening and reading ftrace files Tzvetomir Stoyanov (VMware)
2021-01-12 9:20 ` [PATCH v2 5/7] libtracefs: Documentation for enable / disable tracing APIs Tzvetomir Stoyanov (VMware)
2021-01-12 9:20 ` [PATCH v2 6/7] libtracefs: Unit tests for the new APIs for opening and reading ftrace files Tzvetomir Stoyanov (VMware)
2021-01-12 9:20 ` [PATCH v2 7/7] libtracefs: Unit tests for enable / disable tracing APIs 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=20210112092024.605705-2-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).