From 2a207aaf819b4bc8edf8953a2cff8dd818d969e6 Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Wed, 17 Feb 2016 17:18:27 +0100 Subject: include: Add list implementation This adds a list implementation similar to the one found in the Linux kernel. --- include/ouroboros/list.h | 270 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 270 insertions(+) create mode 100644 include/ouroboros/list.h diff --git a/include/ouroboros/list.h b/include/ouroboros/list.h new file mode 100644 index 00000000..7c59df7a --- /dev/null +++ b/include/ouroboros/list.h @@ -0,0 +1,270 @@ +/* + * Ouroboros - Copyright (C) 2016 + * + * 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 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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. + * + * 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. + */ + +#ifndef OUROBOROS_LIST_H +#define OUROBOROS_LIST_H + +/* + * 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) + */ + +struct list_head { + struct list_head * next, * prev; +}; + +#define LIST_HEAD_INIT(name) { &(name), &(name) } + +#define LIST_HEAD(name) \ + struct list_head name = LIST_HEAD_INIT(name) + +#define INIT_LIST_HEAD(ptr) do { \ + (ptr)->next = (ptr); (ptr)->prev = (ptr); \ +} while (0) + +/* + * Insert a new entry between two known consecutive entries. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static inline 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; +} + +/** + * list_add - add a new entry + * @new: new entry to be added + * @head: list head to add it after + * + * Insert a new entry after the specified head. + * This is good for implementing stacks. + */ +void list_add(struct list_head * new, + struct list_head * head) +{ + __list_add(new, head, head->next); +} + +/** + * list_add_tail - add a new entry + * @new: new entry to be added + * @head: list head to add it before + * + * Insert a new entry before the specified head. + * This is useful for implementing queues. + */ +void list_add_tail(struct list_head * new, + struct list_head * head) +{ + __list_add(new, head->prev, head); +} + +/* + * Delete a list entry by making the prev/next entries + * point to each other. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static inline void __list_del(struct list_head * prev, + struct list_head * next) +{ + next->prev = prev; + prev->next = next; +} + +/** + * list_del - deletes entry from list. + * @entry: the element to delete from the list. + * Note: list_empty on entry does not return true after this, + * the entry is in an undefined state. + */ +void list_del(struct list_head * entry) +{ + __list_del(entry->prev, entry->next); + entry->next = (void *) 0; + entry->prev = (void *) 0; +} + +/** + * list_del_init - deletes entry from list and reinitialize it. + * @entry: the element to delete from the list. + */ +void list_del_init(struct list_head * entry) +{ + __list_del(entry->prev, entry->next); + INIT_LIST_HEAD(entry); +} + +/** + * list_move - delete from one list and add as another's head + * @list: the entry to move + * @head: the head that will precede our entry + */ +void list_move(struct list_head * list, + struct list_head * head) +{ + __list_del(list->prev, list->next); + list_add(list, head); +} + +/** + * list_move_tail - delete from one list and add as another's tail + * @list: the entry to move + * @head: the head that will follow our entry + */ +void list_move_tail(struct list_head * list, + struct list_head * head) +{ + __list_del(list->prev, list->next); + list_add_tail(list, head); +} + +/** + * list_empty - tests whether a list is empty + * @head: the list to test. + */ +int list_empty(struct list_head * head) +{ + return head->next == head; +} + +static inline 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; +} + +/** + * list_splice - join two lists + * @list: the new list to add. + * @head: the place to add it in the first list. + */ +void list_splice(struct list_head * list, + struct list_head * head) +{ + if (!list_empty(list)) + __list_splice(list, head); +} + +/** + * list_splice_init - join two lists and reinitialise the emptied list. + * @list: the new list to add. + * @head: the place to add it in the first list. + * + * The list at @list is reinitialised + */ +void list_splice_init(struct list_head * list, + struct list_head * head) +{ + if (!list_empty(list)) { + __list_splice(list, head); + INIT_LIST_HEAD(list); + } +} + +/** + * list_entry - get the struct for this entry + * @ptr: the &struct list_head pointer. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + */ +#define list_entry(ptr, type, member) \ + ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) + +/** + * list_for_each - iterate over a list + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + */ +#define list_for_each(pos, head) \ + for (pos = (head)->next; pos != (head); \ + pos = pos->next) +/** + * list_for_each_prev - iterate over a list backwards + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + */ +#define list_for_each_prev(pos, head) \ + for (pos = (head)->prev; pos != (head); \ + pos = pos->prev) + +/** + * list_for_each_safe - iterate over a list safe against removal of list entry + * @pos: the &struct list_head to use as a loop counter. + * @n: another &struct list_head to use as temporary storage + * @head: the head for your list. + */ +#define list_for_each_safe(pos, n, head) \ + for (pos = (head)->next, n = pos->next; pos != (head); \ + pos = n, n = pos->next) + +/** + * list_for_each_entry - iterate over list of given type + * @pos: the type * to use as a loop counter. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry(pos, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = list_entry(pos->member.next, typeof(*pos), member)) + +/** + * list_for_each_entry_safe - iterate over list of given type safe + * against removal of list entry + * @pos: the type * to use as a loop counter. + * @n: another type * to use as temporary storage + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry_safe(pos, n, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member), \ + n = list_entry(pos->member.next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = n, n = list_entry(n->member.next, typeof(*n), member)) + + +#endif -- cgit v1.2.3 From 86bc5c03c08c4f62db02a41a734cc5ffdaada50f Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Wed, 17 Feb 2016 17:19:08 +0100 Subject: include: Add bitmap implementation This adds a bitmap implementation loosely based on the one found in the Linux kernel. The functions in the header file actually act as a wrapper around the actual bitmap implementation for portability reasons. --- include/ouroboros/bitmap.h | 41 ++++++++++ src/lib/bitmap.c | 194 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 235 insertions(+) create mode 100644 include/ouroboros/bitmap.h create mode 100644 src/lib/bitmap.c diff --git a/include/ouroboros/bitmap.h b/include/ouroboros/bitmap.h new file mode 100644 index 00000000..6296e2e0 --- /dev/null +++ b/include/ouroboros/bitmap.h @@ -0,0 +1,41 @@ +/* + * Ouroboros - Copyright (C) 2016 + * + * RINA bitmap implementation - wraps around bitmap from Linux kernel + * + * Sander Vrijders + * Francesco Salvestrini + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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. + * + * 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. + */ + +#ifndef OUROBOROS_BITMAP_H +#define OUROBOROS_BITMAP_H + +#include +#include +#include + +struct rbmp; + +struct rbmp * rbmp_create(size_t bits, ssize_t offset); +int rbmp_destroy(struct rbmp * b); + +ssize_t rbmp_allocate(struct rbmp * instance); +int rbmp_release(struct rbmp * instance, + ssize_t id); +bool rbmp_is_id_ok(struct rbmp * b, ssize_t id); + +#endif diff --git a/src/lib/bitmap.c b/src/lib/bitmap.c new file mode 100644 index 00000000..3e1ba049 --- /dev/null +++ b/src/lib/bitmap.c @@ -0,0 +1,194 @@ +/* + * Ouroboros - Copyright (C) 2016 + * + * Bitmap implementation - taken partly from Linux kernel + * + * Sander Vrijders + * Francesco Salvestrini + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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. + * + * 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. + */ + +#include +#include +#include +#include +#include + +#define BITS_PER_BYTE 8 + +#define BITS_PER_LONG (sizeof(long) * BITS_PER_BYTE) + +#define BIT_WORD(nr) ((nr) / BITS_PER_LONG) + +#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) + +#define BITS_TO_LONGS(nr) \ + DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) + +#define BITS_IN_BITMAP ((2 << BITS_PER_BYTE) * sizeof(size_t)) + +static unsigned long find_next_zero_bit(const unsigned long * addr, + unsigned long nbits) +{ + unsigned long tmp; + unsigned long start = 0; + unsigned long pos = 0; + unsigned long mask; + + /* First find correct word */ + tmp = ~addr[start]; + while (!tmp) { + start++; + if (start >= (nbits / BITS_PER_LONG)) + return nbits; + + tmp = ~addr[start]; + } + + /* Find the free bit in the word */ + mask = 1UL; + while (!(tmp ^ mask)) { + pos++; + mask = 1UL << pos; + } + + return (start * BITS_PER_LONG) + pos; +} + +static void bitmap_zero(unsigned long * dst, + unsigned int nbits) +{ + unsigned int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long); + memset(dst, 0, len); +} + +static void bitmap_clear(unsigned long * map, + unsigned int start) +{ + unsigned long * p = map + BIT_WORD(start); + unsigned long mask = ~(1UL << (start % (BITS_PER_LONG - 1))); + + *p &= mask; +} + + +static void bitmap_set(unsigned long * map, + unsigned int start) +{ + unsigned long * p = map + BIT_WORD(start); + unsigned long mask = 1UL << (start % (BITS_PER_LONG - 1)); + + *p |= mask; +} + +struct rbmp { + ssize_t offset; + size_t size; + + unsigned long bitmap[BITS_TO_LONGS(BITS_IN_BITMAP)]; +}; + +struct rbmp * rbmp_create(size_t bits, ssize_t offset) +{ + struct rbmp * tmp; + + if (bits == 0) + return NULL; + + tmp = malloc(sizeof(*tmp)); + if (!tmp) + return NULL; + + tmp->size = bits; + tmp->offset = offset; + bitmap_zero(tmp->bitmap, BITS_IN_BITMAP); + + return tmp; +} + + +int rbmp_destroy(struct rbmp * b) +{ + if (!b) + return -1; + + free(b); + + return 0; +} + +static ssize_t bad_id(struct rbmp * b) +{ + assert(b); + + return b->offset - 1; +} + +ssize_t rbmp_allocate(struct rbmp * b) +{ + ssize_t id; + + if (!b) + return bad_id(b); + + id = (ssize_t) find_next_zero_bit(b->bitmap, + BITS_IN_BITMAP); + + if (id == BITS_IN_BITMAP) + return bad_id(b); + + bitmap_set(b->bitmap, id); + + return id + b->offset; +} + +static bool is_id_ok(struct rbmp * b, + ssize_t id) +{ + assert(b); + + if ((id < b->offset) || (id > (b->offset + b->size))) + return false; + + return true; +} + +bool rbmp_is_id_ok(struct rbmp * b, + ssize_t id) +{ + if (!b) + return false; + + return is_id_ok(b, id); +} + +int rbmp_release(struct rbmp * b, + ssize_t id) +{ + ssize_t rid; + + if (!b) + return -1; + + if (!is_id_ok(b, id)) + return -1; + + rid = id - b->offset; + + bitmap_clear(b->bitmap, id); + + return 0; +} -- cgit v1.2.3 From 815d2d611edec929b970868ac5ae9b3980165d0e Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Wed, 17 Feb 2016 17:23:06 +0100 Subject: lib: Update CMakeLists.txt Forgot to include the updated CMakeLists.txt file with the bitmap implementation. --- src/lib/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 5099fa48..5c0e6bbe 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -6,6 +6,7 @@ include_directories(${CMAKE_BINARY_DIR}/include) set(SOURCE_FILES # Add source files here + bitmap.c cdap.c ) -- cgit v1.2.3 From 59c9251f3584e8d016c41305ec272bfbf662405a Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Mon, 22 Feb 2016 17:34:21 +0100 Subject: src: Rename daemons and add tools folder This renames the daemons to end with a 'd', as is common for UNIX daemons. It also adds a tools folder, that will hold the tools of the Ouroboros prototype. Examples are a simple echo application, an application to instruct the IRM ... --- CMakeLists.txt | 6 ++++-- src/CMakeLists.txt | 7 ++++--- src/da/CMakeLists.txt | 16 ---------------- src/da/main.c | 10 ---------- src/dad/CMakeLists.txt | 16 ++++++++++++++++ src/dad/main.c | 10 ++++++++++ src/ipcp/CMakeLists.txt | 16 ---------------- src/ipcp/main.c | 10 ---------- src/ipcpd/CMakeLists.txt | 16 ++++++++++++++++ src/ipcpd/main.c | 10 ++++++++++ src/irm/CMakeLists.txt | 16 ---------------- src/irm/main.c | 10 ---------- src/irmd/CMakeLists.txt | 16 ++++++++++++++++ src/irmd/main.c | 10 ++++++++++ src/tools/CMakeLists.txt | 1 + src/tools/irm/CMakeLists.txt | 16 ++++++++++++++++ src/tools/irm/main.c | 32 ++++++++++++++++++++++++++++++++ 17 files changed, 135 insertions(+), 83 deletions(-) delete mode 100644 src/da/CMakeLists.txt delete mode 100644 src/da/main.c create mode 100644 src/dad/CMakeLists.txt create mode 100644 src/dad/main.c delete mode 100644 src/ipcp/CMakeLists.txt delete mode 100644 src/ipcp/main.c create mode 100644 src/ipcpd/CMakeLists.txt create mode 100644 src/ipcpd/main.c delete mode 100644 src/irm/CMakeLists.txt delete mode 100644 src/irm/main.c create mode 100644 src/irmd/CMakeLists.txt create mode 100644 src/irmd/main.c create mode 100644 src/tools/CMakeLists.txt create mode 100644 src/tools/irm/CMakeLists.txt create mode 100644 src/tools/irm/main.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 6685dc2f..1ca05c95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,11 +46,13 @@ add_subdirectory(include) add_subdirectory(src) add_subdirectory(tests) +# We may have to move this to the subdirs include(MacroAddCompileFlags) if (CMAKE_BUILD_TYPE MATCHES Debug) - MACRO_ADD_COMPILE_FLAGS(ipcp -DCONFIG_OUROBOROS_DEBUG) + MACRO_ADD_COMPILE_FLAGS(ipcpd -DCONFIG_OUROBOROS_DEBUG) + MACRO_ADD_COMPILE_FLAGS(irmd -DCONFIG_OUROBOROS_DEBUG) + MACRO_ADD_COMPILE_FLAGS(dad -DCONFIG_OUROBOROS_DEBUG) MACRO_ADD_COMPILE_FLAGS(irm -DCONFIG_OUROBOROS_DEBUG) - MACRO_ADD_COMPILE_FLAGS(da -DCONFIG_OUROBOROS_DEBUG) endif (CMAKE_BUILD_TYPE MATCHES Debug) include(FeatureSummary) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ca434d8a..b0732f08 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,5 @@ -add_subdirectory(ipcp) -add_subdirectory(irm) -add_subdirectory(da) +add_subdirectory(ipcpd) +add_subdirectory(irmd) +add_subdirectory(dad) add_subdirectory(lib) +add_subdirectory(tools) diff --git a/src/da/CMakeLists.txt b/src/da/CMakeLists.txt deleted file mode 100644 index 050b0f80..00000000 --- a/src/da/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) - -include_directories(${CMAKE_SOURCE_DIR}/include) -include_directories(${CMAKE_BINARY_DIR}/include) - -set(SOURCE_FILES - # Add source files here - main.c -) - -add_executable (da ${SOURCE_FILES}) - -target_link_libraries (da LINK_PUBLIC ouroboros) - -install(TARGETS da RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}) diff --git a/src/da/main.c b/src/da/main.c deleted file mode 100644 index e2971dca..00000000 --- a/src/da/main.c +++ /dev/null @@ -1,10 +0,0 @@ -#define OUROBOROS_PREFIX "da" - -#include - -int main() -{ - LOG_DBG("Test of the DA"); - - return 0; -} diff --git a/src/dad/CMakeLists.txt b/src/dad/CMakeLists.txt new file mode 100644 index 00000000..3d4b8ea7 --- /dev/null +++ b/src/dad/CMakeLists.txt @@ -0,0 +1,16 @@ +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +include_directories(${CMAKE_SOURCE_DIR}/include) +include_directories(${CMAKE_BINARY_DIR}/include) + +set(SOURCE_FILES + # Add source files here + main.c +) + +add_executable (dad ${SOURCE_FILES}) + +target_link_libraries (dad LINK_PUBLIC ouroboros) + +install(TARGETS dad RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}) diff --git a/src/dad/main.c b/src/dad/main.c new file mode 100644 index 00000000..e2971dca --- /dev/null +++ b/src/dad/main.c @@ -0,0 +1,10 @@ +#define OUROBOROS_PREFIX "da" + +#include + +int main() +{ + LOG_DBG("Test of the DA"); + + return 0; +} diff --git a/src/ipcp/CMakeLists.txt b/src/ipcp/CMakeLists.txt deleted file mode 100644 index 845f5b7b..00000000 --- a/src/ipcp/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) - -include_directories(${CMAKE_SOURCE_DIR}/include) -include_directories(${CMAKE_BINARY_DIR}/include) - -set(SOURCE_FILES - # Add source files here - main.c -) - -add_executable (ipcp ${SOURCE_FILES}) - -target_link_libraries (ipcp LINK_PUBLIC ouroboros) - -install(TARGETS ipcp RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}) diff --git a/src/ipcp/main.c b/src/ipcp/main.c deleted file mode 100644 index b67b0af9..00000000 --- a/src/ipcp/main.c +++ /dev/null @@ -1,10 +0,0 @@ -#define OUROBOROS_PREFIX "ipcp" - -#include - -int main() -{ - LOG_DBG("Test of the IPCP"); - - return 0; -} diff --git a/src/ipcpd/CMakeLists.txt b/src/ipcpd/CMakeLists.txt new file mode 100644 index 00000000..b16413cc --- /dev/null +++ b/src/ipcpd/CMakeLists.txt @@ -0,0 +1,16 @@ +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +include_directories(${CMAKE_SOURCE_DIR}/include) +include_directories(${CMAKE_BINARY_DIR}/include) + +set(SOURCE_FILES + # Add source files here + main.c +) + +add_executable (ipcpd ${SOURCE_FILES}) + +target_link_libraries (ipcpd LINK_PUBLIC ouroboros) + +install(TARGETS ipcpd RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}) diff --git a/src/ipcpd/main.c b/src/ipcpd/main.c new file mode 100644 index 00000000..b67b0af9 --- /dev/null +++ b/src/ipcpd/main.c @@ -0,0 +1,10 @@ +#define OUROBOROS_PREFIX "ipcp" + +#include + +int main() +{ + LOG_DBG("Test of the IPCP"); + + return 0; +} diff --git a/src/irm/CMakeLists.txt b/src/irm/CMakeLists.txt deleted file mode 100644 index 82c73e38..00000000 --- a/src/irm/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) - -include_directories(${CMAKE_SOURCE_DIR}/include) -include_directories(${CMAKE_BINARY_DIR}/include) - -set(SOURCE_FILES - # Add source files here - main.c -) - -add_executable (irm ${SOURCE_FILES}) - -target_link_libraries (irm LINK_PUBLIC ouroboros) - -install(TARGETS irm RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}) diff --git a/src/irm/main.c b/src/irm/main.c deleted file mode 100644 index 8ab071e0..00000000 --- a/src/irm/main.c +++ /dev/null @@ -1,10 +0,0 @@ -#define OUROBOROS_PREFIX "irm" - -#include - -int main() -{ - LOG_DBG("Test of the IRM"); - - return 0; -} diff --git a/src/irmd/CMakeLists.txt b/src/irmd/CMakeLists.txt new file mode 100644 index 00000000..bda793b7 --- /dev/null +++ b/src/irmd/CMakeLists.txt @@ -0,0 +1,16 @@ +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +include_directories(${CMAKE_SOURCE_DIR}/include) +include_directories(${CMAKE_BINARY_DIR}/include) + +set(SOURCE_FILES + # Add source files here + main.c +) + +add_executable (irmd ${SOURCE_FILES}) + +target_link_libraries (irmd LINK_PUBLIC ouroboros) + +install(TARGETS irmd RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}) diff --git a/src/irmd/main.c b/src/irmd/main.c new file mode 100644 index 00000000..8ab071e0 --- /dev/null +++ b/src/irmd/main.c @@ -0,0 +1,10 @@ +#define OUROBOROS_PREFIX "irm" + +#include + +int main() +{ + LOG_DBG("Test of the IRM"); + + return 0; +} diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt new file mode 100644 index 00000000..6e00c17b --- /dev/null +++ b/src/tools/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(irm) diff --git a/src/tools/irm/CMakeLists.txt b/src/tools/irm/CMakeLists.txt new file mode 100644 index 00000000..82c73e38 --- /dev/null +++ b/src/tools/irm/CMakeLists.txt @@ -0,0 +1,16 @@ +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +include_directories(${CMAKE_SOURCE_DIR}/include) +include_directories(${CMAKE_BINARY_DIR}/include) + +set(SOURCE_FILES + # Add source files here + main.c +) + +add_executable (irm ${SOURCE_FILES}) + +target_link_libraries (irm LINK_PUBLIC ouroboros) + +install(TARGETS irm RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}) diff --git a/src/tools/irm/main.c b/src/tools/irm/main.c new file mode 100644 index 00000000..bad1000e --- /dev/null +++ b/src/tools/irm/main.c @@ -0,0 +1,32 @@ +/* + * Ouroboros - Copyright (C) 2016 + * + * A tool to instruct the IRM + * + * Sander Vrijders + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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. + * + * 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. + */ + +#define OUROBOROS_PREFIX "irm" + +#include + +int main () { + + LOG_DBG("Test of the IRM tool"); + + return 0; +} -- cgit v1.2.3 From bc7bd364545f21b3b8522d5e7eabb9faa846845d Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Mon, 22 Feb 2016 17:36:10 +0100 Subject: include: Fix common includes common.h will now include stdbool and several other useful includes (size_t for instance). --- include/ouroboros/common.h | 2 ++ src/lib/CMakeLists.txt | 1 + src/lib/bitmap.c | 1 - 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/ouroboros/common.h b/include/ouroboros/common.h index f2be815f..90431208 100644 --- a/include/ouroboros/common.h +++ b/include/ouroboros/common.h @@ -24,6 +24,8 @@ #define OUROBOROS_COMMON_H #include +#include +#include typedef uint32_t port_id_t; diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 5c0e6bbe..11183716 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -8,6 +8,7 @@ set(SOURCE_FILES # Add source files here bitmap.c cdap.c + irm.c ) add_library(ouroboros SHARED ${SOURCE_FILES}) diff --git a/src/lib/bitmap.c b/src/lib/bitmap.c index 3e1ba049..cb414e7f 100644 --- a/src/lib/bitmap.c +++ b/src/lib/bitmap.c @@ -22,7 +22,6 @@ */ #include -#include #include #include #include -- cgit v1.2.3 From 59ee34ef5650c415a6a747afb816964378d17b36 Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Mon, 22 Feb 2016 18:02:27 +0100 Subject: lib: Remove irm.c from CMakeLists.txt This removes the source file irm.c from CMakeLists.txt, as it is not yet in the repo. --- src/lib/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 11183716..5c0e6bbe 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -8,7 +8,6 @@ set(SOURCE_FILES # Add source files here bitmap.c cdap.c - irm.c ) add_library(ouroboros SHARED ${SOURCE_FILES}) -- cgit v1.2.3