Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf fs: Rename NAME_find_mountpoint() to NAME__mountpoint()

Shorten it, "finding" it is an implementation detail, what callers want
is the pathname, not to ask for it to _always_ do the lookup.

And the existing implementation already caches it, i.e. it doesn't
"finds" it on every call.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-r24wa4bvtccg7mnkessrbbdj@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+16 -21
+2 -2
tools/perf/tests/parse-events.c
··· 1456 1456 int ret; 1457 1457 1458 1458 snprintf(path, PATH_MAX, "%s/bus/event_source/devices/cpu/format/", 1459 - sysfs_find_mountpoint()); 1459 + sysfs__mountpoint()); 1460 1460 1461 1461 ret = stat(path, &st); 1462 1462 if (ret) ··· 1473 1473 int ret; 1474 1474 1475 1475 snprintf(path, PATH_MAX, "%s/bus/event_source/devices/cpu/events/", 1476 - sysfs_find_mountpoint()); 1476 + sysfs__mountpoint()); 1477 1477 1478 1478 ret = stat(path, &st); 1479 1479 if (ret) {
+2 -2
tools/perf/util/cpumap.c
··· 216 216 217 217 cpu = map->map[idx]; 218 218 219 - mnt = sysfs_find_mountpoint(); 219 + mnt = sysfs__mountpoint(); 220 220 if (!mnt) 221 221 return -1; 222 222 ··· 279 279 280 280 cpu = map->map[idx]; 281 281 282 - mnt = sysfs_find_mountpoint(); 282 + mnt = sysfs__mountpoint(); 283 283 if (!mnt) 284 284 return -1; 285 285
+6 -6
tools/perf/util/fs.c
··· 88 88 return fs__read_mounts(fs) ? fs->path : NULL; 89 89 } 90 90 91 - static const char *fs__find_mountpoint(int idx) 91 + static const char *fs__mountpoint(int idx) 92 92 { 93 93 struct fs *fs = &fs__entries[idx]; 94 94 ··· 98 98 return fs__get_mountpoint(fs); 99 99 } 100 100 101 - #define FIND_MOUNTPOINT(name, idx) \ 102 - const char *name##_find_mountpoint(void) \ 103 - { \ 104 - return fs__find_mountpoint(idx); \ 101 + #define FS__MOUNTPOINT(name, idx) \ 102 + const char *name##__mountpoint(void) \ 103 + { \ 104 + return fs__mountpoint(idx); \ 105 105 } 106 106 107 - FIND_MOUNTPOINT(sysfs, FS__SYSFS); 107 + FS__MOUNTPOINT(sysfs, FS__SYSFS);
+1 -1
tools/perf/util/fs.h
··· 1 1 #ifndef __PERF_FS 2 2 #define __PERF_FS 3 3 4 - const char *sysfs_find_mountpoint(void); 4 + const char *sysfs__mountpoint(void); 5 5 6 6 #endif /* __PERF_FS */
+5 -10
tools/perf/util/pmu.c
··· 77 77 { 78 78 struct stat st; 79 79 char path[PATH_MAX]; 80 - const char *sysfs; 80 + const char *sysfs = sysfs__mountpoint(); 81 81 82 - sysfs = sysfs_find_mountpoint(); 83 82 if (!sysfs) 84 83 return -1; 85 84 ··· 165 166 { 166 167 struct stat st; 167 168 char path[PATH_MAX]; 168 - const char *sysfs; 169 + const char *sysfs = sysfs__mountpoint(); 169 170 170 - sysfs = sysfs_find_mountpoint(); 171 171 if (!sysfs) 172 172 return -1; 173 173 ··· 210 212 { 211 213 struct stat st; 212 214 char path[PATH_MAX]; 213 - const char *sysfs; 214 215 FILE *file; 215 216 int ret = 0; 217 + const char *sysfs = sysfs__mountpoint(); 216 218 217 - sysfs = sysfs_find_mountpoint(); 218 219 if (!sysfs) 219 220 return -1; 220 221 ··· 238 241 static void pmu_read_sysfs(void) 239 242 { 240 243 char path[PATH_MAX]; 241 - const char *sysfs; 242 244 DIR *dir; 243 245 struct dirent *dent; 246 + const char *sysfs = sysfs__mountpoint(); 244 247 245 - sysfs = sysfs_find_mountpoint(); 246 248 if (!sysfs) 247 249 return; 248 250 ··· 266 270 { 267 271 struct stat st; 268 272 char path[PATH_MAX]; 269 - const char *sysfs; 270 273 FILE *file; 271 274 struct cpu_map *cpus; 275 + const char *sysfs = sysfs__mountpoint(); 272 276 273 - sysfs = sysfs_find_mountpoint(); 274 277 if (!sysfs) 275 278 return NULL; 276 279