summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2023-09-17 13:49:59 +0200
committerSander Vrijders <sander@ouroboros.rocks>2023-09-20 18:51:19 +0200
commitc7fbae74dcf91333cc53632153e1c91e2a641f0d (patch)
tree93fc011ea9d249589a92c0becc569eae3e88a832
parenta032b25832a75deef7d6d8b48a0786e5838df419 (diff)
downloadouroboros-c7fbae74dcf91333cc53632153e1c91e2a641f0d.tar.gz
ouroboros-c7fbae74dcf91333cc53632153e1c91e2a641f0d.zip
lib: Rename portevent to flowevent
Doesn't make any sense to call it a port event... Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
-rw-r--r--include/ouroboros/shm_flow_set.h4
-rw-r--r--src/lib/dev.c5
-rw-r--r--src/lib/shm_flow_set.c14
3 files changed, 11 insertions, 12 deletions
diff --git a/include/ouroboros/shm_flow_set.h b/include/ouroboros/shm_flow_set.h
index 7b133c4e..dad58126 100644
--- a/include/ouroboros/shm_flow_set.h
+++ b/include/ouroboros/shm_flow_set.h
@@ -27,7 +27,7 @@
#include <sys/time.h>
-struct portevent {
+struct flowevent {
int flow_id;
int event;
};
@@ -63,7 +63,7 @@ void shm_flow_set_notify(struct shm_flow_set * set,
ssize_t shm_flow_set_wait(const struct shm_flow_set * shm_set,
size_t idx,
- struct portevent * fqueue,
+ struct flowevent * fqueue,
const struct timespec * abstime);
#endif /* OUROBOROS_LIB_SHM_FLOW_SET_H */
diff --git a/src/lib/dev.c b/src/lib/dev.c
index 69843c58..7de257e2 100644
--- a/src/lib/dev.c
+++ b/src/lib/dev.c
@@ -126,7 +126,7 @@ struct flow_set {
};
struct fqueue {
- struct portevent fqueue[SHM_BUFFER_SIZE]; /* Safe copy from shm. */
+ struct flowevent fqueue[SHM_BUFFER_SIZE]; /* Safe copy from shm. */
size_t fqsize;
size_t next;
};
@@ -909,7 +909,6 @@ int flow_alloc(const char * dst,
irm_msg__free_unpacked(recv_msg, NULL);
-
return fd;
fail_result:
@@ -1726,7 +1725,7 @@ static int fqueue_filter(struct fqueue * fq)
int fqueue_next(struct fqueue * fq)
{
int fd;
- struct portevent * e;
+ struct flowevent * e;
if (fq == NULL)
return -EINVAL;
diff --git a/src/lib/shm_flow_set.c b/src/lib/shm_flow_set.c
index 4a30b1b8..9eb9bb65 100644
--- a/src/lib/shm_flow_set.c
+++ b/src/lib/shm_flow_set.c
@@ -54,7 +54,7 @@
#define FN_MAX_CHARS 255
#define FS_PROT (PROT_READ | PROT_WRITE)
-#define QUEUESIZE ((SHM_BUFFER_SIZE) * sizeof(struct portevent))
+#define QUEUESIZE ((SHM_BUFFER_SIZE) * sizeof(struct flowevent))
#define SHM_FSET_FILE_SIZE (SYS_MAX_FLOWS * sizeof(ssize_t) \
+ PROG_MAX_FQUEUES * sizeof(size_t) \
@@ -68,7 +68,7 @@ struct shm_flow_set {
ssize_t * mtable;
size_t * heads;
pthread_cond_t * conds;
- struct portevent * fqueues;
+ struct flowevent * fqueues;
pthread_mutex_t * lock;
pid_t pid;
@@ -104,7 +104,7 @@ static struct shm_flow_set * flow_set_create(pid_t pid,
set->mtable = shm_base;
set->heads = (size_t *) (set->mtable + SYS_MAX_FLOWS);
set->conds = (pthread_cond_t *)(set->heads + PROG_MAX_FQUEUES);
- set->fqueues = (struct portevent *) (set->conds + PROG_MAX_FQUEUES);
+ set->fqueues = (struct flowevent *) (set->conds + PROG_MAX_FQUEUES);
set->lock = (pthread_mutex_t *)
(set->fqueues + PROG_MAX_FQUEUES * (SHM_BUFFER_SIZE));
@@ -297,7 +297,7 @@ void shm_flow_set_notify(struct shm_flow_set * set,
int flow_id,
int event)
{
- struct portevent * e;
+ struct flowevent * e;
assert(set);
assert(!(flow_id < 0) && flow_id < SYS_MAX_FLOWS);
@@ -313,7 +313,7 @@ void shm_flow_set_notify(struct shm_flow_set * set,
set->heads[set->mtable[flow_id]];
e->flow_id = flow_id;
- e->event = event;
+ e->event = event;
++set->heads[set->mtable[flow_id]];
@@ -325,7 +325,7 @@ void shm_flow_set_notify(struct shm_flow_set * set,
ssize_t shm_flow_set_wait(const struct shm_flow_set * set,
size_t idx,
- struct portevent * fqueue,
+ struct flowevent * fqueue,
const struct timespec * abstime)
{
ssize_t ret = 0;
@@ -365,7 +365,7 @@ ssize_t shm_flow_set_wait(const struct shm_flow_set * set,
if (ret != -ETIMEDOUT) {
memcpy(fqueue,
fqueue_ptr(set, idx),
- set->heads[idx] * sizeof(struct portevent));
+ set->heads[idx] * sizeof(*fqueue));
ret = set->heads[idx];
set->heads[idx] = 0;
}