shithub: lwext4

Download patch

ref: 4f4561a7faea00a960804169fda2d03c0a1e24d4
parent: 8e75911fee8589de164b7c6c96e80aaf9256403b
author: gkostka <[email protected]>
date: Thu Nov 19 18:27:44 EST 2015

Add #ifdef __cplusplus to all header files

--- a/lwext4/ext4.h
+++ b/lwext4/ext4.h
@@ -38,6 +38,10 @@
 #ifndef EXT4_H_
 #define EXT4_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include <stdint.h>
 #include <stddef.h>
 
@@ -403,6 +407,10 @@
 /**@brief   Rewine directory entry offset.
  * @param   d directory handle*/
 void ext4_dir_entry_rewind(ext4_dir *d);
+
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* EXT4_H_ */
 
--- a/lwext4/ext4_balloc.h
+++ b/lwext4/ext4_balloc.h
@@ -42,6 +42,10 @@
 #ifndef EXT4_BALLOC_H_
 #define EXT4_BALLOC_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "ext4_config.h"
 #include "ext4_types.h"
 
@@ -102,6 +106,10 @@
  * @return  standard error code*/
 int ext4_balloc_try_alloc_block(struct ext4_inode_ref *inode_ref,
 				ext4_fsblk_t baddr, bool *free);
+
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* EXT4_BALLOC_H_ */
 
--- a/lwext4/ext4_bcache.h
+++ b/lwext4/ext4_bcache.h
@@ -37,6 +37,10 @@
 #ifndef EXT4_BCACHE_H_
 #define EXT4_BCACHE_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "ext4_config.h"
 
 #include <stdint.h>
@@ -159,6 +163,10 @@
  * @param   bc block cache descriptor
  * @return  full status*/
 bool ext4_bcache_is_full(struct ext4_bcache *bc);
+
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* EXT4_BCACHE_H_ */
 
--- a/lwext4/ext4_bitmap.h
+++ b/lwext4/ext4_bitmap.h
@@ -37,6 +37,10 @@
 #ifndef EXT4_BITMAP_H_
 #define EXT4_BITMAP_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "ext4_config.h"
 
 #include <stdint.h>
@@ -87,6 +91,10 @@
  * @return  standard error code*/
 int ext4_bmap_bit_find_clr(uint8_t *bmap, uint32_t sbit, uint32_t ebit,
 			   uint32_t *bit_id);
+
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* EXT4_BITMAP_H_ */
 
--- a/lwext4/ext4_block_group.h
+++ b/lwext4/ext4_block_group.h
@@ -42,6 +42,10 @@
 #ifndef EXT4_BLOCK_GROUP_H_
 #define EXT4_BLOCK_GROUP_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "ext4_config.h"
 #include "ext4_types.h"
 #include "ext4_super.h"
--- a/lwext4/ext4_blockdev.h
+++ b/lwext4/ext4_blockdev.h
@@ -25,9 +25,6 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-#ifndef EXT4_BLOCKDEV_H_
-#define EXT4_BLOCKDEV_H_
-
 /** @addtogroup lwext4
  * @{
  */
@@ -36,6 +33,13 @@
  * @brief Block device module.
  */
 
+#ifndef EXT4_BLOCKDEV_H_
+#define EXT4_BLOCKDEV_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "ext4_config.h"
 #include "ext4_bcache.h"
 #include "ext4_debug.h"
@@ -204,6 +208,10 @@
  *               0 - DISABLE (all delayed cache buffers will be flushed)
  * @return  standard error code*/
 int ext4_block_cache_write_back(struct ext4_blockdev *bdev, uint8_t on_off);
+
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* EXT4_BLOCKDEV_H_ */
 
--- a/lwext4/ext4_config.h
+++ b/lwext4/ext4_config.h
@@ -37,6 +37,10 @@
 #ifndef EXT4_CONFIG_H_
 #define EXT4_CONFIG_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #ifdef CONFIG_HAVE_OWN_CFG
 #include <config.h>
 #endif
