[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cdi-devel] [PATCH] Add extern "C" to header files.



NOTE: This patch depends on the "Update cdi-osdep.h to contain OS-specific structs for PCI and DMA" commit.

Signed-off-by: Matthew Iselin <matthew@xxxxxxxxxxxxxx>
---
 include/cdi/bios.h    |    8 ++++++++
 include/cdi/cache.h   |    7 +++++++
 include/cdi/dma.h     |   13 ++++++++++---
 include/cdi/fs.h      |    7 ++++++-
 include/cdi/io.h      |    8 ++++++++
 include/cdi/lists.h   |    8 ++++++++
 include/cdi/misc.h    |    8 ++++++++
 include/cdi/net.h     |    8 ++++++++
 include/cdi/pci.h     |   11 +++++++++++
 include/cdi/scsi.h    |    8 ++++++++
 include/cdi/storage.h |    6 ++++++
 11 files changed, 88 insertions(+), 4 deletions(-)

diff --git a/include/cdi/bios.h b/include/cdi/bios.h
index 43ec828..461a6c5 100644
--- a/include/cdi/bios.h
+++ b/include/cdi/bios.h
@@ -47,6 +47,10 @@ struct cdi_bios_memory {
     uint16_t size;
 };
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * Ruft den BIOS-Interrupt 0x10 auf.
  * @param registers Pointer auf eine Register-Struktur. Diese wird beim Aufruf
@@ -59,5 +63,9 @@ struct cdi_bios_memory {
  */
 int cdi_bios_int10(struct cdi_bios_registers *registers, cdi_list_t memory);
 
+#ifdef __cplusplus
+}; // extern "C"
+#endif
+
 #endif
 
diff --git a/include/cdi/cache.h b/include/cdi/cache.h
index 4b9effd..d378599 100644
--- a/include/cdi/cache.h
+++ b/include/cdi/cache.h
@@ -40,6 +40,9 @@ typedef int (cdi_cache_read_block_t)(struct cdi_cache* cache, uint64_t block,
 typedef int (cdi_cache_write_block_t)(struct cdi_cache* cache, uint64_t block,
     size_t count, const void* src, void* prv);
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /**
  * Cache erstellen
@@ -108,4 +111,8 @@ void cdi_cache_block_release(struct cdi_cache* cache,
 void cdi_cache_block_dirty(struct cdi_cache* cache,
     struct cdi_cache_block* block);
 
+#ifdef __cplusplus
+}; // extern "C"
+#endif
+
 #endif
diff --git a/include/cdi/dma.h b/include/cdi/dma.h
index 24f53a8..8d50640 100644
--- a/include/cdi/dma.h
+++ b/include/cdi/dma.h
@@ -20,9 +20,8 @@ struct cdi_dma_handle {
     size_t      length;
     uint8_t     mode;
     void*       buffer;
-
-    // LOST-Implementation...
-    FILE*       file;
+    
+    cdi_dma_osdep meta;
 };
 
 // Geraet => Speicher
@@ -34,6 +33,10 @@ struct cdi_dma_handle {
 #define CDI_DMA_MODE_BLOCK          (2 << 6)
 
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * Initialisiert einen Transport per DMA
  *
@@ -63,5 +66,9 @@ int cdi_dma_write(struct cdi_dma_handle* handle);
  */
 int cdi_dma_close(struct cdi_dma_handle* handle);
 
+#ifdef __cplusplus
+}; // extern "C"
+#endif
+
 #endif
 
diff --git a/include/cdi/fs.h b/include/cdi/fs.h
index c898b08..c464d0d 100644
--- a/include/cdi/fs.h
+++ b/include/cdi/fs.h
@@ -617,7 +617,9 @@ struct cdi_fs_acl_entry_grp_str {
     char*                   group_name;
 };
 
-
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /**
  * Dateisystemtreiber-Struktur initialisieren
@@ -670,6 +672,9 @@ size_t cdi_fs_data_read(struct cdi_fs_filesystem* fs, uint64_t start,
 size_t cdi_fs_data_write(struct cdi_fs_filesystem* fs, uint64_t start,
     size_t size, const void* buffer);
 
+#ifdef __cplusplus
+}; // extern "C"
+#endif
 
 #endif
 
diff --git a/include/cdi/io.h b/include/cdi/io.h
index 64534f8..5b0cad5 100644
--- a/include/cdi/io.h
+++ b/include/cdi/io.h
@@ -13,6 +13,10 @@
 
 #include <stdint.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 static inline uint16_t cdi_inw(uint16_t _port)
 {
 	uint16_t result;
@@ -51,5 +55,9 @@ static inline void cdi_outl(uint16_t _port, uint32_t _data)
 	asm volatile ("outl %0, %1" : : "a"(_data), "Nd" (_port));
 }
 
+#ifdef __cplusplus
+}; // extern "C"
+#endif
+
 #endif
 
diff --git a/include/cdi/lists.h b/include/cdi/lists.h
index 9a3403c..53c3def 100644
--- a/include/cdi/lists.h
+++ b/include/cdi/lists.h
@@ -21,6 +21,10 @@
  */
 typedef struct cdi_list_implementation* cdi_list_t;
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** 
  * Erzeugt eine neue Liste 
  *
