Commit 4d772390 authored by Kirill Smelkov's avatar Kirill Smelkov

*: Use `extern "C"` in all headers

We are going to add C++ parts to wendelin.core soon.
Mark all current functionality with `extern "C"` as a preparatory step.
parent 47507e63
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#define _WENDELIN_BIGFILE_FILE_H_ #define _WENDELIN_BIGFILE_FILE_H_
/* Wendelin.bigfile | Base file class /* Wendelin.bigfile | Base file class
* Copyright (C) 2014-2015 Nexedi SA and Contributors. * Copyright (C) 2014-2019 Nexedi SA and Contributors.
* Kirill Smelkov <kirr@nexedi.com> * Kirill Smelkov <kirr@nexedi.com>
* *
* This program is free software: you can Use, Study, Modify and Redistribute * This program is free software: you can Use, Study, Modify and Redistribute
...@@ -32,6 +32,10 @@ ...@@ -32,6 +32,10 @@
#include <stddef.h> #include <stddef.h>
#include <wendelin/bigfile/types.h> #include <wendelin/bigfile/types.h>
#ifdef __cplusplus
extern "C" {
#endif
/* BigFile base class /* BigFile base class
* *
...@@ -66,5 +70,8 @@ struct bigfile_ops { ...@@ -66,5 +70,8 @@ struct bigfile_ops {
void (*release) (BigFile *file); void (*release) (BigFile *file);
}; };
#ifdef __cplusplus
}
#endif
#endif #endif
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#define _WENDELIN_BIGFILE_PAGEMAP_H_ #define _WENDELIN_BIGFILE_PAGEMAP_H_
/* Wendelin.bigfile | Pgoffset -> page mapping /* Wendelin.bigfile | Pgoffset -> page mapping
* Copyright (C) 2014-2015 Nexedi SA and Contributors. * Copyright (C) 2014-2019 Nexedi SA and Contributors.
* Kirill Smelkov <kirr@nexedi.com> * Kirill Smelkov <kirr@nexedi.com>
* *
* This program is free software: you can Use, Study, Modify and Redistribute * This program is free software: you can Use, Study, Modify and Redistribute
...@@ -55,6 +55,10 @@ ...@@ -55,6 +55,10 @@
#include <wendelin/bigfile/types.h> #include <wendelin/bigfile/types.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct Page Page; typedef struct Page Page;
...@@ -247,5 +251,9 @@ void pagemap_clear(PageMap *pmap); ...@@ -247,5 +251,9 @@ void pagemap_clear(PageMap *pmap);
/* - also it can say break and break the whole pagemap */ \ /* - also it can say break and break the whole pagemap */ \
/* iteration */ /* iteration */
#ifdef __cplusplus
}
#endif
#endif #endif
...@@ -40,6 +40,10 @@ ...@@ -40,6 +40,10 @@
#include <wendelin/list.h> #include <wendelin/list.h>
#include <wendelin/bigfile/types.h> #include <wendelin/bigfile/types.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct RAMH RAMH; typedef struct RAMH RAMH;
typedef struct Page Page; typedef struct Page Page;
...@@ -195,4 +199,8 @@ struct ram_type { ...@@ -195,4 +199,8 @@ struct ram_type {
void ram_register_type(const struct ram_type *ram_type); void ram_register_type(const struct ram_type *ram_type);
#ifdef __cplusplus
}
#endif
#endif #endif
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#define _WENDELIN_BIGFILE_TYPES_H_ #define _WENDELIN_BIGFILE_TYPES_H_
/* Wendelin.bigfile | Basic types definition /* Wendelin.bigfile | Basic types definition
* Copyright (C) 2014-2015 Nexedi SA and Contributors. * Copyright (C) 2014-2019 Nexedi SA and Contributors.
* Kirill Smelkov <kirr@nexedi.com> * Kirill Smelkov <kirr@nexedi.com>
* *
* This program is free software: you can Use, Study, Modify and Redistribute * This program is free software: you can Use, Study, Modify and Redistribute
...@@ -24,7 +24,15 @@ ...@@ -24,7 +24,15 @@
#include <stdint.h> #include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef uint64_t pgoff_t; /* page # in file */ typedef uint64_t pgoff_t; /* page # in file */
typedef uint64_t blk_t; /* block # in file */ typedef uint64_t blk_t; /* block # in file */
#ifdef __cplusplus
}
#endif
#endif #endif
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#define _WENDELIN_BIGFILE_VIRTMEM_H_ #define _WENDELIN_BIGFILE_VIRTMEM_H_
/* Wendelin.bigfile | Virtual memory /* Wendelin.bigfile | Virtual memory
* Copyright (C) 2014-2015 Nexedi SA and Contributors. * Copyright (C) 2014-2019 Nexedi SA and Contributors.
* Kirill Smelkov <kirr@nexedi.com> * Kirill Smelkov <kirr@nexedi.com>
* *
* This program is free software: you can Use, Study, Modify and Redistribute * This program is free software: you can Use, Study, Modify and Redistribute
...@@ -37,6 +37,10 @@ ...@@ -37,6 +37,10 @@
#include <wendelin/bigfile/pagemap.h> #include <wendelin/bigfile/pagemap.h>
#include <ccan/bitmap/bitmap.h> // XXX can't forward-decl for bitmap #include <ccan/bitmap/bitmap.h> // XXX can't forward-decl for bitmap
#ifdef __cplusplus
extern "C" {
#endif
typedef struct RAM RAM; typedef struct RAM RAM;
typedef struct RAMH RAMH; typedef struct RAMH RAMH;
typedef struct Page Page; typedef struct Page Page;
...@@ -332,5 +336,8 @@ void virt_lock_hookgil(const VirtGilHooks *gilhooks); ...@@ -332,5 +336,8 @@ void virt_lock_hookgil(const VirtGilHooks *gilhooks);
/* what happens on out-of-memory */ /* what happens on out-of-memory */
void OOM(void); void OOM(void);
#ifdef __cplusplus
}
#endif
#endif #endif
...@@ -22,6 +22,10 @@ ...@@ -22,6 +22,10 @@
* See https://www.nexedi.com/licensing for rationale and options. * See https://www.nexedi.com/licensing for rationale and options.
*/ */
#ifdef __cplusplus
extern "C" {
#endif
// XXX maybe not needed - just go with std assert() // XXX maybe not needed - just go with std assert()
...@@ -71,4 +75,8 @@ void __bug_fail(const char *, const char *, unsigned, const char *) ...@@ -71,4 +75,8 @@ void __bug_fail(const char *, const char *, unsigned, const char *)
__attribute__((noreturn)); __attribute__((noreturn));
#ifdef __cplusplus
}
#endif
#endif #endif
#ifndef _WENDELIN_COMPAT_PY2_H #ifndef _WENDELIN_COMPAT_PY2_H
#define _WENDELIN_COMPAT_PY2_H #define _WENDELIN_COMPAT_PY2_H
/* Wendelin. Python2 compatibility
* Copyright (C) 2014-2019 Nexedi SA and Contributors.
* Kirill Smelkov <kirr@nexedi.com>
*
* This program is free software: you can Use, Study, Modify and Redistribute
* it under the terms of the GNU General Public License version 3, or (at your
* option) any later version, as published by the Free Software Foundation.
*
* You can also Link and Combine this program with other software covered by
* the terms of any of the Free Software licenses or any of the Open Source
* Initiative approved licenses and Convey the resulting work. Corresponding
* source of such a combination shall include the source code for all other
* software used.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* See COPYING file for full licensing terms.
* See https://www.nexedi.com/licensing for rationale and options.
*/
/* compatibility with python2 */ /* compatibility with python2 */
#include <Python.h> #include <Python.h>
#ifdef __cplusplus
extern "C" {
#endif
/* in python2 it was indicating support for memoryview */ /* in python2 it was indicating support for memoryview */
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
# define Py_TPFLAGS_HAVE_NEWBUFFER 0L # define Py_TPFLAGS_HAVE_NEWBUFFER 0L
...@@ -76,4 +102,9 @@ static inline PyThreadState * _PyThreadState_UncheckedGet(void) ...@@ -76,4 +102,9 @@ static inline PyThreadState * _PyThreadState_UncheckedGet(void)
# error "You are using CPython 3.5.X series. Upgrade your CPython to >= 3.5.2 to get _PyThreadState_UncheckedGet() support." # error "You are using CPython 3.5.X series. Upgrade your CPython to >= 3.5.2 to get _PyThreadState_UncheckedGet() support."
#endif #endif
#ifdef __cplusplus
}
#endif
#endif #endif
...@@ -26,6 +26,9 @@ ...@@ -26,6 +26,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <pthread.h> #include <pthread.h>
#ifdef __cplusplus
extern "C" {
#endif
/* compile-time exact ilog2(x); x must be 2^k */ /* compile-time exact ilog2(x); x must be 2^k */
#define BUILD_ILOG2_EXACT(x) ( \ #define BUILD_ILOG2_EXACT(x) ( \
...@@ -85,4 +88,8 @@ void xpthread_sigmask(int how, const sigset_t *set, sigset_t *oldset); ...@@ -85,4 +88,8 @@ void xpthread_sigmask(int how, const sigset_t *set, sigset_t *oldset);
void xpthread_mutex_lock(pthread_mutex_t *); void xpthread_mutex_lock(pthread_mutex_t *);
void xpthread_mutex_unlock(pthread_mutex_t *); void xpthread_mutex_unlock(pthread_mutex_t *);
#ifdef __cplusplus
}
#endif
#endif #endif
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#define _WENDELIN_TESTING_UTILS_H_ #define _WENDELIN_TESTING_UTILS_H_
/* Wendelin.bigfile | various testing utilities /* Wendelin.bigfile | various testing utilities
* Copyright (C) 2014-2015 Nexedi SA and Contributors. * Copyright (C) 2014-2019 Nexedi SA and Contributors.
* Kirill Smelkov <kirr@nexedi.com> * Kirill Smelkov <kirr@nexedi.com>
* *
* This program is free software: you can Use, Study, Modify and Redistribute * This program is free software: you can Use, Study, Modify and Redistribute
...@@ -24,6 +24,11 @@ ...@@ -24,6 +24,11 @@
#include <wendelin/bigfile/ram.h> #include <wendelin/bigfile/ram.h>
#ifdef __cplusplus
extern "C" {
#endif
/* access to vma memory as byte[] and blk_t[] */ /* access to vma memory as byte[] and blk_t[] */
#define b(vma, idx) ( ((volatile uint8_t *)vma->addr_start) [ idx ] ) #define b(vma, idx) ( ((volatile uint8_t *)vma->addr_start) [ idx ] )
#define B(vma, idx) ( ((volatile blk_t *)vma->addr_start) [ idx ] ) #define B(vma, idx) ( ((volatile blk_t *)vma->addr_start) [ idx ] )
...@@ -46,4 +51,9 @@ RAMLimited *ram_limited_new(RAM *backend, size_t alloc_max); ...@@ -46,4 +51,9 @@ RAMLimited *ram_limited_new(RAM *backend, size_t alloc_max);
/* current time as float */ /* current time as float */
double microtime(); double microtime();
#ifdef __cplusplus
}
#endif
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment