summaryrefslogtreecommitdiff
path: root/lib/ntdb/ntdb.h
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2012-06-22 09:44:41 +0930
committerRusty Russell <rusty@rustcorp.com.au>2012-06-22 07:35:17 +0200
commit01ec4a72de56ade54bbbc92e0a408771390c5c12 (patch)
tree1ee7082cac28cee704ebc0eb6e76d372baa31405 /lib/ntdb/ntdb.h
parentbd5c061932d9aaf2e66cd56a39743c9ff34c3a88 (diff)
downloadsamba-01ec4a72de56ade54bbbc92e0a408771390c5c12.tar.gz
samba-01ec4a72de56ade54bbbc92e0a408771390c5c12.tar.bz2
samba-01ec4a72de56ade54bbbc92e0a408771390c5c12.zip
ntdb: make database read-only during ntdb_parse() callback.
Since we have a readlock, any write will grab a write lock: if it happens to be on the same bucket, we'll fail. For that reason, enforce read-only so every write operation fails (even for NTDB_NOLOCK or NTDB_INTERNAL dbs), and document it! Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib/ntdb/ntdb.h')
-rw-r--r--lib/ntdb/ntdb.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/ntdb/ntdb.h b/lib/ntdb/ntdb.h
index 8e8458e4d1..df3a9ddc4e 100644
--- a/lib/ntdb/ntdb.h
+++ b/lib/ntdb/ntdb.h
@@ -368,9 +368,14 @@ int64_t ntdb_traverse_(struct ntdb_context *ntdb,
*
* This avoids a copy for many cases, by handing you a pointer into
* the memory-mapped database. It also locks the record to prevent
- * other accesses at the same time.
+ * other accesses at the same time, so it won't change.
*
- * Do not alter the data handed to parse()!
+ * Within the @parse callback you can perform read operations on the
+ * database, but no write operations: no ntdb_store() or
+ * ntdb_delete(), for example. The exception is if you call
+ * ntdb_lockall() before ntdb_parse_record().
+ *
+ * Never alter the data handed to parse()!
*/
#define ntdb_parse_record(ntdb, key, parse, data) \
ntdb_parse_record_((ntdb), (key), \