From patchwork Mon Nov 3 22:53:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Sterba X-Patchwork-Id: 5220321 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 66F85C11AC for ; Mon, 3 Nov 2014 22:53:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 86148200F0 for ; Mon, 3 Nov 2014 22:53:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 50847200DE for ; Mon, 3 Nov 2014 22:53:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752023AbaKCWxU (ORCPT ); Mon, 3 Nov 2014 17:53:20 -0500 Received: from cantor2.suse.de ([195.135.220.15]:33596 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751033AbaKCWxT (ORCPT ); Mon, 3 Nov 2014 17:53:19 -0500 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C010DAC0F for ; Mon, 3 Nov 2014 22:53:18 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 44D23DA94B; Mon, 3 Nov 2014 23:53:18 +0100 (CET) From: David Sterba To: linux-btrfs@vger.kernel.org Cc: David Sterba Subject: [PATCH] btrfs-progs: libbtrfs, make exported headers compatible with C++ Date: Mon, 3 Nov 2014 23:53:17 +0100 Message-Id: <1415055197-22806-1-git-send-email-dsterba@suse.cz> X-Mailer: git-send-email 2.1.1 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add externs and don't use a reserved keyword. Signed-off-by: David Sterba --- rbtree-utils.h | 8 ++++++++ rbtree.h | 10 +++++++++- rbtree_augmented.h | 8 ++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/rbtree-utils.h b/rbtree-utils.h index 7298c72eba3d..718581ff105c 100644 --- a/rbtree-utils.h +++ b/rbtree-utils.h @@ -21,6 +21,10 @@ #include "rbtree.h" +#ifdef __cplusplus +extern "C" { +#endif + /* The common insert/search/free functions */ typedef int (*rb_compare_nodes)(struct rb_node *node1, struct rb_node *node2); typedef int (*rb_compare_keys)(struct rb_node *node, void *key); @@ -42,4 +46,8 @@ static void free_##name##_tree(struct rb_root *root) \ rb_free_nodes(root, free_func); \ } +#ifdef __cplusplus +} +#endif + #endif diff --git a/rbtree.h b/rbtree.h index 03c06d8ec16a..0d4f2bfd5a5e 100644 --- a/rbtree.h +++ b/rbtree.h @@ -34,6 +34,10 @@ #include #endif /* BTRFS_FLAT_INCLUDES */ +#ifdef __cplusplus +extern "C" { +#endif + struct rb_node { unsigned long __rb_parent_color; struct rb_node *rb_right; @@ -75,7 +79,7 @@ extern struct rb_node *rb_first_postorder(const struct rb_root *); extern struct rb_node *rb_next_postorder(const struct rb_node *); /* Fast replacement of a single node without remove/rebalance/add/rebalance */ -extern void rb_replace_node(struct rb_node *victim, struct rb_node *new, +extern void rb_replace_node(struct rb_node *victim, struct rb_node *new_node, struct rb_root *root); static inline void rb_link_node(struct rb_node * node, struct rb_node * parent, @@ -107,4 +111,8 @@ static inline void rb_link_node(struct rb_node * node, struct rb_node * parent, typeof(*pos), field); 1; }); \ pos = n) +#ifdef __cplusplus +} +#endif + #endif /* _LINUX_RBTREE_H */ diff --git a/rbtree_augmented.h b/rbtree_augmented.h index 079eb978dc4d..cbc963981667 100644 --- a/rbtree_augmented.h +++ b/rbtree_augmented.h @@ -26,6 +26,10 @@ #include "rbtree.h" +#ifdef __cplusplus +extern "C" { +#endif + /* * Please note - only struct rb_augment_callbacks and the prototypes for * rb_insert_augmented() and rb_erase_augmented() are intended to be public. @@ -228,4 +232,8 @@ rb_erase_augmented(struct rb_node *node, struct rb_root *root, __rb_erase_color(rebalance, root, augment->rotate); } +#ifdef __cplusplus +} +#endif + #endif /* _LINUX_RBTREE_AUGMENTED_H */