[dovecot-cvs] dovecot/src/lib mempool-alloconly.c, 1.29, 1.30 mempool-datastack.c, 1.10, 1.11 mempool-system.c, 1.16, 1.17 mempool-unsafe-datastack.c, 1.1, 1.2 mempool.h, 1.15, 1.16

cras at dovecot.org cras at dovecot.org
Sun Mar 27 16:29:32 EEST 2005


Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv17762

Modified Files:
	mempool-alloconly.c mempool-datastack.c mempool-system.c 
	mempool-unsafe-datastack.c mempool.h 
Log Message:
Added p_get_max_easy_alloc_size().



Index: mempool-alloconly.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/mempool-alloconly.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- mempool-alloconly.c	12 Mar 2005 23:10:33 -0000	1.29
+++ mempool-alloconly.c	27 Mar 2005 13:29:30 -0000	1.30
@@ -47,6 +47,7 @@
 static void *pool_alloconly_realloc(pool_t pool, void *mem,
 				    size_t old_size, size_t new_size);
 static void pool_alloconly_clear(pool_t pool);
+static size_t pool_alloconly_get_max_easy_alloc_size(pool_t pool);
 
 static void block_alloc(struct alloconly_pool *pool, size_t size);
 
@@ -62,6 +63,7 @@
 	pool_alloconly_realloc,
 
 	pool_alloconly_clear,
+	pool_alloconly_get_max_easy_alloc_size,
 
 	TRUE,
 	FALSE
@@ -271,3 +273,10 @@
 	apool->block->left = apool->block->size;
 	apool->block->last_alloc_size = 0;
 }
+
+static size_t pool_alloconly_get_max_easy_alloc_size(pool_t pool)
+{
+	struct alloconly_pool *apool = (struct alloconly_pool *) pool;
+
+	return apool->block->left;
+}

Index: mempool-datastack.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/mempool-datastack.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- mempool-datastack.c	21 Sep 2003 16:21:37 -0000	1.10
+++ mempool-datastack.c	27 Mar 2005 13:29:30 -0000	1.11
@@ -13,6 +13,7 @@
 static void *pool_data_stack_realloc(pool_t pool, void *mem,
 				     size_t old_size, size_t new_size);
 static void pool_data_stack_clear(pool_t pool);
+static size_t pool_data_stack_get_max_easy_alloc_size(pool_t pool);
 
 static struct pool static_data_stack_pool = {
 	pool_data_stack_get_name,
@@ -26,6 +27,7 @@
 	pool_data_stack_realloc,
 
 	pool_data_stack_clear,
+	pool_data_stack_get_max_easy_alloc_size,
 
 	TRUE,
 	TRUE
@@ -128,3 +130,9 @@
 static void pool_data_stack_clear(pool_t pool __attr_unused__)
 {
 }
+
+static size_t
+pool_data_stack_get_max_easy_alloc_size(pool_t pool __attr_unused__)
+{
+	return t_get_bytes_available();
+}

Index: mempool-system.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/mempool-system.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- mempool-system.c	12 Mar 2005 23:10:33 -0000	1.16
+++ mempool-system.c	27 Mar 2005 13:29:30 -0000	1.17
@@ -21,6 +21,7 @@
 static void *pool_system_realloc(pool_t pool, void *mem,
 				 size_t old_size, size_t new_size);
 static void pool_system_clear(pool_t pool);
+static size_t pool_system_get_max_easy_alloc_size(pool_t pool);
 
 static struct pool static_system_pool = {
 	pool_system_get_name,
@@ -34,6 +35,7 @@
 	pool_system_realloc,
 
 	pool_system_clear,
+	pool_system_get_max_easy_alloc_size,
 
 	FALSE,
 	FALSE
@@ -111,3 +113,8 @@
 {
 	i_panic("pool_system_clear() must not be called");
 }
+
+static size_t pool_system_get_max_easy_alloc_size(pool_t pool __attr_unused__)
+{
+	return 0;
+}

Index: mempool-unsafe-datastack.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/mempool-unsafe-datastack.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- mempool-unsafe-datastack.c	21 Sep 2003 16:21:37 -0000	1.1
+++ mempool-unsafe-datastack.c	27 Mar 2005 13:29:30 -0000	1.2
@@ -13,6 +13,7 @@
 static void *pool_unsafe_data_stack_realloc(pool_t pool, void *mem,
 					    size_t old_size, size_t new_size);
 static void pool_unsafe_data_stack_clear(pool_t pool);
+static size_t pool_unsafe_data_stack_get_max_easy_alloc_size(pool_t pool);
 
 static struct pool static_unsafe_data_stack_pool = {
 	pool_unsafe_data_stack_get_name,
@@ -26,6 +27,7 @@
 	pool_unsafe_data_stack_realloc,
 
 	pool_unsafe_data_stack_clear,
+	pool_unsafe_data_stack_get_max_easy_alloc_size,
 
 	TRUE,
 	TRUE
@@ -89,3 +91,9 @@
 static void pool_unsafe_data_stack_clear(pool_t pool __attr_unused__)
 {
 }
+
+static size_t
+pool_unsafe_data_stack_get_max_easy_alloc_size(pool_t pool __attr_unused__)
+{
+	return t_get_bytes_available();
+}

Index: mempool.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/mempool.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- mempool.h	6 Jan 2004 06:09:26 -0000	1.15
+++ mempool.h	27 Mar 2005 13:29:30 -0000	1.16
@@ -26,6 +26,10 @@
 	   this and crashes if it's used */
 	void (*clear)(pool_t pool);
 
+	/* Returns the maximum amount of bytes that can be allocated with
+	   minimal trouble. If there's no such concept, always returns 0. */
+	size_t (*get_max_easy_alloc_size)(pool_t pool);
+
 	unsigned int alloconly_pool:1;
 	unsigned int datastack_pool:1;
 };
@@ -65,4 +69,6 @@
 
 #define p_clear(pool) (pool)->clear(pool)
 
+#define p_get_max_easy_alloc_size(pool) (pool)->get_max_easy_alloc_size(pool)
+
 #endif



More information about the dovecot-cvs mailing list