[SCM] CTDB repository - branch libctdb updated - ctdb-1.0.114-80-g10d64b4

Ronnie Sahlberg sahlberg at samba.org
Mon May 10 18:59:26 MDT 2010


The branch, libctdb has been updated
       via  10d64b4ad659c311dde839bdb47efdeeaf2cffbf (commit)
      from  0457ca22654dadf681f877c4dcd345e6746353a4 (commit)

http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=libctdb


- Log -----------------------------------------------------------------
commit 10d64b4ad659c311dde839bdb47efdeeaf2cffbf
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Tue May 11 10:58:27 2010 +1000

    updates

-----------------------------------------------------------------------

Summary of changes:
 Makefile.in                           |    2 +-
 include/libctdb.h                     |   27 +++++++++++----------------
 libctdb/{ctdb_connect.c => libctdb.c} |   14 ++++++++++----
 libctdb/tst.c                         |    2 +-
 4 files changed, 23 insertions(+), 22 deletions(-)
 rename libctdb/{ctdb_connect.c => libctdb.c} (95%)


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index cdcb394..be7a182 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -41,7 +41,7 @@ UTIL_OBJ = lib/util/idtree.o lib/util/db_wrap.o lib/util/strlist.o lib/util/util
 	lib/util/util_time.o lib/util/util_file.o lib/util/fault.o lib/util/substitute.o \
 	lib/util/signal.o
 
-CTDB_LIB_OBJ = libctdb/ctdb_io.o libctdb/ctdb_connect.o \
+CTDB_LIB_OBJ = libctdb/libctdb.o libctdb/ctdb_io.o \
 	libctdb/ctdb_client.o libctdb/ctdb_message.o \
 	libctdb/ctdb_ltdb.o \
 	libctdb/ctdb_util.o lib/util/debug.o \
diff --git a/include/libctdb.h b/include/libctdb.h
index 9a14a7e..928da56 100644
--- a/include/libctdb.h
+++ b/include/libctdb.h
@@ -20,38 +20,33 @@
 #ifndef _LIBCTDB_H
 #define _LIBCTDB_H
 
-/*
- * initialize the l;ibctdb layer and connect to the daemon 
+/* all functions except libctdb_connect() and libctdb_service()
+ * are non-blocking
  */
+
 struct ctdb_context *libctdb_connect(const char *addr);
 
-/*
- * get the filedescriptor for the event system.
- */
 int libctdb_get_fd(struct ctdb_context *ctdb);
 
-/*
- * what events do we need to trigger on right now
- * we always trigger on POLLIN in case ctdb has a packet for us,
- * but we also trigger on POLLOUT in case the message queue
- * is in use and we need to wait for the socket to become writeable
- */
 int libctdb_which_events(struct ctdb_context *ctdb);
 
-/*
- * called when there are events that libctdb needs to service
- */
 int libctdb_service(struct ctdb_context *ctdb);
 
 
 
+typedef void libctdb_handle;
+
+
 typedef void (*get_recmaster_cb)(int32_t status, int32_t recmaster, void *private_data);
 
-struct ctdb_client_control_state *
-libctdb_getrecmaster_send_cb(struct ctdb_context *ctdb,
+
+
+libctdb_handle *
+libctdb_getrecmaster_cb_send(struct ctdb_context *ctdb,
 			uint32_t destnode,
 			get_recmaster_cb callback,
 			void *private_data);
 
+int libctdb_cancel(libctdb_handle *);
 
 #endif
diff --git a/libctdb/ctdb_connect.c b/libctdb/libctdb.c
similarity index 95%
rename from libctdb/ctdb_connect.c
rename to libctdb/libctdb.c
index de0a5b3..994c074 100644
--- a/libctdb/ctdb_connect.c
+++ b/libctdb/libctdb.c
@@ -128,12 +128,17 @@ int libctdb_service(struct ctdb_context *ctdb)
 
 
 
+int libctdb_cancel(libctdb_handle *handle)
+{
+	talloc_free(handle);
+	return 0;
+}
+
 struct libctdb_control_cb_data {
 	void *callback;
 	void *private_data;
 };
 
-
 static void
 libctdb_getrecmaster_recv_cb(struct ctdb_client_control_state *state)
 {
@@ -143,11 +148,12 @@ libctdb_getrecmaster_recv_cb(struct ctdb_client_control_state *state)
 	callback(0, state->status, cb_data->private_data);
 }
 
+
 /*
   get the recovery master of a remote node
  */
-struct ctdb_client_control_state *
-libctdb_getrecmaster_send_cb(struct ctdb_context *ctdb,
+libctdb_handle *
+libctdb_getrecmaster_cb_send(struct ctdb_context *ctdb,
 			uint32_t destnode,
 			get_recmaster_cb callback,
 			void *private_data)
@@ -166,7 +172,7 @@ libctdb_getrecmaster_send_cb(struct ctdb_context *ctdb,
 	state->async.fn           = libctdb_getrecmaster_recv_cb;
 	state->async.private_data = cb_data;
 
-	return state;
+	return (libctdb_handle *)state;
 }
 
 
diff --git a/libctdb/tst.c b/libctdb/tst.c
index 6e1cd21..6781746 100644
--- a/libctdb/tst.c
+++ b/libctdb/tst.c
@@ -20,7 +20,7 @@ int main(int argc, char *argv[])
 
 	pfd.fd = libctdb_get_fd(ctdb_context);
 
-	state = libctdb_getrecmaster_send_cb(ctdb_context, 0, rm_cb, NULL);
+	state = libctdb_getrecmaster_cb_send(ctdb_context, 0, rm_cb, NULL);
 
 	for (;;) {
 	  pfd.events = libctdb_which_events(ctdb_context);


-- 
CTDB repository


More information about the samba-cvs mailing list