All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -v1.1 0/2] perf tool: Carve out fs.* stuff
@ 2013-12-09 16:14 Borislav Petkov
  2013-12-09 16:14 ` [PATCH 1/2] tools/: Convert to new topic libraries Borislav Petkov
  2013-12-09 16:14 ` [PATCH 2/2] perf: Move fs.* to lib/api/fs/ Borislav Petkov
  0 siblings, 2 replies; 20+ messages in thread
From: Borislav Petkov @ 2013-12-09 16:14 UTC (permalink / raw)
  To: LKML
  Cc: Borislav Petkov, Arnaldo Carvalho de Melo, Ingo Molnar,
	Jiri Olsa, Peter Zijlstra, Robert Richter, David Ahern,
	Adrian Hunter, Namhyung Kim, Steven Rostedt, Stanislav Fomichev,
	Stephane Eranian, Andi Kleen, Arjan van de Ven,
	Frederic Weisbecker, Mike Galbraith, Pekka Enberg,
	Paul Mackerras

From: Borislav Petkov <bp@suse.de>

v1 -> v1.1:

* take care of some build nuisances and review comments caught by jolsa
and David Ahern. Fixup the doc cleaning target in Makefile.perf, while
at it.

v1:

step one: carve out fs-related stuff into a libapikfs.a library.

Borislav Petkov (2):
  tools/: Convert to new topic libraries
  perf: Move fs.* to lib/api/fs/

 tools/Makefile                                     | 12 ++++----
 tools/lib/{lk => api}/Makefile                     | 20 +++++++-----
 tools/lib/{lk => api/fs}/debugfs.c                 |  0
 tools/lib/{lk => api/fs}/debugfs.h                 |  6 ++--
 tools/{perf/util => lib/api/fs}/fs.c               | 11 +++++--
 .../util/include/linux/magic.h => lib/api/fs/fs.h} | 12 +++-----
 tools/perf/Makefile.perf                           | 36 ++++++++++------------
 tools/perf/builtin-kvm.c                           |  2 +-
 tools/perf/builtin-probe.c                         |  2 +-
 tools/perf/perf.c                                  |  2 +-
 tools/perf/tests/parse-events.c                    |  4 +--
 tools/perf/util/cpumap.c                           |  2 +-
 tools/perf/util/evlist.c                           |  2 +-
 tools/perf/util/evsel.c                            |  2 +-
 tools/perf/util/fs.h                               |  7 -----
 tools/perf/util/parse-events.c                     |  2 +-
 tools/perf/util/pmu.c                              |  2 +-
 tools/perf/util/probe-event.c                      |  2 +-
 tools/perf/util/python-ext-sources                 |  2 +-
 tools/perf/util/record.c                           |  2 +-
 tools/perf/util/setup.py                           |  4 +--
 tools/perf/util/trace-event-info.c                 |  2 +-
 tools/perf/util/util.h                             |  2 +-
 tools/vm/Makefile                                  | 14 ++++-----
 tools/vm/page-types.c                              |  2 +-
 25 files changed, 76 insertions(+), 78 deletions(-)
 rename tools/lib/{lk => api}/Makefile (64%)
 rename tools/lib/{lk => api/fs}/debugfs.c (100%)
 rename tools/lib/{lk => api/fs}/debugfs.h (86%)
 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

-- 
1.8.4


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 1/2] tools/: Convert to new topic libraries
  2013-12-09 16:14 [PATCH -v1.1 0/2] perf tool: Carve out fs.* stuff Borislav Petkov
@ 2013-12-09 16:14 ` Borislav Petkov
  2013-12-10  1:32   ` Namhyung Kim
                     ` (2 more replies)
  2013-12-09 16:14 ` [PATCH 2/2] perf: Move fs.* to lib/api/fs/ Borislav Petkov
  1 sibling, 3 replies; 20+ messages in thread
From: Borislav Petkov @ 2013-12-09 16:14 UTC (permalink / raw)
  To: LKML
  Cc: Borislav Petkov, Arnaldo Carvalho de Melo, Ingo Molnar,
	Jiri Olsa, Peter Zijlstra, Robert Richter, David Ahern,
	Adrian Hunter, Namhyung Kim, Steven Rostedt, Stanislav Fomichev,
	Stephane Eranian, Andi Kleen, Arjan van de Ven,
	Frederic Weisbecker, Mike Galbraith, Pekka Enberg,
	Paul Mackerras

From: Borislav Petkov <bp@suse.de>

Move debugfs.* to api/fs/. We have a common tools/lib/api/ place
where the Makefile lives and then we place the headers in subdirs.
For example, all the fs-related stuff goes to tools/lib/api/fs/ from
which we get libapikfs.a (acme got almost the naming he wanted :-))
and we link it into the tools which need it - in this case perf and
tools/vm/page-types.

acme:

"Looking at the implementation, I think some tools can even link
directly to the .o files, avoiding the .a file altogether.

But that is just an optimization/finer granularity tools/lib/
cherrypicking that toolers can make use of."

Fixup documentation cleaning target while at it.

Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
---
 tools/Makefile                     | 12 ++++++------
 tools/lib/{lk => api}/Makefile     | 18 +++++++++++-------
 tools/lib/{lk => api/fs}/debugfs.c |  0
 tools/lib/{lk => api/fs}/debugfs.h |  6 +++---
 tools/perf/Makefile.perf           | 33 ++++++++++++++++-----------------
 tools/perf/builtin-kvm.c           |  2 +-
 tools/perf/builtin-probe.c         |  2 +-
 tools/perf/perf.c                  |  2 +-
 tools/perf/tests/parse-events.c    |  2 +-
 tools/perf/util/evlist.c           |  2 +-
 tools/perf/util/evsel.c            |  2 +-
 tools/perf/util/parse-events.c     |  2 +-
 tools/perf/util/probe-event.c      |  2 +-
 tools/perf/util/setup.py           |  4 ++--
 tools/perf/util/trace-event-info.c |  2 +-
 tools/perf/util/util.h             |  2 +-
 tools/vm/Makefile                  | 14 +++++++-------
 tools/vm/page-types.c              |  2 +-
 18 files changed, 56 insertions(+), 53 deletions(-)
 rename tools/lib/{lk => api}/Makefile (66%)
 rename tools/lib/{lk => api/fs}/debugfs.c (100%)
 rename tools/lib/{lk => api/fs}/debugfs.h (86%)

diff --git a/tools/Makefile b/tools/Makefile
index a9b02008443c..927cd46d36dc 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -39,10 +39,10 @@ cpupower: FORCE
 cgroup firewire guest usb virtio vm net: FORCE
 	$(call descend,$@)
 
-liblk: FORCE
-	$(call descend,lib/lk)
+libapikfs: FORCE
+	$(call descend,lib/api)
 
-perf: liblk FORCE
+perf: libapikfs FORCE
 	$(call descend,$@)
 
 selftests: FORCE
@@ -80,10 +80,10 @@ cpupower_clean:
 cgroup_clean firewire_clean lguest_clean usb_clean virtio_clean vm_clean net_clean:
 	$(call descend,$(@:_clean=),clean)
 
-liblk_clean:
-	$(call descend,lib/lk,clean)
+libapikfs_clean:
+	$(call descend,lib/api,clean)
 
-perf_clean: liblk_clean
+perf_clean: libapikfs_clean
 	$(call descend,$(@:_clean=),clean)
 
 selftests_clean:
diff --git a/tools/lib/lk/Makefile b/tools/lib/api/Makefile
similarity index 66%
rename from tools/lib/lk/Makefile
rename to tools/lib/api/Makefile
index 3dba0a4aebbf..ed2f51e11b80 100644
--- a/tools/lib/lk/Makefile
+++ b/tools/lib/api/Makefile
@@ -1,4 +1,5 @@
 include ../../scripts/Makefile.include
+include ../../perf/config/utilities.mak		# QUIET_CLEAN
 
 CC = $(CROSS_COMPILE)gcc
 AR = $(CROSS_COMPILE)ar
@@ -7,11 +8,11 @@ AR = $(CROSS_COMPILE)ar
 LIB_H=
 LIB_OBJS=
 
-LIB_H += debugfs.h
+LIB_H += fs/debugfs.h
 
-LIB_OBJS += $(OUTPUT)debugfs.o
+LIB_OBJS += $(OUTPUT)fs/debugfs.o
 
-LIBFILE = liblk.a
+LIBFILE = libapikfs.a
 
 CFLAGS = -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) -fPIC
 EXTLIBS = -lelf -lpthread -lrt -lm
@@ -25,14 +26,17 @@ $(LIBFILE): $(LIB_OBJS)
 
 $(LIB_OBJS): $(LIB_H)
 
-$(OUTPUT)%.o: %.c
+libapi_dirs:
+	$(QUIET_MKDIR)mkdir -p $(OUTPUT)fs/
+
+$(OUTPUT)%.o: %.c libapi_dirs
 	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
-$(OUTPUT)%.s: %.c
+$(OUTPUT)%.s: %.c libapi_dirs
 	$(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
-$(OUTPUT)%.o: %.S
+$(OUTPUT)%.o: %.S libapi_dirs
 	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
 
 clean:
-	$(RM) $(LIB_OBJS) $(LIBFILE)
+	$(call QUIET_CLEAN, libapi) $(RM) $(LIB_OBJS) $(LIBFILE)
 
 .PHONY: clean
diff --git a/tools/lib/lk/debugfs.c b/tools/lib/api/fs/debugfs.c
similarity index 100%
rename from tools/lib/lk/debugfs.c
rename to tools/lib/api/fs/debugfs.c
diff --git a/tools/lib/lk/debugfs.h b/tools/lib/api/fs/debugfs.h
similarity index 86%
rename from tools/lib/lk/debugfs.h
rename to tools/lib/api/fs/debugfs.h
index 935c59bdb442..f19d3df9609d 100644
--- a/tools/lib/lk/debugfs.h
+++ b/tools/lib/api/fs/debugfs.h
@@ -1,5 +1,5 @@
-#ifndef __LK_DEBUGFS_H__
-#define __LK_DEBUGFS_H__
+#ifndef __API_DEBUGFS_H__
+#define __API_DEBUGFS_H__
 
 #define _STR(x) #x
 #define STR(x) _STR(x)
@@ -26,4 +26,4 @@ char *debugfs_mount(const char *mountpoint);
 
 extern char debugfs_mountpoint[];
 
-#endif /* __LK_DEBUGFS_H__ */
+#endif /* __API_DEBUGFS_H__ */
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index ca3b87d5389a..532e5f21b918 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -86,7 +86,7 @@ FLEX    = flex
 BISON   = bison
 STRIP   = strip
 
-LK_DIR          = $(srctree)/tools/lib/lk/
+LIB_DIR          = $(srctree)/tools/lib/api/
 TRACE_EVENT_DIR = $(srctree)/tools/lib/traceevent/
 
 # include config/Makefile by default and rule out
@@ -127,20 +127,20 @@ strip-libs = $(filter-out -l%,$(1))
 ifneq ($(OUTPUT),)
   TE_PATH=$(OUTPUT)
 ifneq ($(subdir),)
-  LK_PATH=$(OUTPUT)/../lib/lk/
+  LIB_PATH=$(OUTPUT)/../lib/api/
 else
-  LK_PATH=$(OUTPUT)
+  LIB_PATH=$(OUTPUT)
 endif
 else
   TE_PATH=$(TRACE_EVENT_DIR)
-  LK_PATH=$(LK_DIR)
+  LIB_PATH=$(LIB_DIR)
 endif
 
 LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
 export LIBTRACEEVENT
 
-LIBLK = $(LK_PATH)liblk.a
-export LIBLK
+LIBAPIKFS = $(LIB_PATH)libapikfs.a
+export LIBAPIKFS
 
 # python extension build directories
 PYTHON_EXTBUILD     := $(OUTPUT)python_ext_build/
@@ -151,7 +151,7 @@ export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
 python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf.so
 
 PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
-PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) $(LIBLK)
+PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) $(LIBAPIKFS)
 
 $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS)
 	$(QUIET_GEN)CFLAGS='$(CFLAGS)' $(PYTHON_WORD) util/setup.py \
