Skip to content

Commit 4605eab

Browse files
olsajiriacmel
authored andcommitted
tools lib api fs: Replace debugfs/tracefs objects interface with fs.c
Switching to the fs.c related filesystem framework. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: David Ahern <dsahern@gmail.com> Cc: Matt Fleming <matt@codeblueprint.co.uk> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Raphael Beamonte <raphael.beamonte@gmail.com> Cc: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/r/1441180605-24737-14-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 4f234f0 commit 4605eab

11 files changed

Lines changed: 23 additions & 29 deletions

File tree

‎tools/lib/api/fs/fs.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include <unistd.h>
1212
#include <sys/mount.h>
1313

14-
#include "debugfs.h"
1514
#include "fs.h"
1615

1716
#define _STR(x) #x

‎tools/lib/api/fs/tracing_path.c‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
#include <string.h>
88
#include <errno.h>
99
#include <unistd.h>
10-
#include "debugfs.h"
11-
#include "tracefs.h"
10+
#include "fs.h"
1211

1312
#include "tracing_path.h"
1413

@@ -29,7 +28,7 @@ static const char *tracing_path_tracefs_mount(void)
2928
{
3029
const char *mnt;
3130

32-
mnt = tracefs_mount(NULL);
31+
mnt = tracefs__mount();
3332
if (!mnt)
3433
return NULL;
3534

@@ -42,7 +41,7 @@ static const char *tracing_path_debugfs_mount(void)
4241
{
4342
const char *mnt;
4443

45-
mnt = debugfs_mount(NULL);
44+
mnt = debugfs__mount();
4645
if (!mnt)
4746
return NULL;
4847

@@ -96,7 +95,7 @@ static int strerror_open(int err, char *buf, size_t size, const char *filename)
9695
* want some tracepoint which wasn't compiled in your kernel.
9796
* - jirka
9897
*/
99-
if (debugfs_configured() || tracefs_configured()) {
98+
if (debugfs__configured() || tracefs__configured()) {
10099
snprintf(buf, size,
101100
"Error:\tFile %s/%s not found.\n"
102101
"Hint:\tPerhaps this kernel misses some CONFIG_ setting to enable this feature?.\n",
@@ -110,13 +109,13 @@ static int strerror_open(int err, char *buf, size_t size, const char *filename)
110109
"Hint:\tTry 'sudo mount -t debugfs nodev /sys/kernel/debug'");
111110
break;
112111
case EACCES: {
113-
const char *mountpoint = debugfs_find_mountpoint();
112+
const char *mountpoint = debugfs__mountpoint();
114113

115114
if (!access(mountpoint, R_OK) && strncmp(filename, "tracing/", 8) == 0) {
116-
const char *tracefs_mntpoint = tracefs_find_mountpoint();
115+
const char *tracefs_mntpoint = tracefs__mountpoint();
117116

118117
if (tracefs_mntpoint)
119-
mountpoint = tracefs_find_mountpoint();
118+
mountpoint = tracefs__mountpoint();
120119
}
121120

122121
snprintf(buf, size,

‎tools/perf/builtin-kvm.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include "util/parse-options.h"
1414
#include "util/trace-event.h"
1515
#include "util/debug.h"
16-
#include <api/fs/debugfs.h>
1716
#include "util/tool.h"
1817
#include "util/stat.h"
1918
#include "util/top.h"

‎tools/perf/builtin-probe.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
#include "util/strfilter.h"
3838
#include "util/symbol.h"
3939
#include "util/debug.h"
40-
#include <api/fs/debugfs.h>
4140
#include "util/parse-options.h"
4241
#include "util/probe-finder.h"
4342
#include "util/probe-event.h"

‎tools/perf/tests/openat-syscall-all-cpus.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <api/fs/fs.h>
12
#include "evsel.h"
23
#include "tests.h"
34
#include "thread_map.h"
@@ -30,9 +31,9 @@ int test__openat_syscall_event_on_all_cpus(void)
3031

3132
evsel = perf_evsel__newtp("syscalls", "sys_enter_openat");
3233
if (evsel == NULL) {
33-
if (tracefs_configured())
34+
if (tracefs__configured())
3435
pr_debug("is tracefs mounted on /sys/kernel/tracing?\n");
35-
else if (debugfs_configured())
36+
else if (debugfs__configured())
3637
pr_debug("is debugfs mounted on /sys/kernel/debug?\n");
3738
else
3839
pr_debug("Neither tracefs or debugfs is enabled in this kernel\n");

‎tools/perf/tests/openat-syscall.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <api/fs/fs.h>
12
#include "thread_map.h"
23
#include "evsel.h"
34
#include "debug.h"
@@ -18,9 +19,9 @@ int test__openat_syscall_event(void)
1819

1920
evsel = perf_evsel__newtp("syscalls", "sys_enter_openat");
2021
if (evsel == NULL) {
21-
if (tracefs_configured())
22+
if (tracefs__configured())
2223
pr_debug("is tracefs mounted on /sys/kernel/tracing?\n");
23-
else if (debugfs_configured())
24+
else if (debugfs__configured())
2425
pr_debug("is debugfs mounted on /sys/kernel/debug?\n");
2526
else
2627
pr_debug("Neither tracefs or debugfs is enabled in this kernel\n");

‎tools/perf/tests/parse-events.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
#include "evsel.h"
44
#include "evlist.h"
55
#include <api/fs/fs.h>
6-
#include <api/fs/tracefs.h>
7-
#include <api/fs/debugfs.h>
86
#include "tests.h"
97
#include "debug.h"
108
#include <linux/hw_breakpoint.h>
9+
#include <api/fs/fs.h>
1110

1211
#define PERF_TP_SAMPLE_TYPE (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | \
1312
PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD)
@@ -1268,12 +1267,12 @@ static int count_tracepoints(void)
12681267
DIR *events_dir;
12691268
int cnt = 0;
12701269

1271-
mountpoint = tracefs_find_mountpoint();
1270+
mountpoint = tracefs__mountpoint();
12721271
if (mountpoint) {
12731272
scnprintf(events_path, PATH_MAX, "%s/events",
12741273
mountpoint);
12751274
} else {
1276-
mountpoint = debugfs_find_mountpoint();
1275+
mountpoint = debugfs__mountpoint();
12771276
scnprintf(events_path, PATH_MAX, "%s/tracing/events",
12781277
mountpoint);
12791278
}

‎tools/perf/util/evsel.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#include <byteswap.h>
1111
#include <linux/bitops.h>
12-
#include <api/fs/debugfs.h>
12+
#include <api/fs/tracing_path.h>
1313
#include <traceevent/event-parse.h>
1414
#include <linux/hw_breakpoint.h>
1515
#include <linux/perf_event.h>

‎tools/perf/util/probe-event.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@
4040
#include "color.h"
4141
#include "symbol.h"
4242
#include "thread.h"
43-
#include <api/fs/debugfs.h>
44-
#include <api/fs/tracefs.h>
43+
#include <api/fs/fs.h>
4544
#include "trace-event.h" /* For __maybe_unused */
4645
#include "probe-event.h"
4746
#include "probe-finder.h"
@@ -2054,7 +2053,7 @@ static void kprobe_blacklist__delete(struct list_head *blacklist)
20542053
static int kprobe_blacklist__load(struct list_head *blacklist)
20552054
{
20562055
struct kprobe_blacklist_node *node;
2057-
const char *__debugfs = debugfs_find_mountpoint();
2056+
const char *__debugfs = debugfs__mountpoint();
20582057
char buf[PATH_MAX], *p;
20592058
FILE *fp;
20602059
int ret;

‎tools/perf/util/probe-file.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
#include "color.h"
2323
#include "symbol.h"
2424
#include "thread.h"
25-
#include <api/fs/debugfs.h>
26-
#include <api/fs/tracefs.h>
25+
#include <api/fs/fs.h>
2726
#include "probe-event.h"
2827
#include "probe-file.h"
2928
#include "session.h"
@@ -77,11 +76,11 @@ static int open_probe_events(const char *trace_file, bool readwrite)
7776
const char *tracing_dir = "";
7877
int ret;
7978

80-
__debugfs = tracefs_find_mountpoint();
79+
__debugfs = tracefs__mountpoint();
8180
if (__debugfs == NULL) {
8281
tracing_dir = "tracing/";
8382

84-
__debugfs = debugfs_find_mountpoint();
83+
__debugfs = debugfs__mountpoint();
8584
if (__debugfs == NULL)
8685
return -ENOTSUP;
8786
}

0 commit comments

Comments
 (0)