From 68082782a65795f75dcbba4bd2d620c1520e6624 Mon Sep 17 00:00:00 2001 From: hunt Date: Thu, 9 Nov 2006 17:57:40 +0000 Subject: [PATCH] 2006-11-09 Martin Hunt * transport_msgs.h: Change all ints to int32_t. Prefix all struct names with "_stp". * transport.c: Use new struct names. (_stp_handle_start): Send pointer size and endianess. * procfs.c: Use new struct names. --- runtime/transport/ChangeLog | 8 ++++++ runtime/transport/procfs.c | 14 +++++----- runtime/transport/transport.c | 18 +++++++------ runtime/transport/transport_msgs.h | 41 +++++++++++++++++------------- 4 files changed, 48 insertions(+), 33 deletions(-) diff --git a/runtime/transport/ChangeLog b/runtime/transport/ChangeLog index 70b21816a..d62068553 100644 --- a/runtime/transport/ChangeLog +++ b/runtime/transport/ChangeLog @@ -1,3 +1,11 @@ +2006-11-09 Martin Hunt + + * transport_msgs.h: Change all ints to int32_t. Prefix + all struct names with "_stp". + * transport.c: Use new struct names. + (_stp_handle_start): Send pointer size and endianess. + * procfs.c: Use new struct names. + 2006-11-02 Martin Hunt * symbols.c (_stp_do_module): Fix error message. diff --git a/runtime/transport/procfs.c b/runtime/transport/procfs.c index 2605e8f13..d208766d1 100644 --- a/runtime/transport/procfs.c +++ b/runtime/transport/procfs.c @@ -87,10 +87,10 @@ static ssize_t _stp_proc_write_cmd (struct file *file, const char __user *buf, switch (type) { case STP_START: { - struct transport_start st; - if (count < sizeof(struct transport_start)) + struct _stp_transport_start st; + if (count < sizeof(struct _stp_transport_start)) return 0; - if (copy_from_user (&st, buf, sizeof(struct transport_start))) + if (copy_from_user (&st, buf, sizeof(struct _stp_transport_start))) return -EFAULT; _stp_handle_start (&st); break; @@ -107,11 +107,11 @@ static ssize_t _stp_proc_write_cmd (struct file *file, const char __user *buf, break; case STP_TRANSPORT_INFO: { - struct transport_info ti; - kbug("STP_TRANSPORT_INFO %d %d\n", (int)count, (int)sizeof(struct transport_info)); - if (count < sizeof(struct transport_info)) + struct _stp_transport_info ti; + kbug("STP_TRANSPORT_INFO %d %d\n", (int)count, (int)sizeof(struct _stp_transport_info)); + if (count < sizeof(struct _stp_transport_info)) return 0; - if (copy_from_user (&ti, buf, sizeof(struct transport_info))) + if (copy_from_user (&ti, buf, sizeof(struct _stp_transport_info))) return -EFAULT; if (_stp_transport_open (&ti) < 0) return -1; diff --git a/runtime/transport/transport.c b/runtime/transport/transport.c index 6e9c9ae16..b87f763d8 100644 --- a/runtime/transport/transport.c +++ b/runtime/transport/transport.c @@ -41,11 +41,11 @@ int _stp_exit_flag = 0; void probe_exit(void); int probe_start(void); void _stp_exit(void); -void _stp_handle_start (struct transport_start *st); +void _stp_handle_start (struct _stp_transport_start *st); static void _stp_work_queue (void *data); static DECLARE_WORK(stp_exit, _stp_work_queue, NULL); static struct workqueue_struct *_stp_wq; -int _stp_transport_open(struct transport_info *info); +int _stp_transport_open(struct _stp_transport_info *info); #include "procfs.c" @@ -74,7 +74,7 @@ static int _stp_transport_write (void *data, int len) #ifdef STP_RELAYFS static void _stp_handle_buf_info(int *cpuptr) { - struct buf_info out; + struct _stp_buf_info out; out.cpu = *cpuptr; #if (RELAYFS_CHANNEL_VERSION >= 4) || defined (CONFIG_RELAY) @@ -93,7 +93,7 @@ static void _stp_handle_buf_info(int *cpuptr) * _stp_handle_start - handle STP_START */ -void _stp_handle_start (struct transport_start *st) +void _stp_handle_start (struct _stp_transport_start *st) { #ifdef CONFIG_MODULES static int got_modules=0; @@ -103,8 +103,10 @@ void _stp_handle_start (struct transport_start *st) /* we've got a start request, but first, grab kernel symbols if we need them */ if (_stp_num_modules == 0) { - char tmp = 0; - _stp_transport_send(STP_SYMBOLS, &tmp, 1); + struct _stp_symbol_req req; + req.endian = 0x1234; + req.ptr_size = sizeof(char *); + _stp_transport_send(STP_SYMBOLS, &req, sizeof(req)); return; } @@ -137,7 +139,7 @@ void _stp_handle_start (struct transport_start *st) /** * _stp_handle_subbufs_consumed - handle STP_SUBBUFS_CONSUMED */ -static void _stp_handle_subbufs_consumed(int pid, struct consumed_info *info) +static void _stp_handle_subbufs_consumed(int pid, struct _stp_consumed_info *info) { relay_subbufs_consumed(_stp_chan, info->cpu, info->consumed); } @@ -253,7 +255,7 @@ void _stp_transport_close() * containing the final parameters used. */ -int _stp_transport_open(struct transport_info *info) +int _stp_transport_open(struct _stp_transport_info *info) { kbug ("stp_transport_open: %d Mb buffer. target=%d\n", info->buf_size, info->target); diff --git a/runtime/transport/transport_msgs.h b/runtime/transport/transport_msgs.h index 282762abf..f43627f10 100644 --- a/runtime/transport/transport_msgs.h +++ b/runtime/transport/transport_msgs.h @@ -21,42 +21,47 @@ enum }; /* control channel command structs */ -struct buf_info +struct _stp_buf_info { - int cpu; - unsigned produced; - unsigned consumed; - int flushing; + int32_t cpu; + uint32_t produced; + uint32_t consumed; + int32_t flushing; }; -struct consumed_info +struct _stp_consumed_info { - int cpu; - unsigned consumed; + int32_t cpu; + uint32_t consumed; }; -struct transport_info +struct _stp_transport_info { - unsigned buf_size; - unsigned subbuf_size; - unsigned n_subbufs; - int transport_mode; - int merge; // merge relayfs output? - int target; // target pid + uint32_t buf_size; + uint32_t subbuf_size; + uint32_t n_subbufs; + int32_t transport_mode; + int32_t merge; // merge relayfs output? + int32_t target; // target pid #if 0 char cmd[256]; // cmd to process data #endif }; -struct transport_start +struct _stp_transport_start { - int pid; // pid for streaming data + int32_t pid; // pid for streaming data }; -struct cmd_info +struct _stp_cmd_info { char cmd[128]; }; +struct _stp_symbol_req +{ + int32_t endian; + int32_t ptr_size; +}; -- 2.43.5