@@ -439,7 +439,7 @@ BUILTIN_OBJS += $(OUTPUT)builtin-inject.o
 BUILTIN_OBJS += $(OUTPUT)tests/builtin-test.o
 BUILTIN_OBJS += $(OUTPUT)builtin-mem.o
 
-PERFLIBS = $(LIB_FILE) $(LIBLK) $(LIBTRACEEVENT)
+PERFLIBS = $(LIB_FILE) $(LIBAPIKFS) $(LIBTRACEEVENT)
 
 # We choose to avoid "if .. else if .. else .. endif endif"
 # because maintaining the nesting to match is a pain.  If
@@ -725,19 +725,19 @@ $(LIBTRACEEVENT)-clean:
 install-traceevent-plugins:
 	$(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) install_plugins
 
-LIBLK_SOURCES = $(wildcard $(LK_PATH)*.[ch])
+LIBAPIKFS_SOURCES = $(wildcard $(LIB_PATH)fs/*.[ch])
 
 # if subdir is set, we've been called from above so target has been built
 # already
-$(LIBLK): $(LIBLK_SOURCES)
+$(LIBAPIKFS): $(LIBAPIKFS_SOURCES)
 ifeq ($(subdir),)
-	$(QUIET_SUBDIR0)$(LK_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) liblk.a
+	$(QUIET_SUBDIR0)$(LIB_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) libapikfs.a
 endif
 
-$(LIBLK)-clean:
+$(LIBAPIKFS)-clean:
 ifeq ($(subdir),)
-	$(call QUIET_CLEAN, liblk)
-	@$(MAKE) -C $(LK_DIR) O=$(OUTPUT) clean >/dev/null
+	$(call QUIET_CLEAN, libapikfs)
+	@$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null
 endif
 
 help:
@@ -876,12 +876,11 @@ config-clean:
 	$(call QUIET_CLEAN, config)
 	@$(MAKE) -C config/feature-checks clean >/dev/null
 
-clean: $(LIBTRACEEVENT)-clean $(LIBLK)-clean config-clean
+clean: $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean config-clean
 	$(call QUIET_CLEAN, core-objs)  $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS) $(GTK_OBJS)
 	$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf
 	$(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
-	$(call QUIET_CLEAN, Documentation)
-	@$(MAKE) -C Documentation O=$(OUTPUT) clean >/dev/null
+	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
 	$(python-clean)
 
 #
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index f8bf5f244d77..252b6ed507b7 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -13,7 +13,7 @@
 #include "util/parse-options.h"
 #include "util/trace-event.h"
 #include "util/debug.h"
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include "util/tool.h"
 #include "util/stat.h"
 #include "util/top.h"
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index 6ea9e85bdc00..c98ccb570509 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -37,7 +37,7 @@
 #include "util/strfilter.h"
 #include "util/symbol.h"
 #include "util/debug.h"
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include "util/parse-options.h"
 #include "util/probe-finder.h"
 #include "util/probe-event.h"
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 8b38b4e80ec2..431798a4110d 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -13,7 +13,7 @@
 #include "util/quote.h"
 #include "util/run-command.h"
 #include "util/parse-events.h"
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include <pthread.h>
 
 const char perf_usage_string[] =
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 3cbd10496087..e4ce8aed29d3 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -3,7 +3,7 @@
 #include "evsel.h"
 #include "evlist.h"
 #include "fs.h"
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include "tests.h"
 #include <linux/hw_breakpoint.h>
 
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 7bb6ee1ca19f..8bb4eabca118 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -7,7 +7,7 @@
  * Released under the GPL v2. (and only v2, not any later version)
  */
 #include "util.h"
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include <poll.h>
 #include "cpumap.h"
 #include "thread_map.h"
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 7b510fd1f08d..01ff4cfde1f5 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -9,7 +9,7 @@
 
 #include <byteswap.h>
 #include <linux/bitops.h>
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include <traceevent/event-parse.h>
 #include <linux/hw_breakpoint.h>
 #include <linux/perf_event.h>
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 969cb8f0d88d..094c28ba2fae 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -10,7 +10,7 @@
 #include "symbol.h"
 #include "cache.h"
 #include "header.h"
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include "parse-events-bison.h"
 #define YY_EXTRA_TYPE int
 #include "parse-events-flex.h"
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 9c6989ca2bea..8cd98ef628be 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -40,7 +40,7 @@
 #include "color.h"
 #include "symbol.h"
 #include "thread.h"
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include "trace-event.h"	/* For __maybe_unused */
 #include "probe-event.h"
 #include "probe-finder.h"
diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
index 58ea5ca6c255..d0aee4b9dfd4 100644
--- a/tools/perf/util/setup.py
+++ b/tools/perf/util/setup.py
@@ -25,7 +25,7 @@ cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter'
 build_lib = getenv('PYTHON_EXTBUILD_LIB')
 build_tmp = getenv('PYTHON_EXTBUILD_TMP')
 libtraceevent = getenv('LIBTRACEEVENT')
-liblk = getenv('LIBLK')
+libapikfs = getenv('LIBAPIKFS')
 
 ext_sources = [f.strip() for f in file('util/python-ext-sources')
 				if len(f.strip()) > 0 and f[0] != '#']
@@ -34,7 +34,7 @@ perf = Extension('perf',
 		  sources = ext_sources,
 		  include_dirs = ['util/include'],
 		  extra_compile_args = cflags,
-		  extra_objects = [libtraceevent, liblk],
+		  extra_objects = [libtraceevent, libapikfs],
                  )
 
 setup(name='perf',
diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
index f3c9e551bd35..c354b95a2348 100644
--- a/tools/perf/util/trace-event-info.c
+++ b/tools/perf/util/trace-event-info.c
@@ -38,7 +38,7 @@
 
 #include "../perf.h"
 #include "trace-event.h"
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include "evsel.h"
 
 #define VERSION "0.5"
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index adb39f251f90..4dc21c8e87b0 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -71,7 +71,7 @@
 #include <linux/magic.h>
 #include "types.h"
 #include <sys/ttydefaults.h>
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include <termios.h>
 
 extern const char *graph_line;
diff --git a/tools/vm/Makefile b/tools/vm/Makefile
index 24e9ddd93fa4..3d907dacf2ac 100644
--- a/tools/vm/Makefile
+++ b/tools/vm/Makefile
@@ -2,21 +2,21 @@
 #
 TARGETS=page-types slabinfo
 
-LK_DIR = ../lib/lk
-LIBLK = $(LK_DIR)/liblk.a
+LIB_DIR = ../lib/api
+LIBS = $(LIB_DIR)/libapikfs.a
 
 CC = $(CROSS_COMPILE)gcc
 CFLAGS = -Wall -Wextra -I../lib/
-LDFLAGS = $(LIBLK)
+LDFLAGS = $(LIBS)
 
-$(TARGETS): liblk
+$(TARGETS): $(LIBS)
 
-liblk:
-	make -C $(LK_DIR)
+$(LIBS):
+	make -C $(LIB_DIR)
 
 %: %.c
 	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
 
 clean:
 	$(RM) page-types slabinfo
-	make -C ../lib/lk clean
+	make -C $(LIB_DIR) clean
diff --git a/tools/vm/page-types.c b/tools/vm/page-types.c
index d5e9d6d185c8..f9be24d9efac 100644
--- a/tools/vm/page-types.c
+++ b/tools/vm/page-types.c
@@ -36,7 +36,7 @@
 #include <sys/statfs.h>
 #include "../../include/uapi/linux/magic.h"
 #include "../../include/uapi/linux/kernel-page-flags.h"
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 
 #ifndef MAX_PATH
 # define MAX_PATH 256
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 2/2] perf: Move fs.* to lib/api/fs/
  2013-12-09 16:14 [PATCH -v1.1 0/2] perf tool: Carve out fs.* stuff Borislav Petkov
  2013-12-09 16:14 ` [PATCH 1/2] tools/: Convert to new topic libraries Borislav Petkov
@ 2013-12-09 16:14 ` Borislav Petkov
  2013-12-16 13:37   ` Arnaldo Carvalho de Melo
  2014-02-22 17:59   ` [tip:perf/core] perf tools: " tip-bot for Borislav Petkov
  1 sibling, 2 replies; 20+ messages in thread
From: Borislav Petkov @ 2013-12-09 16:14 UTC (permalink / raw)
  To: LKML
  Cc: Borislav Petkov, Arnaldo Carvalho de Melo, Ingo Molnar,
	Jiri Olsa, Peter Zijlstra, Robert Richter, David Ahern,
	Adrian Hunter, Namhyung Kim, Steven Rostedt, Stanislav Fomichev,
	Stephane Eranian, Andi Kleen, Arjan van de Ven,
	Frederic Weisbecker, Mike Galbraith, Pekka Enberg,
	Paul Mackerras

From: Borislav Petkov <bp@suse.de>

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

Signed-off-by: Borislav Petkov <bp@suse.de>
---
 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 +-
 10 files changed, 20 insertions(+), 25 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

diff --git a/tools/lib/api/Makefile b/tools/lib/api/Makefile
index ed2f51e11b80..ce00f7ee6455 100644
--- a/tools/lib/api/Makefile
+++ b/tools/lib/api/Makefile
@@ -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
 
diff --git a/tools/perf/util/fs.c b/tools/lib/api/fs/fs.c
similarity index 91%
rename from tools/perf/util/fs.c
rename to tools/lib/api/fs/fs.c
index f5be1f26e724..5b5eb788996e 100644
--- a/tools/perf/util/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -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",
diff --git a/tools/perf/util/include/linux/magic.h b/tools/lib/api/fs/fs.h
similarity index 50%
rename from tools/perf/util/include/linux/magic.h
rename to tools/lib/api/fs/fs.h
index 07d63cf3e0f6..cb7049551f33 100644
--- a/tools/perf/util/include/linux/magic.h
+++ b/tools/lib/api/fs/fs.h
@@ -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__ */
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 532e5f21b918..1a51460c5903 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -216,7 +216,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
@@ -242,7 +241,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
@@ -304,7 +302,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
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index e4ce8aed29d3..6109150d36cc 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -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>
diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c
index a9b48c42e81e..7fe4994eeb63 100644
--- a/tools/perf/util/cpumap.c
+++ b/tools/perf/util/cpumap.c
@@ -1,5 +1,5 @@
 #include "util.h"
-#include "fs.h"
+#include <api/fs/fs.h>
 #include "../perf.h"
 #include "cpumap.h"
 #include <assert.h>
diff --git a/tools/perf/util/fs.h b/tools/perf/util/fs.h
deleted file mode 100644
index 5e09ce1bab0e..000000000000
--- a/tools/perf/util/fs.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef __PERF_FS
-#define __PERF_FS
-
-const char *sysfs__mountpoint(void);
-const char *procfs__mountpoint(void);
-
-#endif /* __PERF_FS */
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 56fc10a5e288..b22d2447550f 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -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"
diff --git a/tools/perf/util/python-ext-sources b/tools/perf/util/python-ext-sources
index 595bfc73d2ed..16a475a7d492 100644
--- a/tools/perf/util/python-ext-sources
+++ b/tools/perf/util/python-ext-sources
@@ -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
diff --git a/tools/perf/util/record.c b/tools/perf/util/record.c
index c8845b107f60..da4113679ae5 100644
--- a/tools/perf/util/record.c
+++ b/tools/perf/util/record.c
@@ -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);
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/2] tools/: Convert to new topic libraries
  2013-12-09 16:14 ` [PATCH 1/2] tools/: Convert to new topic libraries Borislav Petkov
@ 2013-12-10  1:32   ` Namhyung Kim
  2013-12-10 11:27     ` Borislav Petkov
  2013-12-11  1:46   ` David Ahern
  2013-12-18 10:30   ` [tip:perf/core] " tip-bot for Borislav Petkov
  2 siblings, 1 reply; 20+ messages in thread
From: Namhyung Kim @ 2013-12-10  1:32 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: LKML, Borislav Petkov, Arnaldo Carvalho de Melo, Ingo Molnar,
	Jiri Olsa, Peter Zijlstra, Robert Richter, David Ahern,
	Adrian Hunter, Steven Rostedt, Stanislav Fomichev,
	Stephane Eranian, Andi Kleen, Arjan van de Ven,
	Frederic Weisbecker, Mike Galbraith, Pekka Enberg,
	Paul Mackerras

Hi Borislav,

On Mon,  9 Dec 2013 17:14:23 +0100, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.de>
>
> Move debugfs.* to api/fs/. We have a common tools/lib/api/ place
> where the Makefile lives and then we place the headers in subdirs.
> For example, all the fs-related stuff goes to tools/lib/api/fs/ from
> which we get libapikfs.a (acme got almost the naming he wanted :-))
> and we link it into the tools which need it - in this case perf and
> tools/vm/page-types.

I'm sorry to raise a naming issue again.  But why the lib has 'k' and
the directory doesn't?  Isn't it more natural to prepend 'k' to 'api' as
the name "api" looks too general?

  - libkapifs.{a,so}
  - lib/kapi/fs/fs.c

(Please ignore if it's already discussed..)

Thanks,
Namhyung

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/2] tools/: Convert to new topic libraries
  2013-12-10  1:32   ` Namhyung Kim
