summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@intec.ugent.be>2017-01-09 16:42:25 +0100
committerSander Vrijders <sander.vrijders@intec.ugent.be>2017-01-09 16:42:25 +0100
commit77c32c24b781eafd518e2cbe9de46b348a26a201 (patch)
tree817ead055668848866738e037ac3cb4c2a269bfd /src/lib
parentf0167930862e57a2aa22520cd574f0368cb1032c (diff)
parent6c1cfb990f56b2fa87500732cb4f0966616907c7 (diff)
downloadouroboros-77c32c24b781eafd518e2cbe9de46b348a26a201.tar.gz
ouroboros-77c32c24b781eafd518e2cbe9de46b348a26a201.zip
Merge remote-tracking branch 'upstream/be' into be-gam
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/bitmap.c25
-rw-r--r--src/lib/cdap.c27
-rw-r--r--src/lib/cdap.proto21
-rw-r--r--src/lib/cdap_req.c23
-rw-r--r--src/lib/cdap_req.h21
-rw-r--r--src/lib/dev.c21
-rw-r--r--src/lib/dif_config.proto21
-rw-r--r--src/lib/hashtable.c25
-rw-r--r--src/lib/ipcpd_messages.proto21
-rw-r--r--src/lib/irm.c21
-rw-r--r--src/lib/irmd_messages.proto21
-rw-r--r--src/lib/list.c130
-rw-r--r--src/lib/lockfile.c23
-rw-r--r--src/lib/logs.c21
-rw-r--r--src/lib/nsm.c21
-rw-r--r--src/lib/shm_flow_set.c21
-rw-r--r--src/lib/shm_rbuff.c21
-rw-r--r--src/lib/shm_rdrbuff.c21
-rw-r--r--src/lib/sockets.c21
-rw-r--r--src/lib/tests/bitmap_test.c2
-rw-r--r--src/lib/tests/hashtable_test.c2
-rw-r--r--src/lib/time_utils.c21
-rw-r--r--src/lib/utils.c21
23 files changed, 270 insertions, 302 deletions
diff --git a/src/lib/bitmap.c b/src/lib/bitmap.c
index 6aafccfb..5905dfee 100644
--- a/src/lib/bitmap.c
+++ b/src/lib/bitmap.c
@@ -1,23 +1,24 @@
/*
- * Ouroboros - Copyright (C) 2016
+ * Ouroboros - Copyright (C) 2016 - 2017
*
- * Bitmap implementation - taken partly from Linux kernel
+ * Bitmap implementation
*
- * Sander Vrijders <sander.vrijders@intec.ugent.be>
+ * Sander Vrijders <sander.vrijders@intec.ugent.be>
* Francesco Salvestrini <f.salvestrini@nextworks.it>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
*/
#define OUROBOROS_PREFIX "bitmap"
diff --git a/src/lib/cdap.c b/src/lib/cdap.c
index 17104770..956486d1 100644
--- a/src/lib/cdap.c
+++ b/src/lib/cdap.c
@@ -1,22 +1,23 @@
/*
- * Ouroboros - Copyright (C) 2016
+ * Ouroboros - Copyright (C) 2016 - 2017
*
* The Common Distributed Application Protocol
*
* Sander Vrijders <sander.vrijders@intec.ugent.be>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
*/
#include <ouroboros/config.h>
@@ -365,8 +366,8 @@ struct cdap * cdap_create(int fd)
return NULL;
}
- INIT_LIST_HEAD(&instance->sent);
- INIT_LIST_HEAD(&instance->rcvd);
+ list_head_init(&instance->sent);
+ list_head_init(&instance->rcvd);
instance->fd = fd;
@@ -573,7 +574,7 @@ cdap_key_t cdap_request_wait(struct cdap * instance,
pthread_cleanup_push((void(*)(void *))pthread_mutex_unlock,
(void *) &instance->rcvd_lock);
- while (list_empty(&instance->rcvd))
+ while (list_is_empty(&instance->rcvd))
pthread_cond_wait(&instance->rcvd_cond, &instance->rcvd_lock);
rcvd = list_first_entry(&instance->rcvd, struct cdap_rcvd, next);
diff --git a/src/lib/cdap.proto b/src/lib/cdap.proto
index 1a00eaa8..5fde1658 100644
--- a/src/lib/cdap.proto
+++ b/src/lib/cdap.proto
@@ -1,23 +1,24 @@
/*
- * Ouroboros - Copyright (C) 2016
+ * Ouroboros - Copyright (C) 2016- 2017
*
* CDAP message
*
* Dimitri Staessens <dimitri.staessens@intec.ugent.be>
* Sander Vrijders <sander.vrijders@intec.ugent.be>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
*/
syntax = "proto2";
diff --git a/src/lib/cdap_req.c b/src/lib/cdap_req.c
index 57ad22c5..565cafd0 100644
--- a/src/lib/cdap_req.c
+++ b/src/lib/cdap_req.c
@@ -1,23 +1,24 @@
/*
- * Ouroboros - Copyright (C) 2016
+ * Ouroboros - Copyright (C) 2016 - 2017
*
* CDAP - CDAP request management
*
* Sander Vrijders <sander.vrijders@intec.ugent.be>
* Dimitri Staessens <dimitri.staessens@intec.ugent.be>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
*/
#include <ouroboros/config.h>
@@ -51,7 +52,7 @@ struct cdap_req * cdap_req_create(cdap_key_t key)
pthread_cond_init(&creq->cond, &cattr);
pthread_mutex_init(&creq->lock, NULL);
- INIT_LIST_HEAD(&creq->next);
+ list_head_init(&creq->next);
clock_gettime(PTHREAD_COND_CLOCK, &creq->birth);
diff --git a/src/lib/cdap_req.h b/src/lib/cdap_req.h
index b2ded060..2d69526b 100644
--- a/src/lib/cdap_req.h
+++ b/src/lib/cdap_req.h
@@ -1,23 +1,24 @@
/*
- * Ouroboros - Copyright (C) 2016
+ * Ouroboros - Copyright (C) 2016 - 2017
*
* CDAP - CDAP request management
*
* Sander Vrijders <sander.vrijders@intec.ugent.be>
* Dimitri Staessens <dimitri.staessens@intec.ugent.be>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
*/
#ifndef OUROBOROS_CDAP_REQ_H
diff --git a/src/lib/dev.c b/src/lib/dev.c
index 91fc3c0a..8cd8cd53 100644
--- a/src/lib/dev.c
+++ b/src/lib/dev.c
@@ -1,23 +1,24 @@
/*
- * Ouroboros - Copyright (C) 2016
+ * Ouroboros - Copyright (C) 2016 - 2017
*
* API for applications
*
* Dimitri Staessens <dimitri.staessens@intec.ugent.be>
* Sander Vrijders <sander.vrijders@intec.ugent.be>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
*/
#include <ouroboros/config.h>
diff --git a/src/lib/dif_config.proto b/src/lib/dif_config.proto
index 318055fe..8a1d329e 100644
--- a/src/lib/dif_config.proto
+++ b/src/lib/dif_config.proto
@@ -1,23 +1,24 @@
/*
- * Ouroboros - Copyright (C) 2016
+ * Ouroboros - Copyright (C) 2016 - 2017
*
* DIF config message
*
* Dimitri Staessens <dimitri.staessens@intec.ugent.be>
* Sander Vrijders <sander.vrijders@intec.ugent.be>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
*/
syntax = "proto2";
diff --git a/src/lib/hashtable.c b/src/lib/hashtable.c
index 8dcd4ec1..f17accaf 100644
--- a/src/lib/hashtable.c
+++ b/src/lib/hashtable.c
@@ -1,22 +1,23 @@
/*
- * Ouroboros - Copyright (C) 2016
+ * Ouroboros - Copyright (C) 2016 - 2017
*
* Hash table with separate chaining on collisions
*
* Sander Vrijders <sander.vrijders@intec.ugent.be>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
*/
#include <ouroboros/config.h>
@@ -69,7 +70,7 @@ struct htable * htable_create(uint64_t buckets, bool hash_key)
}
for (i = 0; i < buckets; i++)
- INIT_LIST_HEAD(&(tmp->buckets[i]));
+ list_head_init(&(tmp->buckets[i]));
return tmp;
}
@@ -136,7 +137,7 @@ int htable_insert(struct htable * table, uint64_t key, void * val)
entry->key = key;
entry->val = val;
- INIT_LIST_HEAD(&entry->next);
+ list_head_init(&entry->next);
list_add(&entry->next, &(table->buckets[lookup_key]));
diff --git a/src/lib/ipcpd_messages.proto b/src/lib/ipcpd_messages.proto
index 09e959fa..827bd370 100644
--- a/src/lib/ipcpd_messages.proto
+++ b/src/lib/ipcpd_messages.proto
@@ -1,23 +1,24 @@
/*
- * Ouroboros - Copyright (C) 2016
+ * Ouroboros - Copyright (C) 2016 - 2017
*
* IPCPd message
*
* Dimitri Staessens <dimitri.staessens@intec.ugent.be>
* Sander Vrijders <sander.vrijders@intec.ugent.be>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
*/
syntax = "proto2";
diff --git a/src/lib/irm.c b/src/lib/irm.c
index 969a78c3..635c8f9b 100644
--- a/src/lib/irm.c
+++ b/src/lib/irm.c
@@ -1,22 +1,23 @@
/*
- * Ouroboros - Copyright (C) 2016
+ * Ouroboros - Copyright (C) 2016 - 2017
*
* The API to instruct the IRM
*
* Sander Vrijders <sander.vrijders@intec.ugent.be>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
*/
#define OUROBOROS_PREFIX "libouroboros-irm"
diff --git a/src/lib/irmd_messages.proto b/src/lib/irmd_messages.proto
index 74d08f9b..a0965f43 100644
--- a/src/lib/irmd_messages.proto
+++ b/src/lib/irmd_messages.proto
@@ -1,23 +1,24 @@
/*
- * Ouroboros - Copyright (C) 2016
+ * Ouroboros - Copyright (C) 2016 - 2017
*
* IRMd message
*
* Dimitri Staessens <dimitri.staessens@intec.ugent.be>
* Sander Vrijders <sander.vrijders@intec.ugent.be>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
*/
syntax = "proto2";
diff --git a/src/lib/list.c b/src/lib/list.c
index 0f3493e3..2c577ea9 100644
--- a/src/lib/list.c
+++ b/src/lib/list.c
@@ -1,124 +1,72 @@
/*
- * Ouroboros - Copyright (C) 2016
+ * Ouroboros - Copyright (C) 2016 - 2017
*
* Simple doubly linked list implementation.
*
- * Some of the internal functions ("__xxx") are useful when
- * manipulating whole lists rather than single entries, as
- * sometimes we already know the next/prev entries and we can
- * generate better code by using them directly rather than
- * using the generic single-entry routines.
+ * Sander Vrijders <sander.vrijders@intec.ugent.be>
+ * Dimitri Staessense <dimitri.staessens@intec.ugent.be>
*
- * This file is from the Linux Kernel (include/linux/list.h)
- * and modified by simply removing hardware prefetching of list items.
- * Here by copyright, credits attributed to wherever they belong.
- * Kulesh Shanmugasundaram (kulesh [squiggly] isis.poly.edu)
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
*
- * Sander Vrijders <sander.vrijders@intec.ugent.be>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
*/
#include <ouroboros/list.h>
-static void __list_add(struct list_head * new,
- struct list_head * prev,
- struct list_head * next)
-{
- next->prev = new;
- new->next = next;
- new->prev = prev;
- prev->next = new;
-}
-
-void list_add(struct list_head * new,
- struct list_head * head)
-{
- __list_add(new, head, head->next);
-}
-
-void list_add_tail(struct list_head * new,
- struct list_head * head)
-{
- __list_add(new, head->prev, head);
-}
-
-static void __list_del(struct list_head * prev,
- struct list_head * next)
-{
- next->prev = prev;
- prev->next = next;
-}
+#include <stddef.h>
-void list_del(struct list_head * entry)
+void list_head_init(struct list_head * h)
{
- __list_del(entry->prev, entry->next);
- entry->next = (void *) 0;
- entry->prev = (void *) 0;
+ h->nxt = h;
+ h->prv = h;
}
-void list_del_init(struct list_head * entry)
+static void add_list(struct list_head * n,
+ struct list_head * prv,
+ struct list_head * nxt)
{
- __list_del(entry->prev, entry->next);
- INIT_LIST_HEAD(entry);
+ nxt->prv = n;
+ n->nxt = nxt;
+ n->prv = prv;
+ prv->nxt = n;
}
-void list_move(struct list_head * list,
- struct list_head * head)
+static void del_list(struct list_head * prv,
+ struct list_head * nxt)
{
- __list_del(list->prev, list->next);
- list_add(list, head);
+ nxt->prv = prv;
+ prv->nxt = nxt;
}
-void list_move_tail(struct list_head * list,
- struct list_head * head)
+void list_add(struct list_head * n,
+ struct list_head * h)
{
- __list_del(list->prev, list->next);
- list_add_tail(list, head);
+ add_list(n, h, h->nxt);
}
-int list_empty(struct list_head * head)
+void list_add_tail(struct list_head * n,
+ struct list_head * h)
{
- return head->next == head;
-}
-
-static void __list_splice(struct list_head *list,
- struct list_head *head)
-{
- struct list_head *first = list->next;
- struct list_head *last = list->prev;
- struct list_head *at = head->next;
-
- first->prev = head;
- head->next = first;
-
- last->next = at;
- at->prev = last;
+ add_list(n, h->prv, h);
}
-void list_splice(struct list_head * list,
- struct list_head * head)
+void list_del(struct list_head * e)
{
- if (!list_empty(list))
- __list_splice(list, head);
+ del_list(e->prv, e->nxt);
+ e->nxt = e->prv = NULL;
}
-void list_splice_init(struct list_head * list,
- struct list_head * head)
+bool list_is_empty(struct list_head * h)
{
- if (!list_empty(list)) {
- __list_splice(list, head);
- INIT_LIST_HEAD(list);
- }
+ return h->nxt == h;
}
diff --git a/src/lib/lockfile.c b/src/lib/lockfile.c
index 45e95ef0..2868cb71 100644
--- a/src/lib/lockfile.c
+++ b/src/lib/lockfile.c
@@ -1,22 +1,23 @@
/*
- * Ouroboros - Copyright (C) 2016
+ * Ouroboros - Copyright (C) 2016 - 2017
*
- * Lockfile for ouroboros system
+ * Lockfile for Ouroboros
*
* Dimitri Staessens <dimitri.staessens@intec.ugent.be>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
*/
#include <ouroboros/config.h>
diff --git a/src/lib/logs.c b/src/lib/logs.c
index 5a2ef26f..449ee191 100644
--- a/src/lib/logs.c
+++ b/src/lib/logs.c
@@ -1,22 +1,23 @@
/*
- * Ouroboros - Copyright (C) 2016
+ * Ouroboros - Copyright (C) 2016 - 2017
*
* Logging facilities
*
* Sander Vrijders <sander.vrijders@intec.ugent.be>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
*/
#define OUROBOROS_PREFIX "logging"
diff --git a/src/lib/nsm.c b/src/lib/nsm.c
index b61bb57a..3fc98021 100644
--- a/src/lib/nsm.c
+++ b/src/lib/nsm.c
@@ -1,22 +1,23 @@
/*
- * Ouroboros - Copyright (C) 2016
+ * Ouroboros - Copyright (C) 2016 - 2017
*
* The API to instruct the global Namespace Manager
*
* Sander Vrijders <sander.vrijders@intec.ugent.be>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
*/
#include <ouroboros/nsm.h>
diff --git a/src/lib/shm_flow_set.c b/src/lib/shm_flow_set.c
index ca8e6142..161e070c 100644
--- a/src/lib/shm_flow_set.c
+++ b/src/lib/shm_flow_set.c
@@ -1,22 +1,23 @@
/*
- * Ouroboros - Copyright (C) 2016
+ * Ouroboros - Copyright (C) 2016 - 2017
*
* Management of flow_sets for fqueue
*
* Dimitri Staessens <dimitri.staessens@intec.ugent.be>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
*/
#include <ouroboros/config.h>
diff --git a/src/lib/shm_rbuff.c b/src/lib/shm_rbuff.c
index a585226e..0d0795aa 100644
--- a/src/lib/shm_rbuff.c
+++ b/src/lib/shm_rbuff.c
@@ -1,22 +1,23 @@
/*
- * Ouroboros - Copyright (C) 2016
+ * Ouroboros - Copyright (C) 2016 - 2017
*
* Ring buffer for incoming SDUs
*
* Dimitri Staessens <dimitri.staessens@intec.ugent.be>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
*/
#include <ouroboros/config.h>
diff --git a/src/lib/shm_rdrbuff.c b/src/lib/shm_rdrbuff.c
index c3e527eb..ce81d171 100644
--- a/src/lib/shm_rdrbuff.c
+++ b/src/lib/shm_rdrbuff.c
@@ -1,23 +1,24 @@
/*
- * Ouroboros - Copyright (C) 2016
+ * Ouroboros - Copyright (C) 2016 - 2017
*
* Random Deletion Ring Buffer for Data Units
*
* Dimitri Staessens <dimitri.staessens@intec.ugent.be>
* Sander Vrijders <sander.vrijders@intec.ugent.be>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
*/
#include <ouroboros/config.h>
diff --git a/src/lib/sockets.c b/src/lib/sockets.c
index 3d8fc488..e57cd748 100644
--- a/src/lib/sockets.c
+++ b/src/lib/sockets.c
@@ -1,22 +1,23 @@
/*
- * Ouroboros - Copyright (C) 2016
+ * Ouroboros - Copyright (C) 2016 - 2017
*
* The sockets layer to communicate between daemons
*
* Sander Vrijders <sander.vrijders@intec.ugent.be>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
*/
#include <ouroboros/config.h>
diff --git a/src/lib/tests/bitmap_test.c b/src/lib/tests/bitmap_test.c
index 292397df..b1684f72 100644
--- a/src/lib/tests/bitmap_test.c
+++ b/src/lib/tests/bitmap_test.c
@@ -1,5 +1,5 @@
/*
- * Ouroboros - Copyright (C) 2016
+ * Ouroboros - Copyright (C) 2016 - 2017
*
* Test of the bitmap
*
diff --git a/src/lib/tests/hashtable_test.c b/src/lib/tests/hashtable_test.c
index ccd34ebd..fb7f1156 100644
--- a/src/lib/tests/hashtable_test.c
+++ b/src/lib/tests/hashtable_test.c
@@ -1,5 +1,5 @@
/*
- * Ouroboros - Copyright (C) 2016
+ * Ouroboros - Copyright (C) 2016 - 2017
*
* Test of the hash table
*
diff --git a/src/lib/time_utils.c b/src/lib/time_utils.c
index 99b18706..3b791157 100644
--- a/src/lib/time_utils.c
+++ b/src/lib/time_utils.c
@@ -1,22 +1,23 @@
/*
- * Ouroboros - Copyright (C) 2016
+ * Ouroboros - Copyright (C) 2016 - 2017
*
* Time utilities
*
* Dimitri Staessens <dimitri.staessens@intec.ugent.be>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
*/
#include <ouroboros/config.h>
diff --git a/src/lib/utils.c b/src/lib/utils.c
index a5f46f52..40d1c285 100644
--- a/src/lib/utils.c
+++ b/src/lib/utils.c
@@ -1,22 +1,23 @@
/*
- * Ouroboros - Copyright (C) 2016
+ * Ouroboros - Copyright (C) 2016 - 2017
*
* Handy utilities
*
* Sander Vrijders <sander.vrijders@intec.ugent.be>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
*/
#include <stdlib.h>