[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] cluster/rgmanager/src/daemons rg_state.c



CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	lhh sourceware org	2008-01-02 19:54:28

Modified files:
	rgmanager/src/daemons: rg_state.c 

Log message:
	Fix endian issue on big-endian arches

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/rg_state.c.diff?cvsroot=cluster&r1=1.44&r2=1.45

--- cluster/rgmanager/src/daemons/rg_state.c	2007/12/30 08:27:21	1.44
+++ cluster/rgmanager/src/daemons/rg_state.c	2008/01/02 19:54:28	1.45
@@ -270,6 +270,7 @@
 set_rg_state(char *name, rg_state_t *svcblk)
 {
 	char res[256];
+	rg_state_t svcblk_store;
 #ifndef OPENAIS
 	cluster_member_list_t *membership;
 	int ret, tries = 0;
@@ -279,8 +280,12 @@
 		strncpy(svcblk->rs_name, name, sizeof(svcblk->rs_name));
 
 	snprintf(res, sizeof(res), "rg=\"%s\"", name);
+
+	memcpy(&svcblk_store, svcblk, sizeof(svcblk_store));
+	swab_rg_state_t(&svcblk_store);
+
 #ifdef OPENAIS
-	if (ds_write(res, svcblk, sizeof(*svcblk)) < 0)
+	if (ds_write(res, &svcblk_store, sizeof(svcblk_store)) < 0)
 		return -1;
 	return 0;
 #else
@@ -288,8 +293,9 @@
 		/* Retry up to 3 times just in case members transition
 		   while we're trying to commit something */
 		membership = member_list();
-		ret = vf_write(membership, VFF_IGN_CONN_ERRORS, res, svcblk,
-       		       	       sizeof(*svcblk));
+		ret = vf_write(membership, VFF_IGN_CONN_ERRORS, res,
+			       &svcblk_store,
+       		       	       sizeof(svcblk_store));
 		free_member_list(membership);
 	} while (ret == VFR_TIMEOUT && ++tries < 3);
 
@@ -360,6 +366,7 @@
 	}
 
 	memcpy(svcblk, data, sizeof(*svcblk));
+	swab_rg_state_t(svcblk);
 
 	return 0;
 #else
@@ -399,6 +406,7 @@
 
 	/* Copy out the data. */
 	memcpy(svcblk, data, sizeof(*svcblk));
+	swab_rg_state_t(svcblk);
 	free(data);
 	free_member_list(membership);
 
@@ -452,6 +460,7 @@
 
 	/* Copy out the data. */
 	memcpy(svcblk, data, sizeof(*svcblk));
+	swab_rg_state_t(svcblk);
 #ifndef OPENAIS
 	free(data);
 #endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]