Skip to content

Commit 5631af6

Browse files
geraldcombspoiana
authored andcommitted
update(userspace/plugin): Update ss_plugin_field_extract_input
Remove field_offsets from ss_plugin_field_extract_input. We can just check to see if field_offsets is set. Update some comments. Signed-off-by: Gerald Combs <[email protected]>
1 parent 7707102 commit 5631af6

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

userspace/libsinsp/plugin.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,11 +1003,6 @@ bool sinsp_plugin::extract_fields_and_offsets(sinsp_evt* evt,
10031003
in.get_owner_last_error = sinsp_plugin::get_owner_last_error;
10041004
in.table_reader_ext = &table_reader_ext;
10051005
in.field_offsets = field_offsets;
1006-
if(in.field_offsets) {
1007-
in.request_offsets = true;
1008-
} else {
1009-
in.request_offsets = false;
1010-
}
10111006
sinsp_plugin::table_read_api(in.table_reader, table_reader_ext);
10121007
auto res = m_handle->api.extract_fields(m_state, &ev, &in) == SS_PLUGIN_SUCCESS;
10131008

userspace/plugin/plugin_api.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -371,12 +371,8 @@ typedef struct ss_plugin_field_extract_input {
371371
// Vtable for controlling a state table for read operations.
372372
ss_plugin_table_reader_vtable_ext* table_reader_ext;
373373

374-
// If true, signal that the framework wants offsets to be computed.
375-
ss_plugin_bool request_offsets;
376-
377-
// An array of ss_plugin_extract_field_offsets structs. Optional.
378-
// The array should be allocated only if `request_offsets` is true.
379-
// Indexed as `fields`.
374+
// An array of ss_plugin_extract_field_offsets structs. This member
375+
// is optional, and might be ignored by extractors.
380376
ss_plugin_extract_field_offsets* field_offsets;
381377
} ss_plugin_field_extract_input;
382378

userspace/plugin/plugin_types.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,12 @@ typedef struct ss_plugin_byte_buffer {
130130

131131
// Used in extract_fields_and_offsets to receive field offsets along
132132
// with field data.
133-
// Extraction functions should be set these to the zero-indexed start
134-
// and end offsets of the field in the event or log data. 0..0 can be
135-
// used to indicate that there are no valid offsets, e.g. if the field
136-
// was generated or computed from other data.
133+
// Extraction functions might not support offsets. In order to detect
134+
// this, callers can initialize this to an invalid pair, such as 1..0.
135+
// Extraction functions that support offsets should be set these to the
136+
// zero-indexed start and end offsets of the field in the event or log
137+
// data. 0..0 can be used to indicate that there are no valid offsets,
138+
// e.g. if the field was generated or computed from other data.
137139
typedef struct ss_plugin_extract_field_offsets {
138140
uint32_t start_offset;
139141
uint32_t end_offset;

0 commit comments

Comments
 (0)