From owner-svn-src-stable-8@FreeBSD.ORG Thu May 5 18:50:52 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC493106566C; Thu, 5 May 2011 18:50:52 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C8A218FC0C; Thu, 5 May 2011 18:50:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p45IoqQ7011610; Thu, 5 May 2011 18:50:52 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p45Ioq2P011604; Thu, 5 May 2011 18:50:52 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201105051850.p45Ioq2P011604@svn.freebsd.org> From: Mikolaj Golub Date: Thu, 5 May 2011 18:50:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221507 - in stable/8/sbin: hastctl hastd X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 May 2011 18:50:53 -0000 Author: trociny Date: Thu May 5 18:50:52 2011 New Revision: 221507 URL: http://svn.freebsd.org/changeset/base/221507 Log: MFC r221074, r221075, r221076, r221078: r221074: Fix assert messages. r221075: For conversation between hastctl and hastd we should use HASTCTL_CMD defines. r221076: Rename HASTCTL_ defines, which are used for conversation between main hastd process and workers, remove unused one and set different range of numbers. This is done in order not to confuse them with HASTCTL_CMD defines, used for conversation between hastctl and hastd, and to avoid bugs like the one fixed in r221075. r221078: Add missing ifdef. This fixes build with NO_OPENSSL. Reported by: Pawel Tyll Approved by: pjd (mentor) Modified: stable/8/sbin/hastctl/hastctl.c stable/8/sbin/hastd/control.c stable/8/sbin/hastd/control.h stable/8/sbin/hastd/hast_proto.c stable/8/sbin/hastd/hastd.c Directory Properties: stable/8/sbin/hastctl/ (props changed) stable/8/sbin/hastd/ (props changed) Modified: stable/8/sbin/hastctl/hastctl.c ============================================================================== --- stable/8/sbin/hastctl/hastctl.c Thu May 5 18:47:24 2011 (r221506) +++ stable/8/sbin/hastctl/hastctl.c Thu May 5 18:50:52 2011 (r221507) @@ -465,7 +465,7 @@ main(int argc, char *argv[]) } break; default: - assert(!"Impossible role!"); + assert(!"Impossible command!"); } /* Setup control connection... */ @@ -513,7 +513,7 @@ main(int argc, char *argv[]) error = control_status(nv); break; default: - assert(!"Impossible role!"); + assert(!"Impossible command!"); } exit(error); Modified: stable/8/sbin/hastd/control.c ============================================================================== --- stable/8/sbin/hastd/control.c Thu May 5 18:47:24 2011 (r221506) +++ stable/8/sbin/hastd/control.c Thu May 5 18:50:52 2011 (r221507) @@ -162,7 +162,7 @@ control_status_worker(struct hast_resour * Prepare and send command to worker process. */ cnvout = nv_alloc(); - nv_add_uint8(cnvout, HASTCTL_STATUS, "cmd"); + nv_add_uint8(cnvout, CONTROL_STATUS, "cmd"); error = nv_error(cnvout); if (error != 0) { pjdlog_common(LOG_ERR, 0, error, @@ -324,7 +324,7 @@ control_handle(struct hastd_config *cfg) error = EHAST_INVALID; goto fail; } - if (cmd == HASTCTL_SET_ROLE) { + if (cmd == HASTCTL_CMD_SETROLE) { role = nv_get_uint8(nvin, "role"); switch (role) { case HAST_ROLE_INIT: @@ -345,11 +345,11 @@ control_handle(struct hastd_config *cfg) ii = 0; TAILQ_FOREACH(res, &cfg->hc_resources, hr_next) { switch (cmd) { - case HASTCTL_SET_ROLE: + case HASTCTL_CMD_SETROLE: control_set_role_common(cfg, nvout, role, res, res->hr_name, ii++); break; - case HASTCTL_STATUS: + case HASTCTL_CMD_STATUS: control_status(cfg, nvout, res, res->hr_name, ii++); break; @@ -368,11 +368,11 @@ control_handle(struct hastd_config *cfg) if (str == NULL) break; switch (cmd) { - case HASTCTL_SET_ROLE: + case HASTCTL_CMD_SETROLE: control_set_role_common(cfg, nvout, role, NULL, str, ii); break; - case HASTCTL_STATUS: + case HASTCTL_CMD_STATUS: control_status(cfg, nvout, NULL, str, ii); break; default: @@ -427,7 +427,7 @@ ctrl_thread(void *arg) } nvout = nv_alloc(); switch (cmd) { - case HASTCTL_STATUS: + case CONTROL_STATUS: if (res->hr_remotein != NULL && res->hr_remoteout != NULL) { nv_add_string(nvout, "complete", "status"); @@ -448,7 +448,7 @@ ctrl_thread(void *arg) } nv_add_int16(nvout, 0, "error"); break; - case HASTCTL_RELOAD: + case CONTROL_RELOAD: /* * When parent receives SIGHUP and discovers that * something related to us has changes, it sends reload Modified: stable/8/sbin/hastd/control.h ============================================================================== --- stable/8/sbin/hastd/control.h Thu May 5 18:47:24 2011 (r221506) +++ stable/8/sbin/hastd/control.h Thu May 5 18:50:52 2011 (r221507) @@ -32,9 +32,8 @@ #ifndef _CONTROL_H_ #define _CONTROL_H_ -#define HASTCTL_SET_ROLE 1 -#define HASTCTL_STATUS 2 -#define HASTCTL_RELOAD 3 +#define CONTROL_STATUS 10 +#define CONTROL_RELOAD 11 struct hastd_config; struct hast_resource; Modified: stable/8/sbin/hastd/hast_proto.c ============================================================================== --- stable/8/sbin/hastd/hast_proto.c Thu May 5 18:47:24 2011 (r221506) +++ stable/8/sbin/hastd/hast_proto.c Thu May 5 18:50:52 2011 (r221507) @@ -69,7 +69,9 @@ struct hast_pipe_stage { static struct hast_pipe_stage pipeline[] = { { "compression", compression_send, compression_recv }, +#ifdef HAVE_CRYPTO { "checksum", checksum_send, checksum_recv } +#endif }; /* Modified: stable/8/sbin/hastd/hastd.c ============================================================================== --- stable/8/sbin/hastd/hastd.c Thu May 5 18:47:24 2011 (r221506) +++ stable/8/sbin/hastd/hastd.c Thu May 5 18:50:52 2011 (r221507) @@ -424,7 +424,7 @@ resource_reload(const struct hast_resour PJDLOG_ASSERT(res->hr_role == HAST_ROLE_PRIMARY); nvout = nv_alloc(); - nv_add_uint8(nvout, HASTCTL_RELOAD, "cmd"); + nv_add_uint8(nvout, CONTROL_RELOAD, "cmd"); nv_add_string(nvout, res->hr_remoteaddr, "remoteaddr"); nv_add_string(nvout, res->hr_sourceaddr, "sourceaddr"); nv_add_int32(nvout, (int32_t)res->hr_replication, "replication");