Lines Matching defs:activity
429 dso_activity_t *activity;
433 FAULT("[DSO%u] Cannot search for activity with name and context both equal to NULL - "
435 activity = NULL;
439 for (activity = dso->activities; activity != NULL; activity = activity->next) {
440 if (activity->activity_type != activity_type) {
445 // If name is specified, always use the name to search for the corresponding activity, even if context is
447 if (activity->name == NULL) {
450 if (strcmp(name, activity->name) != 0) {
454 if (context != NULL && activity->context != context) {
455 FAULT("[DSO%u] The activity specified by the name does not have the expected context - "
461 // If name is not specified, use context to search for the activity.
462 if (context != activity->context) {
471 return activity;
474 // Make an activity structure to hang off the DSO.
480 dso_activity_t *activity;
483 // Shouldn't add an activity that's already been added.
484 activity = dso_find_activity(dso, name, activity_type, context);
485 if (activity != NULL) {
486 FAULT("[DSO%u] Trying to add a duplicate activity - activity name: " PRI_S_SRP ", activity type: " PUB_S_SRP
487 ", activity context: %p.", dso->serial, name, activity_type, context);
491 len = namelen + sizeof *activity;
496 activity = (dso_activity_t *)ap;
497 ap = (char *)ap + sizeof *activity;
501 activity->name = ap;
502 memcpy(activity->name, name, namelen);
504 activity->name = NULL;
506 activity->context = context;
508 // Activity type is expected to be a string constant; all activities of the same type must
510 activity->activity_type = activity_type;
511 activity->finalize = finalize;
513 INFO("[DSO%u] Adding a DSO activity - activity name: " PRI_S_SRP ", activity type: " PUB_S_SRP
514 ", activity context: %p.", dso->serial, activity->name, activity->activity_type, activity->context);
516 // Retain this activity on the list.
517 activity->next = dso->activities;
518 dso->activities = activity;
520 return activity;
523 void dso_drop_activity(dso_state_t *dso, dso_activity_t *activity)
528 // Remove this activity from the list.
530 if (*app == activity) {
531 *app = activity->next;
539 // If an activity that's not on the DSO list is passed here, it's an internal consistency
542 FAULT("[DSO%u] Trying to remove an activity that is not in the list - "
543 "activity name: " PRI_S_SRP ", activity type: " PUB_S_SRP ", activity context: %p.",
544 dso->serial, activity->name, activity->activity_type, activity->context);
546 INFO("[DSO%u] Removing a DSO activity - activity name: " PRI_S_SRP ", activity type: " PUB_S_SRP
547 ", activity context: %p.", dso->serial, activity->name, activity->activity_type, activity->context);
549 if (activity->finalize != NULL) {
550 activity->finalize(activity);
552 mdns_free(activity);