summaryrefslogtreecommitdiff
path: root/source4/cluster/ctdb
diff options
context:
space:
mode:
Diffstat (limited to 'source4/cluster/ctdb')
-rw-r--r--source4/cluster/ctdb/brlock_ctdb.c26
-rw-r--r--source4/cluster/ctdb/client/ctdb_client.c35
-rw-r--r--source4/cluster/ctdb/common/ctdb_io.c11
-rw-r--r--source4/cluster/ctdb/common/ctdb_ltdb.c4
-rw-r--r--source4/cluster/ctdb/common/ctdb_util.c2
-rw-r--r--source4/cluster/ctdb/ctdb_cluster.c14
-rw-r--r--source4/cluster/ctdb/opendb_ctdb.c19
7 files changed, 58 insertions, 53 deletions
diff --git a/source4/cluster/ctdb/brlock_ctdb.c b/source4/cluster/ctdb/brlock_ctdb.c
index fecc88da45..8b633358a3 100644
--- a/source4/cluster/ctdb/brlock_ctdb.c
+++ b/source4/cluster/ctdb/brlock_ctdb.c
@@ -148,7 +148,7 @@ static struct brl_handle *brl_ctdb_create_handle(TALLOC_CTX *mem_ctx, struct ntv
/*
see if two locking contexts are equal
*/
-static BOOL brl_ctdb_same_context(struct lock_context *ctx1, struct lock_context *ctx2)
+static bool brl_ctdb_same_context(struct lock_context *ctx1, struct lock_context *ctx2)
{
return (cluster_id_equal(&ctx1->server, &ctx2->server) &&
ctx1->smbpid == ctx2->smbpid &&
@@ -158,7 +158,7 @@ static BOOL brl_ctdb_same_context(struct lock_context *ctx1, struct lock_context
/*
see if lck1 and lck2 overlap
*/
-static BOOL brl_ctdb_overlap(struct lock_struct *lck1,
+static bool brl_ctdb_overlap(struct lock_struct *lck1,
struct lock_struct *lck2)
{
/* this extra check is not redundent - it copes with locks
@@ -166,35 +166,35 @@ static BOOL brl_ctdb_overlap(struct lock_struct *lck1,
if (lck1->size != 0 &&
lck1->start == lck2->start &&
lck1->size == lck2->size) {
- return True;
+ return true;
}
if (lck1->start >= (lck2->start+lck2->size) ||
lck2->start >= (lck1->start+lck1->size)) {
- return False;
+ return false;
}
- return True;
+ return true;
}
/*
See if lock2 can be added when lock1 is in place.
*/
-static BOOL brl_ctdb_conflict(struct lock_struct *lck1,
+static bool brl_ctdb_conflict(struct lock_struct *lck1,
struct lock_struct *lck2)
{
/* pending locks don't conflict with anything */
if (lck1->lock_type >= PENDING_READ_LOCK ||
lck2->lock_type >= PENDING_READ_LOCK) {
- return False;
+ return false;
}
if (lck1->lock_type == READ_LOCK && lck2->lock_type == READ_LOCK) {
- return False;
+ return false;
}
if (brl_ctdb_same_context(&lck1->context, &lck2->context) &&
lck2->lock_type == READ_LOCK && lck1->ntvfs == lck2->ntvfs) {
- return False;
+ return false;
}
return brl_ctdb_overlap(lck1, lck2);
@@ -205,16 +205,16 @@ static BOOL brl_ctdb_conflict(struct lock_struct *lck1,
Check to see if this lock conflicts, but ignore our own locks on the
same fnum only.
*/
-static BOOL brl_ctdb_conflict_other(struct lock_struct *lck1, struct lock_struct *lck2)
+static bool brl_ctdb_conflict_other(struct lock_struct *lck1, struct lock_struct *lck2)
{
/* pending locks don't conflict with anything */
if (lck1->lock_type >= PENDING_READ_LOCK ||
lck2->lock_type >= PENDING_READ_LOCK) {
- return False;
+ return false;
}
if (lck1->lock_type == READ_LOCK && lck2->lock_type == READ_LOCK)
- return False;
+ return false;
/*
* note that incoming write calls conflict with existing READ
@@ -224,7 +224,7 @@ static BOOL brl_ctdb_conflict_other(struct lock_struct *lck1, struct lock_struct
if (brl_ctdb_same_context(&lck1->context, &lck2->context) &&
lck1->ntvfs == lck2->ntvfs &&
(lck2->lock_type == READ_LOCK || lck1->lock_type == WRITE_LOCK)) {
- return False;
+ return false;
}
return brl_ctdb_overlap(lck1, lck2);
diff --git a/source4/cluster/ctdb/client/ctdb_client.c b/source4/cluster/ctdb/client/ctdb_client.c
index b569a69c8d..84c095ec8a 100644
--- a/source4/cluster/ctdb/client/ctdb_client.c
+++ b/source4/cluster/ctdb/client/ctdb_client.c
@@ -79,7 +79,7 @@ int ctdb_call_local(struct ctdb_db_context *ctdb_db, struct ctdb_call *call,
c->key = call->key;
c->call_data = &call->call_data;
- c->record_data.dptr = talloc_memdup(c, data->dptr, data->dsize);
+ c->record_data.dptr = (unsigned char *)talloc_memdup(c, data->dptr, data->dsize);
c->record_data.dsize = data->dsize;
CTDB_NO_MEMORY(ctdb, c->record_data.dptr);
c->new_data = NULL;
@@ -311,9 +311,10 @@ int ctdb_call_recv(struct ctdb_client_call_state *state, struct ctdb_call *call)
}
if (state->call.reply_data.dsize) {
- call->reply_data.dptr = talloc_memdup(state->ctdb_db,
- state->call.reply_data.dptr,
- state->call.reply_data.dsize);
+ call->reply_data.dptr = (unsigned char *)talloc_memdup(
+ state->ctdb_db,
+ state->call.reply_data.dptr,
+ state->call.reply_data.dsize);
call->reply_data.dsize = state->call.reply_data.dsize;
} else {
call->reply_data.dptr = NULL;
@@ -484,7 +485,7 @@ int ctdb_set_message_handler(struct ctdb_context *ctdb, uint64_t srvid,
/*
tell the daemon we no longer want a srvid
*/
-int ctdb_remove_message_handler(struct ctdb_context *ctdb, uint64_t srvid, void *private_data)
+static int ctdb_remove_message_handler(struct ctdb_context *ctdb, uint64_t srvid, void *private_data)
{
int res;
int32_t status;
@@ -580,7 +581,7 @@ struct ctdb_record_handle *ctdb_fetch_lock(struct ctdb_db_context *ctdb_db, TALL
h->ctdb_db = ctdb_db;
h->key = key;
- h->key.dptr = talloc_memdup(h, key.dptr, key.dsize);
+ h->key.dptr = (unsigned char *)talloc_memdup(h, key.dptr, key.dsize);
if (h->key.dptr == NULL) {
talloc_free(h);
return NULL;
@@ -812,7 +813,7 @@ int ctdb_control(struct ctdb_context *ctdb, uint32_t destnode, uint64_t srvid,
if (outdata) {
*outdata = state->outdata;
- outdata->dptr = talloc_memdup(mem_ctx, outdata->dptr, outdata->dsize);
+ outdata->dptr = (unsigned char *)talloc_memdup(mem_ctx, outdata->dptr, outdata->dsize);
}
*status = state->status;
@@ -1156,10 +1157,10 @@ int ctdb_ctrl_pulldb(struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid
rec = (struct ctdb_rec_data *)&reply->data[0];
for (i=0;i<reply->count;i++) {
- keys->keys[i].dptr = talloc_memdup(mem_ctx, &rec->data[0], rec->keylen);
+ keys->keys[i].dptr = (unsigned char *)talloc_memdup(mem_ctx, &rec->data[0], rec->keylen);
keys->keys[i].dsize = rec->keylen;
- keys->data[i].dptr = talloc_memdup(mem_ctx, &rec->data[keys->keys[i].dsize], rec->datalen);
+ keys->data[i].dptr = (unsigned char *)talloc_memdup(mem_ctx, &rec->data[keys->keys[i].dsize], rec->datalen);
keys->data[i].dsize = rec->datalen;
if (keys->data[i].dsize < sizeof(struct ctdb_ltdb_header)) {
@@ -1333,7 +1334,7 @@ int ctdb_ctrl_createdb(struct ctdb_context *ctdb, struct timeval timeout, uint32
int32_t res;
TDB_DATA data;
- data.dptr = discard_const(name);
+ data.dptr = (unsigned char *)discard_const(name);
data.dsize = strlen(name)+1;
ret = ctdb_control(ctdb, destnode, 0,
@@ -1468,7 +1469,7 @@ struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, const char *name)
ctdb_db->db_name = talloc_strdup(ctdb_db, name);
CTDB_NO_MEMORY_NULL(ctdb, ctdb_db->db_name);
- data.dptr = discard_const(name);
+ data.dptr = (unsigned char *)discard_const(name);
data.dsize = strlen(name)+1;
/* tell ctdb daemon to attach */
@@ -1557,7 +1558,7 @@ static void traverse_handler(struct ctdb_context *ctdb, uint64_t srvid, TDB_DATA
if (data.dsize < sizeof(uint32_t) ||
d->length != data.dsize) {
DEBUG(0,("Bad data size %u in traverse_handler\n", (unsigned)data.dsize));
- state->done = True;
+ state->done = true;
return;
}
@@ -1568,12 +1569,12 @@ static void traverse_handler(struct ctdb_context *ctdb, uint64_t srvid, TDB_DATA
if (key.dsize == 0 && data.dsize == 0) {
/* end of traverse */
- state->done = True;
+ state->done = true;
return;
}
if (state->fn(ctdb, key, data, state->private_data) != 0) {
- state->done = True;
+ state->done = true;
}
state->count++;
@@ -1593,7 +1594,7 @@ int ctdb_traverse(struct ctdb_db_context *ctdb_db, ctdb_traverse_func fn, void *
uint64_t srvid = (getpid() | 0xFLL<<60);
struct traverse_state state;
- state.done = False;
+ state.done = false;
state.count = 0;
state.private_data = private_data;
state.fn = fn;
@@ -1929,7 +1930,7 @@ int ctdb_ctrl_get_tunable(struct ctdb_context *ctdb,
int ret;
data.dsize = offsetof(struct ctdb_control_get_tunable, name) + strlen(name) + 1;
- data.dptr = talloc_size(ctdb, data.dsize);
+ data.dptr = (unsigned char *)talloc_size(ctdb, data.dsize);
CTDB_NO_MEMORY(ctdb, data.dptr);
t = (struct ctdb_control_get_tunable *)data.dptr;
@@ -1970,7 +1971,7 @@ int ctdb_ctrl_set_tunable(struct ctdb_context *ctdb,
int ret;
data.dsize = offsetof(struct ctdb_control_set_tunable, name) + strlen(name) + 1;
- data.dptr = talloc_size(ctdb, data.dsize);
+ data.dptr = talloc_array(ctdb, unsigned char, data.dsize);
CTDB_NO_MEMORY(ctdb, data.dptr);
t = (struct ctdb_control_set_tunable *)data.dptr;
diff --git a/source4/cluster/ctdb/common/ctdb_io.c b/source4/cluster/ctdb/common/ctdb_io.c
index 3cc522b58a..ca9c635878 100644
--- a/source4/cluster/ctdb/common/ctdb_io.c
+++ b/source4/cluster/ctdb/common/ctdb_io.c
@@ -73,8 +73,9 @@ static void queue_io_read(struct ctdb_queue *queue)
}
- queue->partial.data = talloc_realloc_size(queue, queue->partial.data,
- num_ready + queue->partial.length);
+ queue->partial.data = talloc_realloc(queue, queue->partial.data,
+ uint8_t,
+ num_ready + queue->partial.length);
if (queue->partial.data == NULL) {
DEBUG(0,("read error alloc failed for %u\n",
@@ -114,7 +115,7 @@ static void queue_io_read(struct ctdb_queue *queue)
DEBUG(0,("Invalid packet of length 0\n"));
goto failed;
}
- d2 = talloc_memdup(queue, data, len);
+ d2 = (uint8_t *)talloc_memdup(queue, data, len);
if (d2 == NULL) {
DEBUG(0,("read error memdup failed for %u\n", len));
/* sigh */
@@ -131,7 +132,7 @@ static void queue_io_read(struct ctdb_queue *queue)
queue->partial.data = data;
queue->partial.length = nread;
} else {
- queue->partial.data = talloc_memdup(queue, data, nread);
+ queue->partial.data = (uint8_t *)talloc_memdup(queue, data, nread);
if (queue->partial.data == NULL) {
DEBUG(0,("read error memdup partial failed for %u\n",
(unsigned)nread));
@@ -265,7 +266,7 @@ int ctdb_queue_send(struct ctdb_queue *queue, uint8_t *data, uint32_t length)
pkt = talloc(queue, struct ctdb_queue_pkt);
CTDB_NO_MEMORY(queue->ctdb, pkt);
- pkt->data = talloc_memdup(pkt, data, length2);
+ pkt->data = (uint8_t *)talloc_memdup(pkt, data, length2);
CTDB_NO_MEMORY(queue->ctdb, pkt->data);
pkt->length = length2;
diff --git a/source4/cluster/ctdb/common/ctdb_ltdb.c b/source4/cluster/ctdb/common/ctdb_ltdb.c
index 7db1523ca1..8d8b4fd24a 100644
--- a/source4/cluster/ctdb/common/ctdb_ltdb.c
+++ b/source4/cluster/ctdb/common/ctdb_ltdb.c
@@ -106,7 +106,7 @@ int ctdb_ltdb_fetch(struct ctdb_db_context *ctdb_db,
if (data) {
data->dsize = rec.dsize - sizeof(struct ctdb_ltdb_header);
- data->dptr = talloc_memdup(mem_ctx,
+ data->dptr = (unsigned char *)talloc_memdup(mem_ctx,
sizeof(struct ctdb_ltdb_header)+rec.dptr,
data->dsize);
}
@@ -144,7 +144,7 @@ int ctdb_ltdb_store(struct ctdb_db_context *ctdb_db, TDB_DATA key,
}
rec.dsize = sizeof(*header) + data.dsize;
- rec.dptr = talloc_size(ctdb, rec.dsize);
+ rec.dptr = (unsigned char *)talloc_size(ctdb, rec.dsize);
CTDB_NO_MEMORY(ctdb, rec.dptr);
memcpy(rec.dptr, header, sizeof(*header));
diff --git a/source4/cluster/ctdb/common/ctdb_util.c b/source4/cluster/ctdb/common/ctdb_util.c
index 54b1e4e7ff..f11388331d 100644
--- a/source4/cluster/ctdb/common/ctdb_util.c
+++ b/source4/cluster/ctdb/common/ctdb_util.c
@@ -51,7 +51,7 @@ void ctdb_set_error(struct ctdb_context *ctdb, const char *fmt, ...)
/*
a fatal internal error occurred - no hope for recovery
*/
-void ctdb_fatal(struct ctdb_context *ctdb, const char *msg)
+_NORETURN_ void ctdb_fatal(struct ctdb_context *ctdb, const char *msg)
{
DEBUG(0,("ctdb fatal error: %s\n", msg));
abort();
diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c
index 8acb794251..d8860aabd0 100644
--- a/source4/cluster/ctdb/ctdb_cluster.c
+++ b/source4/cluster/ctdb/ctdb_cluster.c
@@ -28,6 +28,8 @@
#include "include/ctdb.h"
#include "db_wrap.h"
#include "lib/util/dlinklist.h"
+#include "param/param.h"
+#include "librpc/gen_ndr/misc.h"
/* a linked list of messaging handlers, allowing incoming messages
to be directed to the right messaging context */
@@ -52,7 +54,7 @@ struct cluster_state {
*/
static struct server_id ctdb_id(struct cluster_ops *ops, uint32_t id)
{
- struct cluster_state *state = ops->private;
+ struct cluster_state *state = (struct cluster_state *)ops->private;
struct ctdb_context *ctdb = state->ctdb;
struct server_id server_id;
server_id.node = ctdb_get_vnn(ctdb);
@@ -80,7 +82,7 @@ static struct tdb_wrap *ctdb_tdb_tmp_open(struct cluster_ops *ops,
TALLOC_CTX *mem_ctx, const char *dbname,
int flags)
{
- const char *dir = lp_parm_string(-1, "ctdb", "shared data");
+ const char *dir = lp_parm_string(global_loadparm, NULL, "ctdb", "shared data");
char *path;
struct tdb_wrap *w;
if (dir == NULL) {
@@ -100,7 +102,7 @@ static struct tdb_wrap *ctdb_tdb_tmp_open(struct cluster_ops *ops,
*/
static void *ctdb_backend_handle(struct cluster_ops *ops)
{
- struct cluster_state *state = ops->private;
+ struct cluster_state *state = (struct cluster_state *)ops->private;
return (void *)state->ctdb;
}
@@ -138,7 +140,7 @@ static NTSTATUS ctdb_message_init(struct cluster_ops *ops,
struct server_id server,
cluster_message_fn_t handler)
{
- struct cluster_state *state = ops->private;
+ struct cluster_state *state = (struct cluster_state *)ops->private;
struct ctdb_handler_state *h;
int ret;
@@ -169,7 +171,7 @@ static NTSTATUS ctdb_message_init(struct cluster_ops *ops,
static NTSTATUS ctdb_message_send(struct cluster_ops *ops,
struct server_id server, DATA_BLOB *data)
{
- struct cluster_state *state = ops->private;
+ struct cluster_state *state = (struct cluster_state *)ops->private;
struct ctdb_context *ctdb = state->ctdb;
TDB_DATA tdata;
int ret;
@@ -200,7 +202,7 @@ void cluster_ctdb_init(struct event_context *ev, const char *model)
struct cluster_state *state;
int ret;
- if (!lp_parm_bool(-1, "ctdb", "enable", False)) {
+ if (!lp_parm_bool(global_loadparm, NULL, "ctdb", "enable", false)) {
return;
}
diff --git a/source4/cluster/ctdb/opendb_ctdb.c b/source4/cluster/ctdb/opendb_ctdb.c
index f894af839e..7753992df8 100644
--- a/source4/cluster/ctdb/opendb_ctdb.c
+++ b/source4/cluster/ctdb/opendb_ctdb.c
@@ -49,12 +49,13 @@
#include "ntvfs/common/ntvfs_common.h"
#include "cluster/cluster.h"
#include "include/ctdb.h"
+#include "param/param.h"
struct odb_context {
struct ctdb_context *ctdb;
struct ctdb_db_context *ctdb_db;
struct ntvfs_context *ntvfs_ctx;
- BOOL oplocks;
+ bool oplocks;
};
/*
@@ -96,7 +97,7 @@ static struct odb_context *odb_ctdb_init(TALLOC_CTX *mem_ctx,
odb->ntvfs_ctx = ntvfs_ctx;
/* leave oplocks disabled by default until the code is working */
- odb->oplocks = lp_parm_bool(-1, "opendb", "oplocks", False);
+ odb->oplocks = lp_parm_bool(global_loadparm, NULL, "opendb", "oplocks", false);
return odb;
}
@@ -263,7 +264,7 @@ static NTSTATUS odb_oplock_break_send(struct odb_context *odb, struct opendb_ent
*/
static NTSTATUS odb_ctdb_open_file(struct odb_lock *lck, void *file_handle,
uint32_t stream_id, uint32_t share_access,
- uint32_t access_mask, BOOL delete_on_close,
+ uint32_t access_mask, bool delete_on_close,
const char *path,
uint32_t oplock_level, uint32_t *oplock_granted)
{
@@ -273,7 +274,7 @@ static NTSTATUS odb_ctdb_open_file(struct odb_lock *lck, void *file_handle,
struct opendb_file file;
NTSTATUS status;
- if (odb->oplocks == False) {
+ if (odb->oplocks == false) {
oplock_level = OPLOCK_NONE;
}
@@ -404,7 +405,7 @@ static NTSTATUS odb_ctdb_close_file(struct odb_lock *lck, void *file_handle)
if (file_handle == file.entries[i].file_handle &&
cluster_id_equal(&odb->ntvfs_ctx->server_id, &file.entries[i].server)) {
if (file.entries[i].delete_on_close) {
- file.delete_on_close = True;
+ file.delete_on_close = true;
}
if (i < file.num_entries-1) {
memmove(file.entries+i, file.entries+i+1,
@@ -491,7 +492,7 @@ static NTSTATUS odb_ctdb_rename(struct odb_lock *lck, const char *path)
/*
update delete on close flag on an open file
*/
-static NTSTATUS odb_ctdb_set_delete_on_close(struct odb_lock *lck, BOOL del_on_close)
+static NTSTATUS odb_ctdb_set_delete_on_close(struct odb_lock *lck, bool del_on_close)
{
NTSTATUS status;
struct opendb_file file;
@@ -509,7 +510,7 @@ static NTSTATUS odb_ctdb_set_delete_on_close(struct odb_lock *lck, BOOL del_on_c
people still have the file open
*/
static NTSTATUS odb_ctdb_get_delete_on_close(struct odb_context *odb,
- DATA_BLOB *key, BOOL *del_on_close,
+ DATA_BLOB *key, bool *del_on_close,
int *open_count, char **path)
{
NTSTATUS status;
@@ -522,7 +523,7 @@ static NTSTATUS odb_ctdb_get_delete_on_close(struct odb_context *odb,
status = odb_pull_record(lck, &file);
if (NT_STATUS_EQUAL(NT_STATUS_OBJECT_NAME_NOT_FOUND, status)) {
talloc_free(lck);
- (*del_on_close) = False;
+ (*del_on_close) = false;
return NT_STATUS_OK;
}
if (!NT_STATUS_IS_OK(status)) {
@@ -538,7 +539,7 @@ static NTSTATUS odb_ctdb_get_delete_on_close(struct odb_context *odb,
*path = talloc_strdup(odb, file.path);
NT_STATUS_HAVE_NO_MEMORY(*path);
if (file.num_entries == 1 && file.entries[0].delete_on_close) {
- (*del_on_close) = True;
+ (*del_on_close) = true;
}
}