two patches to dbwrap_ctdb
Volker Lendecke
Volker.Lendecke at SerNet.DE
Wed Nov 7 08:30:11 MST 2012
Hi, Michael!
Two simple patches to dbwrap_ctdb. Please push if you agree.
Thanks,
Volker
--
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
-------------- next part --------------
From 6a223afa5b8c4dedf265aab3677e34c161385a86 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Wed, 7 Nov 2012 16:22:07 +0100
Subject: [PATCH 1/2] s3: Fix some blank line endings
---
source3/lib/dbwrap/dbwrap_ctdb.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c
index 6b599c5..f124b73 100644
--- a/source3/lib/dbwrap/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap/dbwrap_ctdb.c
@@ -1,4 +1,4 @@
-/*
+/*
Unix SMB/CIFS implementation.
Database interface wrapper around ctdbd
Copyright (C) Volker Lendecke 2007-2009
@@ -181,15 +181,15 @@ static NTSTATUS db_ctdb_ltdb_store(struct db_ctdb_ctx *db,
note that header may be NULL. If not NULL then it is included in the data portion
of the record
*/
-static struct ctdb_rec_data *db_ctdb_marshall_record(TALLOC_CTX *mem_ctx, uint32_t reqid,
- TDB_DATA key,
+static struct ctdb_rec_data *db_ctdb_marshall_record(TALLOC_CTX *mem_ctx, uint32_t reqid,
+ TDB_DATA key,
struct ctdb_ltdb_header *header,
TDB_DATA data)
{
size_t length;
struct ctdb_rec_data *d;
- length = offsetof(struct ctdb_rec_data, data) + key.dsize +
+ length = offsetof(struct ctdb_rec_data, data) + key.dsize +
data.dsize + (header?sizeof(*header):0);
d = (struct ctdb_rec_data *)talloc_size(mem_ctx, length);
if (d == NULL) {
@@ -212,7 +212,7 @@ static struct ctdb_rec_data *db_ctdb_marshall_record(TALLOC_CTX *mem_ctx, uint32
/* helper function for marshalling multiple records */
-static struct ctdb_marshall_buffer *db_ctdb_marshall_add(TALLOC_CTX *mem_ctx,
+static struct ctdb_marshall_buffer *db_ctdb_marshall_add(TALLOC_CTX *mem_ctx,
struct ctdb_marshall_buffer *m,
uint64_t db_id,
uint32_t reqid,
@@ -267,8 +267,8 @@ static TDB_DATA db_ctdb_marshall_finish(struct ctdb_marshall_buffer *m)
return data;
}
-/*
- loop over a marshalling buffer
+/*
+ loop over a marshalling buffer
- pass r==NULL to start
- loop the number of times indicated by m->count
@@ -353,7 +353,7 @@ static int db_ctdb_transaction_start(struct db_context *db)
h = talloc_zero(db, struct db_ctdb_transaction_handle);
if (h == NULL) {
- DEBUG(0,(__location__ " oom for transaction handle\n"));
+ DEBUG(0,(__location__ " oom for transaction handle\n"));
return -1;
}
@@ -592,7 +592,7 @@ static struct db_record *db_ctdb_fetch_locked_persistent(struct db_ctdb_ctx *ctx
rec = db_ctdb_fetch_locked_transaction(ctx, mem_ctx, key);
if (rec == NULL) {
- ctx->db->transaction_cancel(ctx->db);
+ ctx->db->transaction_cancel(ctx->db);
return NULL;
}
@@ -677,7 +677,7 @@ static NTSTATUS db_ctdb_store_transaction(struct db_record *rec, TDB_DATA data,
return status;
}
-/*
+/*
a record delete inside a transaction
*/
static NTSTATUS db_ctdb_delete_transaction(struct db_record *rec)
--
1.7.9.5
From bea4e54020e6bf8d6542a19c1bf5d04fd7c29955 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Wed, 7 Nov 2012 16:25:31 +0100
Subject: [PATCH 2/2] s3: Remove header==NULL code from
db_ctdb_marshall_record
The only call chain (via db_ctdb_marshall_add) has header != NULL
---
source3/lib/dbwrap/dbwrap_ctdb.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c
index f124b73..6377ea9 100644
--- a/source3/lib/dbwrap/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap/dbwrap_ctdb.c
@@ -177,9 +177,6 @@ static NTSTATUS db_ctdb_ltdb_store(struct db_ctdb_ctx *db,
/*
form a ctdb_rec_data record from a key/data pair
-
- note that header may be NULL. If not NULL then it is included in the data portion
- of the record
*/
static struct ctdb_rec_data *db_ctdb_marshall_record(TALLOC_CTX *mem_ctx, uint32_t reqid,
TDB_DATA key,
@@ -190,7 +187,7 @@ static struct ctdb_rec_data *db_ctdb_marshall_record(TALLOC_CTX *mem_ctx, uint32
struct ctdb_rec_data *d;
length = offsetof(struct ctdb_rec_data, data) + key.dsize +
- data.dsize + (header?sizeof(*header):0);
+ data.dsize + sizeof(*header);
d = (struct ctdb_rec_data *)talloc_size(mem_ctx, length);
if (d == NULL) {
return NULL;
@@ -199,14 +196,10 @@ static struct ctdb_rec_data *db_ctdb_marshall_record(TALLOC_CTX *mem_ctx, uint32
d->reqid = reqid;
d->keylen = key.dsize;
memcpy(&d->data[0], key.dptr, key.dsize);
- if (header) {
- d->datalen = data.dsize + sizeof(*header);
- memcpy(&d->data[key.dsize], header, sizeof(*header));
- memcpy(&d->data[key.dsize+sizeof(*header)], data.dptr, data.dsize);
- } else {
- d->datalen = data.dsize;
- memcpy(&d->data[key.dsize], data.dptr, data.dsize);
- }
+
+ d->datalen = data.dsize + sizeof(*header);
+ memcpy(&d->data[key.dsize], header, sizeof(*header));
+ memcpy(&d->data[key.dsize+sizeof(*header)], data.dptr, data.dsize);
return d;
}
--
1.7.9.5
More information about the samba-technical
mailing list