Change Monitor to take a struct context
Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
ef898ce65b
commit
95c5020544
27
Monitor.c
27
Monitor.c
|
@ -72,9 +72,10 @@ static void link_containers_with_subarrays(struct state *list);
|
|||
|
||||
int Monitor(struct mddev_dev *devlist,
|
||||
char *mailaddr, char *alert_cmd,
|
||||
int period, int daemonise, int scan, int oneshot,
|
||||
int dosyslog, int test, char *pidfile, int increments,
|
||||
int share, char *prefer)
|
||||
struct context *c,
|
||||
int daemonise, int oneshot,
|
||||
int dosyslog, char *pidfile, int increments,
|
||||
int share)
|
||||
{
|
||||
/*
|
||||
* Every few seconds, scan every md device looking for changes
|
||||
|
@ -127,7 +128,7 @@ int Monitor(struct mddev_dev *devlist,
|
|||
|
||||
if (!mailaddr) {
|
||||
mailaddr = conf_get_mailaddr();
|
||||
if (mailaddr && ! scan)
|
||||
if (mailaddr && ! c->scan)
|
||||
pr_err("Monitor using email address \"%s\" from config file\n",
|
||||
mailaddr);
|
||||
}
|
||||
|
@ -135,11 +136,11 @@ int Monitor(struct mddev_dev *devlist,
|
|||
|
||||
if (!alert_cmd) {
|
||||
alert_cmd = conf_get_program();
|
||||
if (alert_cmd && ! scan)
|
||||
if (alert_cmd && ! c->scan)
|
||||
pr_err("Monitor using program \"%s\" from config file\n",
|
||||
alert_cmd);
|
||||
}
|
||||
if (scan && !mailaddr && !alert_cmd && !dosyslog) {
|
||||
if (c->scan && !mailaddr && !alert_cmd && !dosyslog) {
|
||||
pr_err("No mail address or alert command - not monitoring.\n");
|
||||
return 1;
|
||||
}
|
||||
|
@ -155,7 +156,7 @@ int Monitor(struct mddev_dev *devlist,
|
|||
}
|
||||
|
||||
if (share)
|
||||
if (check_one_sharer(scan))
|
||||
if (check_one_sharer(c->scan))
|
||||
return 1;
|
||||
|
||||
if (devlist == NULL) {
|
||||
|
@ -212,13 +213,13 @@ int Monitor(struct mddev_dev *devlist,
|
|||
mdstat = mdstat_read(oneshot?0:1, 0);
|
||||
|
||||
for (st=statelist; st; st=st->next)
|
||||
if (check_array(st, mdstat, test, &info,
|
||||
increments, prefer))
|
||||
if (check_array(st, mdstat, c->test, &info,
|
||||
increments, c->prefer))
|
||||
anydegraded = 1;
|
||||
|
||||
/* now check if there are any new devices found in mdstat */
|
||||
if (scan)
|
||||
new_found = add_new_arrays(mdstat, &statelist, test,
|
||||
if (c->scan)
|
||||
new_found = add_new_arrays(mdstat, &statelist, c->test,
|
||||
&info);
|
||||
|
||||
/* If an array has active < raid && spare == 0 && spare_group != NULL
|
||||
|
@ -231,9 +232,9 @@ int Monitor(struct mddev_dev *devlist,
|
|||
if (oneshot)
|
||||
break;
|
||||
else
|
||||
mdstat_wait(period);
|
||||
mdstat_wait(c->delay);
|
||||
}
|
||||
test = 0;
|
||||
c->test = 0;
|
||||
}
|
||||
for (st2 = statelist; st2; st2 = statelist) {
|
||||
statelist = st2->next;
|
||||
|
|
8
mdadm.c
8
mdadm.c
|
@ -1388,10 +1388,12 @@ int main(int argc, char *argv[])
|
|||
else
|
||||
c.delay = 60;
|
||||
}
|
||||
if (c.delay == 0)
|
||||
c.delay = 60;
|
||||
rv= Monitor(devlist, mailaddr, program,
|
||||
c.delay?c.delay:60, daemonise, c.scan, oneshot,
|
||||
dosyslog, c.test, pidfile, increments,
|
||||
spare_sharing, c.prefer);
|
||||
&c, daemonise, oneshot,
|
||||
dosyslog, pidfile, increments,
|
||||
spare_sharing);
|
||||
break;
|
||||
|
||||
case GROW:
|
||||
|
|
7
mdadm.h
7
mdadm.h
|
@ -1120,9 +1120,10 @@ extern int Examine(struct mddev_dev *devlist, struct context *c,
|
|||
struct supertype *forcest);
|
||||
extern int Monitor(struct mddev_dev *devlist,
|
||||
char *mailaddr, char *alert_cmd,
|
||||
int period, int daemonise, int scan, int oneshot,
|
||||
int dosyslog, int test, char *pidfile, int increments,
|
||||
int share, char *prefer);
|
||||
struct context *c,
|
||||
int daemonise, int oneshot,
|
||||
int dosyslog, char *pidfile, int increments,
|
||||
int share);
|
||||
|
||||
extern int Kill(char *dev, struct supertype *st, int force, int verbose, int noexcl);
|
||||
extern int Kill_subarray(char *dev, char *subarray, int verbose);
|
||||
|
|
Loading…
Reference in New Issue