diff options
| author | Olof Johansson <olof@lixom.net> | 2013-11-15 18:17:59 -0500 |
|---|---|---|
| committer | Olof Johansson <olof@lixom.net> | 2013-11-15 18:17:59 -0500 |
| commit | 6886059f2ef5d62c73e87a905e84fa4f87d56074 (patch) | |
| tree | dfe6e1611d7c50057df52db7b55eafbfb8e33a93 /tools/perf/util/sysfs.c | |
| parent | ca439c9b983ffa14e9eae6030e3ee80ad039388f (diff) | |
| parent | 26273e02a0cf18eb72416559310d3294390a9024 (diff) | |
Merge tag 'omap-for-v3.13/fixes-for-merge-window-take2' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into fixes
Few clock fixes, a runtime PM fix, and pinctrl-single fix along
with few other fixes that popped up during the merge window.
* tag 'omap-for-v3.13/fixes-for-merge-window-take2' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap:
ARM: OMAP2+: Fix build for dra7xx without omap4 and 5
ARM: OMAP2+: omap_device: maintain sane runtime pm status around suspend/resume
doc: devicetree: Add bindings documentation for omap-des driver
ARM: dts: doc: Document missing compatible property for omap-sham driver
ARM: OMAP3: Beagle: fix return value check in beagle_opp_init()
ARM: OMAP: devicetree: fix SPI node compatible property syntax items
pinctrl: single: call pcs_soc->rearm() whenever IRQ mask is changed
ARM: OMAP2+: smsc911x: fix return value check in gpmc_smsc911x_init()
+ sync with newer trunk
Diffstat (limited to 'tools/perf/util/sysfs.c')
| -rw-r--r-- | tools/perf/util/sysfs.c | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/tools/perf/util/sysfs.c b/tools/perf/util/sysfs.c deleted file mode 100644 index f71e9eafe15a..000000000000 --- a/tools/perf/util/sysfs.c +++ /dev/null | |||
| @@ -1,60 +0,0 @@ | |||
| 1 | |||
| 2 | #include "util.h" | ||
| 3 | #include "sysfs.h" | ||
| 4 | |||
| 5 | static const char * const sysfs_known_mountpoints[] = { | ||
| 6 | "/sys", | ||
| 7 | 0, | ||
| 8 | }; | ||
| 9 | |||
| 10 | static int sysfs_found; | ||
| 11 | char sysfs_mountpoint[PATH_MAX + 1]; | ||
| 12 | |||
| 13 | static int sysfs_valid_mountpoint(const char *sysfs) | ||
| 14 | { | ||
| 15 | struct statfs st_fs; | ||
| 16 | |||
| 17 | if (statfs(sysfs, &st_fs) < 0) | ||
| 18 | return -ENOENT; | ||
| 19 | else if (st_fs.f_type != (long) SYSFS_MAGIC) | ||
| 20 | return -ENOENT; | ||
| 21 | |||
| 22 | return 0; | ||
| 23 | } | ||
| 24 | |||
| 25 | const char *sysfs_find_mountpoint(void) | ||
| 26 | { | ||
| 27 | const char * const *ptr; | ||
| 28 | char type[100]; | ||
| 29 | FILE *fp; | ||
| 30 | |||
| 31 | if (sysfs_found) | ||
| 32 | return (const char *) sysfs_mountpoint; | ||
| 33 | |||
| 34 | ptr = sysfs_known_mountpoints; | ||
| 35 | while (*ptr) { | ||
| 36 | if (sysfs_valid_mountpoint(*ptr) == 0) { | ||
| 37 | sysfs_found = 1; | ||
| 38 | strcpy(sysfs_mountpoint, *ptr); | ||
| 39 | return sysfs_mountpoint; | ||
| 40 | } | ||
| 41 | ptr++; | ||
| 42 | } | ||
| 43 | |||
| 44 | /* give up and parse /proc/mounts */ | ||
| 45 | fp = fopen("/proc/mounts", "r"); | ||
| 46 | if (fp == NULL) | ||
| 47 | return NULL; | ||
| 48 | |||
| 49 | while (!sysfs_found && | ||
| 50 | fscanf(fp, "%*s %" STR(PATH_MAX) "s %99s %*s %*d %*d\n", | ||
| 51 | sysfs_mountpoint, type) == 2) { | ||
| 52 | |||
| 53 | if (strcmp(type, "sysfs") == 0) | ||
| 54 | sysfs_found = 1; | ||
| 55 | } | ||
| 56 | |||
| 57 | fclose(fp); | ||
| 58 | |||
| 59 | return sysfs_found ? sysfs_mountpoint : NULL; | ||
| 60 | } | ||