@@ -138,6 +142,10 @@
 /**@brief   Use full extent implemrntation*/
 #ifndef CONFIG_EXTENT_FULL
 #define CONFIG_EXTENT_FULL 1
+#endif
+
+#ifdef __cplusplus
+}
 #endif
 
 #endif /* EXT4_CONFIG_H_ */
--- a/lwext4/ext4_crc32c.h
+++ b/lwext4/ext4_crc32c.h
@@ -39,6 +39,10 @@
 #ifndef LWEXT4_EXT4_CRC32C_H_
 #define LWEXT4_EXT4_CRC32C_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "ext4_config.h"
 
 #include <stdint.h>
@@ -49,6 +53,10 @@
  * @param	length input buffer length (bytes)
  * @return	updated crc32c value*/
 uint32_t ext4_crc32c(uint32_t crc, const void *buffer, uint32_t length);
+
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* LWEXT4_EXT4_CRC32C_H_ */
 
--- a/lwext4/ext4_debug.h
+++ b/lwext4/ext4_debug.h
@@ -37,6 +37,10 @@
 #ifndef EXT4_DEBUG_H_
 #define EXT4_DEBUG_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "ext4_config.h"
 #include "ext4_errno.h"
 
@@ -165,6 +169,10 @@
  #endif
 #else
 #define ext4_assert(_v)
+#endif
+
+#ifdef __cplusplus
+}
 #endif
 
 #endif /* EXT4_DEBUG_H_ */
--- a/lwext4/ext4_dir.h
+++ b/lwext4/ext4_dir.h
@@ -42,6 +42,10 @@
 #ifndef EXT4_DIR_H_
 #define EXT4_DIR_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "ext4_config.h"
 #include "ext4_types.h"
 #include "ext4_blockdev.h"
@@ -277,6 +281,10 @@
 
 /* checksumming functions */
 void initialize_dir_tail(struct ext4_dir_entry_tail *t);
+
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* EXT4_DIR_H_ */
 
--- a/lwext4/ext4_dir_idx.h
+++ b/lwext4/ext4_dir_idx.h
@@ -42,6 +42,10 @@
 #ifndef EXT4_DIR_IDX_H_
 #define EXT4_DIR_IDX_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "ext4_config.h"
 #include "ext4_types.h"
 
@@ -84,6 +88,10 @@
  */
 int ext4_dir_dx_reset_parent_inode(struct ext4_inode_ref *dir,
                                    uint32_t parent_inode);
+
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* EXT4_DIR_IDX_H_ */
 
--- a/lwext4/ext4_errno.h
+++ b/lwext4/ext4_errno.h
@@ -36,6 +36,10 @@
 #ifndef EXT4_ERRNO_H_
 #define EXT4_ERRNO_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "ext4_config.h"
 
 #if !CONFIG_HAVE_OWN_ERRNO
@@ -94,6 +98,10 @@
 
 #ifndef EOK
 #define EOK 0
+#endif
+
+#ifdef __cplusplus
+}
 #endif
 
 #endif /* EXT4_ERRNO_H_ */
--- a/lwext4/ext4_extent.h
+++ b/lwext4/ext4_extent.h
@@ -41,6 +41,10 @@
 #ifndef EXT4_EXTENT_H_
 #define EXT4_EXTENT_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "ext4_config.h"
 #include "ext4_types.h"
 #include "ext4_inode.h"
@@ -273,6 +277,10 @@
 int ext4_extent_remove_space(struct ext4_inode_ref *inode_ref, ext4_lblk_t from,
 			     ext4_lblk_t to);
 
+
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* EXT4_EXTENT_H_ */
 /**
--- a/lwext4/ext4_fs.h
+++ b/lwext4/ext4_fs.h
@@ -42,6 +42,10 @@
 #ifndef EXT4_FS_H_
 #define EXT4_FS_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "ext4_config.h"
 #include "ext4_types.h"
 
@@ -227,6 +231,10 @@
  * @param   inode none handle
  */
 void ext4_fs_inode_links_count_dec(struct ext4_inode_ref *inode_ref);
