[sysprof/wip/chergert/sysprof-3] shared: remove use of libshared
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof/wip/chergert/sysprof-3] shared: remove use of libshared
- Date: Wed, 8 May 2019 17:00:31 +0000 (UTC)
commit 1956e4f6e702a21afa655d26b8451cf8c8695157
Author: Christian Hergert <chergert redhat com>
Date: Wed May 8 09:57:30 2019 -0700
shared: remove use of libshared
This moves everything into other places and simple includes the
files in the cases that it is necessary. In the future, we can
rewrite sysprofd to use GDBus and add GetProcFile() to allow
for client-side processing of kallsyms.
src/libsysprof-capture/meson.build | 9 ++++--
.../sp-address-fallback.h | 0
src/{shared => libsysprof-capture}/sp-address.c | 0
src/{shared => libsysprof-capture}/sp-address.h | 4 ++-
src/{shared => libsysprof-capture}/sp-clock.c | 0
src/{shared => libsysprof-capture}/sp-clock.h | 6 +++-
src/{shared => libsysprof-capture}/sp-platform.c | 0
src/{shared => libsysprof-capture}/sp-platform.h | 0
src/libsysprof-capture/sysprof-capture.h | 1 -
src/libsysprof-capture/sysprof-version-macros.h | 4 ---
src/libsysprof-capture/sysprof-version.h.in | 4 ---
src/libsysprof/meson.build | 3 ++
src/{shared => libsysprof}/sp-kallsyms.c | 0
src/{shared => libsysprof}/sp-kallsyms.h | 7 +++--
src/libsysprof/sp-kernel-symbol.c | 1 -
src/{shared => libsysprof}/sp-line-reader.c | 0
src/{shared => libsysprof}/sp-line-reader.h | 3 ++
src/libsysprof/sysprof.h | 1 +
src/meson.build | 1 -
src/shared/meson.build | 31 ---------------------
src/shared/sp-error.c | 32 ----------------------
src/shared/sp-error.h | 31 ---------------------
src/sysprof/meson.build | 1 -
src/sysprofd/meson.build | 11 ++++----
src/tests/test-kallsyms.c | 4 +--
src/tools/meson.build | 1 -
26 files changed, 33 insertions(+), 122 deletions(-)
---
diff --git a/src/libsysprof-capture/meson.build b/src/libsysprof-capture/meson.build
index e2c9cae..529440d 100644
--- a/src/libsysprof-capture/meson.build
+++ b/src/libsysprof-capture/meson.build
@@ -1,19 +1,25 @@
libsysprof_capture_headers = [
+ 'sp-address.h',
+ 'sp-clock.h',
'sp-capture-condition.h',
'sp-capture-cursor.h',
'sp-capture-reader.h',
'sp-capture-types.h',
'sp-capture-writer.h',
+ 'sp-platform.h',
'sysprof-capture.h',
'sysprof-version-macros.h',
]
libsysprof_capture_sources = [
+ 'sp-address.c',
'sp-capture-condition.c',
'sp-capture-cursor.c',
'sp-capture-reader.c',
- 'sp-capture-writer.c',
'sp-capture-util.c',
+ 'sp-capture-writer.c',
+ 'sp-clock.c',
+ 'sp-platform.c',
]
configure_file(
@@ -25,7 +31,6 @@ configure_file(
libsysprof_capture_deps = [
dependency('glib-2.0', version: glib_req_version),
- libshared_dep,
]
install_headers(libsysprof_capture_headers, subdir: sysprof_header_subdir)
diff --git a/src/shared/sp-address-fallback.h b/src/libsysprof-capture/sp-address-fallback.h
similarity index 100%
rename from src/shared/sp-address-fallback.h
rename to src/libsysprof-capture/sp-address-fallback.h
diff --git a/src/shared/sp-address.c b/src/libsysprof-capture/sp-address.c
similarity index 100%
rename from src/shared/sp-address.c
rename to src/libsysprof-capture/sp-address.c
diff --git a/src/shared/sp-address.h b/src/libsysprof-capture/sp-address.h
similarity index 94%
rename from src/shared/sp-address.h
rename to src/libsysprof-capture/sp-address.h
index af8b302..858de17 100644
--- a/src/shared/sp-address.h
+++ b/src/libsysprof-capture/sp-address.h
@@ -20,7 +20,7 @@
#pragma once
-#include <glib.h>
+#include "sysprof-version-macros.h"
G_BEGIN_DECLS
@@ -39,8 +39,10 @@ typedef enum
SP_ADDRESS_CONTEXT_GUEST_USER,
} SpAddressContext;
+SYSPROF_AVAILABLE_IN_ALL
gboolean sp_address_is_context_switch (SpAddress address,
SpAddressContext *context);
+SYSPROF_AVAILABLE_IN_ALL
const gchar *sp_address_context_to_string (SpAddressContext context);
static inline gint
diff --git a/src/shared/sp-clock.c b/src/libsysprof-capture/sp-clock.c
similarity index 100%
rename from src/shared/sp-clock.c
rename to src/libsysprof-capture/sp-clock.c
diff --git a/src/shared/sp-clock.h b/src/libsysprof-capture/sp-clock.h
similarity index 92%
rename from src/shared/sp-clock.h
rename to src/libsysprof-capture/sp-clock.h
index 9edeb74..e53773c 100644
--- a/src/shared/sp-clock.h
+++ b/src/libsysprof-capture/sp-clock.h
@@ -23,13 +23,16 @@
#include <glib.h>
#include <time.h>
+#include "sysprof-version-macros.h"
+
G_BEGIN_DECLS
typedef gint SpClock;
typedef gint64 SpTimeStamp;
typedef gint32 SpTimeSpan;
-extern SpClock sp_clock;
+SYSPROF_AVAILABLE_IN_ALL
+SpClock sp_clock;
static inline SpTimeStamp
sp_clock_get_current_time (void)
@@ -50,6 +53,7 @@ sp_clock_get_relative_time (SpTimeStamp epoch)
return sp_clock_get_current_time () - epoch;
}
+SYSPROF_AVAILABLE_IN_ALL
void sp_clock_init (void);
G_END_DECLS
diff --git a/src/shared/sp-platform.c b/src/libsysprof-capture/sp-platform.c
similarity index 100%
rename from src/shared/sp-platform.c
rename to src/libsysprof-capture/sp-platform.c
diff --git a/src/shared/sp-platform.h b/src/libsysprof-capture/sp-platform.h
similarity index 100%
rename from src/shared/sp-platform.h
rename to src/libsysprof-capture/sp-platform.h
diff --git a/src/libsysprof-capture/sysprof-capture.h b/src/libsysprof-capture/sysprof-capture.h
index 5e86631..d949b92 100644
--- a/src/libsysprof-capture/sysprof-capture.h
+++ b/src/libsysprof-capture/sysprof-capture.h
@@ -32,7 +32,6 @@ G_BEGIN_DECLS
# include "sp-capture-reader.h"
# include "sp-capture-writer.h"
# include "sp-clock.h"
-# include "sp-error.h"
# include "sysprof-version.h"
# include "sysprof-version-macros.h"
diff --git a/src/libsysprof-capture/sysprof-version-macros.h b/src/libsysprof-capture/sysprof-version-macros.h
index 5224d3e..f787873 100644
--- a/src/libsysprof-capture/sysprof-version-macros.h
+++ b/src/libsysprof-capture/sysprof-version-macros.h
@@ -20,10 +20,6 @@
#pragma once
-#if !defined (SYSPROF_CAPTURE_INSIDE) && !defined (SYSPROF_CAPTURE_COMPILATION)
-# error "Only <sysprof-capture.h> can be included directly."
-#endif
-
#include <glib.h>
#include "sysprof-version.h"
diff --git a/src/libsysprof-capture/sysprof-version.h.in b/src/libsysprof-capture/sysprof-version.h.in
index d511c72..811725a 100644
--- a/src/libsysprof-capture/sysprof-version.h.in
+++ b/src/libsysprof-capture/sysprof-version.h.in
@@ -20,10 +20,6 @@
#pragma once
-#if !defined(SYSPROF_CAPTURE_INSIDE) && !defined(SYSPROF_CAPTURE_COMPILATION)
-# error "Only <sysprof-capture.h> can be included directly."
-#endif
-
/**
* SECTION:sysprof-version
* @short_description: sysprof version checking
diff --git a/src/libsysprof/meson.build b/src/libsysprof/meson.build
index c86aa5e..2186d09 100644
--- a/src/libsysprof/meson.build
+++ b/src/libsysprof/meson.build
@@ -6,6 +6,7 @@ libsysprof_public_sources = [
'sp-elf-symbol-resolver.c',
'sp-hostinfo-source.c',
'sp-jitmap-symbol-resolver.c',
+ 'sp-kallsyms.c',
'sp-kernel-symbol.c',
'sp-kernel-symbol-resolver.c',
'sp-local-profiler.c',
@@ -27,6 +28,7 @@ libsysprof_public_headers = [
'sp-elf-symbol-resolver.h',
'sp-hostinfo-source.h',
'sp-jitmap-symbol-resolver.h',
+ 'sp-kallsyms.h',
'sp-kernel-symbol.h',
'sp-kernel-symbol-resolver.h',
'sp-local-profiler.h',
@@ -48,6 +50,7 @@ libsysprof_private_sources = [
'elfparser.c',
'stackstash.c',
'sp-source-util.c',
+ 'sp-line-reader.c',
]
libsysprof_deps = [
diff --git a/src/shared/sp-kallsyms.c b/src/libsysprof/sp-kallsyms.c
similarity index 100%
rename from src/shared/sp-kallsyms.c
rename to src/libsysprof/sp-kallsyms.c
diff --git a/src/shared/sp-kallsyms.h b/src/libsysprof/sp-kallsyms.h
similarity index 91%
rename from src/shared/sp-kallsyms.h
rename to src/libsysprof/sp-kallsyms.h
index 70cee2d..2357d0b 100644
--- a/src/shared/sp-kallsyms.h
+++ b/src/libsysprof/sp-kallsyms.h
@@ -20,19 +20,20 @@
#pragma once
-#include <glib.h>
-
-#include "sp-kallsyms.h"
+#include "sysprof-version-macros.h"
G_BEGIN_DECLS
typedef struct _SpKallsyms SpKallsyms;
+SYSPROF_AVAILABLE_IN_ALL
SpKallsyms *sp_kallsyms_new (const gchar *path);
+SYSPROF_AVAILABLE_IN_ALL
gboolean sp_kallsyms_next (SpKallsyms *self,
const gchar **name,
guint64 *address,
guint8 *type);
+SYSPROF_AVAILABLE_IN_ALL
void sp_kallsyms_free (SpKallsyms *self);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SpKallsyms, sp_kallsyms_free)
diff --git a/src/libsysprof/sp-kernel-symbol.c b/src/libsysprof/sp-kernel-symbol.c
index c45fd72..37f8c69 100644
--- a/src/libsysprof/sp-kernel-symbol.c
+++ b/src/libsysprof/sp-kernel-symbol.c
@@ -27,7 +27,6 @@
#include <sysprof-capture.h>
#include "sp-kallsyms.h"
-#include "sp-line-reader.h"
#include "sp-kernel-symbol.h"
static GArray *kernel_symbols;
diff --git a/src/shared/sp-line-reader.c b/src/libsysprof/sp-line-reader.c
similarity index 100%
rename from src/shared/sp-line-reader.c
rename to src/libsysprof/sp-line-reader.c
diff --git a/src/shared/sp-line-reader.h b/src/libsysprof/sp-line-reader.h
similarity index 96%
rename from src/shared/sp-line-reader.h
rename to src/libsysprof/sp-line-reader.h
index fd2fcfb..9fa02c2 100644
--- a/src/shared/sp-line-reader.h
+++ b/src/libsysprof/sp-line-reader.h
@@ -26,9 +26,12 @@ G_BEGIN_DECLS
typedef struct _SpLineReader SpLineReader;
+G_GNUC_INTERNAL
SpLineReader *sp_line_reader_new (const gchar *contents,
gssize length);
+G_GNUC_INTERNAL
void sp_line_reader_free (SpLineReader *self);
+G_GNUC_INTERNAL
const gchar *sp_line_reader_next (SpLineReader *self,
gsize *length);
diff --git a/src/libsysprof/sysprof.h b/src/libsysprof/sysprof.h
index 3c4030d..1b762df 100644
--- a/src/libsysprof/sysprof.h
+++ b/src/libsysprof/sysprof.h
@@ -27,6 +27,7 @@ G_BEGIN_DECLS
# include "sp-callgraph-profile.h"
# include "sp-capture-gobject.h"
# include "sp-local-profiler.h"
+# include "sp-kallsyms.h"
# include "sp-profile.h"
# include "sp-profiler.h"
# include "sp-map-lookaside.h"
diff --git a/src/meson.build b/src/meson.build
index 4e91322..8b59c28 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -7,7 +7,6 @@ sysprof_version_conf.set('MINOR_VERSION', sysprof_version[1])
sysprof_version_conf.set('MICRO_VERSION', sysprof_version[2])
sysprof_version_conf.set('VERSION', meson.project_version())
-subdir('shared')
subdir('libsysprof-capture')
subdir('sysprofd')
subdir('libsysprof')
diff --git a/src/sysprof/meson.build b/src/sysprof/meson.build
index f64a233..df9feba 100644
--- a/src/sysprof/meson.build
+++ b/src/sysprof/meson.build
@@ -14,7 +14,6 @@ sysprof_resources = gnome.compile_resources('sysprof-resources', 'sysprof.gresou
sysprof_deps = [
cc.find_library('m', required: false),
- libshared_dep,
libsysprof_capture_dep,
libsysprof_dep,
libsysprof_ui_dep,
diff --git a/src/sysprofd/meson.build b/src/sysprofd/meson.build
index c3a9534..097c2d6 100644
--- a/src/sysprofd/meson.build
+++ b/src/sysprofd/meson.build
@@ -4,6 +4,7 @@ sysprofd_sources = [
'sysprofd.c',
'sd-bus-helper.c',
'sd-bus-helper.h',
+ '../libsysprof/sp-kallsyms.c',
]
pkglibexecdir = join_paths(get_option('prefix'), get_option('libexecdir'))
@@ -11,14 +12,14 @@ pkglibexecdir = join_paths(get_option('prefix'), get_option('libexecdir'))
sysprofd_deps = [
dependency('libsystemd', version: '>=222'),
dependency('glib-2.0', version: glib_req_version),
- libshared_dep,
]
sysprofd = executable('sysprofd', sysprofd_sources,
- dependencies: sysprofd_deps,
- install: true,
- install_dir: pkglibexecdir,
- pie: true,
+ dependencies: sysprofd_deps,
+ install: true,
+ install_dir: pkglibexecdir,
+ pie: true,
+ include_directories: [include_directories('.'), '../libsysprof'],
)
sysprofdconf = configuration_data()
diff --git a/src/tests/test-kallsyms.c b/src/tests/test-kallsyms.c
index be14112..417bf56 100644
--- a/src/tests/test-kallsyms.c
+++ b/src/tests/test-kallsyms.c
@@ -1,8 +1,6 @@
-#include "../shared/sp-address.h"
-#include "../shared/sp-kallsyms.h"
-
#include <glib.h>
#include <stdlib.h>
+#include <sysprof.h>
int
main (gint argc,
diff --git a/src/tools/meson.build b/src/tools/meson.build
index d896e6e..1c7a0e4 100644
--- a/src/tools/meson.build
+++ b/src/tools/meson.build
@@ -1,5 +1,4 @@
tools_deps = [
- libshared_dep,
libsysprof_capture_dep,
]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]