diff options
author | David Smith <dsmith@redhat.com> | 2009-04-02 10:16:35 -0500 |
---|---|---|
committer | David Smith <dsmith@redhat.com> | 2009-04-02 10:16:35 -0500 |
commit | 9b23198d73b782bc05dc2b834c7db3afbdefda86 (patch) | |
tree | 63ed86aec9f2ac155158accb72add6af73a416b0 | |
parent | 2e07d704dc5d7304d6a9e666553a1a8ac4382730 (diff) | |
download | systemtap-steved-9b23198d73b782bc05dc2b834c7db3afbdefda86.tar.gz systemtap-steved-9b23198d73b782bc05dc2b834c7db3afbdefda86.tar.xz systemtap-steved-9b23198d73b782bc05dc2b834c7db3afbdefda86.zip |
Renamed STP_OLD_TRANSPORT to STP_TRANSPORT_VERSION.
2009-04-02 David Smith <dsmith@redhat.com>
* runtime.h: Defines STP_TRANSPORT_VERSION instead of STP_OLD_TRANSPORT.
* staprun/staprun.h (STP_OLD_TRANSPORT): Ditto.
* print.c: Changed STP_OLD_TRANSPORT to STP_TRANSPORT_VERSION.
* staprun/mainloop.c (stp_main_loop): Ditto.
* transport/transport.c: Ditto.
* transport/transport.h: Ditto.
* transport/transport_msgs.h: Ditto.
* transport/utt.h: Ditto.
-rw-r--r-- | runtime/print.c | 2 | ||||
-rw-r--r-- | runtime/runtime.h | 7 | ||||
-rw-r--r-- | runtime/staprun/mainloop.c | 2 | ||||
-rw-r--r-- | runtime/staprun/staprun.h | 5 | ||||
-rw-r--r-- | runtime/transport/transport.c | 17 | ||||
-rw-r--r-- | runtime/transport/transport.h | 2 | ||||
-rw-r--r-- | runtime/transport/transport_msgs.h | 4 | ||||
-rw-r--r-- | runtime/transport/utt.h | 2 |
8 files changed, 26 insertions, 15 deletions
diff --git a/runtime/print.c b/runtime/print.c index fa517cb5..2e205f10 100644 --- a/runtime/print.c +++ b/runtime/print.c @@ -90,7 +90,7 @@ static void _stp_print_cleanup (void) /* The relayfs API changed between 2.6.15 and 2.6.16. */ /* Use the appropriate print flush function. */ -#ifdef STP_OLD_TRANSPORT +#if STP_TRANSPORT_VERSION == 1 #include "print_old.c" #else #include "print_new.c" diff --git a/runtime/runtime.h b/runtime/runtime.h index 28283db6..78c27a84 100644 --- a/runtime/runtime.h +++ b/runtime/runtime.h @@ -34,9 +34,14 @@ #if !defined (CONFIG_DEBUG_FS) && !defined (CONFIG_DEBUG_FS_MODULE) #error "DebugFS is required and was not found in the kernel." #endif +#ifdef CONFIG_RING_BUFFER +#define STP_TRANSPORT_VERSION 3 +#else +#define STP_TRANSPORT_VERSION 2 +#endif #else /* older kernels have no debugfs and older version of relayfs. */ -#define STP_OLD_TRANSPORT +#define STP_TRANSPORT_VERSION 1 #endif #ifndef stp_for_each_cpu diff --git a/runtime/staprun/mainloop.c b/runtime/staprun/mainloop.c index 29eb4f1f..0745f611 100644 --- a/runtime/staprun/mainloop.c +++ b/runtime/staprun/mainloop.c @@ -452,7 +452,7 @@ int stp_main_loop(void) nb -= sizeof(uint32_t); switch (type) { -#ifdef STP_OLD_TRANSPORT +#if STP_TRANSPORT_VERSION == 1 case STP_REALTIME_DATA: { ssize_t bw = write(out_fd[0], data, nb); diff --git a/runtime/staprun/staprun.h b/runtime/staprun/staprun.h index 84cf63fc..f49cc7db 100644 --- a/runtime/staprun/staprun.h +++ b/runtime/staprun/staprun.h @@ -90,8 +90,9 @@ extern char *__name__; /* Grabbed from linux/module.h kernel include. */ #define MODULE_NAME_LEN (64 - sizeof(unsigned long)) -/* we define this so we are compatible with old transport, but we don't have to use it. */ -#define STP_OLD_TRANSPORT +/* We define this so we are compatible with old transport, but we + * don't have to use it. */ +#define STP_TRANSPORT_VERSION 1 #include "../transport/transport_msgs.h" #define RELAYFS_MAGIC 0xF0B4A981 diff --git a/runtime/transport/transport.c b/runtime/transport/transport.c index c4c9da1e..c0c97467 100644 --- a/runtime/transport/transport.c +++ b/runtime/transport/transport.c @@ -41,12 +41,17 @@ static int _stp_probes_started = 0; static struct utt_trace *_stp_utt = NULL; static unsigned int utt_seq = 1; #include "control.h" -#ifdef STP_OLD_TRANSPORT +#if STP_TRANSPORT_VERSION == 1 #include "relayfs.c" #include "procfs.c" -#else +#elif STP_TRANSPORT_VERSION == 2 #include "utt.c" #include "debugfs.c" +#elif STP_TRANSPORT_VERSION == 3 +#include "debugfs.c" +#include "ring_buffer.c" +#else +#error "Unknown STP_TRANSPORT_VERSION" #endif #include "control.c" @@ -355,7 +360,7 @@ static struct dentry *_stp_lockfile = NULL; static int _stp_lock_transport_dir(void) { int numtries = 0; -#ifdef STP_OLD_TRANSPORT +#if STP_TRANSPORT_VERSION == 1 while ((_stp_lockfile = relayfs_create_dir("systemtap_lock", NULL)) == NULL) { #else while ((_stp_lockfile = debugfs_create_dir("systemtap_lock", NULL)) == NULL) { @@ -370,7 +375,7 @@ static int _stp_lock_transport_dir(void) static void _stp_unlock_transport_dir(void) { if (_stp_lockfile) { -#ifdef STP_OLD_TRANSPORT +#if STP_TRANSPORT_VERSION == 1 relayfs_remove_dir(_stp_lockfile); #else debugfs_remove(_stp_lockfile); @@ -394,7 +399,7 @@ static struct dentry *_stp_get_root_dir(void) return __stp_root_dir; } -#ifdef STP_OLD_TRANSPORT +#if STP_TRANSPORT_VERSION == 1 fs = get_fs_type("relayfs"); if (!fs) { errk("Couldn't find relayfs filesystem.\n"); @@ -412,7 +417,7 @@ static struct dentry *_stp_get_root_dir(void) errk("Couldn't lock transport directory.\n"); return NULL; } -#ifdef STP_OLD_TRANSPORT +#if STP_TRANSPORT_VERSION == 1 __stp_root_dir = relayfs_create_dir(name, NULL); #else __stp_root_dir = debugfs_create_dir(name, NULL); diff --git a/runtime/transport/transport.h b/runtime/transport/transport.h index 7d1f5c5d..1d245cc6 100644 --- a/runtime/transport/transport.h +++ b/runtime/transport/transport.h @@ -26,7 +26,7 @@ static inline void *utt_reserve(struct utt_trace *utt, size_t length) /* STP_CTL_BUFFER_SIZE is the maximum size of a message */ /* exchanged on the control channel. */ -#ifdef STP_OLD_TRANSPORT +#if STP_TRANSPORT_VERSION == 1 /* Old transport sends print output on control channel */ #define STP_CTL_BUFFER_SIZE STP_BUFFER_SIZE #else diff --git a/runtime/transport/transport_msgs.h b/runtime/transport/transport_msgs.h index 596f4925..0d6853f7 100644 --- a/runtime/transport/transport_msgs.h +++ b/runtime/transport/transport_msgs.h @@ -30,7 +30,7 @@ enum STP_BULK, STP_READY, STP_RELOCATION, - /** deprecated STP_OLD_TRANSPORT **/ + /** deprecated STP_TRANSPORT_VERSION == 1 **/ STP_BUF_INFO, STP_SUBBUFS_CONSUMED, STP_REALTIME_DATA, @@ -81,7 +81,7 @@ struct _stp_msg_start int32_t res; // for reply: result of probe_start() }; -#ifdef STP_OLD_TRANSPORT +#if STP_TRANSPORT_VERSION == 1 /**** for compatibility with old relayfs ****/ struct _stp_buf_info { diff --git a/runtime/transport/utt.h b/runtime/transport/utt.h index 0a0944c0..2a479d70 100644 --- a/runtime/transport/utt.h +++ b/runtime/transport/utt.h @@ -47,7 +47,7 @@ static int utt_trace_startstop(struct utt_trace *utt, int start, static void utt_trace_cleanup(struct utt_trace *utt); static int utt_trace_remove(struct utt_trace *utt); -#ifndef STP_OLD_TRANSPORT +#if STP_TRANSPORT_VERSION == 2 static size_t utt_switch_subbuf(struct utt_trace *utt, struct rchan_buf *buf, size_t length); /** |