@ 2013-12-10 11:27     ` Borislav Petkov
  2013-12-11  1:21       ` Namhyung Kim
  0 siblings, 1 reply; 20+ messages in thread
From: Borislav Petkov @ 2013-12-10 11:27 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: LKML, Borislav Petkov, Arnaldo Carvalho de Melo, Ingo Molnar,
	Jiri Olsa, Peter Zijlstra, Robert Richter, David Ahern,
	Adrian Hunter, Steven Rostedt, Stanislav Fomichev,
	Stephane Eranian, Andi Kleen, Arjan van de Ven,
	Frederic Weisbecker, Mike Galbraith, Pekka Enberg,
	Paul Mackerras

On Tue, Dec 10, 2013 at 10:32:42AM +0900, Namhyung Kim wrote:
> I'm sorry to raise a naming issue again. But why the lib has 'k' and
> the directory doesn't? Isn't it more natural to prepend 'k' to 'api'
> as the name "api" looks too general?
>
>   - libkapifs.{a,so} /kapi/fs/fs.c
>
> (Please ignore if it's already discussed..)

Hmm, no, it hasn't been discussed but I assumed tools/lib/api/ being in
the *kernel* repository implicitly says which api functionality we're
collecting there. One of the main reasons to have tools/ in the kernel
AFAIU is to have those tools which are using its API close. Therefore,
tools/lib/api/ should be unambiguous.

libkapifs.a (and the .so version even more, for that matter, and if we
decide to do it one day) would probably need more distinction and the
"k" in "kapi" there makes more sense.

This is at least how I see it from here.

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/2] tools/: Convert to new topic libraries
  2013-12-10 11:27     ` Borislav Petkov
@ 2013-12-11  1:21       ` Namhyung Kim
  2013-12-11 12:31         ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 20+ messages in thread
From: Namhyung Kim @ 2013-12-11  1:21 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: LKML, Borislav Petkov, Arnaldo Carvalho de Melo, Ingo Molnar,
	Jiri Olsa, Peter Zijlstra, Robert Richter, David Ahern,
	Adrian Hunter, Steven Rostedt, Stanislav Fomichev,
	Stephane Eranian, Andi Kleen, Arjan van de Ven,
	Frederic Weisbecker, Mike Galbraith, Pekka Enberg,
	Paul Mackerras

Hi Borislav,

On Tue, 10 Dec 2013 12:27:59 +0100, Borislav Petkov wrote:
> On Tue, Dec 10, 2013 at 10:32:42AM +0900, Namhyung Kim wrote:
>> I'm sorry to raise a naming issue again. But why the lib has 'k' and
>> the directory doesn't? Isn't it more natural to prepend 'k' to 'api'
>> as the name "api" looks too general?
>>
>>   - libkapifs.{a,so} /kapi/fs/fs.c
>>
>> (Please ignore if it's already discussed..)
>
> Hmm, no, it hasn't been discussed but I assumed tools/lib/api/ being in
> the *kernel* repository implicitly says which api functionality we're
> collecting there. One of the main reasons to have tools/ in the kernel
> AFAIU is to have those tools which are using its API close. Therefore,
> tools/lib/api/ should be unambiguous.
>
> libkapifs.a (and the .so version even more, for that matter, and if we
> decide to do it one day) would probably need more distinction and the
> "k" in "kapi" there makes more sense.
>
> This is at least how I see it from here.

Yeah I assumed you guys plan to export it to the wild. :)

I'm OK with tools/lib/api if it lives and used only in the kernel tree.

Thanks,
Namhyung

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/2] tools/: Convert to new topic libraries
  2013-12-09 16:14 ` [PATCH 1/2] tools/: Convert to new topic libraries Borislav Petkov
  2013-12-10  1:32   ` Namhyung Kim
@ 2013-12-11  1:46   ` David Ahern
  2013-12-11  9:56     ` Borislav Petkov
  2013-12-18 10:30   ` [tip:perf/core] " tip-bot for Borislav Petkov
  2 siblings, 1 reply; 20+ messages in thread
From: David Ahern @ 2013-12-11  1:46 UTC (permalink / raw)
  To: Borislav Petkov, LKML
  Cc: Borislav Petkov, Arnaldo Carvalho de Melo, Ingo Molnar,
	Jiri Olsa, Peter Zijlstra, Robert Richter, Adrian Hunter,
	Namhyung Kim, Steven Rostedt, Stanislav Fomichev,
	Stephane Eranian, Andi Kleen, Arjan van de Ven,
	Frederic Weisbecker, Mike Galbraith, Pekka Enberg,
	Paul Mackerras

On 12/9/13, 9:14 AM, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.de>
>
> Move debugfs.* to api/fs/. We have a common tools/lib/api/ place
> where the Makefile lives and then we place the headers in subdirs.
> For example, all the fs-related stuff goes to tools/lib/api/fs/ from
> which we get libapikfs.a (acme got almost the naming he wanted :-))
> and we link it into the tools which need it - in this case perf and
> tools/vm/page-types.
>
> acme:
>
> "Looking at the implementation, I think some tools can even link
> directly to the .o files, avoiding the .a file altogether.
>
> But that is just an optimization/finer granularity tools/lib/
> cherrypicking that toolers can make use of."
>
> Fixup documentation cleaning target while at it.
>

no longer applies to the moving target that is acme's tree.

David


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/2] tools/: Convert to new topic libraries
  2013-12-11  1:46   ` David Ahern
@ 2013-12-11  9:56     ` Borislav Petkov
  2013-12-11 12:31       ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 20+ messages in thread
From: Borislav Petkov @ 2013-12-11  9:56 UTC (permalink / raw)
  To: David Ahern
  Cc: LKML, Borislav Petkov, Arnaldo Carvalho de Melo, Ingo Molnar,
	Jiri Olsa, Peter Zijlstra, Robert Richter, Adrian Hunter,
	Namhyung Kim, Steven Rostedt, Stanislav Fomichev,
	Stephane Eranian, Andi Kleen, Arjan van de Ven,
	Frederic Weisbecker, Mike Galbraith, Pekka Enberg,
	Paul Mackerras

On Tue, Dec 10, 2013 at 06:46:15PM -0700, David Ahern wrote:
> no longer applies to the moving target that is acme's tree.

Of course it doesn't, with all the junk flood going in there :-)

Btw, this is why I'm planning on sending only a small amount of patches
and hoping that acme picks them up quickly. :)

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/2] tools/: Convert to new topic libraries
  2013-12-11  1:21       ` Namhyung Kim
