linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: acme@redhat.com, a.p.zijlstra@chello.nl, mingo@elte.hu,
	paulus@samba.org, cjashfor@linux.vnet.ibm.com
Cc: linux-kernel@vger.kernel.org, Jiri Olsa <jolsa@redhat.com>
Subject: [PATCH 2/9] perf, tool: Remove unused functions from debugfs object
Date: Fri, 27 Jan 2012 15:34:21 +0100	[thread overview]
Message-ID: <1327674868-10486-3-git-send-email-jolsa@redhat.com> (raw)
In-Reply-To: <1327674868-10486-1-git-send-email-jolsa@redhat.com>

Following debugfs object functions are not referenced
within the code:

  int debugfs_valid_entry(const char *path);
  int debugfs_umount(void);
  int debugfs_write(const char *entry, const char *value);
  int debugfs_read(const char *entry, char *buffer, size_t size);
  void debugfs_force_cleanup(void);
  int debugfs_make_path(const char *element, char *buffer, int size);

Removing them.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 tools/perf/util/debugfs.c |  141 ---------------------------------------------
 tools/perf/util/debugfs.h |    6 --
 2 files changed, 0 insertions(+), 147 deletions(-)

diff --git a/tools/perf/util/debugfs.c b/tools/perf/util/debugfs.c
index ffc35e7..dd8b193 100644
--- a/tools/perf/util/debugfs.c
+++ b/tools/perf/util/debugfs.c
@@ -15,32 +15,6 @@ static const char *debugfs_known_mountpoints[] = {
 	0,
 };
 
-/* use this to force a umount */
-void debugfs_force_cleanup(void)
-{
-	debugfs_find_mountpoint();
-	debugfs_premounted = 0;
-	debugfs_umount();
-}
-
-/* construct a full path to a debugfs element */
-int debugfs_make_path(const char *element, char *buffer, int size)
-{
-	int len;
-
-	if (strlen(debugfs_mountpoint) == 0) {
-		buffer[0] = '\0';
-		return -1;
-	}
-
-	len = strlen(debugfs_mountpoint) + strlen(element) + 1;
-	if (len >= size)
-		return len+1;
-
-	snprintf(buffer, size-1, "%s/%s", debugfs_mountpoint, element);
-	return 0;
-}
-
 static int debugfs_found;
 
 /* find the path to the mounted debugfs */
@@ -97,17 +71,6 @@ int debugfs_valid_mountpoint(const char *debugfs)
 	return 0;
 }
 
