summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-10-12 23:01:08 +1100
committerAndrew Bartlett <abartlet@samba.org>2011-10-13 14:06:07 +0200
commit01c934c81e55b79601122d8e0740c7946077c37e (patch)
treef6e7909690bc399c3036ef80e22997aadbf88884 /source4
parent3cdb1fe4404e26ae383cfb73bfa8af36cb1d7f7c (diff)
downloadsamba-01c934c81e55b79601122d8e0740c7946077c37e.tar.gz
samba-01c934c81e55b79601122d8e0740c7946077c37e.tar.bz2
samba-01c934c81e55b79601122d8e0740c7946077c37e.zip
lib/util: Add back control of mmap and hash size in tdb for top level build
This passes down a struct loadparm_context to allow these parameters to be checked. This may be s3 or s4 context, allowing the #if _SAMBA_BUILD_ macro to go away safely. Andrew Bartlett
Diffstat (limited to 'source4')
-rw-r--r--source4/cluster/local.c2
-rw-r--r--source4/lib/messaging/messaging.c9
-rw-r--r--source4/ntvfs/posix/python/pyxattr_tdb.c6
-rw-r--r--source4/ntvfs/posix/vfs_posix.c3
-rw-r--r--source4/param/secrets.c2
-rw-r--r--source4/torture/local/dbspeed.c2
6 files changed, 17 insertions, 7 deletions
diff --git a/source4/cluster/local.c b/source4/cluster/local.c
index 0a294b4d1d..c62c5cf405 100644
--- a/source4/cluster/local.c
+++ b/source4/cluster/local.c
@@ -53,7 +53,7 @@ static struct tdb_wrap *local_tdb_tmp_open(struct cluster_ops *ops,
char *path = smbd_tmp_path(mem_ctx, lp_ctx, dbname);
struct tdb_wrap *w;
w = tdb_wrap_open(mem_ctx, path, 0, flags,
- O_RDWR|O_CREAT, 0600);
+ O_RDWR|O_CREAT, 0600, lp_ctx);
talloc_free(path);
return w;
}
diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c
index 51fc8e26ed..21ff1b456a 100644
--- a/source4/lib/messaging/messaging.c
+++ b/source4/lib/messaging/messaging.c
@@ -56,6 +56,7 @@ struct imessaging_context {
struct socket_context *sock;
const char *base_path;
const char *path;
+ struct loadparm_context *lp_ctx;
struct dispatch_fn **dispatch;
uint32_t num_types;
struct idr_context *dispatch_tree;
@@ -594,6 +595,12 @@ struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx,
/* create the messaging directory if needed */
+ msg->lp_ctx = talloc_reference(msg, lp_ctx);
+ if (!msg->lp_ctx) {
+ talloc_free(msg);
+ return NULL;
+ }
+
msg->base_path = lpcfg_imessaging_path(msg, lp_ctx);
mkdir(msg->base_path, 0700);
@@ -881,7 +888,7 @@ static struct tdb_wrap *irpc_namedb_open(struct imessaging_context *msg_ctx)
if (path == NULL) {
return NULL;
}
- t = tdb_wrap_open(msg_ctx, path, 0, 0, O_RDWR|O_CREAT, 0660);
+ t = tdb_wrap_open(msg_ctx, path, 0, 0, O_RDWR|O_CREAT, 0660, msg_ctx->lp_ctx);
talloc_free(path);
return t;
}
diff --git a/source4/ntvfs/posix/python/pyxattr_tdb.c b/source4/ntvfs/posix/python/pyxattr_tdb.c
index 768dcbcafd..7e59b54ee2 100644
--- a/source4/ntvfs/posix/python/pyxattr_tdb.c
+++ b/source4/ntvfs/posix/python/pyxattr_tdb.c
@@ -26,6 +26,7 @@
#include "lib/util/wrap_xattr.h"
#include "ntvfs/posix/vfs_posix.h"
#include "libcli/util/pyerrors.h"
+#include "param/pyparam.h"
void initxattr_tdb(void);
@@ -50,7 +51,8 @@ static PyObject *py_wrap_setxattr(PyObject *self, PyObject *args)
blob.length = blobsize;
mem_ctx = talloc_new(NULL);
eadb = tdb_wrap_open(mem_ctx, tdbname, 50000,
- TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
+ TDB_DEFAULT, O_RDWR|O_CREAT, 0600,
+ py_default_loadparm_context(mem_ctx));
if (eadb == NULL) {
PyErr_SetFromErrno(PyExc_IOError);
@@ -82,7 +84,7 @@ static PyObject *py_wrap_getxattr(PyObject *self, PyObject *args)
mem_ctx = talloc_new(NULL);
eadb = tdb_wrap_open(mem_ctx, tdbname, 50000,
- TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
+ TDB_DEFAULT, O_RDWR|O_CREAT, 0600, py_default_loadparm_context(mem_ctx));
if (eadb == NULL) {
PyErr_SetFromErrno(PyExc_IOError);
talloc_free(mem_ctx);
diff --git a/source4/ntvfs/posix/vfs_posix.c b/source4/ntvfs/posix/vfs_posix.c
index 00ed146c96..cecaee00cc 100644
--- a/source4/ntvfs/posix/vfs_posix.c
+++ b/source4/ntvfs/posix/vfs_posix.c
@@ -120,7 +120,8 @@ static void pvfs_setup_options(struct pvfs_state *pvfs)
eadb = share_string_option(scfg, PVFS_EADB, NULL);
if (eadb != NULL) {
pvfs->ea_db = tdb_wrap_open(pvfs, eadb, 50000,
- TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
+ TDB_DEFAULT, O_RDWR|O_CREAT, 0600,
+ pvfs->ntvfs->ctx->lp_ctx);
if (pvfs->ea_db != NULL) {
pvfs->flags |= PVFS_FLAG_XATTR_ENABLE;
} else {
diff --git a/source4/param/secrets.c b/source4/param/secrets.c
index 55d1aa779b..32a97453d4 100644
--- a/source4/param/secrets.c
+++ b/source4/param/secrets.c
@@ -59,7 +59,7 @@ bool randseed_init(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
fname = lpcfg_private_path(mem_ctx, lp_ctx, "randseed.tdb");
- tdb = tdb_wrap_open(mem_ctx, fname, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
+ tdb = tdb_wrap_open(mem_ctx, fname, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600, lp_ctx);
if (!tdb) {
DEBUG(0,("Failed to open %s\n", fname));
diff --git a/source4/torture/local/dbspeed.c b/source4/torture/local/dbspeed.c
index 614a9b52ae..60721cc2c0 100644
--- a/source4/torture/local/dbspeed.c
+++ b/source4/torture/local/dbspeed.c
@@ -65,7 +65,7 @@ static bool test_tdb_speed(struct torture_context *torture, const void *_data)
torture_comment(torture, "Testing tdb speed for sidmap\n");
tdbw = tdb_wrap_open(tmp_ctx, "test.tdb",
- 10000, 0, O_RDWR|O_CREAT|O_TRUNC, 0600);
+ 10000, 0, O_RDWR|O_CREAT|O_TRUNC, 0600, torture->lp_ctx);
if (!tdbw) {
torture_result(torture, TORTURE_FAIL, "Failed to open test.tdb");
goto failed;