Make control_set_role() more public. We will need it soon.
MFC after: 1 month
This commit is contained in:
parent
f377917cdc
commit
a00829bb71
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=210882
@ -51,18 +51,18 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include "control.h"
|
#include "control.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
control_set_role(struct hastd_config *cfg, struct nv *nvout, uint8_t role,
|
control_set_role_common(struct hastd_config *cfg, struct nv *nvout,
|
||||||
struct hast_resource *res, const char *name, unsigned int no)
|
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. */
|
/* 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) {
|
if (res == NULL) {
|
||||||
|
assert(cfg != NULL);
|
||||||
|
assert(name != NULL);
|
||||||
|
|
||||||
TAILQ_FOREACH(res, &cfg->hc_resources, hr_next) {
|
TAILQ_FOREACH(res, &cfg->hc_resources, hr_next) {
|
||||||
if (strcmp(res->hr_name, name) == 0)
|
if (strcmp(res->hr_name, name) == 0)
|
||||||
break;
|
break;
|
||||||
@ -115,6 +115,13 @@ control_set_role(struct hastd_config *cfg, struct nv *nvout, uint8_t role,
|
|||||||
pjdlog_prefix_set("%s", "");
|
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
|
static void
|
||||||
control_status_worker(struct hast_resource *res, struct nv *nvout,
|
control_status_worker(struct hast_resource *res, struct nv *nvout,
|
||||||
unsigned int no)
|
unsigned int no)
|
||||||
@ -306,7 +313,7 @@ control_handle(struct hastd_config *cfg)
|
|||||||
TAILQ_FOREACH(res, &cfg->hc_resources, hr_next) {
|
TAILQ_FOREACH(res, &cfg->hc_resources, hr_next) {
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case HASTCTL_SET_ROLE:
|
case HASTCTL_SET_ROLE:
|
||||||
control_set_role(cfg, nvout, role, res,
|
control_set_role_common(cfg, nvout, role, res,
|
||||||
res->hr_name, ii++);
|
res->hr_name, ii++);
|
||||||
break;
|
break;
|
||||||
case HASTCTL_STATUS:
|
case HASTCTL_STATUS:
|
||||||
@ -329,8 +336,8 @@ control_handle(struct hastd_config *cfg)
|
|||||||
break;
|
break;
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case HASTCTL_SET_ROLE:
|
case HASTCTL_SET_ROLE:
|
||||||
control_set_role(cfg, nvout, role, NULL, str,
|
control_set_role_common(cfg, nvout, role, NULL,
|
||||||
ii);
|
str, ii);
|
||||||
break;
|
break;
|
||||||
case HASTCTL_STATUS:
|
case HASTCTL_STATUS:
|
||||||
control_status(cfg, nvout, NULL, str, ii);
|
control_status(cfg, nvout, NULL, str, ii);
|
||||||
|
@ -36,6 +36,9 @@
|
|||||||
#define HASTCTL_STATUS 2
|
#define HASTCTL_STATUS 2
|
||||||
|
|
||||||
struct hastd_config;
|
struct hastd_config;
|
||||||
|
struct hast_resource;
|
||||||
|
|
||||||
|
void control_set_role(struct hast_resource *res, uint8_t role);
|
||||||
|
|
||||||
void control_handle(struct hastd_config *cfg);
|
void control_handle(struct hastd_config *cfg);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user