[Cluster-devel] cluster/cman/lib libcman.c libcman.h

pcaulfield at sourceware.org pcaulfield at sourceware.org
Wed May 2 10:27:08 UTC 2007


CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	pcaulfield at sourceware.org	2007-05-02 10:27:07

Modified files:
	cman/lib       : libcman.c libcman.h 

Log message:
	Add const to libcman
	Thanks to  Jim Meyering for the patch

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/lib/libcman.c.diff?cvsroot=cluster&r1=1.33&r2=1.34
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/lib/libcman.h.diff?cvsroot=cluster&r1=1.29&r2=1.30

--- cluster/cman/lib/libcman.c	2007/01/05 10:30:53	1.33
+++ cluster/cman/lib/libcman.c	2007/05/02 10:27:07	1.34
@@ -1,7 +1,7 @@
 /******************************************************************************
 *******************************************************************************
 **
-**  Copyright (C) 2004-2006 Red Hat, Inc.  All rights reserved.
+**  Copyright (C) 2004-2007 Red Hat, Inc.  All rights reserved.
 **
 **  This library is free software; you can redistribute it and/or
 **  modify it under the terms of the GNU Lesser General Public
@@ -250,7 +250,7 @@
 }
 
 
-static int send_message(struct cman_handle *h, int msgtype, void *inbuf, int inlen)
+static int send_message(struct cman_handle *h, int msgtype, const void *inbuf, int inlen)
 {
 	struct sock_header header;
 	size_t len;
@@ -268,7 +268,7 @@
 	if (inbuf)
 	{
 		iov[1].iov_len = inlen;
-		iov[1].iov_base = inbuf;
+		iov[1].iov_base = (void *) inbuf;
 		iovlen++;
 	}
 
@@ -279,7 +279,7 @@
 }
 
 /* Does something similar to the ioctl calls */
-static int info_call(struct cman_handle *h, int msgtype, void *inbuf, int inlen, void *outbuf, int outlen)
+static int info_call(struct cman_handle *h, int msgtype, const void *inbuf, int inlen, void *outbuf, int outlen)
 {
 	if (send_message(h, msgtype, inbuf, inlen))
 		return -1;
@@ -752,7 +752,7 @@
 	return info_call(h, CMAN_CMD_GET_VERSION, NULL, 0, version, sizeof(cman_version_t));
 }
 
-int cman_set_version(cman_handle_t handle, cman_version_t *version)
+int cman_set_version(cman_handle_t handle, const cman_version_t *version)
 {
 	struct cman_handle *h = (struct cman_handle *)handle;
 	VALIDATE_HANDLE(h);
@@ -841,7 +841,7 @@
 	return info_call(h, CMAN_CMD_GETEXTRAINFO, NULL, 0, info, maxlen);
 }
 
-int cman_send_data(cman_handle_t handle, void *buf, int len, int flags, uint8_t port, int nodeid)
+int cman_send_data(cman_handle_t handle, const void *buf, int len, int flags, uint8_t port, int nodeid)
 {
 	struct cman_handle *h = (struct cman_handle *)handle;
 	struct iovec iov[2];
@@ -859,7 +859,7 @@
 	iov[0].iov_len = sizeof(header);
 	iov[0].iov_base = &header;
 	iov[1].iov_len = len;
-	iov[1].iov_base = buf;
+	iov[1].iov_base = (void *) buf;
 
 	return loopy_writev(h->fd, iov, 2);
 }
@@ -892,7 +892,7 @@
 }
 
 
-int cman_barrier_register(cman_handle_t handle, char *name, int flags, int nodes)
+int cman_barrier_register(cman_handle_t handle, const char *name, int flags, int nodes)
 {
 	struct cman_handle *h = (struct cman_handle *)handle;
 	struct cl_barrier_info binfo;
@@ -913,7 +913,7 @@
 }
 
 
-int cman_barrier_change(cman_handle_t handle, char *name, int flags, int arg)
+int cman_barrier_change(cman_handle_t handle, const char *name, int flags, int arg)
 {
 	struct cman_handle *h = (struct cman_handle *)handle;
 	struct cl_barrier_info binfo;
@@ -934,7 +934,7 @@
 
 }
 
-int cman_barrier_wait(cman_handle_t handle, char *name)
+int cman_barrier_wait(cman_handle_t handle, const char *name)
 {
 	struct cman_handle *h = (struct cman_handle *)handle;
 	struct cl_barrier_info binfo;
@@ -952,7 +952,7 @@
 	return info_call(h, CMAN_CMD_BARRIER, &binfo, sizeof(binfo), NULL, 0);
 }
 
-int cman_barrier_delete(cman_handle_t handle, char *name)
+int cman_barrier_delete(cman_handle_t handle, const char *name)
 {
 	struct cman_handle *h = (struct cman_handle *)handle;
 	struct cl_barrier_info binfo;
--- cluster/cman/lib/libcman.h	2006/10/05 07:48:33	1.29
+++ cluster/cman/lib/libcman.h	2007/05/02 10:27:07	1.30
@@ -1,7 +1,7 @@
 /******************************************************************************
 *******************************************************************************
 **
-**  Copyright (C) 2004-2006 Red Hat, Inc.  All rights reserved.
+**  Copyright (C) 2004-2007 Red Hat, Inc.  All rights reserved.
 **
 **  This library is free software; you can redistribute it and/or
 **  modify it under the terms of the GNU Lesser General Public
@@ -321,7 +321,7 @@
 
 /* Change the config file version. This should be needed much less now, as cman will
    re-read the config file if a new node joins with a new config versoin */
-int cman_set_version(cman_handle_t handle, cman_version_t *version);
+int cman_set_version(cman_handle_t handle, const cman_version_t *version);
 
 /* Deprecated in favour of cman_shutdown(). Use cman_tool anyway please. */
 int cman_leave_cluster(cman_handle_t handle, int reason);
@@ -363,7 +363,7 @@
  * cman_start_recv_data() is like a bind(), and marks the port
  * as "listening". See cman_is_listening() above.
  */
-int cman_send_data(cman_handle_t handle, void *buf, int len, int flags, uint8_t port, int nodeid);
+int cman_send_data(cman_handle_t handle, const void *buf, int len, int flags, uint8_t port, int nodeid);
 int cman_start_recv_data(cman_handle_t handle, cman_datacallback_t, uint8_t port);
 int cman_end_recv_data(cman_handle_t handle);
 
@@ -372,10 +372,10 @@
  * Here for backwards compatibility. Most of the things you would achieve
  * with this can now be better done using openAIS services or just messaging.
  */
-int cman_barrier_register(cman_handle_t handle, char *name, int flags, int nodes);
-int cman_barrier_change(cman_handle_t handle, char *name, int flags, int arg);
-int cman_barrier_wait(cman_handle_t handle, char *name);
-int cman_barrier_delete(cman_handle_t handle, char *name);
+int cman_barrier_register(cman_handle_t handle, const char *name, int flags, int nodes);
+int cman_barrier_change(cman_handle_t handle, const char *name, int flags, int arg);
+int cman_barrier_wait(cman_handle_t handle, const char *name);
+int cman_barrier_delete(cman_handle_t handle, const char *name);
 
 /*
  * Add your own quorum device here, needs an admin socket




More information about the Cluster-devel mailing list