summaryrefslogtreecommitdiff
path: root/src/lib/dev.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2026-05-15 11:40:00 +0200
committerSander Vrijders <sander@ouroboros.rocks>2026-05-20 08:17:06 +0200
commitf33769c818cb1f01079405f543b36aa294764112 (patch)
treec986f184c429ef79ed166c848f748084a725a36a /src/lib/dev.c
parentab476259d875e8352a4ef23c2d25b0e67161c771 (diff)
downloadouroboros-f33769c818cb1f01079405f543b36aa294764112.tar.gz
ouroboros-f33769c818cb1f01079405f543b36aa294764112.zip
lib: Use push/pop for ssm_pk_buff ops
Renames the allocation for head/tail to push/pop instead of alloc/release as it's simpler and shorter. Took this approach insted of adopting the kernel's push/pull/put/trim. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/lib/dev.c')
-rw-r--r--src/lib/dev.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/dev.c b/src/lib/dev.c
index bf09c8a4..b202a85c 100644
--- a/src/lib/dev.c
+++ b/src/lib/dev.c
@@ -272,11 +272,11 @@ static int spb_encrypt(struct flow * flow,
if (crypt_encrypt(flow->crypt, in, &out) < 0)
goto fail_encrypt;
- head = ssm_pk_buff_head_alloc(spb, flow->headsz);
+ head = ssm_pk_buff_push(spb, flow->headsz);
if (head == NULL)
goto fail_alloc;
- tail = ssm_pk_buff_tail_alloc(spb, flow->tailsz);
+ tail = ssm_pk_buff_push_tail(spb, flow->tailsz);
if (tail == NULL)
goto fail_alloc;
@@ -308,8 +308,8 @@ static int spb_decrypt(struct flow * flow,
return -ENOMEM;
- head = ssm_pk_buff_head_release(spb, flow->headsz) + flow->headsz;
- ssm_pk_buff_tail_release(spb, flow->tailsz);
+ head = ssm_pk_buff_pop(spb, flow->headsz) + flow->headsz;
+ ssm_pk_buff_pop_tail(spb, flow->tailsz);
memcpy(head, out.data, out.len);
@@ -1245,7 +1245,7 @@ static int chk_crc(struct ssm_pk_buff * spb)
{
uint32_t crc;
uint8_t * head = ssm_pk_buff_head(spb);
- uint8_t * tail = ssm_pk_buff_tail_release(spb, CRCLEN);
+ uint8_t * tail = ssm_pk_buff_pop_tail(spb, CRCLEN);
mem_hash(HASH_CRC32, &crc, head, tail - head);
@@ -1257,7 +1257,7 @@ static int add_crc(struct ssm_pk_buff * spb)
uint8_t * head;
uint8_t * tail;
- tail = ssm_pk_buff_tail_alloc(spb, CRCLEN);
+ tail = ssm_pk_buff_push_tail(spb, CRCLEN);
if (tail == NULL)
return -ENOMEM;
@@ -1522,7 +1522,7 @@ ssize_t flow_read(int fd,
} else {
if (partrd) {
memcpy(buf, packet, count);
- ssm_pk_buff_head_release(spb, n);
+ ssm_pk_buff_pop(spb, n);
pthread_rwlock_wrlock(&proc.lock);
flow->part_idx = idx;