@ 2013-12-11 12:31         ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 20+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-11 12:31 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Borislav Petkov, LKML, Borislav Petkov, Ingo Molnar, Jiri Olsa,
	Peter Zijlstra, Robert Richter, David Ahern, Adrian Hunter,
	Steven Rostedt, Stanislav Fomichev, Stephane Eranian, Andi Kleen,
	Arjan van de Ven, Frederic Weisbecker, Mike Galbraith,
	Pekka Enberg, Paul Mackerras

Em Wed, Dec 11, 2013 at 10:21:07AM +0900, Namhyung Kim escreveu:
> On Tue, 10 Dec 2013 12:27:59 +0100, Borislav Petkov wrote:
> > On Tue, Dec 10, 2013 at 10:32:42AM +0900, Namhyung Kim wrote:
> >> I'm sorry to raise a naming issue again. But why the lib has 'k' and
> >> the directory doesn't? Isn't it more natural to prepend 'k' to 'api'
> >> as the name "api" looks too general?

> >>   - libkapifs.{a,so} /kapi/fs/fs.c

> >> (Please ignore if it's already discussed..)

> > Hmm, no, it hasn't been discussed but I assumed tools/lib/api/ being in
> > the *kernel* repository implicitly says which api functionality we're
> > collecting there. One of the main reasons to have tools/ in the kernel
> > AFAIU is to have those tools which are using its API close. Therefore,
> > tools/lib/api/ should be unambiguous.

> > libkapifs.a (and the .so version even more, for that matter, and if we
> > decide to do it one day) would probably need more distinction and the
> > "k" in "kapi" there makes more sense.

> > This is at least how I see it from here.

> Yeah I assumed you guys plan to export it to the wild. :)

> I'm OK with tools/lib/api if it lives and used only in the kernel tree.

This is the idea, no commitment to use outside tools/ living code at
this point.

Anybody can try and provide comments on his mileage, but we're still at
a too early stage for any kind of commitments.

But yeah, everybody, I think, agrees that the ball needs to keep on
rolling on the direction of avoiding code duplication for tools/ living
code.

Back to Namhyung's suggestion, yeah, tools/lib/kapi/ would consume just
one more letter and would further disambiguate things.

But this can be done later if Borislav is unconvinced at this point.

- Arnaldo

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/2] tools/: Convert to new topic libraries
  2013-12-11  9:56     ` Borislav Petkov
@ 2013-12-11 12:31       ` Arnaldo Carvalho de Melo
  2013-12-11 13:24         ` Ingo Molnar
  0 siblings, 1 reply; 20+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-11 12:31 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: David Ahern, LKML, Borislav Petkov, Ingo Molnar, Jiri Olsa,
	Peter Zijlstra, Robert Richter, Adrian Hunter, Namhyung Kim,
	Steven Rostedt, Stanislav Fomichev, Stephane Eranian, Andi Kleen,
	Arjan van de Ven, Frederic Weisbecker, Mike Galbraith,
	Pekka Enberg, Paul Mackerras

Em Wed, Dec 11, 2013 at 10:56:26AM +0100, Borislav Petkov escreveu:
> On Tue, Dec 10, 2013 at 06:46:15PM -0700, David Ahern wrote:
> > no longer applies to the moving target that is acme's tree.
> 
> Of course it doesn't, with all the junk flood going in there :-)
> 
> Btw, this is why I'm planning on sending only a small amount of patches
> and hoping that acme picks them up quickly. :)

I'll try to keep this moving today, together with the start of
tools/lib/symbol/ ;-)

- Arnaldo

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/2] tools/: Convert to new topic libraries
  2013-12-11 12:31       ` Arnaldo Carvalho de Melo
@ 2013-12-11 13:24         ` Ingo Molnar
  2013-12-11 13:30           ` Borislav Petkov
  0 siblings, 1 reply; 20+ messages in thread
From: Ingo Molnar @ 2013-12-11 13:24 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Borislav Petkov, David Ahern, LKML, Borislav Petkov, Jiri Olsa,
	Peter Zijlstra, Robert Richter, Adrian Hunter, Namhyung Kim,
	Steven Rostedt, Stanislav Fomichev, Stephane Eranian, Andi Kleen,
	Arjan van de Ven, Frederic Weisbecker, Mike Galbraith,
	Pekka Enberg, Paul Mackerras


* Arnaldo Carvalho de Melo <acme@infradead.org> wrote:

> Em Wed, Dec 11, 2013 at 10:56:26AM +0100, Borislav Petkov escreveu:
> > On Tue, Dec 10, 2013 at 06:46:15PM -0700, David Ahern wrote:
> > > no longer applies to the moving target that is acme's tree.
> > 
> > Of course it doesn't, with all the junk flood going in there :-)
> > 
> > Btw, this is why I'm planning on sending only a small amount of patches
> > and hoping that acme picks them up quickly. :)
> 
> I'll try to keep this moving today, together with the start of
> tools/lib/symbol/ ;-)

That looks good to me as well. Lets see how well this whole approach 
works in practice. Please be on the lookout for 
anomalies/inconsistencies as the set of topics increases.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/2] tools/: Convert to new topic libraries
  2013-12-11 13:24         ` Ingo Molnar
@ 2013-12-11 13:30           ` Borislav Petkov
  2013-12-11 13:54             ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 20+ messages in thread
From: Borislav Petkov @ 2013-12-11 13:30 UTC (permalink / raw)
  To: Ingo Molnar, Arnaldo Carvalho de Melo
  Cc: David Ahern, LKML, Borislav Petkov, Jiri Olsa, Peter Zijlstra,
	Robert Richter, Adrian Hunter, Namhyung Kim, Steven Rostedt,
	Stanislav Fomichev, Stephane Eranian, Andi Kleen,
	Arjan van de Ven, Frederic Weisbecker, Mike Galbraith,
	Pekka Enberg, Paul Mackerras

On Wed, Dec 11, 2013 at 02:24:43PM +0100, Ingo Molnar wrote:
> > I'll try to keep this moving today, together with the start of
> > tools/lib/symbol/ ;-)
>
> That looks good to me as well. Lets see how well this whole
> approach works in practice. Please be on the lookout for
> anomalies/inconsistencies as the set of topics increases.

Right, I'll CC the whole list on future submissions so that such
anomalies are caught in time.

@acme: if you're having too much trouble keeping this moving, let me
know and I'll rebase.

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/2] tools/: Convert to new topic libraries
  2013-12-11 13:30           ` Borislav Petkov
@ 2013-12-11 13:54             ` Arnaldo Carvalho de Melo
  2013-12-11 14:02               ` Borislav Petkov
  0 siblings, 1 reply; 20+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-11 13:54 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Ingo Molnar, David Ahern, LKML, Borislav Petkov, Jiri Olsa,
	Peter Zijlstra, Robert Richter, Adrian Hunter, Namhyung Kim,
	Steven Rostedt, Stanislav Fomichev, Stephane Eranian, Andi Kleen,
	Arjan van de Ven, Frederic Weisbecker, Mike Galbraith,
	Pekka Enberg, Paul Mackerras

Em Wed, Dec 11, 2013 at 02:30:33PM +0100, Borislav Petkov escreveu:
> On Wed, Dec 11, 2013 at 02:24:43PM +0100, Ingo Molnar wrote:
> > > I'll try to keep this moving today, together with the start of
> > > tools/lib/symbol/ ;-)
> >
> > That looks good to me as well. Lets see how well this whole
> > approach works in practice. Please be on the lookout for
> > anomalies/inconsistencies as the set of topics increases.
> 
> Right, I'll CC the whole list on future submissions so that such
> anomalies are caught in time.
> 
> @acme: if you're having too much trouble keeping this moving, let me
> know and I'll rebase.

Not needed, there is even more flux happening as I merge bits from the
(big) IPT patchset, so I'll cope.

Will probably send a new patchset with it later today or tomorrow.

Thanks for your effort on this!

- Arnaldo

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/2] tools/: Convert to new topic libraries
  2013-12-11 13:54             ` Arnaldo Carvalho de Melo
@ 2013-12-11 14:02               ` Borislav Petkov
  0 siblings, 0 replies; 20+ messages in thread
From: Borislav Petkov @ 2013-12-11 14:02 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, David Ahern, LKML, Borislav Petkov, Jiri Olsa,
	Peter Zijlstra, Robert Richter, Adrian Hunter, Namhyung Kim,
	Steven Rostedt, Stanislav Fomichev, Stephane Eranian, Andi Kleen,
	Arjan van de Ven, Frederic Weisbecker, Mike Galbraith,
	Pekka Enberg, Paul Mackerras

On Wed, Dec 11, 2013 at 10:54:51AM -0300, Arnaldo Carvalho de Melo wrote:
> Not needed, there is even more flux happening as I merge bits from the
> (big) IPT patchset, so I'll cope.

Thanks!

> Will probably send a new patchset with it later today or tomorrow.

Oh boy, will the flood ever stop?!1?

So I'll wait until acme/perf/core settles down toward the weekend(?) to
work on the next part.

:-)

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 2/2] perf: Move fs.* to lib/api/fs/
  2013-12-09 16:14 ` [PATCH 2/2] perf: Move fs.* to lib/api/fs/ Borislav Petkov
@ 2013-12-16 13:37   ` Arnaldo Carvalho de Melo
  2014-02-22 17:59   ` [tip:perf/core] perf tools: " tip-bot for Borislav Petkov
  1 sibling, 0 replies; 20+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-16 13:37 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: LKML, Borislav Petkov, Ingo Molnar, Jiri Olsa, Peter Zijlstra,
	Robert Richter, David Ahern, Adrian Hunter, Namhyung Kim,
	Steven Rostedt, Stanislav Fomichev, Stephane Eranian, Andi Kleen,
	Arjan van de Ven, Frederic Weisbecker, Mike Galbraith,
	Pekka Enberg, Paul Mackerras

Em Mon, Dec 09, 2013 at 05:14:24PM +0100, Borislav Petkov escreveu:
> From: Borislav Petkov <bp@suse.de>
> 
> Move to generic library and kill magic.h as it is needed only in fs.h.
> 
> Signed-off-by: Borislav Petkov <bp@suse.de>

Investigating...

[acme@ssdandy linux]$ am /wb/1
Applying: perf: Move fs.* to lib/api/fs/
[perf/core 5da46742cf76] perf tools: Move fs.* to lib/api/fs/
 Author: Borislav Petkov <bp@suse.de>
 10 files changed, 20 insertions(+), 25 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
