Make control_set_role() more public. We will need it soon.
MFC after: 1 month
This commit is contained in:
parent
64f20fee87
commit
31021ec9f1
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user