summaryrefslogtreecommitdiff
path: root/source3/torture/vfstest.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2007-12-18 09:41:03 +0100
committerVolker Lendecke <vl@samba.org>2007-12-18 09:56:04 +0100
commitf427d4ce65659419c8989d87acd97d00b4db41e6 (patch)
tree382dce7bf0150c284b84d822e3d1c8c037fb0281 /source3/torture/vfstest.c
parent68e65b29815f1f9bbe7384e07fc341f6c8f2f605 (diff)
downloadsamba-f427d4ce65659419c8989d87acd97d00b4db41e6.tar.gz
samba-f427d4ce65659419c8989d87acd97d00b4db41e6.tar.bz2
samba-f427d4ce65659419c8989d87acd97d00b4db41e6.zip
Add a in-memory cache
This is a more general API that caches data with a LRU scheme. See include/cache.h. No comments yet, I'm still working on it. But Jeremy has given me a hint in one of his checkins that he would like to make use of this now. The idea is that we get rid of all our silly little caches and merge them all into one cache that we can then very easily trim, for example even with a smbcontrol message if someone decides memory is tight. The main user is the stat cache, this patch also converts the getwd cache. More caches to come. (This used to be commit 7a911b35713538d82001a3c9f34152e293fe1943)
Diffstat (limited to 'source3/torture/vfstest.c')
-rw-r--r--source3/torture/vfstest.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source3/torture/vfstest.c b/source3/torture/vfstest.c
index 1436ecc022..7e4ee624a1 100644
--- a/source3/torture/vfstest.c
+++ b/source3/torture/vfstest.c
@@ -495,6 +495,19 @@ struct messaging_context *smbd_messaging_context(void)
return ctx;
}
+struct memcache *smbd_memcache(void)
+{
+ static struct memcache *cache;
+
+ if (!cache
+ && !(cache = memcache_init(NULL,
+ lp_max_stat_cache_size()*1024))) {
+
+ smb_panic("Could not init smbd memcache");
+ }
+ return cache;
+}
+
/* Main function */
int main(int argc, char *argv[])