Skip to contentSkip to conversation

perf: Move fs.* to lib/api/fs/

PATCH New Borislav Petkov 1 participant 1 message Jan 25, 2014 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf: Move fs.* to lib/api/fs/

From: Borislav Petkov <[email protected]>

Move to generic library and kill magic.h as it is needed only in fs.h.

---
 tools/lib/api/Makefile                                     |  2 ++
 tools/{perf/util => lib/api/fs}/fs.c                       | 11 ++++++++---
 tools/{perf/util/include/linux/magic.h => lib/api/fs/fs.h} | 12 +++++-------
 tools/perf/Makefile.perf                                   |  3 ---
 tools/perf/tests/parse-events.c                            |  2 +-
 tools/perf/util/cpumap.c                                   |  2 +-
 tools/perf/util/fs.h                                       |  7 -------
 tools/perf/util/pmu.c                                      |  2 +-
 tools/perf/util/python-ext-sources                         |  2 +-
 tools/perf/util/record.c                                   |  2 +-
 tools/perf/util/util.c                                     |  2 +-
 11 files changed, 21 insertions(+), 26 deletions(-)
 rename tools/{perf/util => lib/api/fs}/fs.c (91%)
 rename tools/{perf/util/include/linux/magic.h => lib/api/fs/fs.h} (50%)
 delete mode 100644 tools/perf/util/fs.h
tools/lib/api/Makefile +2 -0
index ed2f51e11b80..ce00f7ee6455 100644
@@ -9,8 +9,10 @@ LIB_H=
 LIB_OBJS=
 
 LIB_H += fs/debugfs.h
+LIB_H += fs/fs.h
 
 LIB_OBJS += $(OUTPUT)fs/debugfs.o
+LIB_OBJS += $(OUTPUT)fs/fs.o
 
 LIBFILE = libapikfs.a
 
tools/lib/api/fs/fs.c renamed from tools/perf/util/fs.c +8 -3
similarity index 91%
rename from tools/perf/util/fs.c
rename to tools/lib/api/fs/fs.c
index f5be1f26e724..5b5eb788996e 100644
@@ -1,8 +1,13 @@
+/* TODO merge/factor in debugfs.c here */
 
-/* TODO merge/factor into tools/lib/lk/debugfs.c */
+#include <errno.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/vfs.h>
 
-#include "util.h"
-#include "util/fs.h"
+#include "debugfs.h"
+#include "fs.h"
 
 static const char * const sysfs__fs_known_mountpoints[] = {
 	"/sys",
tools/lib/api/fs/fs.h renamed from tools/perf/util/include/linux/magic.h +5 -7
similarity index 50%
rename from tools/perf/util/include/linux/magic.h
rename to tools/lib/api/fs/fs.h
index 07d63cf3e0f6..cb7049551f33 100644
@@ -1,9 +1,5 @@
-#ifndef _PERF_LINUX_MAGIC_H_
-#define _PERF_LINUX_MAGIC_H_
-
-#ifndef DEBUGFS_MAGIC
-#define DEBUGFS_MAGIC          0x64626720
-#endif
+#ifndef __API_FS__
+#define __API_FS__
 
 #ifndef SYSFS_MAGIC
 #define SYSFS_MAGIC            0x62656572
@@ -13,4 +9,6 @@
 #define PROC_SUPER_MAGIC       0x9fa0
 #endif
 
-#endif
+const char *sysfs__mountpoint(void);
+const char *procfs__mountpoint(void);
+#endif /* __API_FS__ */
tools/perf/Makefile.perf +0 -3
index 7257e7e9e38a..455008461c90 100644
@@ -218,7 +218,6 @@ LIB_H += util/include/linux/ctype.h
 LIB_H += util/include/linux/kernel.h
 LIB_H += util/include/linux/list.h
 LIB_H += util/include/linux/export.h
-LIB_H += util/include/linux/magic.h
 LIB_H += util/include/linux/poison.h
 LIB_H += util/include/linux/prefetch.h
 LIB_H += util/include/linux/rbtree.h
@@ -244,7 +243,6 @@ LIB_H += util/cache.h
 LIB_H += util/callchain.h
 LIB_H += util/build-id.h
 LIB_H += util/debug.h
-LIB_H += util/fs.h
 LIB_H += util/pmu.h
 LIB_H += util/event.h
 LIB_H += util/evsel.h
@@ -306,7 +304,6 @@ LIB_OBJS += $(OUTPUT)util/annotate.o
 LIB_OBJS += $(OUTPUT)util/build-id.o
 LIB_OBJS += $(OUTPUT)util/config.o
 LIB_OBJS += $(OUTPUT)util/ctype.o
-LIB_OBJS += $(OUTPUT)util/fs.o
 LIB_OBJS += $(OUTPUT)util/pmu.o
 LIB_OBJS += $(OUTPUT)util/environment.o
 LIB_OBJS += $(OUTPUT)util/event.o
tools/perf/tests/parse-events.c +1 -1
index 4db0ae617d70..8605ff5572ae 100644
@@ -2,7 +2,7 @@
 #include "parse-events.h"
 #include "evsel.h"
 #include "evlist.h"
-#include "fs.h"
+#include <api/fs/fs.h>
 #include <api/fs/debugfs.h>
 #include "tests.h"
 #include <linux/hw_breakpoint.h>
tools/perf/util/cpumap.c +1 -1
index a9b48c42e81e..7fe4994eeb63 100644
@@ -1,5 +1,5 @@
 #include "util.h"
-#include "fs.h"
+#include <api/fs/fs.h>
 #include "../perf.h"
 #include "cpumap.h"
 #include <assert.h>
tools/perf/util/fs.h deleted +0 -7
deleted file mode 100644
index 5e09ce1bab0e..000000000000
@@ -1,7 +0,0 @@
-#ifndef __PERF_FS
-#define __PERF_FS
-
-const char *sysfs__mountpoint(void);
-const char *procfs__mountpoint(void);
-
-#endif /* __PERF_FS */
tools/perf/util/pmu.c +1 -1
index b752ecb40d86..00a7dcb2f55c 100644
@@ -3,7 +3,7 @@
 #include <unistd.h>
 #include <stdio.h>
 #include <dirent.h>
-#include "fs.h"
+#include <api/fs/fs.h>
 #include <locale.h>
 #include "util.h"
 #include "pmu.h"
tools/perf/util/python-ext-sources +1 -1
index 595bfc73d2ed..16a475a7d492 100644
@@ -17,6 +17,6 @@ util/xyarray.c
 util/cgroup.c
 util/rblist.c
 util/strlist.c
-util/fs.c
+../lib/api/fs/fs.c
 util/trace-event.c
 ../../lib/rbtree.c
tools/perf/util/record.c +1 -1
index 373762501dad..049e0a09ccd3 100644
@@ -2,7 +2,7 @@
 #include "evsel.h"
 #include "cpumap.h"
 #include "parse-events.h"
-#include "fs.h"
+#include <api/fs/fs.h>
 #include "util.h"
 
 typedef void (*setup_probe_fn_t)(struct perf_evsel *evsel);
tools/perf/util/util.c +1 -1
index 42ad667bb317..9f66549562bd 100644
@@ -1,6 +1,6 @@
 #include "../perf.h"
 #include "util.h"
-#include "fs.h"
+#include <api/fs/fs.h>
 #include <sys/mman.h>
 #ifdef HAVE_BACKTRACE_SUPPORT
 #include <execinfo.h>
Signature · 1 line
1.8.5.2.192.g7794a68