Date: Thu, 5 Aug 2010 19:04:29 +0000 (UTC) From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r210882 - head/sbin/hastd Message-ID: <201008051904.o75J4THx077969@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pjd Date: Thu Aug 5 19:04:29 2010 New Revision: 210882 URL: http://svn.freebsd.org/changeset/base/210882 Log: Make control_set_role() more public. We will need it soon. MFC after: 1 month Modified: head/sbin/hastd/control.c head/sbin/hastd/control.h Modified: head/sbin/hastd/control.c ============================================================================== --- head/sbin/hastd/control.c Thu Aug 5 19:01:57 2010 (r210881) +++ head/sbin/hastd/control.c Thu Aug 5 19:04:29 2010 (r210882) @@ -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 *cf 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); Modified: head/sbin/hastd/control.h ============================================================================== --- head/sbin/hastd/control.h Thu Aug 5 19:01:57 2010 (r210881) +++ head/sbin/hastd/control.h Thu Aug 5 19:04:29 2010 (r210882) @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008051904.o75J4THx077969>