static int compare_session_foreach_cb(struct session_entry const *session, void *arg) { struct session_entry *expected = arg; bool success = true; if (!session_equals(expected, session)) return 0; /* Still not found; keep foreaching. */ success &= ASSERT_INT(expected->proto, session->proto, "Session's proto"); success &= ASSERT_INT(expected->state, session->state, "Session's state"); success &= ASSERT_BOOL(expected->timer_type, session->timer_type, "Session's timer type"); success &= ASSERT_BOOL(true, session->update_time != 0, "Session's update time"); success &= ASSERT_ULONG(expected->timeout, session->timeout, "Session's timeout"); success &= ASSERT_INT(expected->has_stored, session->has_stored, "Session's stored"); /* * Success? Interrupt the foreach positively. * Failure? Interrupt the foreach negatively. */ return success ? 1 : -EINVAL; }
static int compare_session_foreach_cb(struct session_entry *session, void *arg) { return session_equals(session, arg); }