cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] cluster/cman/lib libcman.c libcman.h
@ 2006-07-11  8:13 pcaulfield
  2006-07-11 19:57 ` Lon Hohberger
  0 siblings, 1 reply; 5+ messages in thread
From: pcaulfield @ 2006-07-11  8:13 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	pcaulfield at sourceware.org	2006-07-11 08:13:18

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

Log message:
	Don't copy the agent name if it's NULL.
	Make the requred size of the agent string clear.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/lib/libcman.c.diff?cvsroot=cluster&r1=1.24&r2=1.25
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/lib/libcman.h.diff?cvsroot=cluster&r1=1.25&r2=1.26

--- cluster/cman/lib/libcman.c	2006/05/10 14:20:07	1.24
+++ cluster/cman/lib/libcman.c	2006/07/11 08:13:18	1.25
@@ -943,7 +943,8 @@
 	ret = info_call(h, CMAN_CMD_GET_FENCE_INFO, &nodeid, sizeof(int), &f, sizeof(f));
 	if (!ret) {
 		*time = f.fence_time;
-		strcpy(agent, f.fence_agent);
+		if (agent)
+			strcpy(agent, f.fence_agent);
 		*fenced = ((f.flags & FENCE_FLAGS_FENCED) != 0);
 	}
 	return ret;
--- cluster/cman/lib/libcman.h	2006/06/20 15:27:04	1.25
+++ cluster/cman/lib/libcman.h	2006/07/11 08:13:18	1.26
@@ -30,9 +30,10 @@
 /*
  * Some maxima
  */
-#define CMAN_MAX_ADDR_LEN sizeof(struct sockaddr_in6)
-#define CMAN_MAX_NODENAME_LEN 255
-#define MAX_CLUSTER_NAME_LEN   16
+#define CMAN_MAX_ADDR_LEN             sizeof(struct sockaddr_in6)
+#define CMAN_MAX_NODENAME_LEN         255
+#define MAX_CLUSTER_NAME_LEN           16
+#define CMAN_MAX_FENCE_AGENT_NAME_LEN 255
 
 /*
  * Pass this into cman_get_node() as the nodeid to get local node information
@@ -286,6 +287,7 @@
 /* Get fence information for a node.
  * 'int *fenced' is only valid if the node is down, it is set to
  * 1 if the node has been fenced since it left the cluster.
+ * agent should be CMAN_MAX_FENCE_AGENT_NAME_LEN
  */
 int cman_get_fenceinfo(cman_handle_t handle, int nodeid, uint64_t *fence_time, int *fenced, char *agent);
 



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Cluster-devel] cluster/cman/lib libcman.c libcman.h
  2006-07-11  8:13 pcaulfield
@ 2006-07-11 19:57 ` Lon Hohberger
  0 siblings, 0 replies; 5+ messages in thread
From: Lon Hohberger @ 2006-07-11 19:57 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On Tue, 2006-07-11 at 08:13 +0000, pcaulfield at sourceware.org wrote:
> CVSROOT:	/cvs/cluster
> Module name:	cluster
> Changes by:	pcaulfield at sourceware.org	2006-07-11 08:13:18
> 
> Modified files:
> 	cman/lib       : libcman.c libcman.h 
> 
> Log message:
> 	Don't copy the agent name if it's NULL.
> 	Make the requred size of the agent string clear.

Nice, thanks!

-- Lon




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Cluster-devel] cluster/cman/lib libcman.c libcman.h
@ 2007-05-02 10:27 pcaulfield
  0 siblings, 0 replies; 5+ messages in thread
From: pcaulfield @ 2007-05-02 10:27 UTC (permalink / raw)
  To: cluster-devel.redhat.com

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Cluster-devel] cluster/cman/lib libcman.c libcman.h
@ 2007-11-05 16:43 fabbione
  0 siblings, 0 replies; 5+ messages in thread
From: fabbione @ 2007-11-05 16:43 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	fabbione at sourceware.org	2007-11-05 16:43:50

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

Log message:
	Add cman_wait_init as wrapper for cman_admin_init/cman_init and cman_is_quorate

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/lib/libcman.c.diff?cvsroot=cluster&r1=1.37&r2=1.38
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/lib/libcman.h.diff?cvsroot=cluster&r1=1.35&r2=1.36

--- cluster/cman/lib/libcman.c	2007/09/18 15:34:41	1.37
+++ cluster/cman/lib/libcman.c	2007/11/05 16:43:50	1.38
@@ -354,6 +354,61 @@
 	return open_socket(CLIENT_SOCKNAME, sizeof(CLIENT_SOCKNAME), privdata);
 }
 
