Commit 2837609fefbfe8f1248bfce09d9f0b44d5eb713d
Committed by
Arnaldo Carvalho de Melo
1 parent
e334c726ca
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
perf tools: Remove unused functions from debugfs object
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. Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1327674868-10486-3-git-send-email-jolsa@redhat.com Signed-off-by: Jiri Olsa <jolsa@redhat.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Showing 2 changed files with 0 additions and 147 deletions Side-by-side Diff
tools/perf/util/debugfs.c
... | ... | @@ -15,32 +15,6 @@ |
15 | 15 | 0, |
16 | 16 | }; |
17 | 17 | |
18 | -/* use this to force a umount */ | |
19 | -void debugfs_force_cleanup(void) | |
20 | -{ | |
21 | - debugfs_find_mountpoint(); | |
22 | - debugfs_premounted = 0; | |
23 | - debugfs_umount(); | |
24 | -} | |
25 | - | |
26 | -/* construct a full path to a debugfs element */ | |
27 | -int debugfs_make_path(const char *element, char *buffer, int size) | |
28 | -{ | |
29 | - int len; | |
30 | - | |
31 | - if (strlen(debugfs_mountpoint) == 0) { | |
32 | - buffer[0] = '\0'; | |
33 | - return -1; | |
34 | - } | |
35 | - | |
36 | - len = strlen(debugfs_mountpoint) + strlen(element) + 1; | |
37 | - if (len >= size) | |
38 | - return len+1; | |
39 | - | |
40 | - snprintf(buffer, size-1, "%s/%s", debugfs_mountpoint, element); | |
41 | - return 0; | |
42 | -} | |
43 | - | |
44 | 18 | static int debugfs_found; |
45 | 19 | |
46 | 20 | /* find the path to the mounted debugfs */ |
... | ... | @@ -97,17 +71,6 @@ |
97 | 71 | return 0; |
98 | 72 | } |
99 | 73 | |
100 | - | |
101 | -int debugfs_valid_entry(const char *path) | |
102 | -{ | |
103 | - struct stat st; | |
104 | - | |
105 | - if (stat(path, &st)) | |
106 | - return -errno; | |
107 | - | |
108 | - return 0; | |
109 | -} | |
110 | - | |
111 | 74 | static void debugfs_set_tracing_events_path(const char *mountpoint) |
112 | 75 | { |
113 | 76 | snprintf(tracing_events_path, sizeof(tracing_events_path), "%s/%s", |
... | ... | @@ -148,109 +111,5 @@ |
148 | 111 | { |
149 | 112 | snprintf(debugfs_mountpoint, sizeof(debugfs_mountpoint), "%s", mountpoint); |
150 | 113 | debugfs_set_tracing_events_path(mountpoint); |
151 | -} | |
152 | - | |
153 | -/* umount the debugfs */ | |
154 | - | |
155 | -int debugfs_umount(void) | |
156 | -{ | |
157 | - char umountcmd[128]; | |
158 | - int ret; | |
159 | - | |
160 | - /* if it was already mounted, leave it */ | |
161 | - if (debugfs_premounted) | |
162 | - return 0; | |
163 | - | |
164 | - /* make sure it's a valid mount point */ | |
165 | - ret = debugfs_valid_mountpoint(debugfs_mountpoint); | |
166 | - if (ret) | |
167 | - return ret; | |
168 | - | |
169 | - snprintf(umountcmd, sizeof(umountcmd), | |
170 | - "/bin/umount %s", debugfs_mountpoint); | |
171 | - return system(umountcmd); | |
172 | -} | |
173 | - | |
174 | -int debugfs_write(const char *entry, const char *value) | |
175 | -{ | |
176 | - char path[PATH_MAX + 1]; | |
177 | - int ret, count; | |
178 | - int fd; | |
179 | - | |
180 | - /* construct the path */ | |
181 | - snprintf(path, sizeof(path), "%s/%s", debugfs_mountpoint, entry); | |
182 | - | |
183 | - /* verify that it exists */ | |
184 | - ret = debugfs_valid_entry(path); | |
185 | - if (ret) | |
186 | - return ret; | |
187 | - | |
188 | - /* get how many chars we're going to write */ | |
189 | - count = strlen(value); | |
190 | - | |
191 | - /* open the debugfs entry */ | |
192 | - fd = open(path, O_RDWR); | |
193 | - if (fd < 0) | |
194 | - return -errno; | |
195 | - | |
196 | - while (count > 0) { | |
197 | - /* write it */ | |
198 | - ret = write(fd, value, count); | |
199 | - if (ret <= 0) { | |
200 | - if (ret == EAGAIN) | |
201 | - continue; | |
202 | - close(fd); | |
203 | - return -errno; | |
204 | - } | |
205 | - count -= ret; | |
206 | - } | |
207 | - | |
208 | - /* close it */ | |
209 | - close(fd); | |
210 | - | |
211 | - /* return success */ | |
212 | - return 0; | |
213 | -} | |
214 | - | |
215 | -/* | |
216 | - * read a debugfs entry | |
217 | - * returns the number of chars read or a negative errno | |
218 | - */ | |
219 | -int debugfs_read(const char *entry, char *buffer, size_t size) | |
220 | -{ | |
221 | - char path[PATH_MAX + 1]; | |
222 | - int ret; | |
223 | - int fd; | |
224 | - | |
225 | - /* construct the path */ | |
226 | - snprintf(path, sizeof(path), "%s/%s", debugfs_mountpoint, entry); | |
227 | - | |
228 | - /* verify that it exists */ | |
229 | - ret = debugfs_valid_entry(path); | |
230 | - if (ret) | |
231 | - return ret; | |
232 | - | |
233 | - /* open the debugfs entry */ | |
234 | - fd = open(path, O_RDONLY); | |
235 | - if (fd < 0) | |
236 | - return -errno; | |
237 | - | |
238 | - do { | |
239 | - /* read it */ | |
240 | - ret = read(fd, buffer, size); | |
241 | - if (ret == 0) { | |
242 | - close(fd); | |
243 | - return EOF; | |
244 | - } | |
245 | - } while (ret < 0 && errno == EAGAIN); | |
246 | - | |
247 | - /* close it */ | |
248 | - close(fd); | |
249 | - | |
250 | - /* make *sure* there's a null character at the end */ | |
251 | - buffer[ret] = '\0'; | |
252 | - | |
253 | - /* return the number of chars read */ | |
254 | - return ret; | |
255 | 114 | } |
tools/perf/util/debugfs.h
... | ... | @@ -3,14 +3,8 @@ |
3 | 3 | |
4 | 4 | const char *debugfs_find_mountpoint(void); |
5 | 5 | int debugfs_valid_mountpoint(const char *debugfs); |
6 | -int debugfs_valid_entry(const char *path); | |
7 | 6 | char *debugfs_mount(const char *mountpoint); |
8 | -int debugfs_umount(void); | |
9 | 7 | void debugfs_set_path(const char *mountpoint); |
10 | -int debugfs_write(const char *entry, const char *value); | |
11 | -int debugfs_read(const char *entry, char *buffer, size_t size); | |
12 | -void debugfs_force_cleanup(void); | |
13 | -int debugfs_make_path(const char *element, char *buffer, int size); | |
14 | 8 | |
15 | 9 | extern char debugfs_mountpoint[]; |
16 | 10 | extern char tracing_events_path[]; |