- nb = ltt_trace_facility_find(t, facility, &pos);
- if(nb < 1) g_error("No %s facility", facility);
- f = ltt_trace_facility_get(t, pos);
- et = ltt_facility_eventtype_get_by_name(f, event_type);
- if(et == NULL) g_error("Event %s does not exist", event_type);
+ ev_id = ltt_eventtype_id(et);
+
+ thf->h = h;
+ thf->id = GET_HOOK_ID(fac_id, ev_id);
+ thf->f1 = find_field(et, field1);
+ thf->f2 = find_field(et, field2);
+ thf->f3 = find_field(et, field3);
+ thf->hook_data = hook_data;
+
+ first_thf = thf;
+ first_et = et;
+
+ /* Check for type compatibility too */
+ for(i=1;i<facilities->len;i++) {
+ fac_id = g_array_index(facilities, guint, i);
+ f = ltt_trace_get_facility_by_num(t, fac_id);
+
+ et = ltt_facility_eventtype_get_by_name(f, ltt_eventtype_name(et));
+ if(unlikely(et == NULL)) goto event_error;
+
+ thf = &g_array_index(th->fac_index, LttvTraceHookByFacility, fac_id);
+ g_array_index(th->fac_list, LttvTraceHookByFacility*, i) = thf;
+ ev_id = ltt_eventtype_id(et);
+ thf->h = h;
+ thf->id = GET_HOOK_ID(fac_id, ev_id);
+ thf->f1 = find_field(et, field1);
+ if(check_fields_compatibility(first_et, et,
+ first_thf->f1, thf->f1))
+ goto type_error;
+
+ thf->f2 = find_field(et, field2);
+ if(check_fields_compatibility(first_et, et,
+ first_thf->f2, thf->f2))
+ goto type_error;
+
+ thf->f3 = find_field(et, field3);
+ if(check_fields_compatibility(first_et, et,
+ first_thf->f3, thf->f3))
+ goto type_error;
+ thf->hook_data = hook_data;
+ }
+
+ return 0;