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
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)
{
.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,
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)
.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,
__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: \
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;