summaryrefslogtreecommitdiffstats
path: root/runtime/transport/transport.h
blob: feaa950c5a69d51c5ee8f707d15204e40a9b939b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef _TRANSPORT_TRANSPORT_H_ /* -*- linux-c -*- */
#define _TRANSPORT_TRANSPORT_H_

/** @file transport.h
 * @brief Header file for stp transport
 */

#include "transport_msgs.h"

/* The size of print buffers. This limits the maximum */
/* amount of data a print can send. */
#define STP_BUFFER_SIZE 8192

struct utt_trace;

static int _stp_ctl_write(int type, void *data, unsigned len);

static int _stp_transport_init(void);
static void _stp_transport_close(void);

static inline void *utt_reserve(struct utt_trace *utt, size_t length)
{
    return NULL;
}


/* STP_CTL_BUFFER_SIZE is the maximum size of a message */
/* exchanged on the control channel. */
#ifdef STP_OLD_TRANSPORT
/* Old transport sends print output on control channel */
#define STP_CTL_BUFFER_SIZE STP_BUFFER_SIZE
#else
#define STP_CTL_BUFFER_SIZE 256
#endif

/* how often the work queue wakes up and checks buffers */
#define STP_WORK_TIMER (HZ/100)

static unsigned _stp_nsubbufs;
static unsigned _stp_subbuf_size;

static int _stp_transport_init(void);
static void _stp_transport_close(void);

static int _stp_lock_transport_dir(void);
static void _stp_unlock_transport_dir(void);

static struct dentry *_stp_get_root_dir(void);
static struct dentry *_stp_get_module_dir(void);

static int _stp_transport_fs_init(const char *module_name);
static void _stp_transport_fs_close(void);

static void _stp_attach(void);
static void _stp_detach(void);
static void _stp_handle_start(struct _stp_msg_start *st);

static uid_t _stp_uid;
static gid_t _stp_gid;

static int _stp_ctl_attached;

static int _stp_bufsize;
static int _stp_transport_data_fs_init(void);
static void _stp_transport_data_fs_close(void);

struct _stp_entry {
	void			*event;
	size_t			len;
	char			buf[];
};

static struct _stp_entry *_stp_data_write_reserve(size_t size);
static int _stp_data_write_commit(struct _stp_entry *entry);

#endif /* _TRANSPORT_TRANSPORT_H_ */