notify->messaging_ctx = messaging_ctx;
notify->list = NULL;
notify->array = NULL;
- notify->seqnum = notify->db_recursive->get_seqnum(
- notify->db_recursive);
+ notify->seqnum = dbwrap_get_seqnum(notify->db_recursive);
notify->key = string_term_tdb_data(NOTIFY_KEY);
talloc_set_destructor(notify, notify_destructor);
*/
static NTSTATUS notify_fetch_locked(struct notify_context *notify, struct db_record **rec)
{
- *rec = notify->db_recursive->fetch_locked(notify->db_recursive,
- notify, notify->key);
+ *rec = dbwrap_fetch_locked(notify->db_recursive, notify, notify->key);
if (*rec == NULL) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
NTSTATUS status;
int seqnum;
- seqnum = notify->db_recursive->get_seqnum(notify->db_recursive);
+ seqnum = dbwrap_get_seqnum(notify->db_recursive);
if (seqnum == notify->seqnum && notify->array != NULL) {
return NT_STATUS_OK;
NT_STATUS_HAVE_NO_MEMORY(notify->array);
if (!rec) {
- if (notify->db_recursive->fetch(notify->db_recursive, notify,
- notify->key, &dbuf) != 0) {
+ status = dbwrap_fetch(notify->db_recursive, notify,
+ notify->key, &dbuf);
+ if (!NT_STATUS_IS_OK(status)) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
} else {
- dbuf = rec->value;
+ dbuf = dbwrap_record_get_value(rec);
}
blob.data = (uint8 *)dbuf.dptr;
ZERO_STRUCTP(notify->array);
if (rec != NULL) {
- rec->delete_rec(rec);
+ dbwrap_record_delete(rec);
}
} else {
/* we might just be able to delete the record */
if (notify->array->num_depths == 0) {
- return rec->delete_rec(rec);
+ return dbwrap_record_delete(rec);
}
tmp_ctx = talloc_new(notify);
dbuf.dptr = blob.data;
dbuf.dsize = blob.length;
- status = rec->store(rec, dbuf, TDB_REPLACE);
+ status = dbwrap_record_store(rec, dbuf, TDB_REPLACE);
talloc_free(tmp_ctx);
return status;
struct db_record *rec;
DATA_BLOB blob;
TDB_DATA dbuf;
+ TDB_DATA value;
enum ndr_err_code ndr_err;
NTSTATUS status;
return;
}
- rec = notify->db_onelevel->fetch_locked(
- notify->db_onelevel, talloc_tos(),
- make_tdb_data((uint8_t *)&e->dir_id, sizeof(e->dir_id)));
+ rec = dbwrap_fetch_locked(notify->db_onelevel, talloc_tos(),
+ make_tdb_data((uint8_t *)&e->dir_id,
+ sizeof(e->dir_id)));
if (rec == NULL) {
DEBUG(10, ("notify_add_onelevel: fetch_locked for %s failed"
"\n", file_id_string_tos(&e->dir_id)));
return;
}
- blob.data = (uint8_t *)rec->value.dptr;
- blob.length = rec->value.dsize;
+ value = dbwrap_record_get_value(rec);
+ blob.data = (uint8_t *)value.dptr;
+ blob.length = value.dsize;
if (blob.length > 0) {
ndr_err = ndr_pull_struct_blob(&blob, array, array,
dbuf.dptr = blob.data;
dbuf.dsize = blob.length;
- status = rec->store(rec, dbuf, TDB_REPLACE);
+ status = dbwrap_record_store(rec, dbuf, TDB_REPLACE);
TALLOC_FREE(array);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(10, ("notify_add_onelevel: store failed: %s\n",
struct db_record *rec;
DATA_BLOB blob;
TDB_DATA dbuf;
+ TDB_DATA value;
enum ndr_err_code ndr_err;
NTSTATUS status;
int i;
return NT_STATUS_NO_MEMORY;
}
- rec = notify->db_onelevel->fetch_locked(
+ rec = dbwrap_fetch_locked(
notify->db_onelevel, array,
make_tdb_data((const uint8_t *)fid, sizeof(*fid)));
if (rec == NULL) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
- blob.data = (uint8_t *)rec->value.dptr;
- blob.length = rec->value.dsize;
+ value = dbwrap_record_get_value(rec);
+ blob.data = (uint8_t *)value.dptr;
+ blob.length = value.dsize;
if (blob.length > 0) {
ndr_err = ndr_pull_struct_blob(&blob, array, array,
array->num_entries -= 1;
if (array->num_entries == 0) {
- rec->delete_rec(rec);
+ dbwrap_record_delete(rec);
TALLOC_FREE(array);
return NT_STATUS_OK;
}
dbuf.dptr = blob.data;
dbuf.dsize = blob.length;
- status = rec->store(rec, dbuf, TDB_REPLACE);
+ status = dbwrap_record_store(rec, dbuf, TDB_REPLACE);
TALLOC_FREE(array);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(10, ("notify_add_onelevel: store failed: %s\n",
DATA_BLOB blob;
bool have_dead_entries = false;
int i;
+ NTSTATUS status;
if (notify == NULL) {
return;
return;
}
- if (notify->db_onelevel->fetch(
- notify->db_onelevel, array,
- make_tdb_data((uint8_t *)&fid, sizeof(fid)),
- &dbuf) != 0) {
+ status = dbwrap_fetch(notify->db_onelevel, array,
+ make_tdb_data((uint8_t *)&fid, sizeof(fid)),
+ &dbuf);
+ if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(array);
return;
}
struct notify_entry *e = &array->entries[i];
if ((e->filter & filter) != 0) {
- NTSTATUS status;
-
status = notify_send(notify, e, name, action);
if (NT_STATUS_EQUAL(
status, NT_STATUS_INVALID_HANDLE)) {