diff options
author | pjd <pjd@FreeBSD.org> | 2010-08-05 19:04:29 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2010-08-05 19:04:29 +0000 |
commit | 31021ec9f13b3e3a013f75bfa436a2c7c4622ef3 (patch) | |
tree | 25b7bf8edc77ef7e87a64ffbf66ae0325157da6c /sbin | |
parent | 64f20fee8760b7e158ffef062ffa7abc5eeb0943 (diff) | |
download | FreeBSD-src-31021ec9f13b3e3a013f75bfa436a2c7c4622ef3.zip FreeBSD-src-31021ec9f13b3e3a013f75bfa436a2c7c4622ef3.tar.gz |
Make control_set_role() more public. We will need it soon.
MFC after: 1 month
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/hastd/control.c | 27 | ||||
-rw-r--r-- | sbin/hastd/control.h | 3 |
2 files changed, 20 insertions, 10 deletions
diff --git a/sbin/hastd/control.c b/sbin/hastd/control.c index 0ad39b4..5c48061 100644 --- a/sbin/hastd/control.c +++ b/sbin/hastd/control.c @@ -51,18 +51,18 @@ __FBSDID("$FreeBSD$"); #include "control.h" static void -control_set_role(struct hastd_config *cfg, struct nv *nvout, uint8_t role, - struct hast_resource *res, const char *name, unsigned int no) +control_set_role_common(struct hastd_config *cfg, struct nv *nvout, + uint8_t role, struct hast_resource *res, const char *name, unsigned int no) { - assert(cfg != NULL); - assert(nvout != NULL); - assert(name != NULL); - /* Name is always needed. */ - nv_add_string(nvout, name, "resource%u", no); + if (name != NULL) + nv_add_string(nvout, name, "resource%u", no); if (res == NULL) { + assert(cfg != NULL); + assert(name != NULL); + TAILQ_FOREACH(res, &cfg->hc_resources, hr_next) { if (strcmp(res->hr_name, name) == 0) break; @@ -115,6 +115,13 @@ control_set_role(struct hastd_config *cfg, struct nv *nvout, uint8_t role, pjdlog_prefix_set("%s", ""); } +void +control_set_role(struct hast_resource *res, uint8_t role) +{ + + control_set_role_common(NULL, NULL, role, res, NULL, 0); +} + static void control_status_worker(struct hast_resource *res, struct nv *nvout, unsigned int no) @@ -306,7 +313,7 @@ control_handle(struct hastd_config *cfg) TAILQ_FOREACH(res, &cfg->hc_resources, hr_next) { switch (cmd) { case HASTCTL_SET_ROLE: - control_set_role(cfg, nvout, role, res, + control_set_role_common(cfg, nvout, role, res, res->hr_name, ii++); break; case HASTCTL_STATUS: @@ -329,8 +336,8 @@ control_handle(struct hastd_config *cfg) break; switch (cmd) { case HASTCTL_SET_ROLE: - control_set_role(cfg, nvout, role, NULL, str, - ii); + control_set_role_common(cfg, nvout, role, NULL, + str, ii); break; case HASTCTL_STATUS: control_status(cfg, nvout, NULL, str, ii); diff --git a/sbin/hastd/control.h b/sbin/hastd/control.h index 15ea290..bde790a 100644 --- a/sbin/hastd/control.h +++ b/sbin/hastd/control.h @@ -36,6 +36,9 @@ #define HASTCTL_STATUS 2 struct hastd_config; +struct hast_resource; + +void control_set_role(struct hast_resource *res, uint8_t role); void control_handle(struct hastd_config *cfg); |