[acme@ssdandy linux]$ fg
bash: fg: current: no such job
[acme@ssdandy linux]$ time make O=/tmp/build/perf -C tools/perf/ install-bin
make: Entering directory `/home/acme/git/linux/tools/perf'
  BUILD:   Doing 'make -j8' parallel build
  GEN      perf-archive
  CC       /tmp/build/perf/util/pmu.o
  CC       /tmp/build/perf/util/cpumap.o
  CC       /tmp/build/perf/util/record.o
  CC       /tmp/build/perf/tests/parse-events.o
  GEN      /tmp/build/perf/python/perf.so
  AR       /tmp/build/perf/libperf.a
  LINK     /tmp/build/perf/libperf-gtk.so
  LINK     /tmp/build/perf/perf
  INSTALL  GTK UI
/tmp/build/perf/libperf.a(pmu.o): In function `pmu_type':
/home/acme/git/linux/tools/perf/util/pmu.c:314: undefined reference to `sysfs__mountpoint'
/tmp/build/perf/libperf.a(pmu.o): In function `pmu_cpumask':
/home/acme/git/linux/tools/perf/util/pmu.c:370: undefined reference to `sysfs__mountpoint'
/tmp/build/perf/libperf.a(pmu.o): In function `pmu_aliases':
/home/acme/git/linux/tools/perf/util/pmu.c:267: undefined reference to `sysfs__mountpoint'
/tmp/build/perf/libperf.a(pmu.o): In function `pmu_format':
/home/acme/git/linux/tools/perf/util/pmu.c:84: undefined reference to `sysfs__mountpoint'
/tmp/build/perf/libperf.a(pmu.o): In function `pmu_read_sysfs':
/home/acme/git/linux/tools/perf/util/pmu.c:342: undefined reference to `sysfs__mountpoint'
/tmp/build/perf/libperf.a(util.o): In function `perf_event_paranoid':
/home/acme/git/linux/tools/perf/util/util.c:506: undefined reference to `procfs__mountpoint'
/tmp/build/perf/libperf.a(cpumap.o): In function `cpu_map__get_socket':
/home/acme/git/linux/tools/perf/util/cpumap.c:219: undefined reference to `sysfs__mountpoint'
/tmp/build/perf/libperf.a(cpumap.o): In function `cpu_map__get_core':
/home/acme/git/linux/tools/perf/util/cpumap.c:282: undefined reference to `sysfs__mountpoint'
/tmp/build/perf/libperf.a(cpumap.o): In function `cpu_map__get_socket':
/home/acme/git/linux/tools/perf/util/cpumap.c:219: undefined reference to `sysfs__mountpoint'
/tmp/build/perf/libperf.a(record.o): In function `get_max_rate':
/home/acme/git/linux/tools/perf/util/record.c:115: undefined reference to `procfs__mountpoint'
/tmp/build/perf/libperf.a(parse-events.o): In function `test_pmu':
/home/acme/git/linux/tools/perf/tests/parse-events.c:1457: undefined reference to `sysfs__mountpoint'
/tmp/build/perf/libperf.a(parse-events.o): In function `test_pmu_events':
/home/acme/git/linux/tools/perf/tests/parse-events.c:1474: undefined reference to `sysfs__mountpoint'
collect2: error: ld returned 1 exit status
make[1]: *** [/tmp/build/perf/perf] Error 1
make[1]: *** Waiting for unfinished jobs....
util/util.c:3:16: fatal error: fs.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
make: *** [install-bin] Error 2
make: Leaving directory `/home/acme/git/linux/tools/perf'

real	0m2.891s
user	0m5.030s
sys	0m0.668s
[acme@ssdandy linux]$ 


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [tip:perf/core] tools/: Convert to new topic libraries
  2013-12-09 16:14 ` [PATCH 1/2] tools/: Convert to new topic libraries Borislav Petkov
  2013-12-10  1:32   ` Namhyung Kim
  2013-12-11  1:46   ` David Ahern
@ 2013-12-18 10:30   ` tip-bot for Borislav Petkov
  2 siblings, 0 replies; 20+ messages in thread
From: tip-bot for Borislav Petkov @ 2013-12-18 10:30 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, eranian, mingo, peterz, penberg, efault, jolsa, fweisbec,
	rostedt, ak, dsahern, tglx, linux-kernel, hpa, paulus, arjan,
	namhyung, stfomichev, adrian.hunter, bp, rric

Commit-ID:  553873e1df63a20559ac9c336765dc7055cfc3d4
Gitweb:     http://git.kernel.org/tip/553873e1df63a20559ac9c336765dc7055cfc3d4
Author:     Borislav Petkov <bp@suse.de>
AuthorDate: Mon, 9 Dec 2013 17:14:23 +0100
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 16 Dec 2013 16:03:27 -0300

tools/: Convert to new topic libraries

Move debugfs.* to api/fs/. We have a common tools/lib/api/ place where
the Makefile lives and then we place the headers in subdirs.

For example, all the fs-related stuff goes to tools/lib/api/fs/ from
which we get libapikfs.a (acme got almost the naming he wanted :-)) and
we link it into the tools which need it - in this case perf and
tools/vm/page-types.

acme:

"Looking at the implementation, I think some tools can even link
directly to the .o files, avoiding the .a file altogether.

But that is just an optimization/finer granularity tools/lib/
cherrypicking that toolers can make use of."

Fixup documentation cleaning target while at it.

Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Robert Richter <rric@kernel.org>
Cc: Stanislav Fomichev <stfomichev@yandex-team.ru>
Cc: Stephane Eranian <eranian@google.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1386605664-24041-2-git-send-email-bp@alien8.de
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/Makefile                     | 12 ++++++------
 tools/lib/{lk => api}/Makefile     | 18 +++++++++++-------
 tools/lib/{lk => api/fs}/debugfs.c |  0
 tools/lib/{lk => api/fs}/debugfs.h |  6 +++---
 tools/perf/Makefile.perf           | 33 ++++++++++++++++-----------------
 tools/perf/builtin-kvm.c           |  2 +-
 tools/perf/builtin-probe.c         |  2 +-
 tools/perf/perf.c                  |  2 +-
 tools/perf/tests/parse-events.c    |  2 +-
 tools/perf/util/evlist.c           |  2 +-
 tools/perf/util/evsel.c            |  2 +-
 tools/perf/util/parse-events.c     |  2 +-
 tools/perf/util/probe-event.c      |  2 +-
 tools/perf/util/setup.py           |  4 ++--
 tools/perf/util/trace-event-info.c |  2 +-
 tools/perf/util/util.h             |  2 +-
 tools/vm/Makefile                  | 14 +++++++-------
 tools/vm/page-types.c              |  2 +-
 18 files changed, 56 insertions(+), 53 deletions(-)

diff --git a/tools/Makefile b/tools/Makefile
index a9b0200..927cd46 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -39,10 +39,10 @@ cpupower: FORCE
 cgroup firewire guest usb virtio vm net: FORCE
 	$(call descend,$@)
 
-liblk: FORCE
-	$(call descend,lib/lk)
+libapikfs: FORCE
+	$(call descend,lib/api)
 
-perf: liblk FORCE
+perf: libapikfs FORCE
 	$(call descend,$@)
 
 selftests: FORCE
@@ -80,10 +80,10 @@ cpupower_clean:
 cgroup_clean firewire_clean lguest_clean usb_clean virtio_clean vm_clean net_clean:
 	$(call descend,$(@:_clean=),clean)
 
-liblk_clean:
-	$(call descend,lib/lk,clean)
+libapikfs_clean:
+	$(call descend,lib/api,clean)
 
-perf_clean: liblk_clean
+perf_clean: libapikfs_clean
 	$(call descend,$(@:_clean=),clean)
 
 selftests_clean:
diff --git a/tools/lib/lk/Makefile b/tools/lib/api/Makefile
similarity index 66%
rename from tools/lib/lk/Makefile
rename to tools/lib/api/Makefile
index 3dba0a4..ed2f51e 100644
--- a/tools/lib/lk/Makefile
+++ b/tools/lib/api/Makefile
@@ -1,4 +1,5 @@
 include ../../scripts/Makefile.include
+include ../../perf/config/utilities.mak		# QUIET_CLEAN
 
 CC = $(CROSS_COMPILE)gcc
 AR = $(CROSS_COMPILE)ar
@@ -7,11 +8,11 @@ AR = $(CROSS_COMPILE)ar
 LIB_H=
 LIB_OBJS=
 
-LIB_H += debugfs.h
+LIB_H += fs/debugfs.h
 
-LIB_OBJS += $(OUTPUT)debugfs.o
+LIB_OBJS += $(OUTPUT)fs/debugfs.o
 
-LIBFILE = liblk.a
+LIBFILE = libapikfs.a
 
 CFLAGS = -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) -fPIC
 EXTLIBS = -lelf -lpthread -lrt -lm
@@ -25,14 +26,17 @@ $(LIBFILE): $(LIB_OBJS)
 
 $(LIB_OBJS): $(LIB_H)
 
-$(OUTPUT)%.o: %.c
+libapi_dirs:
+	$(QUIET_MKDIR)mkdir -p $(OUTPUT)fs/
+
+$(OUTPUT)%.o: %.c libapi_dirs
 	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
-$(OUTPUT)%.s: %.c
+$(OUTPUT)%.s: %.c libapi_dirs
 	$(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
-$(OUTPUT)%.o: %.S
+$(OUTPUT)%.o: %.S libapi_dirs
 	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
 
 clean:
-	$(RM) $(LIB_OBJS) $(LIBFILE)
+	$(call QUIET_CLEAN, libapi) $(RM) $(LIB_OBJS) $(LIBFILE)
 
 .PHONY: clean
diff --git a/tools/lib/lk/debugfs.c b/tools/lib/api/fs/debugfs.c
similarity index 100%
rename from tools/lib/lk/debugfs.c
rename to tools/lib/api/fs/debugfs.c
diff --git a/tools/lib/lk/debugfs.h b/tools/lib/api/fs/debugfs.h
similarity index 86%
rename from tools/lib/lk/debugfs.h
rename to tools/lib/api/fs/debugfs.h
index 935c59b..f19d3df 100644
--- a/tools/lib/lk/debugfs.h
+++ b/tools/lib/api/fs/debugfs.h
@@ -1,5 +1,5 @@
-#ifndef __LK_DEBUGFS_H__
-#define __LK_DEBUGFS_H__
+#ifndef __API_DEBUGFS_H__
+#define __API_DEBUGFS_H__
 
 #define _STR(x) #x
 #define STR(x) _STR(x)
@@ -26,4 +26,4 @@ char *debugfs_mount(const char *mountpoint);
 
 extern char debugfs_mountpoint[];
 
-#endif /* __LK_DEBUGFS_H__ */
+#endif /* __API_DEBUGFS_H__ */
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index fad6107..97a2145 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -86,7 +86,7 @@ FLEX    = flex
 BISON   = bison
 STRIP   = strip
 
-LK_DIR          = $(srctree)/tools/lib/lk/
+LIB_DIR          = $(srctree)/tools/lib/api/
 TRACE_EVENT_DIR = $(srctree)/tools/lib/traceevent/
 
 # include config/Makefile by default and rule out
@@ -127,20 +127,20 @@ strip-libs = $(filter-out -l%,$(1))
 ifneq ($(OUTPUT),)
   TE_PATH=$(OUTPUT)
 ifneq ($(subdir),)
-  LK_PATH=$(OUTPUT)/../lib/lk/
+  LIB_PATH=$(OUTPUT)/../lib/api/
 else
-  LK_PATH=$(OUTPUT)
+  LIB_PATH=$(OUTPUT)
 endif
 else
   TE_PATH=$(TRACE_EVENT_DIR)
-  LK_PATH=$(LK_DIR)
+  LIB_PATH=$(LIB_DIR)
 endif
 
 LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
 export LIBTRACEEVENT
 
-LIBLK = $(LK_PATH)liblk.a
-export LIBLK
+LIBAPIKFS = $(LIB_PATH)libapikfs.a
+export LIBAPIKFS
 
 # python extension build directories
 PYTHON_EXTBUILD     := $(OUTPUT)python_ext_build/
@@ -151,7 +151,7 @@ export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
 python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf.so
 
 PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
-PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) $(LIBLK)
+PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) $(LIBAPIKFS)
 
 $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS)
 	$(QUIET_GEN)CFLAGS='$(CFLAGS)' $(PYTHON_WORD) util/setup.py \
