mirror of
https://github.com/samba-team/samba.git
synced 2025-01-13 13:18:06 +03:00
r22041: merge trivial changes from samba3
metze
This commit is contained in:
parent
1d4e836a50
commit
902a76ca70
@ -39,7 +39,7 @@ static int seen_insert(struct tdb_context *mem_tdb, tdb_off_t rec_ptr)
|
||||
TDB_DATA key, data;
|
||||
|
||||
memset(&data, '\0', sizeof(data));
|
||||
key.dptr = (char *)&rec_ptr;
|
||||
key.dptr = (unsigned char *)&rec_ptr;
|
||||
key.dsize = sizeof(rec_ptr);
|
||||
return tdb_store(mem_tdb, key, data, TDB_INSERT);
|
||||
}
|
||||
|
@ -124,8 +124,10 @@ static int tdb_read(struct tdb_context *tdb, tdb_off_t off, void *buf,
|
||||
if (ret != (ssize_t)len) {
|
||||
/* Ensure ecode is set for log fn. */
|
||||
tdb->ecode = TDB_ERR_IO;
|
||||
TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_read failed at %d len=%d ret=%d (%s) map_size=%d\n",
|
||||
off, len, ret, strerror(errno), (int)tdb->map_size));
|
||||
TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_read failed at %d "
|
||||
"len=%d ret=%d (%s) map_size=%d\n",
|
||||
(int)off, (int)len, (int)ret, strerror(errno),
|
||||
(int)tdb->map_size));
|
||||
return TDB_ERRCODE(TDB_ERR_IO, -1);
|
||||
}
|
||||
}
|
||||
@ -339,7 +341,7 @@ unsigned char *tdb_alloc_read(struct tdb_context *tdb, tdb_off_t offset, tdb_len
|
||||
len = 1;
|
||||
}
|
||||
|
||||
if (!(buf = malloc(len))) {
|
||||
if (!(buf = (unsigned char *)malloc(len))) {
|
||||
/* Ensure ecode is set for log fn. */
|
||||
tdb->ecode = TDB_ERR_OOM;
|
||||
TDB_LOG((tdb, TDB_DEBUG_ERROR,"tdb_alloc_read malloc failed len=%d (%s)\n",
|
||||
|
@ -372,9 +372,9 @@ int tdb_close(struct tdb_context *tdb)
|
||||
|
||||
/* register a loging function */
|
||||
void tdb_set_logging_function(struct tdb_context *tdb,
|
||||
const struct tdb_logging_context *log)
|
||||
const struct tdb_logging_context *log_ctx)
|
||||
{
|
||||
tdb->log = *log;
|
||||
tdb->log = *log_ctx;
|
||||
}
|
||||
|
||||
void *tdb_get_logging_private(struct tdb_context *tdb)
|
||||
|
@ -564,9 +564,10 @@ int tdb_append(struct tdb_context *tdb, TDB_DATA key, TDB_DATA new_dbuf)
|
||||
dbuf = tdb_fetch(tdb, key);
|
||||
|
||||
if (dbuf.dptr == NULL) {
|
||||
dbuf.dptr = malloc(new_dbuf.dsize);
|
||||
dbuf.dptr = (unsigned char *)malloc(new_dbuf.dsize);
|
||||
} else {
|
||||
dbuf.dptr = realloc(dbuf.dptr, dbuf.dsize + new_dbuf.dsize);
|
||||
dbuf.dptr = (unsigned char *)realloc(dbuf.dptr,
|
||||
dbuf.dsize + new_dbuf.dsize);
|
||||
}
|
||||
|
||||
if (dbuf.dptr == NULL) {
|
||||
|
@ -39,7 +39,7 @@
|
||||
by the header. This removes the need for extra journal files as
|
||||
used by some other databases
|
||||
|
||||
- dymacially allocated the transaction recover record, re-using it
|
||||
- dynamically allocated the transaction recover record, re-using it
|
||||
for subsequent transactions. If a larger record is needed then
|
||||
tdb_free() the old record to place it on the normal tdb freelist
|
||||
before allocating the new record
|
||||
@ -88,6 +88,12 @@
|
||||
|
||||
*/
|
||||
|
||||
struct tdb_transaction_el {
|
||||
struct tdb_transaction_el *next, *prev;
|
||||
tdb_off_t offset;
|
||||
tdb_len_t length;
|
||||
unsigned char *data;
|
||||
};
|
||||
|
||||
/*
|
||||
hold the context of any current transaction
|
||||
@ -105,12 +111,7 @@ struct tdb_transaction {
|
||||
ordered, with first element at the front of the list. It
|
||||
needs to be doubly linked as the read/write traversals need
|
||||
to be backwards, while the commit needs to be forwards */
|
||||
struct tdb_transaction_el {
|
||||
struct tdb_transaction_el *next, *prev;
|
||||
tdb_off_t offset;
|
||||
tdb_len_t length;
|
||||
unsigned char *data;
|
||||
} *elements, *elements_last;
|
||||
struct tdb_transaction_el *elements, *elements_last;
|
||||
|
||||
/* non-zero when an internal transaction error has
|
||||
occurred. All write operations will then fail until the
|
||||
|
@ -98,7 +98,7 @@ void tdb_set_max_dead(struct tdb_context *tdb, int max_dead);
|
||||
|
||||
int tdb_reopen(struct tdb_context *tdb);
|
||||
int tdb_reopen_all(int parent_longlived);
|
||||
void tdb_set_logging_function(struct tdb_context *tdb, const struct tdb_logging_context *log);
|
||||
void tdb_set_logging_function(struct tdb_context *tdb, const struct tdb_logging_context *log_ctx);
|
||||
enum TDB_ERROR tdb_error(struct tdb_context *tdb);
|
||||
const char *tdb_errorstr(struct tdb_context *tdb);
|
||||
TDB_DATA tdb_fetch(struct tdb_context *tdb, TDB_DATA key);
|
||||
|
Loading…
Reference in New Issue
Block a user