+/* cman_wait_init
+ *
+ * @admin: set to 0 for standard socket, != 0 for admin socket
+ * @ctimeout: connection timeout in second to attempt to connect to cman.
+ *            0 = wait forever, -1 = do not wait.
+ * @qtimeout: cluster quorum timeout in second.
+ *            0 = wait forever, -1 = do not wait.
+ * @privdata: see cman_admin_init and cman_init.
+ */
+
+cman_handle_t cman_wait_init(int admin, int ctimeout, int qtimeout, void *privdata)
+{
+	cman_handle_t ch;
+	int i = 0;
+
+	if (!ctimeout)
+		i = 1;
+
+	while (ctimeout != i) {
+
+		if (admin) {
+			ch = cman_admin_init(privdata);
+		} else {
+			ch = cman_init(privdata);
+		}
+
+		if ((ch) || (ctimeout = -1)) {
+			i = ctimeout;
+		} else {
+			sleep(1);
+			i++;
+		}
+	}
+
+	if (!ch)
+		return ch;
+
+	if (!qtimeout) {
+		i = 1;
+	} else {
+		i = 0;
+	}
+
+	while (qtimeout != i) {
+		if ((cman_is_quorate(ch)) || (qtimeout = -1)) {
+			i = qtimeout;
+		} else {
+			sleep(1);
+			i++;
+		}
+	}
+
+	return ch;
+}
+
 int cman_finish(cman_handle_t handle)
 {
 	struct cman_handle *h = (struct cman_handle *)handle;
--- cluster/cman/lib/libcman.h	2007/11/05 15:15:53	1.35
+++ cluster/cman/lib/libcman.h	2007/11/05 16:43:50	1.36
@@ -203,6 +203,7 @@
  */
 cman_handle_t cman_init(void *privdata);
 cman_handle_t cman_admin_init(void *privdata);
+cman_handle_t cman_wait_init(int admin, int ctimeout, int qtimeout, void *privdata);
 int cman_finish(cman_handle_t handle);
 
 /* Update/retrieve the private data */



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Cluster-devel] cluster/cman/lib libcman.c libcman.h
@ 2007-11-09 12:51 fabbione
  0 siblings, 0 replies; 5+ messages in thread
From: fabbione @ 2007-11-09 12:51 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	fabbione at sourceware.org	2007-11-09 12:51:58

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

Log message:
	Remove cman_wait_init for now. It was becoming overly complicated for such
	simple task.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/lib/libcman.c.diff?cvsroot=cluster&r1=1.38&r2=1.39
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/lib/libcman.h.diff?cvsroot=cluster&r1=1.36&r2=1.37

--- cluster/cman/lib/libcman.c	2007/11/05 16:43:50	1.38
+++ cluster/cman/lib/libcman.c	2007/11/09 12:51:58	1.39
@@ -354,61 +354,6 @@
 	return open_socket(CLIENT_SOCKNAME, sizeof(CLIENT_SOCKNAME), privdata);
 }
 
-/* cman_wait_init
- *
- * @admin: set to 0 for standard socket, != 0 for admin socket
- * @ctimeout: connection timeout in second to attempt to connect to cman.
- *            0 = wait forever, -1 = do not wait.
- * @qtimeout: cluster quorum timeout in second.
- *            0 = wait forever, -1 = do not wait.
- * @privdata: see cman_admin_init and cman_init.
- */
-
-cman_handle_t cman_wait_init(int admin, int ctimeout, int qtimeout, void *privdata)
-{
-	cman_handle_t ch;
-	int i = 0;
-
-	if (!ctimeout)
-		i = 1;
-
-	while (ctimeout != i) {
-
-		if (admin) {
-			ch = cman_admin_init(privdata);
-		} else {
-			ch = cman_init(privdata);
-		}
-
-		if ((ch) || (ctimeout = -1)) {
-			i = ctimeout;
-		} else {
-			sleep(1);
-			i++;
-		}
-	}
-
-	if (!ch)
-		return ch;
-
-	if (!qtimeout) {
-		i = 1;
-	} else {
-		i = 0;
-	}
-
-	while (qtimeout != i) {
-		if ((cman_is_quorate(ch)) || (qtimeout = -1)) {
-			i = qtimeout;
-		} else {
-			sleep(1);
-			i++;
-		}
-	}
-
-	return ch;
-}
-
 int cman_finish(cman_handle_t handle)
 {
 	struct cman_handle *h = (struct cman_handle *)handle;
--- cluster/cman/lib/libcman.h	2007/11/05 16:43:50	1.36
+++ cluster/cman/lib/libcman.h	2007/11/09 12:51:58	1.37
@@ -203,7 +203,6 @@
  */
 cman_handle_t cman_init(void *privdata);
 cman_handle_t cman_admin_init(void *privdata);
-cman_handle_t cman_wait_init(int admin, int ctimeout, int qtimeout, void *privdata);
 int cman_finish(cman_handle_t handle);
 
 /* Update/retrieve the private data */



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-11-09 12:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-02 10:27 [Cluster-devel] cluster/cman/lib libcman.c libcman.h pcaulfield
  -- strict thread matches above, loose matches on Subject: below --
2007-11-09 12:51 fabbione
2007-11-05 16:43 fabbione
2006-07-11  8:13 pcaulfield
2006-07-11 19:57 ` Lon Hohberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).