summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri.staessens@intec.ugent.be>2016-03-07 14:53:16 +0100
committerDimitri Staessens <dimitri.staessens@intec.ugent.be>2016-03-07 14:53:16 +0100
commit9ed17496198ad81dfa4973c5a1429d30054e7581 (patch)
tree620f8d97002f0f32519b794473b8cdcad14152ac /src/lib
parent17c2ec5c5c24b65321d9ad0207a269e54d25749e (diff)
downloadouroboros-9ed17496198ad81dfa4973c5a1429d30054e7581.tar.gz
ouroboros-9ed17496198ad81dfa4973c5a1429d30054e7581.zip
lib: changed du_buff default size to 64KB
du_buff.c: default du_buff size is now 64KB. some formatting fixes (missing spaces around operators).
Diffstat (limited to 'src/lib')
-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;
}