@@ -441,7 +441,7 @@ BUILTIN_OBJS += $(OUTPUT)builtin-inject.o
 BUILTIN_OBJS += $(OUTPUT)tests/builtin-test.o
 BUILTIN_OBJS += $(OUTPUT)builtin-mem.o
 
-PERFLIBS = $(LIB_FILE) $(LIBLK) $(LIBTRACEEVENT)
+PERFLIBS = $(LIB_FILE) $(LIBAPIKFS) $(LIBTRACEEVENT)
 
 # We choose to avoid "if .. else if .. else .. endif endif"
 # because maintaining the nesting to match is a pain.  If
@@ -730,19 +730,19 @@ $(LIBTRACEEVENT)-clean:
 install-traceevent-plugins: $(LIBTRACEEVENT)
 	$(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) install_plugins
 
-LIBLK_SOURCES = $(wildcard $(LK_PATH)*.[ch])
+LIBAPIKFS_SOURCES = $(wildcard $(LIB_PATH)fs/*.[ch])
 
 # if subdir is set, we've been called from above so target has been built
 # already
-$(LIBLK): $(LIBLK_SOURCES)
+$(LIBAPIKFS): $(LIBAPIKFS_SOURCES)
 ifeq ($(subdir),)
-	$(QUIET_SUBDIR0)$(LK_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) liblk.a
+	$(QUIET_SUBDIR0)$(LIB_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) libapikfs.a
 endif
 
-$(LIBLK)-clean:
+$(LIBAPIKFS)-clean:
 ifeq ($(subdir),)
-	$(call QUIET_CLEAN, liblk)
-	@$(MAKE) -C $(LK_DIR) O=$(OUTPUT) clean >/dev/null
+	$(call QUIET_CLEAN, libapikfs)
+	@$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null
 endif
 
 help:
@@ -881,12 +881,11 @@ config-clean:
 	$(call QUIET_CLEAN, config)
 	@$(MAKE) -C config/feature-checks clean >/dev/null
 
-clean: $(LIBTRACEEVENT)-clean $(LIBLK)-clean config-clean
+clean: $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean config-clean
 	$(call QUIET_CLEAN, core-objs)  $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS) $(GTK_OBJS)
 	$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf
 	$(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
-	$(call QUIET_CLEAN, Documentation)
-	@$(MAKE) -C Documentation O=$(OUTPUT) clean >/dev/null
+	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
 	$(python-clean)
 
 #
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index c6fa3cb..154b397 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -13,7 +13,7 @@
 #include "util/parse-options.h"
 #include "util/trace-event.h"
 #include "util/debug.h"
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include "util/tool.h"
 #include "util/stat.h"
 #include "util/top.h"
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index 6ea9e85..c98ccb5 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -37,7 +37,7 @@
 #include "util/strfilter.h"
 #include "util/symbol.h"
 #include "util/debug.h"
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include "util/parse-options.h"
 #include "util/probe-finder.h"
 #include "util/probe-event.h"
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 8b38b4e..431798a 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -13,7 +13,7 @@
 #include "util/quote.h"
 #include "util/run-command.h"
 #include "util/parse-events.h"
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include <pthread.h>
 
 const char perf_usage_string[] =
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 3cbd104..e4ce8ae 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -3,7 +3,7 @@
 #include "evsel.h"
 #include "evlist.h"
 #include "fs.h"
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include "tests.h"
 #include <linux/hw_breakpoint.h>
 
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 0b31cee..da31829 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -7,7 +7,7 @@
  * Released under the GPL v2. (and only v2, not any later version)
  */
 #include "util.h"
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include <poll.h>
 #include "cpumap.h"
 #include "thread_map.h"
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 7b510fd..01ff4cf 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -9,7 +9,7 @@
 
 #include <byteswap.h>
 #include <linux/bitops.h>
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include <traceevent/event-parse.h>
 #include <linux/hw_breakpoint.h>
 #include <linux/perf_event.h>
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 969cb8f..094c28b 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -10,7 +10,7 @@
 #include "symbol.h"
 #include "cache.h"
 #include "header.h"
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include "parse-events-bison.h"
 #define YY_EXTRA_TYPE int
 #include "parse-events-flex.h"
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index d7cff57..544ac18 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -40,7 +40,7 @@
 #include "color.h"
 #include "symbol.h"
 #include "thread.h"
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include "trace-event.h"	/* For __maybe_unused */
 #include "probe-event.h"
 #include "probe-finder.h"
diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
index 58ea5ca..d0aee4b 100644
--- a/tools/perf/util/setup.py
+++ b/tools/perf/util/setup.py
@@ -25,7 +25,7 @@ cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter'
 build_lib = getenv('PYTHON_EXTBUILD_LIB')
 build_tmp = getenv('PYTHON_EXTBUILD_TMP')
 libtraceevent = getenv('LIBTRACEEVENT')
-liblk = getenv('LIBLK')
+libapikfs = getenv('LIBAPIKFS')
 
 ext_sources = [f.strip() for f in file('util/python-ext-sources')
 				if len(f.strip()) > 0 and f[0] != '#']
@@ -34,7 +34,7 @@ perf = Extension('perf',
 		  sources = ext_sources,
 		  include_dirs = ['util/include'],
 		  extra_compile_args = cflags,
-		  extra_objects = [libtraceevent, liblk],
+		  extra_objects = [libtraceevent, libapikfs],
                  )
 
 setup(name='perf',
diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
index f3c9e55..c354b95 100644
--- a/tools/perf/util/trace-event-info.c
+++ b/tools/perf/util/trace-event-info.c
@@ -38,7 +38,7 @@
 
 #include "../perf.h"
 #include "trace-event.h"
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include "evsel.h"
 
 #define VERSION "0.5"
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index a1eea3e..9a2c268 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -71,7 +71,7 @@
 #include <linux/magic.h>
 #include "types.h"
 #include <sys/ttydefaults.h>
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include <termios.h>
 #include <linux/bitops.h>
 
diff --git a/tools/vm/Makefile b/tools/vm/Makefile
index 24e9ddd..3d907da 100644
--- a/tools/vm/Makefile
+++ b/tools/vm/Makefile
@@ -2,21 +2,21 @@
 #
 TARGETS=page-types slabinfo
 
-LK_DIR = ../lib/lk
-LIBLK = $(LK_DIR)/liblk.a
+LIB_DIR = ../lib/api
+LIBS = $(LIB_DIR)/libapikfs.a
 
 CC = $(CROSS_COMPILE)gcc
 CFLAGS = -Wall -Wextra -I../lib/
-LDFLAGS = $(LIBLK)
+LDFLAGS = $(LIBS)
 
-$(TARGETS): liblk
+$(TARGETS): $(LIBS)
 
-liblk:
-	make -C $(LK_DIR)
+$(LIBS):
+	make -C $(LIB_DIR)
 
 %: %.c
 	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
 
 clean:
 	$(RM) page-types slabinfo
-	make -C ../lib/lk clean
+	make -C $(LIB_DIR) clean
diff --git a/tools/vm/page-types.c b/tools/vm/page-types.c
index d5e9d6d..f9be24d 100644
--- a/tools/vm/page-types.c
+++ b/tools/vm/page-types.c
@@ -36,7 +36,7 @@
 #include <sys/statfs.h>
 #include "../../include/uapi/linux/magic.h"
 #include "../../include/uapi/linux/kernel-page-flags.h"
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 
 #ifndef MAX_PATH
 # define MAX_PATH 256

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [tip:perf/core] perf tools: Move fs.* to lib/api/fs/
  2013-12-09 16:14 ` [PATCH 2/2] perf: Move fs.* to lib/api/fs/ Borislav Petkov
  2013-12-16 13:37   ` Arnaldo Carvalho de Melo
@ 2014-02-22 17:59   ` tip-bot for Borislav Petkov
  1 sibling, 0 replies; 20+ messages in thread
From: tip-bot for Borislav Petkov @ 2014-02-22 17:59 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, eranian, mingo, peterz, penberg, efault, jolsa, fweisbec,
	rostedt, ak, dsahern, tglx, linux-kernel, hpa, paulus, arjan,
	namhyung, stfomichev, adrian.hunter, bp, rric

Commit-ID:  cd0cfad74eb88e54ba9d205da3ed376e48981448
Gitweb:     http://git.kernel.org/tip/cd0cfad74eb88e54ba9d205da3ed376e48981448
Author:     Borislav Petkov <bp@suse.de>
AuthorDate: Mon, 9 Dec 2013 17:14:24 +0100
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 18 Feb 2014 09:34:49 -0300

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

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

Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Arjan van de Ven <arjan@linux.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: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Robert Richter <rric@kernel.org>
Cc: Stanislav Fomichev <stfomichev@yandex-team.ru>
Cc: Stephane Eranian <eranian@google.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1386605664-24041-3-git-send-email-bp@alien8.de
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 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(-)

diff --git a/tools/lib/api/Makefile b/tools/lib/api/Makefile
index ed2f51e..ce00f7e 100644
--- a/tools/lib/api/Makefile
+++ b/tools/lib/api/Makefile
@@ -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
 
diff --git a/tools/perf/util/fs.c b/tools/lib/api/fs/fs.c
similarity index 91%
rename from tools/perf/util/fs.c
rename to tools/lib/api/fs/fs.c
index f5be1f2..5b5eb78 100644
--- a/tools/perf/util/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -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",
diff --git a/tools/perf/util/include/linux/magic.h b/tools/lib/api/fs/fs.h
similarity index 50%
rename from tools/perf/util/include/linux/magic.h
rename to tools/lib/api/fs/fs.h
index 07d63cf..cb70495 100644
--- a/tools/perf/util/include/linux/magic.h
+++ b/tools/lib/api/fs/fs.h
@@ -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__ */
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index f99a392..869b34a 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -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
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 4db0ae6..8605ff5 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -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>
diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c
index a9b48c4..7fe4994 100644
--- a/tools/perf/util/cpumap.c
+++ b/tools/perf/util/cpumap.c
@@ -1,5 +1,5 @@
 #include "util.h"
-#include "fs.h"
+#include <api/fs/fs.h>
 #include "../perf.h"
 #include "cpumap.h"
 #include <assert.h>
diff --git a/tools/perf/util/fs.h b/tools/perf/util/fs.h
deleted file mode 100644
index 5e09ce1..0000000
--- a/tools/perf/util/fs.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef __PERF_FS
-#define __PERF_FS
-
-const char *sysfs__mountpoint(void);
-const char *procfs__mountpoint(void);
-
-#endif /* __PERF_FS */
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index b752ecb..00a7dcb 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -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"
diff --git a/tools/perf/util/python-ext-sources b/tools/perf/util/python-ext-sources
index 595bfc7..16a475a 100644
--- a/tools/perf/util/python-ext-sources
+++ b/tools/perf/util/python-ext-sources
@@ -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
diff --git a/tools/perf/util/record.c b/tools/perf/util/record.c
index 3737625..049e0a0 100644
--- a/tools/perf/util/record.c
+++ b/tools/perf/util/record.c
@@ -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);
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 42ad667..9f66549 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -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>

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/2] tools/: Convert to new topic libraries
  2013-12-09 10:22   ` Jiri Olsa
@ 2013-12-09 10:42     ` Borislav Petkov
  0 siblings, 0 replies; 20+ messages in thread
From: Borislav Petkov @ 2013-12-09 10:42 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: LKML, Borislav Petkov, Arnaldo Carvalho de Melo, Ingo Molnar,
	Peter Zijlstra, Robert Richter

On Mon, Dec 09, 2013 at 11:22:45AM +0100, Jiri Olsa wrote:
> > -$(LIBLK)-clean:
> > +$(LIBAPIKFS)-clean:
> >  ifeq ($(subdir),)
> > -	$(call QUIET_CLEAN, liblk)
> > -	@$(MAKE) -C $(LK_DIR) O=$(OUTPUT) clean >/dev/null
> > +	$(call QUIET_CLEAN, LIBAPIKFS)
> 
> do we want 'LIBAPIKFS' in lowercase here?

We do!

... aaand

	[what was the vim shortcut... /me looks, finds it, executes it]

done.

:-)

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/2] tools/: Convert to new topic libraries
  2013-12-05 16:25 ` [PATCH 1/2] tools/: Convert to new topic libraries Borislav Petkov
@ 2013-12-09 10:22   ` Jiri Olsa
  2013-12-09 10:42     ` Borislav Petkov
  0 siblings, 1 reply; 20+ messages in thread
From: Jiri Olsa @ 2013-12-09 10:22 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: LKML, Borislav Petkov, Arnaldo Carvalho de Melo, Ingo Molnar,
	Peter Zijlstra, Robert Richter

On Thu, Dec 05, 2013 at 05:25:51PM +0100, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.de>

SNIP

>  	$(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) install_plugins
>  
> -LIBLK_SOURCES = $(wildcard $(LK_PATH)*.[ch])
> +LIBAPIKFS_SOURCES = $(wildcard $(LIB_PATH)fs/*.[ch])
>  
>  # if subdir is set, we've been called from above so target has been built
>  # already
> -$(LIBLK): $(LIBLK_SOURCES)
> +$(LIBAPIKFS): $(LIBAPIKFS_SOURCES)
>  ifeq ($(subdir),)
> -	$(QUIET_SUBDIR0)$(LK_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) liblk.a
> +	$(QUIET_SUBDIR0)$(LIB_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) libapikfs.a
>  endif
>  
> -$(LIBLK)-clean:
> +$(LIBAPIKFS)-clean:
>  ifeq ($(subdir),)
> -	$(call QUIET_CLEAN, liblk)
> -	@$(MAKE) -C $(LK_DIR) O=$(OUTPUT) clean >/dev/null
> +	$(call QUIET_CLEAN, LIBAPIKFS)

do we want 'LIBAPIKFS' in lowercase here?

jirka

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 1/2] tools/: Convert to new topic libraries
  2013-12-05 16:25 [PATCH 0/2] perf tool: Carve out fs.* stuff Borislav Petkov
@ 2013-12-05 16:25 ` Borislav Petkov
  2013-12-09 10:22   ` Jiri Olsa
  0 siblings, 1 reply; 20+ messages in thread
From: Borislav Petkov @ 2013-12-05 16:25 UTC (permalink / raw)
  To: LKML
  Cc: Borislav Petkov, Arnaldo Carvalho de Melo, Ingo Molnar,
	Jiri Olsa, Peter Zijlstra, Robert Richter

From: Borislav Petkov <bp@suse.de>

Move debugfs.* to api/fs/. We have a common tools/lib/api/ place
where the Makefile lives and then we place the headers in subdirs.
For example, all the fs-related stuff goes to tools/lib/api/fs/ from
which we get libapikfs.a (acme got almost the naming he wanted :-))
and we link it into the tools which need it - in this case perf and
tools/vm/page-types.

acme:

"Looking at the implementation, I think some tools can even link
directly to the .o files, avoiding the .a file altogether.

But that is just an optimization/finer granularity tools/lib/
cherrypicking that toolers can make use of."

Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
---
 tools/Makefile                     | 12 ++++++------
 tools/lib/{lk => api}/Makefile     |  6 +++---
 tools/lib/{lk => api/fs}/debugfs.c |  0
 tools/lib/{lk => api/fs}/debugfs.h |  6 +++---
 tools/perf/Makefile.perf           | 30 +++++++++++++++---------------
 tools/perf/builtin-kvm.c           |  2 +-
 tools/perf/builtin-probe.c         |  2 +-
 tools/perf/perf.c                  |  2 +-
 tools/perf/tests/parse-events.c    |  2 +-
 tools/perf/util/evlist.c           |  2 +-
 tools/perf/util/evsel.c            |  2 +-
 tools/perf/util/parse-events.c     |  2 +-
 tools/perf/util/probe-event.c      |  2 +-
 tools/perf/util/setup.py           |  4 ++--
 tools/perf/util/trace-event-info.c |  2 +-
 tools/perf/util/util.h             |  2 +-
 tools/vm/Makefile                  | 14 +++++++-------
 tools/vm/page-types.c              |  2 +-
 18 files changed, 47 insertions(+), 47 deletions(-)
 rename tools/lib/{lk => api}/Makefile (90%)
 rename tools/lib/{lk => api/fs}/debugfs.c (100%)
 rename tools/lib/{lk => api/fs}/debugfs.h (86%)

diff --git a/tools/Makefile b/tools/Makefile
index a9b02008443c..927cd46d36dc 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -39,10 +39,10 @@ cpupower: FORCE
 cgroup firewire guest usb virtio vm net: FORCE
 	$(call descend,$@)
 
-liblk: FORCE
-	$(call descend,lib/lk)
+libapikfs: FORCE
+	$(call descend,lib/api)
 
-perf: liblk FORCE
+perf: libapikfs FORCE
 	$(call descend,$@)
 
 selftests: FORCE
@@ -80,10 +80,10 @@ cpupower_clean:
 cgroup_clean firewire_clean lguest_clean usb_clean virtio_clean vm_clean net_clean:
 	$(call descend,$(@:_clean=),clean)
 
-liblk_clean:
-	$(call descend,lib/lk,clean)
+libapikfs_clean:
+	$(call descend,lib/api,clean)
 
-perf_clean: liblk_clean
+perf_clean: libapikfs_clean
 	$(call descend,$(@:_clean=),clean)
 
 selftests_clean:
diff --git a/tools/lib/lk/Makefile b/tools/lib/api/Makefile
similarity index 90%
rename from tools/lib/lk/Makefile
rename to tools/lib/api/Makefile
index 3dba0a4aebbf..d749cdc8e1d4 100644
--- a/tools/lib/lk/Makefile
+++ b/tools/lib/api/Makefile
@@ -7,11 +7,11 @@ AR = $(CROSS_COMPILE)ar
 LIB_H=
 LIB_OBJS=
 
-LIB_H += debugfs.h
+LIB_H += fs/debugfs.h
 
-LIB_OBJS += $(OUTPUT)debugfs.o
+LIB_OBJS += $(OUTPUT)fs/debugfs.o
 
-LIBFILE = liblk.a
+LIBFILE = libapikfs.a
 
 CFLAGS = -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) -fPIC
 EXTLIBS = -lelf -lpthread -lrt -lm
diff --git a/tools/lib/lk/debugfs.c b/tools/lib/api/fs/debugfs.c
similarity index 100%
rename from tools/lib/lk/debugfs.c
rename to tools/lib/api/fs/debugfs.c
diff --git a/tools/lib/lk/debugfs.h b/tools/lib/api/fs/debugfs.h
similarity index 86%
rename from tools/lib/lk/debugfs.h
rename to tools/lib/api/fs/debugfs.h
index 935c59bdb442..f19d3df9609d 100644
--- a/tools/lib/lk/debugfs.h
+++ b/tools/lib/api/fs/debugfs.h
@@ -1,5 +1,5 @@
-#ifndef __LK_DEBUGFS_H__
-#define __LK_DEBUGFS_H__
+#ifndef __API_DEBUGFS_H__
+#define __API_DEBUGFS_H__
 
 #define _STR(x) #x
 #define STR(x) _STR(x)
@@ -26,4 +26,4 @@ char *debugfs_mount(const char *mountpoint);
 
 extern char debugfs_mountpoint[];
 
-#endif /* __LK_DEBUGFS_H__ */
+#endif /* __API_DEBUGFS_H__ */
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index ca3b87d5389a..71d84811132c 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -86,7 +86,7 @@ FLEX    = flex
 BISON   = bison
 STRIP   = strip
 
-LK_DIR          = $(srctree)/tools/lib/lk/
+LIB_DIR          = $(srctree)/tools/lib/api/
 TRACE_EVENT_DIR = $(srctree)/tools/lib/traceevent/
 
 # include config/Makefile by default and rule out
@@ -127,20 +127,20 @@ strip-libs = $(filter-out -l%,$(1))
 ifneq ($(OUTPUT),)
   TE_PATH=$(OUTPUT)
 ifneq ($(subdir),)
-  LK_PATH=$(OUTPUT)/../lib/lk/
+  LIB_PATH=$(OUTPUT)/../lib/api/
 else
-  LK_PATH=$(OUTPUT)
+  LIB_PATH=$(OUTPUT)
 endif
 else
   TE_PATH=$(TRACE_EVENT_DIR)
-  LK_PATH=$(LK_DIR)
+  LIB_PATH=$(LIB_DIR)
 endif
 
 LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
 export LIBTRACEEVENT
 
-LIBLK = $(LK_PATH)liblk.a
-export LIBLK
+LIBAPIKFS = $(LIB_PATH)libapikfs.a
+export LIBAPIKFS
 
 # python extension build directories
 PYTHON_EXTBUILD     := $(OUTPUT)python_ext_build/
@@ -151,7 +151,7 @@ export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
 python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf.so
 
 PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
-PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) $(LIBLK)
+PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) $(LIBAPIKFS)
 
 $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS)
 	$(QUIET_GEN)CFLAGS='$(CFLAGS)' $(PYTHON_WORD) util/setup.py \
