summaryrefslogtreecommitdiff
path: root/src/lib/du_buff.c
diff options
context:
space:
mode:
authorSander Vrijders <[email protected]>2016-03-07 15:55:10 +0100
committerSander Vrijders <[email protected]>2016-03-07 15:55:10 +0100
commitaf8db503f46049fabaa793905f35bf0a2867744b (patch)
tree0b026ef3ff4182e9cbb15eced34888950c469845 /src/lib/du_buff.c
parentaa5997970f90e48532cfb749b2fe4a6b182de11f (diff)
parent18c42ee096fb7f41248c5ec67be0647c20969fea (diff)
downloadouroboros-af8db503f46049fabaa793905f35bf0a2867744b.tar.gz
ouroboros-af8db503f46049fabaa793905f35bf0a2867744b.zip
Merged in dstaesse/ouroboros/be (pull request #22)
lib: changed du_buff default size to 64KB
Diffstat (limited to 'src/lib/du_buff.c')
-rw-r--r--src/lib/du_buff.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/lib/du_buff.c b/src/lib/du_buff.c
index 08e3d23e..d88d7ac4 100644
--- a/src/lib/du_buff.c
+++ b/src/lib/du_buff.c
@@ -29,7 +29,7 @@
#define OUROBOROS_PREFIX "du_buff"
#ifndef DU_BUFF_BLOCKSIZE
-#define DU_BUFF_BLOCKSIZE sysconf(_SC_PAGESIZE)
+#define DU_BUFF_BLOCKSIZE 1 << 16
#endif
#include "ouroboros/logs.h"
@@ -58,7 +58,6 @@ void buffer_destroy(struct buffer * buf)
free (buf);
}
-
void buffer_destroy_list(struct buffer * head)
{
struct list_head * ptr;
@@ -88,8 +87,8 @@ struct buffer * buffer_create (size_t size, size_t headspace, size_t len)
if (head == NULL)
return NULL;
- head->size=0;
- head->data=NULL;
+ head->size = 0;
+ head->data = NULL;
INIT_LIST_HEAD(&(head->list));
@@ -100,7 +99,7 @@ struct buffer * buffer_create (size_t size, size_t headspace, size_t len)
if (size > DU_BUFF_BLOCKSIZE && head_block) {
sz = headspace;
- head_block=false;
+ head_block = false;
} else if (size > DU_BUFF_BLOCKSIZE
&& remaining - ts <= DU_BUFF_BLOCKSIZE
&& remaining != ts) {
@@ -277,7 +276,7 @@ void du_buff_destroy(du_buff_t * dub)
int du_buff_init(du_buff_t * dub,
size_t start,
- uint8_t * data,
+ uint8_t * data,
size_t len)
{
if (dub == NULL || data == NULL) {
@@ -313,7 +312,7 @@ uint8_t * du_buff_head_alloc(du_buff_t * dub, size_t size)
}
if (dub->du_head - size < 0) {
- LOG_WARN("Failed to allocate PCI headspace");
+ LOG_WARN("Failed to allocate PCI headspace.");
return NULL;
}
@@ -330,7 +329,7 @@ uint8_t * du_buff_tail_alloc(du_buff_t * dub, size_t size)
}
if (dub->du_tail + size >= dub->size) {
- LOG_WARN("Failed to allocate PCI tailspace");
+ LOG_WARN("Failed to allocate PCI tailspace.");
return NULL;
}
@@ -347,7 +346,7 @@ int du_buff_head_release(du_buff_t * dub, size_t size)
}
if (size > dub->du_tail - dub->du_head) {
- LOG_WARN("Tried to release beyond sdu boundary");
+ LOG_WARN("Tried to release beyond sdu boundary.");
return -EOVERFLOW;
}
@@ -366,7 +365,7 @@ int du_buff_tail_release(du_buff_t * dub, size_t size)
}
if (size > dub->du_tail - dub->du_head) {
- LOG_WARN("Tried to release beyond sdu boundary");
+ LOG_WARN("Tried to release beyond sdu boundary.");
return -EOVERFLOW;
}