projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
trigger: implement listing of registered trigger
[lttng-tools.git]
/
src
/
common
/
session-rotation.c
diff --git
a/src/common/session-rotation.c
b/src/common/session-rotation.c
index f8d4439de06056296e1a2bc269bc37b6b0385c22..7df5ebab0d8daf97324fccdc0dfb55715ae01da5 100644
(file)
--- a/
src/common/session-rotation.c
+++ b/
src/common/session-rotation.c
@@
-19,7
+19,7
@@
bool lttng_condition_session_rotation_validate(
static
int lttng_condition_session_rotation_serialize(
const struct lttng_condition *condition,
static
int lttng_condition_session_rotation_serialize(
const struct lttng_condition *condition,
- struct lttng_
dynamic_buffer *buf
);
+ struct lttng_
payload *payload
);
static
bool lttng_condition_session_rotation_is_equal(const struct lttng_condition *_a,
const struct lttng_condition *_b);
static
bool lttng_condition_session_rotation_is_equal(const struct lttng_condition *_a,
const struct lttng_condition *_b);
@@
-39,7
+39,7
@@
struct lttng_condition rotation_condition_template = {
static
int lttng_evaluation_session_rotation_serialize(
const struct lttng_evaluation *evaluation,
static
int lttng_evaluation_session_rotation_serialize(
const struct lttng_evaluation *evaluation,
- struct lttng_
dynamic_buffer *buf
);
+ struct lttng_
payload *payload
);
static
void lttng_evaluation_session_rotation_destroy(
struct lttng_evaluation *evaluation);
static
void lttng_evaluation_session_rotation_destroy(
struct lttng_evaluation *evaluation);
@@
-95,7
+95,7
@@
end:
static
int lttng_condition_session_rotation_serialize(
const struct lttng_condition *condition,
static
int lttng_condition_session_rotation_serialize(
const struct lttng_condition *condition,
- struct lttng_
dynamic_buffer *buf
)
+ struct lttng_
payload *payload
)
{
int ret;
size_t session_name_len;
{
int ret;
size_t session_name_len;
@@
-118,13
+118,13
@@
int lttng_condition_session_rotation_serialize(
}
rotation_comm.session_name_len = session_name_len;
}
rotation_comm.session_name_len = session_name_len;
- ret = lttng_dynamic_buffer_append(
buf
, &rotation_comm,
+ ret = lttng_dynamic_buffer_append(
&payload->buffer
, &rotation_comm,
sizeof(rotation_comm));
if (ret) {
goto end;
}
sizeof(rotation_comm));
if (ret) {
goto end;
}
- ret = lttng_dynamic_buffer_append(
buf, rotation->session_name
,
- session_name_len);
+ ret = lttng_dynamic_buffer_append(
&payload->buffer
,
+
rotation->session_name,
session_name_len);
if (ret) {
goto end;
}
if (ret) {
goto end;
}
@@
-202,33
+202,36
@@
struct lttng_condition *lttng_condition_session_rotation_completed_create(void)
}
static
}
static
-ssize_t init_condition_from_
buffer
(struct lttng_condition *condition,
-
const struct lttng_buffer
_view *src_view)
+ssize_t init_condition_from_
payload
(struct lttng_condition *condition,
+
struct lttng_payload
_view *src_view)
{
ssize_t ret, condition_size;
enum lttng_condition_status status;
{
ssize_t ret, condition_size;
enum lttng_condition_status status;
- const struct lttng_condition_session_rotation_comm *condition_comm;
const char *session_name;
struct lttng_buffer_view name_view;
const char *session_name;
struct lttng_buffer_view name_view;
+ const struct lttng_condition_session_rotation_comm *condition_comm;
+ struct lttng_payload_view condition_comm_view =
+ lttng_payload_view_from_view(
+ src_view, 0, sizeof(*condition_comm));
- if (
src_view->size < sizeof(*condition_comm
)) {
+ if (
!lttng_payload_view_is_valid(&condition_comm_view
)) {
ERR("Failed to initialize from malformed condition buffer: buffer too short to contain header");
ret = -1;
goto end;
}
ERR("Failed to initialize from malformed condition buffer: buffer too short to contain header");
ret = -1;
goto end;
}
- condition_comm = (
const struct lttng_condition_session_rotation_comm *) src_view->
data;
- name_view = lttng_buffer_view_from_view(
src_view
,
-
sizeof(*condition_comm), -1
);
+ condition_comm = (
typeof(condition_comm)) src_view->buffer.
data;
+ name_view = lttng_buffer_view_from_view(
&src_view->buffer
,
+
sizeof(*condition_comm), condition_comm->session_name_len
);
- if (
condition_comm->session_name_len > LTTNG_NAME_MAX
) {
- ERR("Failed to initialize from malformed condition buffer:
name exceeds LTTNG_MAX_NAME
");
+ if (
!lttng_buffer_view_is_valid(&name_view)
) {
+ ERR("Failed to initialize from malformed condition buffer:
buffer too short to contain session name
");
ret = -1;
goto end;
}
ret = -1;
goto end;
}
- if (
name_view.size < condition_comm->session_name_len
) {
- ERR("Failed to initialize from malformed condition buffer:
buffer too short to contain session name
");
+ if (
condition_comm->session_name_len > LTTNG_NAME_MAX
) {
+ ERR("Failed to initialize from malformed condition buffer:
name exceeds LTTNG_MAX_NAME
");
ret = -1;
goto end;
}
ret = -1;
goto end;
}
@@
-261,8
+264,8
@@
end:
}
static
}
static
-ssize_t lttng_condition_session_rotation_create_from_
buffer
(
-
const struct lttng_buffer
_view *view,
+ssize_t lttng_condition_session_rotation_create_from_
payload
(
+
struct lttng_payload
_view *view,
struct lttng_condition **_condition,
enum lttng_condition_type type)
{
struct lttng_condition **_condition,
enum lttng_condition_type type)
{
@@
-286,7
+289,7
@@
ssize_t lttng_condition_session_rotation_create_from_buffer(
goto error;
}
goto error;
}
- ret = init_condition_from_
buffer
(condition, view);
+ ret = init_condition_from_
payload
(condition, view);
if (ret < 0) {
goto error;
}
if (ret < 0) {
goto error;
}
@@
-299,21
+302,21
@@
error:
}
LTTNG_HIDDEN
}
LTTNG_HIDDEN
-ssize_t lttng_condition_session_rotation_ongoing_create_from_
buffer
(
-
const struct lttng_buffer
_view *view,
+ssize_t lttng_condition_session_rotation_ongoing_create_from_
payload
(
+
struct lttng_payload
_view *view,
struct lttng_condition **condition)
{
struct lttng_condition **condition)
{
- return lttng_condition_session_rotation_create_from_
buffer
(view,
+ return lttng_condition_session_rotation_create_from_
payload
(view,
condition,
LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING);
}
LTTNG_HIDDEN
condition,
LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING);
}
LTTNG_HIDDEN
-ssize_t lttng_condition_session_rotation_completed_create_from_
buffer
(
-
const struct lttng_buffer
_view *view,
+ssize_t lttng_condition_session_rotation_completed_create_from_
payload
(
+
struct lttng_payload
_view *view,
struct lttng_condition **condition)
{
struct lttng_condition **condition)
{
- return lttng_condition_session_rotation_create_from_
buffer
(view,
+ return lttng_condition_session_rotation_create_from_
payload
(view,
condition,
LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED);
}
condition,
LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED);
}
@@
-339,27
+342,30
@@
struct lttng_evaluation *lttng_evaluation_session_rotation_create(
}
static
}
static
-ssize_t create_evaluation_from_
buffer
(
+ssize_t create_evaluation_from_
payload
(
enum lttng_condition_type type,
enum lttng_condition_type type,
-
const struct lttng_buffer
_view *view,
+
struct lttng_payload
_view *view,
struct lttng_evaluation **_evaluation)
{
ssize_t ret, size;
struct lttng_evaluation *evaluation = NULL;
struct lttng_trace_archive_location *location = NULL;
struct lttng_evaluation **_evaluation)
{
ssize_t ret, size;
struct lttng_evaluation *evaluation = NULL;
struct lttng_trace_archive_location *location = NULL;
- const struct lttng_evaluation_session_rotation_comm *comm
=
- (const struct lttng_evaluation_session_rotation_comm *) view->data;
-
struct lttng_buffer_view location_view
;
+ const struct lttng_evaluation_session_rotation_comm *comm
;
+ struct lttng_payload_view comm_view = lttng_payload_view_from_view(
+
view, 0, sizeof(*comm))
;
- if (
view->size < sizeof(*comm
)) {
+ if (
!lttng_payload_view_is_valid(&comm_view
)) {
goto error;
}
goto error;
}
+ comm = (typeof(comm)) comm_view.buffer.data;
size = sizeof(*comm);
if (comm->has_location) {
size = sizeof(*comm);
if (comm->has_location) {
- location_view = lttng_buffer_view_from_view(view, sizeof(*comm),
- -1);
- if (!location_view.data) {
+ const struct lttng_buffer_view location_view =
+ lttng_buffer_view_from_view(
+ &view->buffer, sizeof(*comm), -1);
+
+ if (!lttng_buffer_view_is_valid(&location_view)) {
goto error;
}
goto error;
}
@@
-387,9
+393,9
@@
error:
}
static
}
static
-ssize_t lttng_evaluation_session_rotation_create_from_
buffer
(
+ssize_t lttng_evaluation_session_rotation_create_from_
payload
(
enum lttng_condition_type type,
enum lttng_condition_type type,
-
const struct lttng_buffer
_view *view,
+
struct lttng_payload
_view *view,
struct lttng_evaluation **_evaluation)
{
ssize_t ret;
struct lttng_evaluation **_evaluation)
{
ssize_t ret;
@@
-400,7
+406,7
@@
ssize_t lttng_evaluation_session_rotation_create_from_buffer(
goto error;
}
goto error;
}
- ret = create_evaluation_from_
buffer
(type, view, &evaluation);
+ ret = create_evaluation_from_
payload
(type, view, &evaluation);
if (ret < 0) {
goto error;
}
if (ret < 0) {
goto error;
}
@@
-413,21
+419,21
@@
error:
}
LTTNG_HIDDEN
}
LTTNG_HIDDEN
-ssize_t lttng_evaluation_session_rotation_ongoing_create_from_
buffer
(
-
const struct lttng_buffer
_view *view,
+ssize_t lttng_evaluation_session_rotation_ongoing_create_from_
payload
(
+
struct lttng_payload
_view *view,
struct lttng_evaluation **evaluation)
{
struct lttng_evaluation **evaluation)
{
- return lttng_evaluation_session_rotation_create_from_
buffer
(
+ return lttng_evaluation_session_rotation_create_from_
payload
(
LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING,
view, evaluation);
}
LTTNG_HIDDEN
LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING,
view, evaluation);
}
LTTNG_HIDDEN
-ssize_t lttng_evaluation_session_rotation_completed_create_from_
buffer
(
-
const struct lttng_buffer
_view *view,
+ssize_t lttng_evaluation_session_rotation_completed_create_from_
payload
(
+
struct lttng_payload
_view *view,
struct lttng_evaluation **evaluation)
{
struct lttng_evaluation **evaluation)
{
- return lttng_evaluation_session_rotation_create_from_
buffer
(
+ return lttng_evaluation_session_rotation_create_from_
payload
(
LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED,
view, evaluation);
}
LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED,
view, evaluation);
}
@@
-505,7
+511,7
@@
end:
static
int lttng_evaluation_session_rotation_serialize(
const struct lttng_evaluation *evaluation,
static
int lttng_evaluation_session_rotation_serialize(
const struct lttng_evaluation *evaluation,
- struct lttng_
dynamic_buffer *buf
)
+ struct lttng_
payload *payload
)
{
int ret;
struct lttng_evaluation_session_rotation *rotation;
{
int ret;
struct lttng_evaluation_session_rotation *rotation;
@@
-515,7
+521,8
@@
int lttng_evaluation_session_rotation_serialize(
struct lttng_evaluation_session_rotation, parent);
comm.id = rotation->id;
comm.has_location = !!rotation->location;
struct lttng_evaluation_session_rotation, parent);
comm.id = rotation->id;
comm.has_location = !!rotation->location;
- ret = lttng_dynamic_buffer_append(buf, &comm, sizeof(comm));
+ ret = lttng_dynamic_buffer_append(
+ &payload->buffer, &comm, sizeof(comm));
if (ret) {
goto end;
}
if (ret) {
goto end;
}
@@
-523,7
+530,7
@@
int lttng_evaluation_session_rotation_serialize(
goto end;
}
ret = lttng_trace_archive_location_serialize(rotation->location,
goto end;
}
ret = lttng_trace_archive_location_serialize(rotation->location,
-
buf
);
+
&payload->buffer
);
end:
return ret;
}
end:
return ret;
}
This page took
0.028246 seconds
and
4
git commands to generate.