Rev 68: merge back some changes from Samba4 in
http://samba.org/~tridge/ctdb
tridge at samba.org
tridge at samba.org
Wed Apr 4 05:02:50 GMT 2007
------------------------------------------------------------
revno: 68
revision-id: tridge at samba.org-20070404050249-9ca53bdf68db13d5
parent: tridge at samba.org-20070403101350-2b6ff2679f75aa06
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Wed 2007-04-04 15:02:49 +1000
message:
merge back some changes from Samba4
modified:
common/ctdb_ltdb.c ctdb_ltdb.c-20061128065342-to93h6eejj5kon81-2
include/ctdb.h ctdb.h-20061117234101-o3qt14umlg9en8z0-11
include/includes.h includes.h-20061117234101-o3qt14umlg9en8z0-17
=== modified file 'common/ctdb_ltdb.c'
--- a/common/ctdb_ltdb.c 2007-04-03 09:41:00 +0000
+++ b/common/ctdb_ltdb.c 2007-04-04 05:02:49 +0000
@@ -25,7 +25,21 @@
#include "system/filesys.h"
#include "../include/ctdb_private.h"
#include "db_wrap.h"
+#include "lib/util/dlinklist.h"
+/*
+ find an attached ctdb_db handle given a name
+ */
+struct ctdb_db_context *ctdb_db_handle(struct ctdb_context *ctdb, const char *name)
+{
+ struct ctdb_db_context *tmp_db;
+ for (tmp_db=ctdb->db_list;tmp_db;tmp_db=tmp_db->next) {
+ if (strcmp(name, tmp_db->db_name) == 0) {
+ return tmp_db;
+ }
+ }
+ return NULL;
+}
/*
attach to a specific database
@@ -43,7 +57,7 @@
ctdb_db->db_name = talloc_strdup(ctdb_db, name);
CTDB_NO_MEMORY_NULL(ctdb, ctdb_db->db_name);
- data.dptr = name;
+ data.dptr = discard_const(name);
data.dsize = strlen(name);
ctdb_db->db_id = ctdb_hash(&data);
=== modified file 'include/ctdb.h'
--- a/include/ctdb.h 2007-04-03 09:41:00 +0000
+++ b/include/ctdb.h 2007-04-04 05:02:49 +0000
@@ -95,6 +95,11 @@
int open_flags, mode_t mode);
/*
+ find an attached ctdb_db handle given a name
+ */
+struct ctdb_db_context *ctdb_db_handle(struct ctdb_context *ctdb, const char *name);
+
+/*
error string for last ctdb error
*/
const char *ctdb_errstr(struct ctdb_context *);
=== modified file 'include/includes.h'
--- a/include/includes.h 2007-01-30 17:47:26 +0000
+++ b/include/includes.h 2007-04-04 05:02:49 +0000
@@ -20,6 +20,10 @@
#define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))
+#ifndef discard_const
+#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
+#endif
+
struct timeval timeval_zero(void);
bool timeval_is_zero(const struct timeval *tv);
struct timeval timeval_current(void);
More information about the samba-cvs
mailing list