Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1217387
| From | Jiri Olsa <jolsa@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 14/15] tools lib api: Remove debugfs, tracefs and findfs objects |
| Date | 2015-09-02 10:00 +0200 |
| Message-ID | <q4b7B-7ff-35@gated-at.bofh.it> (permalink) |
| References | <q4b7z-7ff-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
We have all the functionality in fs.c, let's remove unneeded
objects.
Link: http://lkml.kernel.org/n/tip-4ylqs27bec3m6ofefqo0eek4@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/lib/api/fs/Build | 3 --
tools/lib/api/fs/debugfs.c | 77 ---------------------------------------------
tools/lib/api/fs/debugfs.h | 23 --------------
tools/lib/api/fs/findfs.c | 63 -------------------------------------
tools/lib/api/fs/findfs.h | 23 --------------
tools/lib/api/fs/tracefs.c | 78 ----------------------------------------------
tools/lib/api/fs/tracefs.h | 21 -------------
7 files changed, 288 deletions(-)
delete mode 100644 tools/lib/api/fs/debugfs.c
delete mode 100644 tools/lib/api/fs/debugfs.h
delete mode 100644 tools/lib/api/fs/findfs.c
delete mode 100644 tools/lib/api/fs/findfs.h
delete mode 100644 tools/lib/api/fs/tracefs.c
delete mode 100644 tools/lib/api/fs/tracefs.h
diff --git a/tools/lib/api/fs/Build b/tools/lib/api/fs/Build
index fa726f679b29..f4ed9629ae85 100644
--- a/tools/lib/api/fs/Build
+++ b/tools/lib/api/fs/Build
@@ -1,5 +1,2 @@
libapi-y += fs.o
libapi-y += tracing_path.o
-libapi-y += debugfs.o
-libapi-y += findfs.o
-libapi-y += tracefs.o
diff --git a/tools/lib/api/fs/debugfs.c b/tools/lib/api/fs/debugfs.c
deleted file mode 100644
index c707cfb32782..000000000000
--- a/tools/lib/api/fs/debugfs.c
+++ /dev/null
@@ -1,77 +0,0 @@
-#define _GNU_SOURCE
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdbool.h>
-#include <sys/vfs.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mount.h>
-#include <linux/kernel.h>
-
-#include "debugfs.h"
-#include "tracefs.h"
-
-#ifndef DEBUGFS_DEFAULT_PATH
-#define DEBUGFS_DEFAULT_PATH "/sys/kernel/debug"
-#endif
-
-char debugfs_mountpoint[PATH_MAX + 1] = DEBUGFS_DEFAULT_PATH;
-
-static const char * const debugfs_known_mountpoints[] = {
- DEBUGFS_DEFAULT_PATH,
- "/debug",
- 0,
-};
-
-static bool debugfs_found;
-
-bool debugfs_configured(void)
-{
- return debugfs_find_mountpoint() != NULL;
-}
-
-/* find the path to the mounted debugfs */
-const char *debugfs_find_mountpoint(void)
-{
- const char *ret;
-
- if (debugfs_found)
- return (const char *)debugfs_mountpoint;
-
- ret = find_mountpoint("debugfs", (long) DEBUGFS_MAGIC,
- debugfs_mountpoint, PATH_MAX + 1,
- debugfs_known_mountpoints);
- if (ret)
- debugfs_found = true;
-
- return ret;
-}
-
-/* mount the debugfs somewhere if it's not mounted */
-char *debugfs_mount(const char *mountpoint)
-{
- /* see if it's already mounted */
- if (debugfs_find_mountpoint())
- goto out;
-
- /* if not mounted and no argument */
- if (mountpoint == NULL) {
- /* see if environment variable set */
- mountpoint = getenv(PERF_DEBUGFS_ENVIRONMENT);
- /* if no environment variable, use default */
- if (mountpoint == NULL)
- mountpoint = DEBUGFS_DEFAULT_PATH;
- }
-
- if (mount(NULL, mountpoint, "debugfs", 0, NULL) < 0)
- return NULL;
-
- /* save the mountpoint */
- debugfs_found = true;
- strncpy(debugfs_mountpoint, mountpoint, sizeof(debugfs_mountpoint));
-out:
- return debugfs_mountpoint;
-}
diff --git a/tools/lib/api/fs/debugfs.h b/tools/lib/api/fs/debugfs.h
deleted file mode 100644
index 455023698d2b..000000000000
--- a/tools/lib/api/fs/debugfs.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef __API_DEBUGFS_H__
-#define __API_DEBUGFS_H__
-
-#include "findfs.h"
-
-#ifndef DEBUGFS_MAGIC
-#define DEBUGFS_MAGIC 0x64626720
-#endif
-
-#ifndef PERF_DEBUGFS_ENVIRONMENT
-#define PERF_DEBUGFS_ENVIRONMENT "PERF_DEBUGFS_DIR"
-#endif
-
-bool debugfs_configured(void);
-const char *debugfs_find_mountpoint(void);
-char *debugfs_mount(const char *mountpoint);
-
-extern char debugfs_mountpoint[];
-
-int debugfs__strerror_open(int err, char *buf, size_t size, const char *filename);
-int debugfs__strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name);
-
-#endif /* __API_DEBUGFS_H__ */
diff --git a/tools/lib/api/fs/findfs.c b/tools/lib/api/fs/findfs.c
deleted file mode 100644
index 49946cb6d7af..000000000000
--- a/tools/lib/api/fs/findfs.c
+++ /dev/null
@@ -1,63 +0,0 @@
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdbool.h>
-#include <sys/vfs.h>
-
-#include "findfs.h"
-
-/* verify that a mountpoint is actually the type we want */
-
-int valid_mountpoint(const char *mount, long magic)
-{
- struct statfs st_fs;
-
- if (statfs(mount, &st_fs) < 0)
- return -ENOENT;
- else if ((long)st_fs.f_type != magic)
- return -ENOENT;
-
- return 0;
-}
-
-/* find the path to a mounted file system */
-const char *find_mountpoint(const char *fstype, long magic,
- char *mountpoint, int len,
- const char * const *known_mountpoints)
-{
- const char * const *ptr;
- char format[128];
- char type[100];
- FILE *fp;
-
- if (known_mountpoints) {
- ptr = known_mountpoints;
- while (*ptr) {
- if (valid_mountpoint(*ptr, magic) == 0) {
- strncpy(mountpoint, *ptr, len - 1);
- mountpoint[len-1] = 0;
- return mountpoint;
- }
- ptr++;
- }
- }
-
- /* give up and parse /proc/mounts */
- fp = fopen("/proc/mounts", "r");
- if (fp == NULL)
- return NULL;
-
- snprintf(format, 128, "%%*s %%%ds %%99s %%*s %%*d %%*d\n", len);
-
- while (fscanf(fp, format, mountpoint, type) == 2) {
- if (strcmp(type, fstype) == 0)
- break;
- }
- fclose(fp);
-
- if (strcmp(type, fstype) != 0)
- return NULL;
-
- return mountpoint;
-}
diff --git a/tools/lib/api/fs/findfs.h b/tools/lib/api/fs/findfs.h
deleted file mode 100644
index b6f5d05acc42..000000000000
--- a/tools/lib/api/fs/findfs.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef __API_FINDFS_H__
-#define __API_FINDFS_H__
-
-#include <stdbool.h>
-
-#define _STR(x) #x
-#define STR(x) _STR(x)
-
-/*
- * On most systems <limits.h> would have given us this, but not on some systems
- * (e.g. GNU/Hurd).
- */
-#ifndef PATH_MAX
-#define PATH_MAX 4096
-#endif
-
-const char *find_mountpoint(const char *fstype, long magic,
- char *mountpoint, int len,
- const char * const *known_mountpoints);
-
-int valid_mountpoint(const char *mount, long magic);
-
-#endif /* __API_FINDFS_H__ */
diff --git a/tools/lib/api/fs/tracefs.c b/tools/lib/api/fs/tracefs.c
deleted file mode 100644
index e4aa9688b71e..000000000000
--- a/tools/lib/api/fs/tracefs.c
+++ /dev/null
@@ -1,78 +0,0 @@
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdbool.h>
-#include <sys/vfs.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mount.h>
-#include <linux/kernel.h>
-
-#include "tracefs.h"
-
-#ifndef TRACEFS_DEFAULT_PATH
-#define TRACEFS_DEFAULT_PATH "/sys/kernel/tracing"
-#endif
-
-char tracefs_mountpoint[PATH_MAX + 1] = TRACEFS_DEFAULT_PATH;
-
-static const char * const tracefs_known_mountpoints[] = {
- TRACEFS_DEFAULT_PATH,
- "/sys/kernel/debug/tracing",
- "/tracing",
- "/trace",
- 0,
-};
-
-static bool tracefs_found;
-
-bool tracefs_configured(void)
-{
- return tracefs_find_mountpoint() != NULL;
-}
-
-/* find the path to the mounted tracefs */
-const char *tracefs_find_mountpoint(void)
-{
- const char *ret;
-
- if (tracefs_found)
- return (const char *)tracefs_mountpoint;
-
- ret = find_mountpoint("tracefs", (long) TRACEFS_MAGIC,
- tracefs_mountpoint, PATH_MAX + 1,
- tracefs_known_mountpoints);
-
- if (ret)
- tracefs_found = true;
-
- return ret;
-}
-
-/* mount the tracefs somewhere if it's not mounted */
-char *tracefs_mount(const char *mountpoint)
-{
- /* see if it's already mounted */
- if (tracefs_find_mountpoint())
- goto out;
-
- /* if not mounted and no argument */
- if (mountpoint == NULL) {
- /* see if environment variable set */
- mountpoint = getenv(PERF_TRACEFS_ENVIRONMENT);
- /* if no environment variable, use default */
- if (mountpoint == NULL)
- mountpoint = TRACEFS_DEFAULT_PATH;
- }
-
- if (mount(NULL, mountpoint, "tracefs", 0, NULL) < 0)
- return NULL;
-
- /* save the mountpoint */
- tracefs_found = true;
- strncpy(tracefs_mountpoint, mountpoint, sizeof(tracefs_mountpoint));
-out:
- return tracefs_mountpoint;
-}
diff --git a/tools/lib/api/fs/tracefs.h b/tools/lib/api/fs/tracefs.h
deleted file mode 100644
index da780ac49acb..000000000000
--- a/tools/lib/api/fs/tracefs.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef __API_TRACEFS_H__
-#define __API_TRACEFS_H__
-
-#include "findfs.h"
-
-#ifndef TRACEFS_MAGIC
-#define TRACEFS_MAGIC 0x74726163
-#endif
-
-#ifndef PERF_TRACEFS_ENVIRONMENT
-#define PERF_TRACEFS_ENVIRONMENT "PERF_TRACEFS_DIR"
-#endif
-
-bool tracefs_configured(void);
-const char *tracefs_find_mountpoint(void);
-int tracefs_valid_mountpoint(const char *debugfs);
-char *tracefs_mount(const char *mountpoint);
-
-extern char tracefs_mountpoint[];
-
-#endif /* __API_DEBUGFS_H__ */
--
2.4.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/15] perf tools: Cleanup filesystem api Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +0200
[PATCH 01/15] perf tools: Fix parse_events_add_pmu caller Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +0200
Re: [PATCH 01/15] perf tools: Fix parse_events_add_pmu caller Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-02 15:10 +0200
Re: [PATCH 01/15] perf tools: Fix parse_events_add_pmu caller Jiri Olsa <jolsa@redhat.com> - 2015-09-02 15:40 +0200
[tip:perf/urgent] perf tools: Fix parse_events_add_pmu caller tip-bot for Jiri Olsa <tipbot@zytor.com> - 2015-09-05 16:10 +0200
[PATCH 06/15] tools lib api: Make tracing_path_strerror_open message generic Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +0200
Re: [PATCH 06/15] tools lib api: Make tracing_path_strerror_open message generic Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-02 15:20 +0200
Re: [PATCH 06/15] tools lib api: Make tracing_path_strerror_open message generic Jiri Olsa <jolsa@redhat.com> - 2015-09-02 15:50 +0200
Re: [PATCH 06/15] tools lib api: Make tracing_path_strerror_open message generic Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-02 16:20 +0200
[PATCH 02/15] perf tools: Remove mountpoint arg from perf_debugfs_mount Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +0200
[PATCH 11/15] tools lib api: Add mount support for fs Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +0200
Re: [PATCH 11/15] tools lib api: Add mount support for fs Raphaël Beamonte <raphael.beamonte@gmail.com> - 2015-09-04 16:20 +0200
Re: [PATCH 11/15] tools lib api: Add mount support for fs Steven Rostedt <rostedt@goodmis.org> - 2015-09-04 16:30 +0200
Re: [PATCH 11/15] tools lib api: Add mount support for fs Jiri Olsa <jolsa@redhat.com> - 2015-09-04 16:30 +0200
Re: [PATCH 11/15] tools lib api: Add mount support for fs Steven Rostedt <rostedt@goodmis.org> - 2015-09-04 17:00 +0200
Re: [PATCH 11/15] tools lib api: Add mount support for fs Steven Rostedt <rostedt@goodmis.org> - 2015-09-04 17:10 +0200
Re: [PATCH 11/15] tools lib api: Add mount support for fs Raphaël Beamonte <raphael.beamonte@gmail.com> - 2015-09-04 17:20 +0200
[PATCH 14/15] tools lib api: Remove debugfs, tracefs and findfs objects Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +0200
[PATCH 13/15] tools lib api: Replace debugfs/tracefs objects interface with fs.c Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +0200
[PATCH 08/15] tools lib api: Move SYSFS_MAGIC PROC_SUPER_MAGIC into fs.c Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +0200
[PATCH 12/15] tools lib api: Add configured support for fs Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +0200
Re: [PATCH 12/15] tools lib api: Add configured support for fs Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-02 15:40 +0200
Re: [PATCH 12/15] tools lib api: Add configured support for fs Jiri Olsa <jolsa@redhat.com> - 2015-09-02 15:50 +0200
Re: [PATCH 12/15] tools lib api: Add configured support for fs Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-02 16:20 +0200
Re: [PATCH 12/15] tools lib api: Add configured support for fs Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-02 19:00 +0200
Re: [PATCH 12/15] tools lib api: Add configured support for fs Jiri Olsa <jolsa@redhat.com> - 2015-09-04 09:10 +0200
Re: [PATCH 12/15] tools lib api: Add configured support for fs Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-04 18:50 +0200
Re: [PATCH 12/15] tools lib api: Add configured support for fs Jiri Olsa <jolsa@redhat.com> - 2015-09-04 19:50 +0200
Re: [PATCH 12/15] tools lib api: Add configured support for fs Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-02 15:50 +0200
[PATCH 09/15] tools lib api: Add debugfs into fs.c object Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +0200
[PATCH 10/15] tools lib api: Add tracefs into fs.c object Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +0200
[PATCH 15/15] perf tools: Switch to tracing_path interface on appropriate places Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +0200
[PATCH 04/15] perf tools: Move tracing_path interface into api/fs/tracing_path.c Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:00 +0200
Re: [PATCH 04/15] perf tools: Move tracing_path interface into api/fs/tracing_path.c Matt Fleming <matt@codeblueprint.co.uk> - 2015-09-04 13:40 +0200
Re: [PATCH 04/15] perf tools: Move tracing_path interface into api/fs/tracing_path.c Raphaël Beamonte <raphael.beamonte@gmail.com> - 2015-09-04 15:30 +0200
[PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:10 +0200
Re: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-02 15:20 +0200
Re: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object Matt Fleming <matt@codeblueprint.co.uk> - 2015-09-04 13:40 +0200
Re: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object Jiri Olsa <jolsa@redhat.com> - 2015-09-04 15:50 +0200
Re: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object Raphaël Beamonte <raphael.beamonte@gmail.com> - 2015-09-04 16:00 +0200
Re: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object Raphaël Beamonte <raphael.beamonte@gmail.com> - 2015-09-04 15:50 +0200
Re: [PATCH 00/15] perf tools: Cleanup filesystem api Jiri Olsa <jolsa@redhat.com> - 2015-09-02 10:10 +0200
[PATCH 03/15] perf tools: Move tracing_path stuff under same namespace Jiri Olsa <jolsa@kernel.org> - 2015-09-02 10:10 +0200
csiph-web