static int events_cb(const struct nlmsghdr *nlh, void *data) { int event = NFNL_MSG_TYPE(nlh->nlmsg_type); struct callback_data *cb = data; int err = MNL_CB_OK; if (!cb || cb->type == CALLBACK_RETURN_NONE) return err; DBG("handle event %s", event_to_str(event)); switch(event) { case NFT_MSG_NEWCHAIN: err = chain_cb(nlh, event, cb); break; case NFT_MSG_NEWRULE: err = rule_cb(nlh, event, cb); break; default: DBG("unhandled event type %s", event_to_str(event)); break; } return err; }
std::set<std::string> all_output_types() { std::set<std::string> result; for (int type = 0; type < SV_NUM; ++type) { result.insert(event_to_str(type)); } result.insert("nextplayback"); return result; }
int main() { tests_failed = 0; tests_succeeded = 0; #ifdef HAVE_MCHECK_H char *mtrace_name = getenv("MALLOC_TRACE"); if (mtrace_name) { printf("malloc trace might be written to %s\n", mtrace_name); } else { printf("If you want to do a malloc trace, set MALLOC_TRACE to " "a path for logging.\n"); } mtrace(); #endif cleanup(); event_to_str(); cleanup(); event_to_str_sep(); cleanup(); str_to_event(); cleanup(); str_to_event_sep(); cleanup(); basic_watch_info(); cleanup(); watch_limit(); cleanup(); tst_inotifytools_snprintf(); cleanup(); printf("Out of %d tests, %d succeeded and %d failed.\n", tests_failed + tests_succeeded, tests_succeeded, tests_failed); if (tests_failed) { return -tests_failed; } }
static int ehci_hsic_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags) { dbg_log_event(urb, event_to_str(URB_SUBMIT), 0); return ehci_urb_enqueue(hcd, urb, mem_flags); }
static void on_event(uint64_t id, enum filter_hook event) { printf("filter-event: id=%016"PRIx64", event=%s\n", id, event_to_str(event)); }