@@ -106,4 +110,8 @@ void* cdi_list_remove(cdi_list_t list, size_t index);
  */
 size_t cdi_list_size(cdi_list_t list);
 
+#ifdef __cplusplus
+}; // extern "C"
+#endif
+
 #endif
diff --git a/include/cdi/misc.h b/include/cdi/misc.h
index 2a130f6..2049c62 100644
--- a/include/cdi/misc.h
+++ b/include/cdi/misc.h
@@ -15,6 +15,10 @@
 
 #include "cdi.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * Registiert einen neuen IRQ-Handler.
  *
@@ -89,5 +93,9 @@ int cdi_ioports_free(uint16_t start, uint16_t count);
  */
 void cdi_sleep_ms(uint32_t ms);
 
+#ifdef __cplusplus
+}; // extern "C"
+#endif
+
 #endif
 
diff --git a/include/cdi/net.h b/include/cdi/net.h
index 89628bd..1fddab6 100644
--- a/include/cdi/net.h
+++ b/include/cdi/net.h
@@ -36,6 +36,10 @@ struct cdi_net_driver {
 };
 
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * Initialisiert die Datenstrukturen fuer einen Netzerktreiber
  * (erzeugt die devices-Liste)
@@ -60,6 +64,10 @@ void cdi_net_device_init(struct cdi_net_device* device);
 void cdi_net_receive(
     struct cdi_net_device* device, void* buffer, size_t size);
 
+#ifdef __cplusplus
+}; // extern "C"
+#endif
+
 #endif
 
 /*\@}*/
diff --git a/include/cdi/pci.h b/include/cdi/pci.h
index 8a9cc18..b5ab5c3 100644
--- a/include/cdi/pci.h
+++ b/include/cdi/pci.h
@@ -14,6 +14,7 @@
 #include <stdint.h>
 
 #include "cdi.h"
+#include "cdi-osdep.h"
 #include "cdi/lists.h"
 
 struct cdi_pci_device {
@@ -33,6 +34,8 @@ struct cdi_pci_device {
     uint8_t     irq;
 
     cdi_list_t resources;
+    
+    cdi_pci_device_osdep meta;
 };
 
 typedef enum {
@@ -49,6 +52,10 @@ struct cdi_pci_resource {
 };
 
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * Gibt alle PCI-Geraete im System zurueck. Die Geraete werden dazu
  * in die uebergebene Liste eingefuegt.
@@ -80,5 +87,9 @@ void cdi_pci_alloc_memory(struct cdi_pci_device* device);
  */
 void cdi_pci_free_memory(struct cdi_pci_device* device);
 
+#ifdef __cplusplus
+}; // extern "C"
+#endif
+
 #endif
 
diff --git a/include/cdi/scsi.h b/include/cdi/scsi.h
index 7b80975..6d12b91 100644
--- a/include/cdi/scsi.h
+++ b/include/cdi/scsi.h
@@ -74,6 +74,10 @@ struct cdi_scsi_driver {
         struct cdi_scsi_packet *packet);
 };
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * Ein SCSI-Paket allozieren
  *
@@ -112,6 +116,10 @@ void cdi_scsi_driver_register(struct cdi_scsi_driver* driver);
  */
 void cdi_scsi_device_init(struct cdi_scsi_device* device);
 
+#ifdef __cplusplus
+}; // extern "C"
+#endif
+
 #endif
 
 /*\@}*/
diff --git a/include/cdi/storage.h b/include/cdi/storage.h
index d19fc6f..4963b68 100644
--- a/include/cdi/storage.h
+++ b/include/cdi/storage.h
@@ -57,6 +57,9 @@ struct cdi_storage_driver {
         uint64_t count, void* buffer);
 };
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /**
  * Initialisiert die Datenstrukturen fuer einen Massenspeichertreiber
@@ -80,6 +83,9 @@ void cdi_storage_driver_register(struct cdi_storage_driver* driver);
  */
 void cdi_storage_device_init(struct cdi_storage_device* device);
 
+#ifdef __cplusplus
+}; // extern "C"
+#endif
 
 #endif
 
-- 
1.6.0.4