b9a3ba56aa49f25b4605bcdab70c256db208394f
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
)
35 unsigned long current
, last
;
41 current
= uatomic_read(&state
->current
);
44 * Here are the conditions for a bad health. Either flag HEALTH_ERROR is
45 * set, or the progress counter is the same as the last one and we are NOT
46 * waiting for a poll() call.
48 if ((uatomic_read(&state
->flags
) & HEALTH_ERROR
) ||
49 (current
== last
&& !HEALTH_IS_IN_POLL(current
))) {
54 DBG("Health state current %" PRIu64
", last %" PRIu64
", ret %d",
58 * Update last counter. This value is and MUST be access only in this
61 state
->last
= current
;
This page took 0.029616 seconds and 4 git commands to generate.