static void reserve_state_check(struct work_struct *work) { struct otg_booting_delay *o_b_d = container_of(work, struct otg_booting_delay, booting_work.work); struct usb_notify *u_noti = container_of(o_b_d, struct usb_notify, b_delay); int enable = 1; unsigned long state = 0; state = u_noti->b_delay.reserve_state; u_noti->o_notify->booting_delay_sec = 0; pr_info("%s booting delay finished\n", __func__); if (u_noti->b_delay.reserve_state != NOTIFY_EVENT_NONE) { pr_info("%s event=%s(%lu) enable=%d\n", __func__, event_string(state), state, enable); if (check_event_type(state) & NOTIFY_EVENT_EXTRA) blocking_notifier_call_chain (&u_noti->o_notify->extra_notifier, state, &enable); else atomic_notifier_call_chain (&u_noti->o_notify->otg_notifier, state, &enable); } }
static struct ast_event *alloc_event(const struct ast_security_event_common *sec) { struct ast_str *str = ast_str_alloca(TIMESTAMP_STR_LEN); struct timeval tv = ast_tvnow(); const char *severity_str; if (check_event_type(sec->event_type)) { return NULL; } encode_timestamp(&str, &tv); severity_str = S_OR( ast_security_event_severity_get_name(sec_events[sec->event_type].severity), "Unknown" ); return ast_event_new(AST_EVENT_SECURITY, AST_EVENT_IE_SECURITY_EVENT, AST_EVENT_IE_PLTYPE_UINT, sec->event_type, AST_EVENT_IE_EVENT_VERSION, AST_EVENT_IE_PLTYPE_UINT, sec->version, AST_EVENT_IE_EVENT_TV, AST_EVENT_IE_PLTYPE_STR, ast_str_buffer(str), AST_EVENT_IE_SERVICE, AST_EVENT_IE_PLTYPE_STR, sec->service, AST_EVENT_IE_SEVERITY, AST_EVENT_IE_PLTYPE_STR, severity_str, AST_EVENT_IE_END); }
const char *ast_security_event_get_name(const enum ast_security_event_type event_type) { if (check_event_type(event_type)) { return NULL; } return sec_events[event_type].name; }
const struct ast_security_event_ie_type *ast_security_event_get_optional_ies( const enum ast_security_event_type event_type) { if (check_event_type(event_type)) { return NULL; } return sec_events[event_type].optional_ies; }
void send_otg_notify(struct otg_notify *n, unsigned long event, int enable) { int type = 0; if (!n) { pr_err("%s otg_notify is null\n", __func__); return; } pr_info("%s event=%s(%lu) enable=%d\n", __func__, event_string(event), event, enable); type = check_event_type(event); if (type & NOTIFY_EVENT_DELAY) { if (n->booting_delay_sec) { if (u_notify) { u_notify->b_delay.reserve_state = (enable) ? event : NOTIFY_EVENT_NONE; pr_info("%s reserve event\n", __func__); } else pr_err("%s u_notify is null\n", __func__); goto end; } } if (type & NOTIFY_EVENT_EXTRA) blocking_notifier_call_chain (&n->extra_notifier, event, &enable); else if (type & NOTIFY_EVENT_STATE) atomic_notifier_call_chain (&n->otg_notifier, event, &enable); else goto end; end: return; }