Rewrite last GPL bits in relay.c and relay.h
[ust.git] / libust / tracer.h
index 0c283ab4dfbb5c501472734a50e4815ff3cda623..58aae583c6aa67d34684f5c8f896ce5116c214ab 100644 (file)
 #include <sys/types.h>
 #include <stdarg.h>
 //#include "list.h"
-#include "kernelcompat.h"
-#include "buffer.h"
-#include "relay.h"
+#include <ust/kernelcompat.h>
+#include "buffers.h"
 #include "channels.h"
 #include "tracercore.h"
-#include "marker.h"
+#include <ust/marker.h>
 
 /* Number of bytes to log with a read/write event */
 #define LTT_LOG_RW_SIZE                        32L
@@ -57,7 +56,7 @@ struct ltt_serialize_closure;
 struct ltt_probe_private_data;
 
 /* Serialization callback '%k' */
-typedef size_t (*ltt_serialize_cb)(struct rchan_buf *buf, size_t buf_offset,
+typedef size_t (*ltt_serialize_cb)(struct ust_buffer *buf, size_t buf_offset,
                        struct ltt_serialize_closure *closure,
                        void *serialize_private, int *largest_align,
                        const char *fmt, va_list *args);
@@ -68,7 +67,7 @@ struct ltt_serialize_closure {
        unsigned int cb_idx;
 };
 
-size_t ltt_serialize_data(struct rchan_buf *buf, size_t buf_offset,
+extern size_t ltt_serialize_data(struct ust_buffer *buf, size_t buf_offset,
                        struct ltt_serialize_closure *closure,
                        void *serialize_private,
                        int *largest_align, const char *fmt, va_list *args);
@@ -110,9 +109,9 @@ struct ltt_active_marker {
 
 struct marker; //ust//
 extern void ltt_vtrace(const struct marker *mdata, void *probe_data,
-       void *call_data, const char *fmt, va_list *args);
+       struct registers *regs, void *call_data, const char *fmt, va_list *args);
 extern void ltt_trace(const struct marker *mdata, void *probe_data,
-       void *call_data, const char *fmt, ...);
+       struct registers *regs, void *call_data, const char *fmt, ...);
 
 /*
  * Unique ID assigned to each registered probe.
@@ -143,7 +142,7 @@ struct user_dbg_data {
 struct ltt_trace_ops {
        /* First 32 bytes cache-hot cacheline */
        int (*reserve_slot) (struct ltt_trace_struct *trace,
-                               struct ltt_channel_struct *channel,
+                               struct ust_channel *channel,
                                void **transport_data, size_t data_size,
                                size_t *slot_size, long *buf_offset, u64 *tsc,
                                unsigned int *rflags,
@@ -151,24 +150,24 @@ struct ltt_trace_ops {
 //ust//        void (*commit_slot) (struct ltt_channel_struct *channel,
 //ust//                                void **transport_data, long buf_offset,
 //ust//                                size_t slot_size);
-       void (*wakeup_channel) (struct ltt_channel_struct *ltt_channel);
+       void (*wakeup_channel) (struct ust_channel *channel);
        int (*user_blocking) (struct ltt_trace_struct *trace,
                                unsigned int index, size_t data_size,
                                struct user_dbg_data *dbg);
-       /* End of first 32 bytes cacheline */
-       int (*create_dirs) (struct ltt_trace_struct *new_trace);
-       void (*remove_dirs) (struct ltt_trace_struct *new_trace);
-       int (*create_channel) (const char *trace_name,
-                               struct ltt_trace_struct *trace,
-                               struct dentry *dir, const char *channel_name,
-                               struct ltt_channel_struct *ltt_chan,
-                               unsigned int subbuf_size,
-                               unsigned int n_subbufs, int overwrite);
-       void (*finish_channel) (struct ltt_channel_struct *channel);
-       void (*remove_channel) (struct ltt_channel_struct *channel);
-       void (*user_errors) (struct ltt_trace_struct *trace,
-                               unsigned int index, size_t data_size,
-                               struct user_dbg_data *dbg);
+       /* End of first 32 bytes cacheline */
+       int (*create_dirs) (struct ltt_trace_struct *new_trace);
+       void (*remove_dirs) (struct ltt_trace_struct *new_trace);
+       int (*create_channel) (const char *trace_name,
+                               struct ltt_trace_struct *trace,
+                               const char *channel_name,
+                               struct ust_channel *channel,
+                               unsigned int subbuf_size,
+                               unsigned int n_subbufs, int overwrite);
+       void (*finish_channel) (struct ust_channel *channel);
+       void (*remove_channel) (struct ust_channel *channel);
+       void (*user_errors) (struct ltt_trace_struct *trace,
+                               unsigned int index, size_t data_size,
+                               struct user_dbg_data *dbg);
 } ____cacheline_aligned;
 
 struct ltt_transport {
@@ -190,7 +189,7 @@ struct ltt_trace_struct {
        struct ltt_trace_ops *ops;
        int active;
        /* Second 32 bytes cache-hot cacheline */
-       struct ltt_channel_struct *channels;
+       struct ust_channel *channels;
        unsigned int nr_channels;
        u32 freq_scale;
        u64 start_freq;
@@ -299,7 +298,7 @@ static inline size_t ltt_subbuffer_header_size(void)
 }
 
 /*
- * ltt_get_header_size
+ * ust_get_header_size
  *
  * Calculate alignment offset to 32-bits. This is the alignment offset of the
  * event header.
@@ -317,8 +316,8 @@ static inline size_t ltt_subbuffer_header_size(void)
  * The payload must itself determine its own alignment from the biggest type it
  * contains.
  * */
-static inline unsigned char ltt_get_header_size(
-               struct ltt_channel_struct *channel,
+static inline unsigned char ust_get_header_size(
+               struct ust_channel *channel,
                size_t offset,
                size_t data_size,
                size_t *before_hdr_pad,
@@ -370,8 +369,7 @@ static inline unsigned char ltt_get_header_size(
  * returns : offset where the event data must be written.
  */
 static inline size_t ltt_write_event_header(struct ltt_trace_struct *trace,
-               struct ltt_channel_struct *channel,
-               struct rchan_buf *buf, long buf_offset,
+               struct ust_buffer *buf, long buf_offset,
                u16 eID, size_t event_size,
                u64 tsc, unsigned int rflags)
 {
@@ -393,44 +391,44 @@ static inline size_t ltt_write_event_header(struct ltt_trace_struct *trace,
                break;
        }
        header.id_time |= (u32)tsc & LTT_TSC_MASK;
-       ltt_relay_write(buf, buf_offset, &header, sizeof(header));
+       ust_buffers_write(buf, buf_offset, &header, sizeof(header));
        buf_offset += sizeof(header);
 
        switch (rflags) {
        case LTT_RFLAG_ID_SIZE_TSC:
                small_size = min_t(size_t, event_size, 0xFFFFU);
-               ltt_relay_write(buf, buf_offset,
+               ust_buffers_write(buf, buf_offset,
                        (u16[]){ (u16)eID }, sizeof(u16));
                buf_offset += sizeof(u16);
-               ltt_relay_write(buf, buf_offset,
+               ust_buffers_write(buf, buf_offset,
                        (u16[]){ (u16)small_size }, sizeof(u16));
                buf_offset += sizeof(u16);
                if (small_size == 0xFFFFU) {
-                       ltt_relay_write(buf, buf_offset,
+                       ust_buffers_write(buf, buf_offset,
                                (u32[]){ (u32)event_size }, sizeof(u32));
                        buf_offset += sizeof(u32);
                }
                buf_offset += ltt_align(buf_offset, sizeof(u64));
-               ltt_relay_write(buf, buf_offset,
+               ust_buffers_write(buf, buf_offset,
                        (u64[]){ (u64)tsc }, sizeof(u64));
                buf_offset += sizeof(u64);
                break;
        case LTT_RFLAG_ID_SIZE:
                small_size = min_t(size_t, event_size, 0xFFFFU);
-               ltt_relay_write(buf, buf_offset,
+               ust_buffers_write(buf, buf_offset,
                        (u16[]){ (u16)eID }, sizeof(u16));
                buf_offset += sizeof(u16);
-               ltt_relay_write(buf, buf_offset,
+               ust_buffers_write(buf, buf_offset,
                        (u16[]){ (u16)small_size }, sizeof(u16));
                buf_offset += sizeof(u16);
                if (small_size == 0xFFFFU) {
-                       ltt_relay_write(buf, buf_offset,
+                       ust_buffers_write(buf, buf_offset,
                                (u32[]){ (u32)event_size }, sizeof(u32));
                        buf_offset += sizeof(u32);
                }
                break;
        case LTT_RFLAG_ID:
-               ltt_relay_write(buf, buf_offset,
+               ust_buffers_write(buf, buf_offset,
                        (u16[]){ (u16)eID }, sizeof(u16));
                buf_offset += sizeof(u16);
                break;
@@ -465,7 +463,7 @@ static inline size_t ltt_write_event_header(struct ltt_trace_struct *trace,
  */
 static inline int ltt_reserve_slot(
                struct ltt_trace_struct *trace,
-               struct ltt_channel_struct *channel,
+               struct ust_channel *channel,
                void **transport_data,
                size_t data_size,
                size_t *slot_size,
@@ -520,14 +518,17 @@ static inline int ltt_reserve_slot(
 #define LTT_FLIGHT_PREFIX      "flight-"
 
 /* Tracer properties */
-//#define LTT_DEFAULT_SUBBUF_SIZE_LOW  65536
-#define LTT_DEFAULT_SUBBUF_SIZE_LOW    4096
+//#define LTT_DEFAULT_SUBBUF_SIZE_LOW  134217728
+#define LTT_DEFAULT_SUBBUF_SIZE_LOW    65536
+//#define LTT_DEFAULT_SUBBUF_SIZE_LOW  4096
 #define LTT_DEFAULT_N_SUBBUFS_LOW      2
-//#define LTT_DEFAULT_SUBBUF_SIZE_MED  262144
-#define LTT_DEFAULT_SUBBUF_SIZE_MED    4096
+//#define LTT_DEFAULT_SUBBUF_SIZE_MED  134217728
+#define LTT_DEFAULT_SUBBUF_SIZE_MED    262144
+//#define LTT_DEFAULT_SUBBUF_SIZE_MED  4096
 #define LTT_DEFAULT_N_SUBBUFS_MED      2
-//#define LTT_DEFAULT_SUBBUF_SIZE_HIGH 1048576
-#define LTT_DEFAULT_SUBBUF_SIZE_HIGH   4096    
+//#define LTT_DEFAULT_SUBBUF_SIZE_HIGH 134217728
+#define LTT_DEFAULT_SUBBUF_SIZE_HIGH   1048576
+//#define LTT_DEFAULT_SUBBUF_SIZE_HIGH 4096
 #define LTT_DEFAULT_N_SUBBUFS_HIGH     2
 #define LTT_TRACER_MAGIC_NUMBER                0x00D6B7ED
 #define LTT_TRACER_VERSION_MAJOR       2
@@ -549,8 +550,8 @@ enum ltt_module_function {
        LTT_FUNCTION_STATEDUMP
 };
 
-void ltt_transport_register(struct ltt_transport *transport);
-void ltt_transport_unregister(struct ltt_transport *transport);
+extern void ltt_transport_register(struct ltt_transport *transport);
+extern void ltt_transport_unregister(struct ltt_transport *transport);
 
 /* Exported control function */
 
@@ -566,22 +567,22 @@ union ltt_control_args {
        } new_trace;
 };
 
-int _ltt_trace_setup(const char *trace_name);
-int ltt_trace_setup(const char *trace_name);
-struct ltt_trace_struct *_ltt_trace_find_setup(const char *trace_name);
-int ltt_trace_set_type(const char *trace_name, const char *trace_type);
-int ltt_trace_set_channel_subbufsize(const char *trace_name,
+extern int _ltt_trace_setup(const char *trace_name);
+extern int ltt_trace_setup(const char *trace_name);
+extern struct ltt_trace_struct *_ltt_trace_find_setup(const char *trace_name);
+extern int ltt_trace_set_type(const char *trace_name, const char *trace_type);
+extern int ltt_trace_set_channel_subbufsize(const char *trace_name,
                const char *channel_name, unsigned int size);
-int ltt_trace_set_channel_subbufcount(const char *trace_name,
+extern int ltt_trace_set_channel_subbufcount(const char *trace_name,
                const char *channel_name, unsigned int cnt);
-int ltt_trace_set_channel_enable(const char *trace_name,
+extern int ltt_trace_set_channel_enable(const char *trace_name,
                const char *channel_name, unsigned int enable);
-int ltt_trace_set_channel_overwrite(const char *trace_name,
+extern int ltt_trace_set_channel_overwrite(const char *trace_name,
                const char *channel_name, unsigned int overwrite);
-int ltt_trace_alloc(const char *trace_name);
-int ltt_trace_destroy(const char *trace_name);
-int ltt_trace_start(const char *trace_name);
-int ltt_trace_stop(const char *trace_name);
+extern int ltt_trace_alloc(const char *trace_name);
+extern int ltt_trace_destroy(const char *trace_name);
+extern int ltt_trace_start(const char *trace_name);
+extern int ltt_trace_stop(const char *trace_name);
 
 enum ltt_filter_control_msg {
        LTT_FILTER_DEFAULT_ACCEPT,
@@ -593,16 +594,16 @@ extern int ltt_filter_control(enum ltt_filter_control_msg msg,
 
 extern struct dentry *get_filter_root(void);
 
-void ltt_write_trace_header(struct ltt_trace_struct *trace,
+extern void ltt_write_trace_header(struct ltt_trace_struct *trace,
                struct ltt_subbuffer_header *header);
-extern void ltt_buffer_destroy(struct ltt_channel_struct *ltt_chan);
+extern void ltt_buffer_destroy(struct ust_channel *ltt_chan);
 
-void ltt_core_register(int (*function)(u8, void *));
+extern void ltt_core_register(int (*function)(u8, void *));
 
-void ltt_core_unregister(void);
+extern void ltt_core_unregister(void);
 
-void ltt_release_trace(struct kref *kref);
-void ltt_release_transport(struct kref *kref);
+extern void ltt_release_trace(struct kref *kref);
+extern void ltt_release_transport(struct kref *kref);
 
 extern int ltt_probe_register(struct ltt_available_probe *pdata);
 extern int ltt_probe_unregister(struct ltt_available_probe *pdata);
@@ -612,9 +613,9 @@ extern int ltt_marker_disconnect(const char *channel, const char *mname,
                const char *pname);
 extern void ltt_dump_marker_state(struct ltt_trace_struct *trace);
 
-void ltt_lock_traces(void);
-void ltt_unlock_traces(void);
+extern void ltt_lock_traces(void);
+extern void ltt_unlock_traces(void);
 
-struct ltt_trace_struct *_ltt_trace_find(const char *trace_name);
+extern struct ltt_trace_struct *_ltt_trace_find(const char *trace_name);
 
 #endif /* _LTT_TRACER_H */
This page took 0.027279 seconds and 4 git commands to generate.