@@ -439,7 +439,7 @@ BUILTIN_OBJS += $(OUTPUT)builtin-inject.o
 BUILTIN_OBJS += $(OUTPUT)tests/builtin-test.o
 BUILTIN_OBJS += $(OUTPUT)builtin-mem.o
 
-PERFLIBS = $(LIB_FILE) $(LIBLK) $(LIBTRACEEVENT)
+PERFLIBS = $(LIB_FILE) $(LIBAPIKFS) $(LIBTRACEEVENT)
 
 # We choose to avoid "if .. else if .. else .. endif endif"
 # because maintaining the nesting to match is a pain.  If
@@ -725,19 +725,19 @@ $(LIBTRACEEVENT)-clean:
 install-traceevent-plugins:
 	$(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) install_plugins
 
-LIBLK_SOURCES = $(wildcard $(LK_PATH)*.[ch])
+LIBAPIKFS_SOURCES = $(wildcard $(LIB_PATH)fs/*.[ch])
 
 # if subdir is set, we've been called from above so target has been built
 # already
-$(LIBLK): $(LIBLK_SOURCES)
+$(LIBAPIKFS): $(LIBAPIKFS_SOURCES)
 ifeq ($(subdir),)
-	$(QUIET_SUBDIR0)$(LK_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) liblk.a
+	$(QUIET_SUBDIR0)$(LIB_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) libapikfs.a
 endif
 
-$(LIBLK)-clean:
+$(LIBAPIKFS)-clean:
 ifeq ($(subdir),)
-	$(call QUIET_CLEAN, liblk)
-	@$(MAKE) -C $(LK_DIR) O=$(OUTPUT) clean >/dev/null
+	$(call QUIET_CLEAN, LIBAPIKFS)
+	@$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null
 endif
 
 help:
@@ -876,7 +876,7 @@ config-clean:
 	$(call QUIET_CLEAN, config)
 	@$(MAKE) -C config/feature-checks clean >/dev/null
 
-clean: $(LIBTRACEEVENT)-clean $(LIBLK)-clean config-clean
+clean: $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean config-clean
 	$(call QUIET_CLEAN, core-objs)  $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS) $(GTK_OBJS)
 	$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf
 	$(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index f8bf5f244d77..252b6ed507b7 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -13,7 +13,7 @@
 #include "util/parse-options.h"
 #include "util/trace-event.h"
 #include "util/debug.h"
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include "util/tool.h"
 #include "util/stat.h"
 #include "util/top.h"
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index 6ea9e85bdc00..c98ccb570509 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -37,7 +37,7 @@
 #include "util/strfilter.h"
 #include "util/symbol.h"
 #include "util/debug.h"
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include "util/parse-options.h"
 #include "util/probe-finder.h"
 #include "util/probe-event.h"
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 8b38b4e80ec2..431798a4110d 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -13,7 +13,7 @@
 #include "util/quote.h"
 #include "util/run-command.h"
 #include "util/parse-events.h"
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include <pthread.h>
 
 const char perf_usage_string[] =
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 3cbd10496087..e4ce8aed29d3 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -3,7 +3,7 @@
 #include "evsel.h"
 #include "evlist.h"
 #include "fs.h"
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include "tests.h"
 #include <linux/hw_breakpoint.h>
 
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 7bb6ee1ca19f..8bb4eabca118 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -7,7 +7,7 @@
  * Released under the GPL v2. (and only v2, not any later version)
  */
 #include "util.h"
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include <poll.h>
 #include "cpumap.h"
 #include "thread_map.h"
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 7b510fd1f08d..01ff4cfde1f5 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -9,7 +9,7 @@
 
 #include <byteswap.h>
 #include <linux/bitops.h>
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include <traceevent/event-parse.h>
 #include <linux/hw_breakpoint.h>
 #include <linux/perf_event.h>
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 969cb8f0d88d..094c28ba2fae 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -10,7 +10,7 @@
 #include "symbol.h"
 #include "cache.h"
 #include "header.h"
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include "parse-events-bison.h"
 #define YY_EXTRA_TYPE int
 #include "parse-events-flex.h"
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 9c6989ca2bea..8cd98ef628be 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -40,7 +40,7 @@
 #include "color.h"
 #include "symbol.h"
 #include "thread.h"
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include "trace-event.h"	/* For __maybe_unused */
 #include "probe-event.h"
 #include "probe-finder.h"
diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
index 58ea5ca6c255..d0aee4b9dfd4 100644
--- a/tools/perf/util/setup.py
+++ b/tools/perf/util/setup.py
@@ -25,7 +25,7 @@ cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter'
 build_lib = getenv('PYTHON_EXTBUILD_LIB')
 build_tmp = getenv('PYTHON_EXTBUILD_TMP')
 libtraceevent = getenv('LIBTRACEEVENT')
-liblk = getenv('LIBLK')
+libapikfs = getenv('LIBAPIKFS')
 
 ext_sources = [f.strip() for f in file('util/python-ext-sources')
 				if len(f.strip()) > 0 and f[0] != '#']
@@ -34,7 +34,7 @@ perf = Extension('perf',
 		  sources = ext_sources,
 		  include_dirs = ['util/include'],
 		  extra_compile_args = cflags,
-		  extra_objects = [libtraceevent, liblk],
+		  extra_objects = [libtraceevent, libapikfs],
                  )
 
 setup(name='perf',
diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
index f3c9e551bd35..c354b95a2348 100644
--- a/tools/perf/util/trace-event-info.c
+++ b/tools/perf/util/trace-event-info.c
@@ -38,7 +38,7 @@
 
 #include "../perf.h"
 #include "trace-event.h"
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include "evsel.h"
 
 #define VERSION "0.5"
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index adb39f251f90..4dc21c8e87b0 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -71,7 +71,7 @@
 #include <linux/magic.h>
 #include "types.h"
 #include <sys/ttydefaults.h>
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 #include <termios.h>
 
 extern const char *graph_line;
diff --git a/tools/vm/Makefile b/tools/vm/Makefile
index 24e9ddd93fa4..3d907dacf2ac 100644
--- a/tools/vm/Makefile
+++ b/tools/vm/Makefile
@@ -2,21 +2,21 @@
 #
 TARGETS=page-types slabinfo
 
-LK_DIR = ../lib/lk
-LIBLK = $(LK_DIR)/liblk.a
+LIB_DIR = ../lib/api
+LIBS = $(LIB_DIR)/libapikfs.a
 
 CC = $(CROSS_COMPILE)gcc
 CFLAGS = -Wall -Wextra -I../lib/
-LDFLAGS = $(LIBLK)
+LDFLAGS = $(LIBS)
 
-$(TARGETS): liblk
+$(TARGETS): $(LIBS)
 
-liblk:
-	make -C $(LK_DIR)
+$(LIBS):
+	make -C $(LIB_DIR)
 
 %: %.c
 	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
 
 clean:
 	$(RM) page-types slabinfo
-	make -C ../lib/lk clean
+	make -C $(LIB_DIR) clean
diff --git a/tools/vm/page-types.c b/tools/vm/page-types.c
index d5e9d6d185c8..f9be24d9efac 100644
--- a/tools/vm/page-types.c
+++ b/tools/vm/page-types.c
@@ -36,7 +36,7 @@
 #include <sys/statfs.h>
 #include "../../include/uapi/linux/magic.h"
 #include "../../include/uapi/linux/kernel-page-flags.h"
-#include <lk/debugfs.h>
+#include <api/fs/debugfs.h>
 
 #ifndef MAX_PATH
 # define MAX_PATH 256
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2014-02-22 18:00 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-09 16:14 [PATCH -v1.1 0/2] perf tool: Carve out fs.* stuff Borislav Petkov
2013-12-09 16:14 ` [PATCH 1/2] tools/: Convert to new topic libraries Borislav Petkov
2013-12-10  1:32   ` Namhyung Kim
2013-12-10 11:27     ` Borislav Petkov
2013-12-11  1:21       ` Namhyung Kim
2013-12-11 12:31         ` Arnaldo Carvalho de Melo
2013-12-11  1:46   ` David Ahern
2013-12-11  9:56     ` Borislav Petkov
2013-12-11 12:31       ` Arnaldo Carvalho de Melo
2013-12-11 13:24         ` Ingo Molnar
2013-12-11 13:30           ` Borislav Petkov
2013-12-11 13:54             ` Arnaldo Carvalho de Melo
2013-12-11 14:02               ` Borislav Petkov
2013-12-18 10:30   ` [tip:perf/core] " tip-bot for Borislav Petkov
2013-12-09 16:14 ` [PATCH 2/2] perf: Move fs.* to lib/api/fs/ Borislav Petkov
2013-12-16 13:37   ` Arnaldo Carvalho de Melo
2014-02-22 17:59   ` [tip:perf/core] perf tools: " tip-bot for Borislav Petkov
  -- strict thread matches above, loose matches on Subject: below --
2013-12-05 16:25 [PATCH 0/2] perf tool: Carve out fs.* stuff Borislav Petkov
2013-12-05 16:25 ` [PATCH 1/2] tools/: Convert to new topic libraries Borislav Petkov
2013-12-09 10:22   ` Jiri Olsa
2013-12-09 10:42     ` Borislav Petkov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.