4486558aa9fe497ffb884511d41540b065d5af40
2 * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
8 #ifndef LTTNG_BUFFER_VIEW_H
9 #define LTTNG_BUFFER_VIEW_H
11 #include <common/macros.h>
16 struct lttng_dynamic_buffer
;
18 struct lttng_buffer_view
{
24 * Return a buffer view referencing a subset of the memory referenced by a raw
27 * @src Source buffer to reference
28 * @offset Offset to apply to the source memory buffer
29 * @len Length of the memory contents to reference.
31 * Note that a buffer view never assumes the ownership of the memory it
35 struct lttng_buffer_view
lttng_buffer_view_init(
36 const char *src
, size_t offset
, ptrdiff_t len
);
39 * Return a buffer view referencing a subset of the memory referenced by another
42 * @src Source view to reference
43 * @offset Offset to apply to the source memory content
44 * @len Length of the memory contents to reference. Passing -1 will
45 * cause the view to reference the whole view from the offset
48 * Note that a buffer view never assumes the ownership of the memory it
52 struct lttng_buffer_view
lttng_buffer_view_from_view(
53 const struct lttng_buffer_view
*src
, size_t offset
,
57 * Return a buffer view referencing a subset of the memory referenced by a
60 * @src Source dynamic buffer to reference
61 * @offset Offset to apply to the source memory content
62 * @len Length of the memory contents to reference. Passing -1 will
63 * cause the view to reference the whole dynamic buffer from the
66 * Note that a buffer view never assumes the ownership of the memory it
70 struct lttng_buffer_view
lttng_buffer_view_from_dynamic_buffer(
71 const struct lttng_dynamic_buffer
*src
, size_t offset
,
75 * Validate that string starting at `str` of length `len_with_null_terminator`
76 * (including the NULL terminator) fits within the buffer view, and validate
77 * that it is indeed of that length.
79 * Return true if the validation passes, false otherwise.
81 * @buf The buffer view
82 * @str The start of the string
83 * @len_with_null_terminator Expected length of the string, including the
88 bool lttng_buffer_view_validate_string(const struct lttng_buffer_view
*buf
,
90 size_t len_with_null_terminator
);
92 #endif /* LTTNG_BUFFER_VIEW_H */
This page took 0.031191 seconds and 5 git commands to generate.