58f804eb94b186c7769a52f2fe1e62653223e918
2 * Copyright (C) 2012 - David Goulet <dgoulet@efficios.com>
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License, version 2 only, as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 51
15 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 #include <common/error.h>
29 * Check health of a specific health state counter.
31 * Return 0 if health is bad or else 1.
33 int health_check_state(struct health_state
*state
)
41 current
= uatomic_read(&state
->current
);
42 last
= uatomic_read(&state
->last
);
45 * Here are the conditions for a bad health. Current state set to 0 or the
46 * current state is the same as the last one and we are NOT waiting for a
49 if (current
== 0 || (current
== last
&& HEALTH_IS_IN_CODE(current
))) {
58 DBG("Health state current %" PRIu64
", last %" PRIu64
", ret %d",
61 /* Exchange current state counter into last one */
62 uatomic_xchg(&state
->last
, state
->current
);
This page took 0.033089 seconds and 4 git commands to generate.