main: remote_trigger only communicating peers

This commit is contained in:
Thomas Schoebel-Theuer 2017-01-04 16:16:56 +01:00
parent d382bd7037
commit f784c6555e
3 changed files with 11 additions and 5 deletions

View File

@ -352,9 +352,10 @@ extern void mars_power_led_off(struct mars_brick *brick, bool val);
/* this should disappear!
*/
extern void (*_mars_trigger)(void);
extern void (*_mars_remote_trigger)(void);
extern void (*_mars_remote_trigger)(bool do_all);
#define mars_trigger() do { if (_mars_trigger) { MARS_DBG("trigger...\n"); _mars_trigger(); } } while (0)
#define mars_remote_trigger() do { if (_mars_remote_trigger) { MARS_DBG("remote_trigger...\n"); _mars_remote_trigger(); } } while (0)
#define mars_remote_trigger() do { if (_mars_remote_trigger) { MARS_DBG("remote_trigger...\n"); _mars_remote_trigger(false); } } while (0)
#define mars_remote_trigger_all() do { if (_mars_remote_trigger) { MARS_DBG("remote_trigger_all...\n"); _mars_remote_trigger(true); } } while (0)
/////////////////////////////////////////////////////////////////////////

View File

@ -2435,7 +2435,7 @@ void from_remote_trigger(void)
EXPORT_SYMBOL_GPL(from_remote_trigger);
static
void __mars_remote_trigger(void)
void __mars_remote_trigger(bool do_all)
{
struct list_head *tmp;
int count = 0;
@ -2443,6 +2443,9 @@ void __mars_remote_trigger(void)
down_read(&peer_lock);
for (tmp = peer_anchor.next; tmp != &peer_anchor; tmp = tmp->next) {
struct mars_peerinfo *peer = container_of(tmp, struct mars_peerinfo, peer_head);
/* skip some peers when requested */
if (!do_all && !peer->do_communicate)
continue;
peer->to_remote_trigger = true;
count++;
}
@ -5898,7 +5901,7 @@ static int exit_fn_nr = 0;
} while (0)
void (*_mars_remote_trigger)(void);
void (*_mars_remote_trigger)(bool do_all);
EXPORT_SYMBOL_GPL(_mars_remote_trigger);
static void exit_main(void)

View File

@ -92,7 +92,9 @@ int trigger_sysctl_handler(
if (code > 0) {
mars_trigger();
}
if (code > 1) {
if (code > 2) {
mars_remote_trigger_all();
} else if (code > 1) {
mars_remote_trigger();
}
}