Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 May 2011 18:50:52 +0000 (UTC)
From:      Mikolaj Golub <trociny@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r221507 - in stable/8/sbin: hastctl hastd
Message-ID:  <201105051850.p45Ioq2P011604@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <ptyll@nitronet.pl>
  
  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");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105051850.p45Ioq2P011604>