Skip to content

Commit

Permalink
cleanup: rename a method
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Terzolo <[email protected]>
  • Loading branch information
Andreagit97 authored and poiana committed Nov 8, 2024
1 parent eb77f2a commit 10d5968
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
14 changes: 7 additions & 7 deletions userspace/libsinsp/sinsp_filtercheck_fd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,9 @@ int32_t sinsp_filter_check_fd::parse_field_name(std::string_view val,
return sinsp_filter_check::parse_field_name(val, alloc_state, needed_for_filtering);
}

bool sinsp_filter_check_fd::extract_fdname_from_creator(sinsp_evt *evt,
bool sanitize_strings,
bool fd_nameraw) {
bool sinsp_filter_check_fd::extract_fdname_from_event(sinsp_evt *evt,
bool sanitize_strings,
bool fd_nameraw) {
const char *resolved_argstr;
uint16_t etype = evt->get_type();

Expand Down Expand Up @@ -537,7 +537,7 @@ uint8_t *sinsp_filter_check_fd::extract_single(sinsp_evt *evt,
int64_t retval = evt->get_param(0)->as<int64_t>();
// this is a weird behavior, see the `net_connect_exit_event_fails` test for more info
if(retval < 0) {
if(!extract_fdname_from_creator(evt, sanitize_strings)) {
if(!extract_fdname_from_event(evt, sanitize_strings)) {
return NULL;
}
if(m_field_id == TYPE_CONTAINERNAME) {
Expand All @@ -549,7 +549,7 @@ uint8_t *sinsp_filter_check_fd::extract_single(sinsp_evt *evt,
}

if(m_fdinfo == NULL) {
if(!extract_fdname_from_creator(evt, sanitize_strings)) {
if(!extract_fdname_from_event(evt, sanitize_strings)) {
return NULL;
}
} else {
Expand Down Expand Up @@ -578,7 +578,7 @@ uint8_t *sinsp_filter_check_fd::extract_single(sinsp_evt *evt,
case TYPE_DIRECTORY:
case TYPE_CONTAINERDIRECTORY: {
if(m_fdinfo == NULL) {
if(!extract_fdname_from_creator(evt, sanitize_strings)) {
if(!extract_fdname_from_event(evt, sanitize_strings)) {
return NULL;
}
} else if(!(m_fdinfo->is_file() || m_fdinfo->is_directory())) {
Expand Down Expand Up @@ -1226,7 +1226,7 @@ uint8_t *sinsp_filter_check_fd::extract_single(sinsp_evt *evt,
} break;
case TYPE_FDNAMERAW: {
if(m_fdinfo == NULL) {
if(!extract_fdname_from_creator(evt, sanitize_strings, true)) {
if(!extract_fdname_from_event(evt, sanitize_strings, true)) {
return NULL;
}
} else {
Expand Down
4 changes: 1 addition & 3 deletions userspace/libsinsp/sinsp_filtercheck_fd.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ class sinsp_filter_check_fd : public sinsp_filter_check {

private:
int32_t extract_arg(std::string_view fldname, std::string_view val);
bool extract_fdname_from_creator(sinsp_evt* evt,
bool sanitize_strings,
bool fd_nameraw = false);
bool extract_fdname_from_event(sinsp_evt* evt, bool sanitize_strings, bool fd_nameraw = false);
bool extract_fd(sinsp_evt* evt);

bool compare_ip(sinsp_evt* evt);
Expand Down
2 changes: 1 addition & 1 deletion userspace/libsinsp/sinsp_filtercheck_fspath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ uint8_t* sinsp_filter_check_fspath::extract_single(sinsp_evt* evt,

if(!std::filesystem::path(m_tstr).is_absolute()) {
std::string sdir; // init
// Compare to `sinsp_filter_check_fd::extract_fdname_from_creator` logic
// Compare to `sinsp_filter_check_fd::extract_fdname_from_event` logic
// note: no implementation for old / legacy event definitions
switch(evt->get_type()) {
// For openat, event fdinfo is already correctly expanded by parsers;
Expand Down

0 comments on commit 10d5968

Please sign in to comment.