From 1d011e6d8f9501b4e7a620f6bca45bf6c54a37d1 Mon Sep 17 00:00:00 2001
From: Georg Reinke <georg.reinke@rwth-aachen.de>
Date: Thu, 8 Jun 2017 12:42:46 +0200
Subject: [PATCH] some include / format error fixes

---
 include/villas/fpga/card.h | 4 +++-
 lib/kernel/pci.c           | 2 +-
 lib/nodes/ngsi.c           | 6 +++---
 src/fpga-bench-overruns.c  | 5 +++++
 4 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/include/villas/fpga/card.h b/include/villas/fpga/card.h
index 5dcd7a0d9..ba2b3ce3f 100644
--- a/include/villas/fpga/card.h
+++ b/include/villas/fpga/card.h
@@ -32,6 +32,8 @@
 #include <libconfig.h>
 
 #include "common.h"
+#include "kernel/pci.h"
+#include "kernel/vfio.h"
 
 /* Forward declarations */
 struct fpga_ip;
@@ -92,4 +94,4 @@ void fpga_card_dump(struct fpga_card *c);
 /** Reset the FPGA to a known state */
 int fpga_card_reset(struct fpga_card *c);
 
-/** @} */
\ No newline at end of file
+/** @} */
diff --git a/lib/kernel/pci.c b/lib/kernel/pci.c
index f981201ad..2e6ddee2c 100644
--- a/lib/kernel/pci.c
+++ b/lib/kernel/pci.c
@@ -20,7 +20,7 @@ int pci_init(struct pci *p)
 	struct dirent *entry;
 	DIR *dp;
 	FILE *f;
-	char path[256];
+	char path[512];
 	int ret;
 
 	snprintf(path, sizeof(path), "%s/bus/pci/devices", SYSFS_PATH);
diff --git a/lib/nodes/ngsi.c b/lib/nodes/ngsi.c
index 0581e9e9d..e80f5bbf8 100644
--- a/lib/nodes/ngsi.c
+++ b/lib/nodes/ngsi.c
@@ -238,9 +238,9 @@ static int ngsi_parse_mapping(struct list *mapping, config_setting_t *cfg)
 		struct ngsi_metadata index = {
 			.name = "index",
 			.type = "integer",
-			.value = alloc(8)
+			.value = alloc(11)
 		};
-		snprintf(index.value, 8, "%u", j);
+		snprintf(index.value, 11, "%u", j);
 
 		list_push(&map.metadata, memdup(&index, sizeof(index)));
 		list_push(&map.metadata, memdup(&source, sizeof(source)));
@@ -600,4 +600,4 @@ static struct plugin p = {
 	}
 };
 
-REGISTER_PLUGIN(&p)
\ No newline at end of file
+REGISTER_PLUGIN(&p)
diff --git a/src/fpga-bench-overruns.c b/src/fpga-bench-overruns.c
index 4fc6b44f0..4e82a2dd5 100644
--- a/src/fpga-bench-overruns.c
+++ b/src/fpga-bench-overruns.c
@@ -7,6 +7,11 @@
 #include <stdio.h>
 #include <sys/utsname.h>
 
+#include <fpga/card.h>
+#include <fpga/ip.h>
+#include <fpga/ips/switch.h>
+#include <fpga/ips/intc.h>
+#include <utils.h>
 #include <villas/log.h>
 
 /* Some hard-coded configuration for the FPGA benchmarks */