1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

use #pragma once instead of #ifdef

This commit is contained in:
Steffen Vogel 2017-02-16 09:04:12 -03:00
parent 098dd6f612
commit 7cab0538ab
31 changed files with 67 additions and 166 deletions

View file

@ -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_ */

View file

@ -2,8 +2,7 @@
*
*/
#ifndef _ADVIO_H_
#define _ADVIO_H_
#pragma once
#include <stdio.h>
@ -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_ */
size_t afwrite(const void *restrict ptr, size_t size, size_t nitems, AFILE *restrict stream);

View file

@ -11,8 +11,7 @@
* Unauthorized copying of this file, via any medium is strictly prohibited.
*********************************************************************************/
#ifndef _CFG_H_
#define _CFG_H_
#pragma once
#include <libconfig.h>
@ -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);

View file

@ -7,8 +7,7 @@
* Unauthorized copying of this file, via any medium is strictly prohibited.
*********************************************************************************/
#ifndef _HIST_H_
#define _HIST_H_
#pragma once
#include <stdio.h>
@ -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);

View file

@ -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 <sys/types.h>
#include <sys/socket.h>
@ -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);

View file

@ -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 <stdint.h>
@ -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);

View file

@ -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 <netlink/netlink.h>
#include <netlink/route/route.h>
@ -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_ */
void nl_shutdown();

View file

@ -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_ */
int pci_get_iommu_group(struct pci_dev *d);

View file

@ -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_ */

View file

@ -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 <stdint.h>
@ -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);

View file

@ -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 <stdbool.h>
#include <sys/mman.h>
@ -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);

View file

@ -13,8 +13,7 @@
* Unauthorized copying of this file, via any medium is strictly prohibited.
*********************************************************************************/
#ifndef _LIST_H_
#define _LIST_H_
#pragma once
#include <stdbool.h>
#include <pthread.h>
@ -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);

View file

@ -7,8 +7,7 @@
* Unauthorized copying of this file, via any medium is strictly prohibited.
*********************************************************************************/
#ifndef _LOG_H_
#define _LOG_H_
#pragma once
#include <stdarg.h>
#include <libconfig.h>
@ -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)));

View file

@ -10,8 +10,7 @@
#include <stddef.h>
#include <stdint.h>
#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_ */
extern const struct memtype memtype_hugepage;

View file

@ -7,8 +7,7 @@
* Unauthorized copying of this file, via any medium is strictly prohibited.
*********************************************************************************/
#ifndef _MSG_H_
#define _MSG_H_
#pragma once
#include <stdio.h>
@ -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);

View file

@ -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 <stdint.h>
@ -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));

View file

@ -10,8 +10,7 @@
* @{
*********************************************************************************/
#ifndef _NODE_H_
#define _NODE_H_
#pragma once
#include <sys/socket.h>
#include <netinet/in.h>
@ -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_ @} */
/** @} */

View file

@ -12,8 +12,7 @@
* @{
*********************************************************************************/
#ifndef _NODES_CBUILDER_H_
#define _NODES_CBUILDER_H_
#pragma once
#include <pthread.h>
@ -52,4 +51,4 @@ struct cbuilder {
pthread_cond_t cv;
};
#endif /** _NODES_CBUILDER_H_ @} */
/** @} */

View file

@ -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_ @} */
/** @} */

View file

@ -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_ @} */
/** @} */

View file

@ -18,8 +18,7 @@
* @{
**********************************************************************************/
#ifndef _NODES_NGSI_H_
#define _NODES_NGSI_H_
#pragma once
#include <curl/curl.h>
#include <jansson.h>
@ -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_ @} */
/** @} */

View file

@ -14,8 +14,7 @@
* @{
**********************************************************************************/
#ifndef _NODES_OPAL_H_
#define _NODES_OPAL_H_
#pragma once
#include <pthread.h>
@ -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_ @} */
/** @} */

View file

@ -14,8 +14,7 @@
* @{
*********************************************************************************/
#ifndef _NODES_SOCKET_H_
#define _NODES_SOCKET_H_
#pragma once
#include <sys/socket.h>
#include <linux/if_packet.h>
@ -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_ @} */
/** @} */

View file

@ -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_ @} */
/** @} */

View file

@ -12,8 +12,7 @@
* @{
*********************************************************************************/
#ifndef _PATH_H_
#define _PATH_H_
#pragma once
#include <pthread.h>
#include <libconfig.h>
@ -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_ @} */
/** @} */

View file

@ -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_ */

View file

@ -9,8 +9,7 @@
* Unauthorized copying of this file, via any medium is strictly prohibited.
*/
#ifndef _POOL_H_
#define _POOL_H_
#pragma once
#include <sys/types.h>
@ -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_ */
}

View file

@ -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 <stdint.h>
#include <stdatomic.h>
@ -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_ */
int queue_pull_many(struct queue *q, void *ptr[], size_t cnt);

View file

@ -7,8 +7,7 @@
* Unauthorized copying of this file, via any medium is strictly prohibited.
*/
#ifndef _SAMPLE_H_
#define _SAMPLE_H_
#pragma once
#include <stdlib.h>
#include <stdio.h>
@ -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_ */
int sample_fscan(FILE *f, struct sample *s, int *flags);

View file

@ -7,8 +7,7 @@
* Unauthorized copying of this file, via any medium is strictly prohibited.
*********************************************************************************/
#ifndef _TIME_H_
#define _TIME_H_
#pragma once
#include <stdio.h>
#include <stdint.h>
@ -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_ */
struct timespec time_from_double(double secs);

View file

@ -7,8 +7,7 @@
* Unauthorized copying of this file, via any medium is strictly prohibited.
*********************************************************************************/
#ifndef _UTILS_H_
#define _UTILS_H_
#pragma once
#include <stdlib.h>
#include <stdint.h>
@ -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_ */
void rdtsc_sleep(uint64_t nanosecs, uint64_t start);