Rev 588: merge changes needed for samba4 in http://samba.org/~tridge/ctdb

tridge at samba.org tridge at samba.org
Tue Aug 14 23:04:00 GMT 2007


------------------------------------------------------------
revno: 588
revision-id: tridge at samba.org-20070814230358-pi3oa2w4gul3m0iz
parent: tridge at samba.org-20070807034013-48m6oprew7yql7ij
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Wed 2007-08-15 09:03:58 +1000
message:
  merge changes needed for samba4
modified:
  client/ctdb_client.c           ctdb_client.c-20070411010216-3kd8v37k61steeya-1
  include/ctdb.h                 ctdb.h-20061117234101-o3qt14umlg9en8z0-11
=== modified file 'client/ctdb_client.c'
--- a/client/ctdb_client.c	2007-07-20 05:05:55 +0000
+++ b/client/ctdb_client.c	2007-08-14 23:03:58 +0000
@@ -637,6 +637,30 @@
 	return ctdb_ltdb_store(h->ctdb_db, h->key, &h->header, data);
 }
 
+/*
+  non-locking fetch of a record
+ */
+int ctdb_fetch(struct ctdb_db_context *ctdb_db, TALLOC_CTX *mem_ctx, 
+	       TDB_DATA key, TDB_DATA *data)
+{
+	struct ctdb_call call;
+	int ret;
+
+	call.call_id = CTDB_FETCH_FUNC;
+	call.call_data.dptr = NULL;
+	call.call_data.dsize = 0;
+
+	ret = ctdb_call(ctdb_db, &call);
+
+	if (ret == 0) {
+		*data = call.reply_data;
+		talloc_steal(mem_ctx, data->dptr);
+	}
+
+	return ret;
+}
+
+
 struct ctdb_client_control_state {
 	struct ctdb_context *ctdb;
 	uint32_t reqid;
@@ -1432,6 +1456,11 @@
 	int ret;
 	int32_t res;
 
+	ctdb_db = ctdb_db_handle(ctdb, name);
+	if (ctdb_db) {
+		return ctdb_db;
+	}
+
 	ctdb_db = talloc_zero(ctdb, struct ctdb_db_context);
 	CTDB_NO_MEMORY_NULL(ctdb, ctdb_db);
 
@@ -2162,6 +2191,8 @@
 	ctdb->idr = idr_init(ctdb);
 	CTDB_NO_MEMORY_NULL(ctdb, ctdb->idr);
 
+	ctdb_set_socketname(ctdb, CTDB_PATH);
+
 	return ctdb;
 }
 

=== modified file 'include/ctdb.h'
--- a/include/ctdb.h	2007-07-10 05:29:31 +0000
+++ b/include/ctdb.h	2007-08-14 23:03:58 +0000
@@ -214,6 +214,9 @@
 
 int ctdb_record_store(struct ctdb_record_handle *h, TDB_DATA data);
 
+int ctdb_fetch(struct ctdb_db_context *ctdb_db, TALLOC_CTX *mem_ctx, 
+	       TDB_DATA key, TDB_DATA *data);
+
 int ctdb_register_message_handler(struct ctdb_context *ctdb, 
 				  TALLOC_CTX *mem_ctx,
 				  uint64_t srvid,
@@ -367,4 +370,6 @@
 		       uint32_t destnode, 
 		       uint32_t set, uint32_t clear);
 
+int ctdb_socket_connect(struct ctdb_context *ctdb);
+
 #endif



More information about the samba-cvs mailing list