Пример #1
0
static void icmap_del_all_track(void)
{
	struct list_head *iter = icmap_track_list_head.next;
	struct icmap_track *icmap_track;

	while (iter != &icmap_track_list_head) {
		icmap_track = list_entry(iter, struct icmap_track, list);
		icmap_track_delete(icmap_track);
		iter = icmap_track_list_head.next;
	}
}
Пример #2
0
static void wd_key_changed(
	int32_t event,
	const char *key_name,
	struct icmap_notify_value new_val,
	struct icmap_notify_value old_val,
	void *user_data)
{
	struct resource* ref = (struct resource*)user_data;
	char *last_key_part;

	if (ref == NULL) {
		return ;
	}

	last_key_part = strrchr(key_name, '.');
	if (last_key_part == NULL) {
		return ;
	}
	last_key_part++;

	if (event == ICMAP_TRACK_ADD || event == ICMAP_TRACK_MODIFY) {
		if (strcmp(last_key_part, "last_updated") == 0 ||
			strcmp(last_key_part, "current") == 0) {
			return;
		}

		cs_fsm_process(&ref->fsm, WD_E_CONFIG_CHANGED, ref);
	}

	if (event == ICMAP_TRACK_DELETE && ref != NULL) {
		if (strcmp(last_key_part, "state") != 0) {
			return ;
		}

		log_printf (LOGSYS_LEVEL_WARNING,
			"resource \"%s\" deleted from cmap!",
			ref->name);

		api->timer_delete(ref->check_timer);
		ref->check_timer = 0;
		icmap_track_delete(ref->icmap_track);

		free(ref);
	}
}