-
-int debugfs_valid_entry(const char *path)
-{
-	struct stat st;
-
-	if (stat(path, &st))
-		return -errno;
-
-	return 0;
-}
-
 static void debugfs_set_tracing_events_path(const char *mountpoint)
 {
 	snprintf(tracing_events_path, sizeof(tracing_events_path), "%s/%s",
@@ -149,107 +112,3 @@ void debugfs_set_path(const char *mountpoint)
 	snprintf(debugfs_mountpoint, sizeof(debugfs_mountpoint), "%s", mountpoint);
 	debugfs_set_tracing_events_path(mountpoint);
 }
-
-/* umount the debugfs */
-
-int debugfs_umount(void)
-{
-	char umountcmd[128];
-	int ret;
-
-	/* if it was already mounted, leave it */
-	if (debugfs_premounted)
-		return 0;
-
-	/* make sure it's a valid mount point */
-	ret = debugfs_valid_mountpoint(debugfs_mountpoint);
-	if (ret)
-		return ret;
-
-	snprintf(umountcmd, sizeof(umountcmd),
-		 "/bin/umount %s", debugfs_mountpoint);
-	return system(umountcmd);
-}
-
-int debugfs_write(const char *entry, const char *value)
-{
-	char path[PATH_MAX + 1];
-	int ret, count;
-	int fd;
-
-	/* construct the path */
-	snprintf(path, sizeof(path), "%s/%s", debugfs_mountpoint, entry);
-
-	/* verify that it exists */
-	ret = debugfs_valid_entry(path);
-	if (ret)
-		return ret;
-
-	/* get how many chars we're going to write */
-	count = strlen(value);
-
-	/* open the debugfs entry */
-	fd = open(path, O_RDWR);
-	if (fd < 0)
-		return -errno;
-
-	while (count > 0) {
-		/* write it */
-		ret = write(fd, value, count);
-		if (ret <= 0) {
-			if (ret == EAGAIN)
-				continue;
-			close(fd);
-			return -errno;
-		}
-		count -= ret;
-	}
-
-	/* close it */
-	close(fd);
-
-	/* return success */
-	return 0;
-}
-
-/*
- * read a debugfs entry
- * returns the number of chars read or a negative errno
- */
-int debugfs_read(const char *entry, char *buffer, size_t size)
-{
-	char path[PATH_MAX + 1];
-	int ret;
-	int fd;
-
-	/* construct the path */
-	snprintf(path, sizeof(path), "%s/%s", debugfs_mountpoint, entry);
-
-	/* verify that it exists */
-	ret = debugfs_valid_entry(path);
-	if (ret)
-		return ret;
-
-	/* open the debugfs entry */
-	fd = open(path, O_RDONLY);
-	if (fd < 0)
-		return -errno;
-
-	do {
-		/* read it */
-		ret = read(fd, buffer, size);
-		if (ret == 0) {
-			close(fd);
-			return EOF;
-		}
-	} while (ret < 0 && errno == EAGAIN);
-
-	/* close it */
-	close(fd);
-
-	/* make *sure* there's a null character at the end */
-	buffer[ret] = '\0';
-
-	/* return the number of chars read */
-	return ret;
-}
diff --git a/tools/perf/util/debugfs.h b/tools/perf/util/debugfs.h
index 4a878f7..68f3e87 100644
--- a/tools/perf/util/debugfs.h
+++ b/tools/perf/util/debugfs.h
@@ -3,14 +3,8 @@
 
 const char *debugfs_find_mountpoint(void);
 int debugfs_valid_mountpoint(const char *debugfs);
-int debugfs_valid_entry(const char *path);
 char *debugfs_mount(const char *mountpoint);
-int debugfs_umount(void);
 void debugfs_set_path(const char *mountpoint);
-int debugfs_write(const char *entry, const char *value);
-int debugfs_read(const char *entry, char *buffer, size_t size);
-void debugfs_force_cleanup(void);
-int debugfs_make_path(const char *element, char *buffer, int size);
 
 extern char debugfs_mountpoint[];
 extern char tracing_events_path[];
-- 
1.7.4.4


  parent reply	other threads:[~2012-01-27 14:34 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-15 15:30 [RFC 0/3] perf tool: Add new event group management Jiri Olsa
2011-12-15 15:30 ` [PATCH 1/3] perf, tool: Add parser generator for events parsing Jiri Olsa
2011-12-16 14:02   ` Peter Zijlstra
2011-12-16 14:03     ` Peter Zijlstra
2011-12-20 10:31       ` Jiri Olsa
2011-12-20 10:47         ` Peter Zijlstra
2011-12-20 11:30           ` Peter Zijlstra
2011-12-20 11:39             ` Peter Zijlstra
2011-12-21 16:16               ` new syntax for perf event Jiri Olsa
2012-01-05  9:17                 ` Jiri Olsa
2012-01-05 14:10                 ` Peter Zijlstra
2012-01-09 15:28                   ` Jiri Olsa
2012-01-09 15:43                     ` Peter Zijlstra
2012-01-16 12:31                     ` [RFCv3 0/9] perf tool: parser generator for events parsing Jiri Olsa
2012-01-16 12:31                       ` [PATCH 1/9] perf, tool: Make perf_evlist__splice_list_tail global Jiri Olsa
2012-01-16 12:31                       ` [PATCH 2/9] perf, tool: Remove unused functions from debugfs object Jiri Olsa
2012-01-16 12:31                       ` [PATCH 3/9] perf, tool: Add sysfs mountpoint interface Jiri Olsa
2012-01-16 12:31                       ` [PATCH 4/9] perf, tool: Add bitmap_or function into bitmap object Jiri Olsa
2012-01-16 12:31                       ` [PATCH 5/9] perf: Add sysfs format attribute for pmu device Jiri Olsa
2012-01-23 15:13                         ` Eric W. Biederman
2012-01-23 15:33                           ` Jiri Olsa
2012-01-24 15:22                             ` Peter Zijlstra
2012-01-24 19:40                               ` Eric W. Biederman
2012-01-25  8:54                                 ` Jiri Olsa
2012-01-26 16:26                         ` Peter Zijlstra
2012-01-27 12:32                           ` Jiri Olsa
2012-01-16 12:31                       ` [PATCH 6/9] perf, tool: Add parser generator for events parsing Jiri Olsa
2012-01-24 16:02                         ` Peter Zijlstra
2012-01-25  8:42                           ` Jiri Olsa
2012-01-16 12:31                       ` [PATCH 7/9] perf, tool: Add config options support for event parsing Jiri Olsa
2012-01-16 12:31                       ` [PATCH 8/9] perf, tool: Add perf pmu object to access pmu format definition Jiri Olsa
2012-01-16 12:31                       ` [PATCH 9/9] perf, tool: Add support to specify pmu style event Jiri Olsa
2012-01-24 15:22                       ` [RFCv3 0/9] perf tool: parser generator for events parsing Peter Zijlstra
2012-01-24 16:26                       ` Peter Zijlstra
2012-01-25  0:53                         ` Greg KH
2012-01-25 10:49                           ` Peter Zijlstra
2012-01-25 14:37                             ` Jiri Olsa
2012-01-26 16:23                               ` Peter Zijlstra
2012-01-26 16:27                                 ` Greg KH
2012-01-25 17:01                             ` Greg KH
2012-01-27 14:34                       ` [PATCHv4 " Jiri Olsa
2012-01-27 14:34                         ` [PATCH 1/9] perf, tool: Make perf_evlist__splice_list_tail global Jiri Olsa
2012-02-07 19:31                           ` [tip:perf/core] perf evlist: Make splice_list_tail method public tip-bot for Jiri Olsa
2012-01-27 14:34                         ` Jiri Olsa [this message]
2012-02-17  9:51                           ` [tip:perf/core] perf tools: Remove unused functions from debugfs object tip-bot for Jiri Olsa
2012-01-27 14:34                         ` [PATCH 3/9] perf, tool: Add sysfs mountpoint interface Jiri Olsa
2012-02-17  9:52                           ` [tip:perf/core] perf tools: " tip-bot for Jiri Olsa
2012-01-27 14:34                         ` [PATCH 4/9] perf, tool: Add bitmap_or function into bitmap object Jiri Olsa
2012-02-17  9:53                           ` [tip:perf/core] perf tools: " tip-bot for Jiri Olsa
2012-01-27 14:34                         ` [PATCH 5/9] perf: Adding sysfs group format attribute for pmu device Jiri Olsa
2012-01-27 21:08                           ` Corey Ashford
2012-01-27 21:19                             ` Peter Zijlstra
2012-02-01  0:47                               ` Corey Ashford
2012-01-30  9:52                             ` Jiri Olsa
2012-02-01  1:25                               ` Corey Ashford
2012-02-01 13:13                                 ` Jiri Olsa
2012-02-01 14:18                                   ` Peter Zijlstra
2012-02-01 14:31                                     ` Jiri Olsa
2012-02-01 14:40                                       ` Peter Zijlstra
2012-02-01 13:36                                 ` Peter Zijlstra
2012-02-02  0:33                                   ` Corey Ashford
2012-01-27 14:34                         ` [PATCH 6/9] perf, tool: Add parser generator for events parsing Jiri Olsa
2012-01-27 14:34                         ` [PATCH 7/9] perf, tool: Add config options support for event parsing Jiri Olsa
2012-01-27 14:34                         ` [PATCH 8/9] perf, tool: Add perf pmu object to access pmu format definition Jiri Olsa
2012-01-27 14:34                         ` [PATCH 9/9] perf, tool: Add support to specify pmu style event Jiri Olsa
2012-02-13 13:13                         ` [PATCHv4 0/9] perf tool: parser generator for events parsing Jiri Olsa
2012-02-14 16:28                         ` Peter Zijlstra
2012-02-14 16:43                           ` Peter Zijlstra
2012-02-14 20:20                             ` Peter Zijlstra
2012-02-14 20:57                               ` Peter Zijlstra
2012-02-14 21:03                                 ` Peter Zijlstra
2012-02-15  9:24                                   ` Jiri Olsa
2012-02-15 11:18                                     ` Peter Zijlstra
2012-02-15 13:32                                       ` Jiri Olsa
2012-02-15 13:39                                         ` Peter Zijlstra
2012-02-15  9:04                                 ` Jiri Olsa
2012-02-15 11:03                                   ` Peter Zijlstra
2011-12-22 19:32             ` [PATCH 1/3] perf, tool: Add " Vince Weaver
2011-12-19 14:37     ` Jiri Olsa
2011-12-20 10:29     ` [PATCHv2 0/2] perf tool: " Jiri Olsa
2011-12-20 10:29       ` [PATCHv2 1/2] perf, tool: Add " Jiri Olsa
2011-12-20 10:29       ` [PATCHv2 2/2] perf, tool: Add more automated tests for event parsing Jiri Olsa
2011-12-20 17:37   ` [PATCH 1/3] perf, tool: Add parser generator for events parsing Arnaldo Carvalho de Melo
2011-12-21  9:55     ` Jiri Olsa
2011-12-15 15:30 ` [PATCH 2/3] perf, tool: Add new event group management Jiri Olsa
2011-12-20 17:47   ` Arnaldo Carvalho de Melo
2011-12-20 21:20     ` Peter Zijlstra
2011-12-21 11:54       ` Arnaldo Carvalho de Melo
2011-12-15 15:30 ` [PATCH 3/3] perf, tool: Add more automated tests for event parsing Jiri Olsa
2011-12-20 17:38   ` Arnaldo Carvalho de Melo
2011-12-21  8:47   ` [tip:perf/core] perf test: " tip-bot for Jiri Olsa

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=1327674868-10486-3-git-send-email-jolsa@redhat.com \
    --to=jolsa@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=cjashfor@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.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).