summaryrefslogtreecommitdiffstats
path: root/sys/opencrypto/deflate.h
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2009-11-28 21:08:19 +0000
committerbz <bz@FreeBSD.org>2009-11-28 21:08:19 +0000
commit3fae6ec1cfa39a9b05af3aa4b01cf5ccdd92c5ca (patch)
tree299ec989558d4f834e8bfc1032a8d246a5cd130c /sys/opencrypto/deflate.h
parentb1928221d27e9428e04efc47dfd666244939ba7f (diff)
downloadFreeBSD-src-3fae6ec1cfa39a9b05af3aa4b01cf5ccdd92c5ca.zip
FreeBSD-src-3fae6ec1cfa39a9b05af3aa4b01cf5ccdd92c5ca.tar.gz
Change memory managment from a fixed size array to a list.
This is needed to avoid running into out of buffer situations where we cannot alloc a new buffer because we hit the array size limit (ZBUF). Use a combined allocation for the struct and the actual data buffer to not increase the number of malloc calls. [1] Defer initialization of zbuf until we actually need it. Make sure the output buffer will be large enough in all cases. Details discussed with: kib [1] Reviewed by: kib [1] MFC after: 6 days
Diffstat (limited to 'sys/opencrypto/deflate.h')
-rw-r--r--sys/opencrypto/deflate.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/opencrypto/deflate.h b/sys/opencrypto/deflate.h
index 5c8ebd4..dcf7a84 100644
--- a/sys/opencrypto/deflate.h
+++ b/sys/opencrypto/deflate.h
@@ -47,10 +47,14 @@ u_int32_t deflate_global(u_int8_t *, u_int32_t, int, u_int8_t **);
void *z_alloc(void *, u_int, u_int);
void z_free(void *, void *);
+/*
+ * We are going to use a combined allocation to hold the metadata
+ * from the struct immediately followed by the real application data.
+ */
struct deflate_buf {
- u_int8_t *out;
- u_int32_t size;
- int flag;
+ struct deflate_buf *next;
+ uint32_t size;
+ uint8_t data[];
};
#endif /* _CRYPTO_DEFLATE_H_ */
OpenPOWER on IntegriCloud