+
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* EXT4_FS_H_ */
 
--- a/lwext4/ext4_hash.h
+++ b/lwext4/ext4_hash.h
@@ -37,6 +37,10 @@
 #ifndef EXT4_HASH_H_
 #define EXT4_HASH_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "ext4_config.h"
 
 #include <stdint.h>
@@ -52,6 +56,10 @@
 int ext2_htree_hash(const char *name, int len, const uint32_t *hash_seed,
 		    int hash_version, uint32_t *hash_major,
 		    uint32_t *hash_minor);
+
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* EXT4_HASH_H_ */
 
--- a/lwext4/ext4_ialloc.h
+++ b/lwext4/ext4_ialloc.h
@@ -77,6 +77,7 @@
 #ifdef __cplusplus
 }
 #endif
+
 #endif /* EXT4_IALLOC_H_ */
 
 /**
--- a/lwext4/ext4_inode.h
+++ b/lwext4/ext4_inode.h
@@ -42,6 +42,10 @@
 #ifndef EXT4_INODE_H_
 #define EXT4_INODE_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "ext4_config.h"
 
 #include <stdint.h>
@@ -320,6 +324,10 @@
  */
 struct ext4_extent_header *
 ext4_inode_get_extent_header(struct ext4_inode *inode);
+
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* EXT4_INODE_H_ */
 
--- a/lwext4/ext4_mkfs.h
+++ b/lwext4/ext4_mkfs.h
@@ -37,6 +37,10 @@
 #ifndef EXT4_MKFS_H_
 #define EXT4_MKFS_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "ext4_config.h"
 #include "ext4_types.h"
 #include "ext4_blockdev.h"
@@ -66,6 +70,10 @@
 
 int ext4_mkfs(struct ext4_fs *fs, struct ext4_blockdev *bd,
 	      struct ext4_mkfs_info *info, int fs_type);
+
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* EXT4_MKFS_H_ */
 
--- a/lwext4/ext4_super.h
+++ b/lwext4/ext4_super.h
@@ -42,6 +42,10 @@
 #ifndef EXT4_SUPER_H_
 #define EXT4_SUPER_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "ext4_config.h"
 #include "ext4_types.h"
 
@@ -221,6 +225,10 @@
 /**@brief   TODO:*/
 uint32_t ext4_num_base_meta_clusters(struct ext4_sblock *s,
 				     uint32_t block_group);
+
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* EXT4_SUPER_H_ */
 
--- a/lwext4/ext4_types.h
+++ b/lwext4/ext4_types.h
@@ -42,6 +42,10 @@
 #ifndef EXT4_TYPES_H_
 #define EXT4_TYPES_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "ext4_config.h"
 #include "ext4_blockdev.h"
 #include "tree.h"
@@ -947,6 +951,10 @@
 #ifndef offsetof
 #define offsetof(type, field) 		\
 	((size_t)(&(((type *)0)->field)))
+#endif
+
+#ifdef __cplusplus
+}
 #endif
 
 #endif /* EXT4_TYPES_H_ */
--- a/lwext4/ext4_xattr.h
+++ b/lwext4/ext4_xattr.h
@@ -37,6 +37,10 @@
 #ifndef EXT4_XATTR_H_
 #define EXT4_XATTR_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "ext4_config.h"
 #include "ext4_types.h"
 
@@ -67,6 +71,10 @@
 
 const char *ext4_get_xattr_name_prefix(uint8_t name_index,
 					size_t *ret_prefix_len);
+
+#ifdef __cplusplus
+}
+#endif
 
 #endif
 /**
--- a/lwext4/tree.h
+++ b/lwext4/tree.h
@@ -30,6 +30,10 @@
 #ifndef	_SYS_TREE_H_
 #define	_SYS_TREE_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "ext4_config.h"
 
 /*
@@ -797,5 +801,9 @@
 	for ((x) = RB_MAX(name, head);					\
 	    ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL);	\
 	     (x) = (y))
+
+#ifdef __cplusplus
+}
+#endif
 
 #endif	/* _SYS_TREE_H_ */