diff --git a/config.h b/config.h index b425ce9c2..3f9b62cca 100644 --- a/config.h +++ b/config.h @@ -10,8 +10,7 @@ * Unauthorized copying of this file, via any medium is strictly prohibited. *********************************************************************************/ -#ifndef _CONFIG_H_ -#define _CONFIG_H_ +#pragma once #ifndef _GIT_REV #define _GIT_REV "nogit" @@ -70,5 +69,3 @@ struct settings { int debug; /**< Debug log level */ double stats; /**< Interval for path statistics. Set to 0 to disable themo disable them. */ }; - -#endif /* _CONFIG_H_ */ diff --git a/include/villas/advio.h b/include/villas/advio.h index 99897873a..b4ab47bcc 100644 --- a/include/villas/advio.h +++ b/include/villas/advio.h @@ -2,8 +2,7 @@ * */ -#ifndef _ADVIO_H_ -#define _ADVIO_H_ +#pragma once #include @@ -40,6 +39,4 @@ int afflush(AFILE *file); #define afeof(af) feof(af->file) size_t afread(void *restrict ptr, size_t size, size_t nitems, AFILE *restrict stream); -size_t afwrite(const void *restrict ptr, size_t size, size_t nitems, AFILE *restrict stream); - -#endif /* _ADVIO_H_ */ \ No newline at end of file +size_t afwrite(const void *restrict ptr, size_t size, size_t nitems, AFILE *restrict stream); \ No newline at end of file diff --git a/include/villas/cfg.h b/include/villas/cfg.h index 9d8dcea75..2065d6d95 100644 --- a/include/villas/cfg.h +++ b/include/villas/cfg.h @@ -11,8 +11,7 @@ * Unauthorized copying of this file, via any medium is strictly prohibited. *********************************************************************************/ -#ifndef _CFG_H_ -#define _CFG_H_ +#pragma once #include @@ -106,6 +105,4 @@ int cfg_parse_hook(config_setting_t *cfg, struct list *list); * @retval 0 Success. Everything went well. * @retval <0 Error. Something went wrong. */ -int cfg_parse_node(config_setting_t *cfg, struct list *nodes, struct settings *set); - -#endif /* _CFG_H_ */ +int cfg_parse_node(config_setting_t *cfg, struct list *nodes, struct cfg *set); \ No newline at end of file diff --git a/include/villas/hist.h b/include/villas/hist.h index 72b232a21..fefd3a728 100644 --- a/include/villas/hist.h +++ b/include/villas/hist.h @@ -7,8 +7,7 @@ * Unauthorized copying of this file, via any medium is strictly prohibited. *********************************************************************************/ -#ifndef _HIST_H_ -#define _HIST_H_ +#pragma once #include @@ -75,6 +74,4 @@ void hist_plot(struct hist *h); char * hist_dump(struct hist *h); /** Prints Matlab struct containing all infos to file. */ -void hist_matlab(struct hist *h, FILE *f); - -#endif /* _HIST_H_ */ +void hist_matlab(struct hist *h, FILE *f); \ No newline at end of file diff --git a/include/villas/kernel/if.h b/include/villas/kernel/if.h index 6099b0280..8317270d7 100644 --- a/include/villas/kernel/if.h +++ b/include/villas/kernel/if.h @@ -10,8 +10,7 @@ * Unauthorized copying of this file, via any medium is strictly prohibited. *********************************************************************************/ -#ifndef _KERNEL_IF_H_ -#define _KERNEL_IF_H_ +#pragma once #include #include @@ -104,6 +103,4 @@ int if_get_irqs(struct interface *i); * @retval 0 Success. Everything went well. * @retval <0 Error. Something went wrong. */ -int if_set_affinity(struct interface *i, int affinity); - -#endif /* _KERNEL_IF_H_ */ +int if_set_affinity(struct interface *i, int affinity); \ No newline at end of file diff --git a/include/villas/kernel/kernel.h b/include/villas/kernel/kernel.h index 86d99406d..b8bf1351d 100644 --- a/include/villas/kernel/kernel.h +++ b/include/villas/kernel/kernel.h @@ -7,8 +7,7 @@ * Unauthorized copying of this file, via any medium is strictly prohibited. *********************************************************************************/ -#ifndef _KERNEL_KERNEL_H_ -#define _KERNEL_KERNEL_H_ +#pragma once #include @@ -67,6 +66,4 @@ int kernel_module_set_param(const char *module, const char *param, const char *v int kernel_get_cacheline_size(); /** Set SMP affinity of IRQ */ -int kernel_irq_setaffinity(unsigned irq, uintmax_t new, uintmax_t *old); - -#endif /* _KERNEL_KERNEL_H_ */ +int kernel_irq_setaffinity(unsigned irq, uintmax_t new, uintmax_t *old); \ No newline at end of file diff --git a/include/villas/kernel/nl.h b/include/villas/kernel/nl.h index 1e7593626..4a3e32f4a 100644 --- a/include/villas/kernel/nl.h +++ b/include/villas/kernel/nl.h @@ -7,8 +7,7 @@ * Unauthorized copying of this file, via any medium is strictly prohibited. *********************************************************************************/ -#ifndef _KERNEL_NL_H_ -#define _KERNEL_NL_H_ +#pragma once #include #include @@ -25,6 +24,4 @@ int nl_get_egress(struct nl_addr *addr); struct nl_sock * nl_init(); /** Close and free global netlink socket. */ -void nl_shutdown(); - -#endif /* _KERNEL_NL_H_ */ \ No newline at end of file +void nl_shutdown(); \ No newline at end of file diff --git a/include/villas/kernel/pci.h b/include/villas/kernel/pci.h index acb0bab39..ae4e6417a 100644 --- a/include/villas/kernel/pci.h +++ b/include/villas/kernel/pci.h @@ -7,8 +7,7 @@ * Unauthorized copying of this file, via any medium is strictly prohibited. **********************************************************************************/ -#ifndef _KERNEL_PCI_H_ -#define _KERNEL_PCI_H_ +#pragma once #include "list.h" @@ -62,6 +61,4 @@ struct pci_dev * pci_lookup_device(struct pci *p, struct pci_dev *filter); int pci_attach_driver(struct pci_dev *d, const char *driver); /** Return the IOMMU group of this PCI device or -1 if the device is not in a group. */ -int pci_get_iommu_group(struct pci_dev *d); - -#endif /* _KERNEL_PCI_H_ */ \ No newline at end of file +int pci_get_iommu_group(struct pci_dev *d); \ No newline at end of file diff --git a/include/villas/kernel/rt.h b/include/villas/kernel/rt.h index dc6d0ae77..c4b5cd2bf 100644 --- a/include/villas/kernel/rt.h +++ b/include/villas/kernel/rt.h @@ -7,9 +7,7 @@ * Unauthorized copying of this file, via any medium is strictly prohibited. *********************************************************************************/ -#ifndef _KERNEL_RT_H_ -#define _KERNEL_RT_H_ +#pragma once int rt_init(int affinity, int priority); -#endif /* _KERNEL_RT_H_ */ \ No newline at end of file diff --git a/include/villas/kernel/tc.h b/include/villas/kernel/tc.h index 147e7dc80..48fdc67af 100644 --- a/include/villas/kernel/tc.h +++ b/include/villas/kernel/tc.h @@ -12,8 +12,7 @@ * Unauthorized copying of this file, via any medium is strictly prohibited. *********************************************************************************/ -#ifndef _KERNEL_TC_H_ -#define _KERNEL_TC_H_ +#pragma once #include @@ -82,6 +81,4 @@ int tc_netem(struct interface *i, struct rtnl_qdisc **qd, tc_hdl_t handle, tc_hd * @retval 0 Success. Everything went well. * @retval <0 Error. Something went wrong. */ -int tc_mark(struct interface *i, struct rtnl_cls **cls, tc_hdl_t flowid, uint32_t mark); - -#endif /* _TC_H_ */ +int tc_mark(struct interface *i, struct rtnl_cls **cls, tc_hdl_t flowid, uint32_t mark); \ No newline at end of file diff --git a/include/villas/kernel/vfio.h b/include/villas/kernel/vfio.h index 928f518cb..b03a5c4a4 100644 --- a/include/villas/kernel/vfio.h +++ b/include/villas/kernel/vfio.h @@ -7,8 +7,7 @@ * Unauthorized copying of this file, via any medium is strictly prohibited. *********************************************************************************/ -#ifndef _KERNEL_VFIO_H_ -#define _KERNEL_VFIO_H_ +#pragma once #include #include @@ -108,6 +107,4 @@ int vfio_map_dma(struct vfio_container *c, struct dma_mem *mem); int vfio_unmap_dma(struct vfio_container *c, struct dma_mem *mem); /** munmap() a region which has been mapped by vfio_map_region() */ -int vfio_unmap_region(struct vfio_dev *d, int idx); - -#endif /* _KERNEL_VFIO_H_ */ +int vfio_unmap_region(struct vfio_dev *d, int idx); \ No newline at end of file diff --git a/include/villas/list.h b/include/villas/list.h index 4487ad10c..2e3e5ec6c 100644 --- a/include/villas/list.h +++ b/include/villas/list.h @@ -13,8 +13,7 @@ * Unauthorized copying of this file, via any medium is strictly prohibited. *********************************************************************************/ -#ifndef _LIST_H_ -#define _LIST_H_ +#pragma once #include #include @@ -97,6 +96,4 @@ int list_count(struct list *l, cmp_cb_t cmp, void *ctx); int list_contains(struct list *l, void *p); /** Sort the list using the quicksort algorithm of libc */ -void list_sort(struct list *l, cmp_cb_t cmp); - -#endif /* _LIST_H_ */ +void list_sort(struct list *l, cmp_cb_t cmp); \ No newline at end of file diff --git a/include/villas/log.h b/include/villas/log.h index dbd7bda46..1fa7ead85 100644 --- a/include/villas/log.h +++ b/include/villas/log.h @@ -7,8 +7,7 @@ * Unauthorized copying of this file, via any medium is strictly prohibited. *********************************************************************************/ -#ifndef _LOG_H_ -#define _LOG_H_ +#pragma once #include #include @@ -121,7 +120,4 @@ void serror(const char *fmt, ...) /** Print configuration error and exit. */ void cerror(config_setting_t *cfg, const char *fmt, ...) - __attribute__ ((format(printf, 2, 3))); - -#endif /* _LOG_H_ */ - + __attribute__ ((format(printf, 2, 3))); \ No newline at end of file diff --git a/include/villas/memory.h b/include/villas/memory.h index f6e3064f5..4890b490a 100644 --- a/include/villas/memory.h +++ b/include/villas/memory.h @@ -10,8 +10,7 @@ #include #include -#ifndef _MEMORY_H_ -#define _MEMORY_H_ +#pragma once #define HUGEPAGESIZE (1 << 21) @@ -56,6 +55,4 @@ void * memory_alloc_aligned(const struct memtype *m, size_t len, size_t alignmen int memory_free(const struct memtype *m, void *ptr, size_t len); extern const struct memtype memtype_heap; -extern const struct memtype memtype_hugepage; - -#endif /* _MEMORY_H_ */ \ No newline at end of file +extern const struct memtype memtype_hugepage; \ No newline at end of file diff --git a/include/villas/msg.h b/include/villas/msg.h index 2fb032f8c..7916e8c28 100644 --- a/include/villas/msg.h +++ b/include/villas/msg.h @@ -7,8 +7,7 @@ * Unauthorized copying of this file, via any medium is strictly prohibited. *********************************************************************************/ -#ifndef _MSG_H_ -#define _MSG_H_ +#pragma once #include @@ -37,6 +36,4 @@ void msg_hdr_swap(struct msg *m); * @retval 0 The message header is valid. * @retval <0 The message header is invalid. */ -int msg_verify(struct msg *m); - -#endif /* _MSG_H_ */ +int msg_verify(struct msg *m); \ No newline at end of file diff --git a/include/villas/msg_format.h b/include/villas/msg_format.h index 5e9e2bccc..5d1be6e8d 100644 --- a/include/villas/msg_format.h +++ b/include/villas/msg_format.h @@ -7,8 +7,7 @@ * Unauthorized copying of this file, via any medium is strictly prohibited. *********************************************************************************/ -#ifndef _MSG_FORMAT_H_ -#define _MSG_FORMAT_H_ +#pragma once #include @@ -95,6 +94,4 @@ struct msg float f; /**< Floating point values (note msg::endian) */ uint32_t i; /**< Integer values (note msg::endian) */ } data[]; -} __attribute__((packed)); - -#endif /* _MSG_FORMAT_H_ */ +} __attribute__((packed)); \ No newline at end of file diff --git a/include/villas/node.h b/include/villas/node.h index f237f6866..af24a35cb 100644 --- a/include/villas/node.h +++ b/include/villas/node.h @@ -10,8 +10,7 @@ * @{ *********************************************************************************/ -#ifndef _NODE_H_ -#define _NODE_H_ +#pragma once #include #include @@ -250,4 +249,4 @@ int node_read(struct node *n, struct sample *smps[], unsigned cnt); int node_write(struct node *n, struct sample *smps[], unsigned cnt); -#endif /** _NODE_H_ @} */ +/** @} */ diff --git a/include/villas/nodes/cbuilder.h b/include/villas/nodes/cbuilder.h index c2364e018..817b52362 100644 --- a/include/villas/nodes/cbuilder.h +++ b/include/villas/nodes/cbuilder.h @@ -12,8 +12,7 @@ * @{ *********************************************************************************/ -#ifndef _NODES_CBUILDER_H_ -#define _NODES_CBUILDER_H_ +#pragma once #include @@ -52,4 +51,4 @@ struct cbuilder { pthread_cond_t cv; }; -#endif /** _NODES_CBUILDER_H_ @} */ \ No newline at end of file +/** @} */ \ No newline at end of file diff --git a/include/villas/nodes/file.h b/include/villas/nodes/file.h index 70e0e5e7b..64febba1b 100644 --- a/include/villas/nodes/file.h +++ b/include/villas/nodes/file.h @@ -15,8 +15,7 @@ *********************************************************************************/ -#ifndef _NODES_FILE_H_ -#define _NODES_FILE_H_ +#pragma once #include "node.h" @@ -73,4 +72,4 @@ int file_read(struct node *n, struct sample *smps[], unsigned cnt); /** @see node_vtable::write */ int file_write(struct node *n, struct sample *smps[], unsigned cnt); -#endif /** _NODES_FILE_H_ @} */ +/** @} */ diff --git a/include/villas/nodes/fpga.h b/include/villas/nodes/fpga.h index 752d0b57c..5685f654d 100644 --- a/include/villas/nodes/fpga.h +++ b/include/villas/nodes/fpga.h @@ -14,44 +14,22 @@ * @{ *********************************************************************************/ -#ifndef _NODES_FPGA_H_ -#define _NODES_FPGA_H_ +#pragma once #include "kernel/vfio.h" #include "kernel/pci.h" -#include "fpga/dma.h" -#include "fpga/ip.h" -#include "fpga/intc.h" +#include "fpga/ips/dma.h" #include "node.h" #include "list.h" +/* Forward declarations */ +struct fpga_ip; + +/** The node type */ struct fpga { - struct pci_dev filter; /**< Filter for PCI device. */ - struct vfio_dev vd; /**< VFIO device handle. */ - - int do_reset; /**< Reset VILLASfpga during startup? */ - int affinity; /**< Affinity for MSI interrupts */ - - struct list ips; /**< List of IP components on FPGA. */ - - char *map; /**< PCI BAR0 mapping for register access */ - - size_t maplen; - size_t dmalen; - - /* Some IP cores are special and referenced here */ - struct ip *intc; - struct ip *reset; - struct ip *sw; - - config_setting_t *cfg; -}; - -struct fpga_dm { - struct ip *ip; - const char *ip_name; + struct fpga_ip *ip; int use_irqs; @@ -61,8 +39,6 @@ struct fpga_dm { FPGA_DM_DMA, FPGA_DM_FIFO } type; - - struct fpga *card; }; /** @see node_vtable::init */ @@ -75,7 +51,7 @@ int fpga_deinit(); int fpga_parse(struct node *n, config_setting_t *cfg); /** Parse the 'fpga' section in the configuration file */ -int fpga_parse_card(struct fpga *v, int argc, char * argv[], config_setting_t *cfg); +int fpga_parse_cards(config_setting_t *cfg); /** @see node_vtable::print */ char * fpga_print(struct node *n); @@ -101,4 +77,4 @@ int fpga_reset(struct fpga *f); /** Dump some details about the fpga card */ void fpga_dump(struct fpga *f); -#endif /** _NODES_FPGA_H_ @} */ +/** @} */ diff --git a/include/villas/nodes/ngsi.h b/include/villas/nodes/ngsi.h index f40b5a257..9a184e690 100644 --- a/include/villas/nodes/ngsi.h +++ b/include/villas/nodes/ngsi.h @@ -18,8 +18,7 @@ * @{ **********************************************************************************/ -#ifndef _NODES_NGSI_H_ -#define _NODES_NGSI_H_ +#pragma once #include #include @@ -81,4 +80,4 @@ int ngsi_read(struct node *n, struct sample *smps[], unsigned cnt); /** @see node_vtable::write */ int ngsi_write(struct node *n, struct sample *smps[], unsigned cnt); -#endif /** _NODES_NGSI_H_ @} */ \ No newline at end of file +/** @} */ \ No newline at end of file diff --git a/include/villas/nodes/opal.h b/include/villas/nodes/opal.h index dd3a5b704..5f2db6aea 100644 --- a/include/villas/nodes/opal.h +++ b/include/villas/nodes/opal.h @@ -14,8 +14,7 @@ * @{ **********************************************************************************/ -#ifndef _NODES_OPAL_H_ -#define _NODES_OPAL_H_ +#pragma once #include @@ -73,4 +72,4 @@ int opal_read(struct node *n, struct sample *smps[], unsigned cnt); /** @see node_vtable::write */ int opal_write(struct node *n, struct sample *smps[], unsigned cnt); -#endif /** _NODES_OPAL_H_ @} */ +/** @} */ \ No newline at end of file diff --git a/include/villas/nodes/socket.h b/include/villas/nodes/socket.h index 00a80d7b9..948301b0c 100644 --- a/include/villas/nodes/socket.h +++ b/include/villas/nodes/socket.h @@ -14,8 +14,7 @@ * @{ *********************************************************************************/ -#ifndef _NODES_SOCKET_H_ -#define _NODES_SOCKET_H_ +#pragma once #include #include @@ -109,4 +108,4 @@ char * socket_print_addr(struct sockaddr *saddr); */ int socket_parse_addr(const char *str, struct sockaddr *sa, enum socket_layer layer, int flags); -#endif /** _NODES_SOCKET_H_ @} */ +/** @} */ \ No newline at end of file diff --git a/include/villas/nodes/websocket.h b/include/villas/nodes/websocket.h index a0bacdcc2..4017230c3 100644 --- a/include/villas/nodes/websocket.h +++ b/include/villas/nodes/websocket.h @@ -15,9 +15,7 @@ * @{ *********************************************************************************/ - -#ifndef _NODES_WEBSOCKET_H_ -#define _NODES_WEBSOCKET_H_ +#pragma once #include "node.h" #include "pool.h" @@ -63,6 +61,8 @@ struct websocket_connection { qptr_t received; }; +int websocket_protocol_cb(struct lws *wsi, enum lws_callback_reasons reason, void *user, void *in, size_t len); + /** @see node_vtable::init */ int websocket_init(int argc, char * argv[], config_setting_t *cfg); @@ -84,4 +84,4 @@ int websocket_read(struct node *n, struct sample *smps[], unsigned cnt); /** @see node_vtable::write */ int websocket_write(struct node *n, struct sample *smps[], unsigned cnt); -#endif /** _NODES_WEBSOCKET_H_ @} */ \ No newline at end of file +/** @} */ \ No newline at end of file diff --git a/include/villas/path.h b/include/villas/path.h index fb01e5d23..e09109a3e 100644 --- a/include/villas/path.h +++ b/include/villas/path.h @@ -12,8 +12,7 @@ * @{ *********************************************************************************/ -#ifndef _PATH_H_ -#define _PATH_H_ +#pragma once #include #include @@ -130,4 +129,4 @@ const char * path_name(struct path *p); /** Check if node is used as source or destination of a path. */ int path_uses_node(struct path *p, struct node *n); -#endif /** _PATH_H_ @} */ +/** @} */ \ No newline at end of file diff --git a/include/villas/plugin.h b/include/villas/plugin.h index 8c1c5a681..c67fe5b51 100644 --- a/include/villas/plugin.h +++ b/include/villas/plugin.h @@ -7,8 +7,7 @@ * Unauthorized copying of this file, via any medium is strictly prohibited. *********************************************************************************/ -#ifndef _PLUGIN_H_ -#define _PLUGIN_H_ +#pragma once #include "hooks.h" #include "api.h" @@ -67,5 +66,3 @@ int plugin_load(struct plugin *p); int plugin_unload(struct plugin *p); int plugin_destroy(struct plugin *p); - -#endif /* _PLUGIN_H_ */ \ No newline at end of file diff --git a/include/villas/pool.h b/include/villas/pool.h index 49f2f1c9a..a36e292db 100644 --- a/include/villas/pool.h +++ b/include/villas/pool.h @@ -9,8 +9,7 @@ * Unauthorized copying of this file, via any medium is strictly prohibited. */ -#ifndef _POOL_H_ -#define _POOL_H_ +#pragma once #include @@ -61,6 +60,4 @@ INLINE void * pool_get(struct pool *p) INLINE int pool_put(struct pool *p, void *buf) { return queue_push(&p->queue, buf); -} - -#endif /* _POOL_H_ */ \ No newline at end of file +} \ No newline at end of file diff --git a/include/villas/queue.h b/include/villas/queue.h index 40baf1f17..654ee4a49 100644 --- a/include/villas/queue.h +++ b/include/villas/queue.h @@ -31,9 +31,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _MPMC_QUEUE_H_ -#define _MPMC_QUEUE_H_ - #include #include @@ -82,6 +79,4 @@ int queue_pull(struct queue *q, void **ptr); int queue_push_many(struct queue *q, void *ptr[], size_t cnt); -int queue_pull_many(struct queue *q, void *ptr[], size_t cnt); - -#endif /* _MPMC_QUEUE_H_ */ \ No newline at end of file +int queue_pull_many(struct queue *q, void *ptr[], size_t cnt); \ No newline at end of file diff --git a/include/villas/sample.h b/include/villas/sample.h index ec58f8bd8..d3a349c22 100644 --- a/include/villas/sample.h +++ b/include/villas/sample.h @@ -7,8 +7,7 @@ * Unauthorized copying of this file, via any medium is strictly prohibited. */ -#ifndef _SAMPLE_H_ -#define _SAMPLE_H_ +#pragma once #include #include @@ -109,6 +108,4 @@ int sample_fprint(FILE *f, struct sample *s, int flags); * @retval 0 Success. Everything went well. * @retval <0 Error. Something went wrong. */ -int sample_fscan(FILE *f, struct sample *s, int *flags); - -#endif /* _SAMPLE_H_ */ \ No newline at end of file +int sample_fscan(FILE *f, struct sample *s, int *flags); \ No newline at end of file diff --git a/include/villas/timing.h b/include/villas/timing.h index 20b2e6baf..1d00de4e7 100644 --- a/include/villas/timing.h +++ b/include/villas/timing.h @@ -7,8 +7,7 @@ * Unauthorized copying of this file, via any medium is strictly prohibited. *********************************************************************************/ -#ifndef _TIME_H_ -#define _TIME_H_ +#pragma once #include #include @@ -52,6 +51,4 @@ double time_delta(struct timespec *start, struct timespec *end); double time_to_double(struct timespec *ts); /** Convert double containing seconds after 1970 to timespec. */ -struct timespec time_from_double(double secs); - -#endif /* _TIMING_H_ */ \ No newline at end of file +struct timespec time_from_double(double secs); \ No newline at end of file diff --git a/include/villas/utils.h b/include/villas/utils.h index c1e7328a8..ee5b5c43c 100644 --- a/include/villas/utils.h +++ b/include/villas/utils.h @@ -7,8 +7,7 @@ * Unauthorized copying of this file, via any medium is strictly prohibited. *********************************************************************************/ -#ifndef _UTILS_H_ -#define _UTILS_H_ +#pragma once #include #include @@ -239,6 +238,4 @@ static inline int log2i(long long x) { } /** Sleep with rdtsc */ -void rdtsc_sleep(uint64_t nanosecs, uint64_t start); - -#endif /* _UTILS_H_ */ \ No newline at end of file +void rdtsc_sleep(uint64_t nanosecs, uint64_t start); \ No newline at end of file