From: Mathieu Desnoyers Date: Tue, 27 Sep 2011 12:15:29 +0000 (-0400) Subject: Add missing memcpy callback X-Git-Tag: v2.0-pre9~23 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=58aa5d24fc1b9bc14fa91a2a9ca8467fb2541fec;p=lttng-modules.git Add missing memcpy callback Signed-off-by: Mathieu Desnoyers --- diff --git a/ltt-events.h b/ltt-events.h index 586608b3..ccb9df82 100644 --- a/ltt-events.h +++ b/ltt-events.h @@ -212,6 +212,8 @@ struct ltt_channel_ops { size_t len); void (*event_write_from_user)(struct lib_ring_buffer_ctx *ctx, const void *src, size_t len); + void (*event_memset)(struct lib_ring_buffer_ctx *ctx, + int c, size_t len); /* * packet_avail_size returns the available size in the current * packet. Note that the size returned is only a hint, since it diff --git a/ltt-ring-buffer-client.h b/ltt-ring-buffer-client.h index f71047f1..8df37901 100644 --- a/ltt-ring-buffer-client.h +++ b/ltt-ring-buffer-client.h @@ -487,6 +487,13 @@ void ltt_event_write_from_user(struct lib_ring_buffer_ctx *ctx, lib_ring_buffer_copy_from_user(&client_config, ctx, src, len); } +static +void ltt_event_memset(struct lib_ring_buffer_ctx *ctx, + int c, size_t len) +{ + lib_ring_buffer_memset(&client_config, ctx, c, len); +} + static wait_queue_head_t *ltt_get_writer_buf_wait_queue(struct channel *chan, int cpu) { @@ -527,6 +534,7 @@ static struct ltt_transport ltt_relay_transport = { .event_commit = ltt_event_commit, .event_write = ltt_event_write, .event_write_from_user = ltt_event_write_from_user, + .event_memset = ltt_event_memset, .packet_avail_size = NULL, /* Would be racy anyway */ .get_writer_buf_wait_queue = ltt_get_writer_buf_wait_queue, .get_hp_wait_queue = ltt_get_hp_wait_queue, diff --git a/ltt-ring-buffer-metadata-client.h b/ltt-ring-buffer-metadata-client.h index 3cf8a342..529bbb19 100644 --- a/ltt-ring-buffer-metadata-client.h +++ b/ltt-ring-buffer-metadata-client.h @@ -231,6 +231,13 @@ void ltt_event_write_from_user(struct lib_ring_buffer_ctx *ctx, lib_ring_buffer_copy_from_user(&client_config, ctx, src, len); } +static +void ltt_event_memset(struct lib_ring_buffer_ctx *ctx, + int c, size_t len) +{ + lib_ring_buffer_memset(&client_config, ctx, c, len); +} + static size_t ltt_packet_avail_size(struct channel *chan) @@ -287,6 +294,7 @@ static struct ltt_transport ltt_relay_transport = { .event_reserve = ltt_event_reserve, .event_commit = ltt_event_commit, .event_write_from_user = ltt_event_write_from_user, + .event_memset = ltt_event_memset, .event_write = ltt_event_write, .packet_avail_size = ltt_packet_avail_size, .get_writer_buf_wait_queue = ltt_get_writer_buf_wait_queue, diff --git a/probes/lttng-events.h b/probes/lttng-events.h index 084666d5..219f63e6 100644 --- a/probes/lttng-events.h +++ b/probes/lttng-events.h @@ -510,6 +510,7 @@ __assign_##dest##_2: \ __chan->ops->event_write(&__ctx, src, \ sizeof(__typemap.dest) * __get_dynamic_array_len(dest));\ goto __end_field_##dest##_2; + #undef tp_memcpy_from_user #define tp_memcpy_from_user(dest, src, len) \ __assign_##dest: \ @@ -518,17 +519,15 @@ __assign_##dest##_2: \ lib_ring_buffer_align_ctx(&__ctx, ltt_alignof(__typemap.dest)); \ __chan->ops->event_write_from_user(&__ctx, src, len); \ goto __end_field_##dest; -/* - * tp_copy_string_from_user "len" parameter is the length of the string - * excluding the final \0. - */ + #undef tp_copy_string_from_user -#define tp_copy_string_from_user(dest, src, len) \ +#define tp_copy_string_from_user(dest, src) \ __assign_##dest: \ if (0) \ (void) __typemap.dest; \ lib_ring_buffer_align_ctx(&__ctx, ltt_alignof(__typemap.dest)); \ - __chan->ops->event_write_from_user(&__ctx, src, len); \ + __chan->ops->event_write_from_user(&__ctx, src, \ + __get_dynamic_array_len(dest) - 1); \ __chan->ops->event_memset(&__ctx, 0, 1); \ goto __end_field_##dest;