From patchwork Sat Apr 7 21:06:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 1680 Return-Path: Received: from confino.investici.org (investici.nine.ch [217.150.252.179]) by open-mesh.org (Postfix) with ESMTPS id C8B10600809 for ; Sat, 7 Apr 2012 23:05:41 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@autistici.org; dkim-adsp=pass Received: from [217.150.252.179] (confino [217.150.252.179]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id 615D4C865D; Sat, 7 Apr 2012 21:05:40 +0000 (UTC) X-DKIM: Sendmail DKIM Filter v2.8.2 confino.investici.org 615D4C865D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1333832741; bh=JqHJY6Rq77PLJvgNp9RimGll5V3XVTWjLku17WbxKXI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=pqo1cRB8wM2SymuQsPlu7xFu1DJVwSGb1b1Qrr/Lcrq3AiARQhBPKJTIXnj7Plp40 VQwmp1S9mZewOU6AKtlHuGfvShTV4TlfakhqwAS/LAIJxopT8w3zy2olQMa7ZBxKm1 qXunA0YpFEAFcxFhzEWcdkhDozB2bW0SlmkvjAQM= From: Antonio Quartulli To: b.a.t.m.a.n@lists.open-mesh.org Date: Sat, 7 Apr 2012 23:06:09 +0200 Message-Id: <1333832769-28493-4-git-send-email-ordex@autistici.org> X-Mailer: git-send-email 1.7.9.4 In-Reply-To: <1333832769-28493-1-git-send-email-ordex@autistici.org> References: <1333832769-28493-1-git-send-email-ordex@autistici.org> Subject: [B.A.T.M.A.N.] [PATCH 3/3] batman-adv: use static inline functions to fake not compiled-in routines X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2012 21:05:42 -0000 In case of not compiled-in components, we need to fake some functions in order to let the rest of the code correctly build. But instead of using something like: We have to use: static inline bla_init(struct bat_priv *bat_priv) { return 1; } In this way the compiler can correctly check the type and the number of the arguments passed to the function, even if the related component (bla in this case) is not compiled. Signed-off-by: Antonio Quartulli --- bridge_loop_avoidance.h | 60 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 51 insertions(+), 9 deletions(-) diff --git a/bridge_loop_avoidance.h b/bridge_loop_avoidance.h index e1a2966..e39f93a 100644 --- a/bridge_loop_avoidance.h +++ b/bridge_loop_avoidance.h @@ -40,16 +40,58 @@ void bla_free(struct bat_priv *bat_priv); #define BLA_CRC_INIT 0 #else /* ifdef CONFIG_BATMAN_ADV_BLA */ -#define bla_rx(...) (0) -#define bla_tx(...) (0) -#define bla_is_backbone_gw(...) (0) -#define bla_claim_table_seq_print_text (0) -#define bla_is_backbone_gw_orig(...) (0) -#define bla_check_bcast_duplist(...) (0) -#define bla_update_orig_address(...) do {} while (0) -#define bla_init(...) (1) -#define bla_free(...) do {} while (0) +static inline int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, + short vid) +{ + return 0; +} +static inline int bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, + short vid) +{ + return 0; +} + +static inline int bla_is_backbone_gw(struct sk_buff *skb, + struct orig_node *orig_node, + int hdr_size) +{ + return 0; +} + +static inline int bla_claim_table_seq_print_text(struct seq_file *seq, + void *offset) +{ + return 0; +} + +static inline int bla_is_backbone_gw_orig(struct bat_priv *bat_priv, + uint8_t *orig) +{ + return 0; +} + +static inline int bla_check_bcast_duplist(struct bat_priv *bat_priv, + struct bcast_packet *bcast_packet, + int hdr_size) +{ + return 0; +} + +static inline void bla_update_orig_address(struct bat_priv *bat_priv, + struct hard_iface *primary_if, + struct hard_iface *oldif) +{ +} + +static inline int bla_init(struct bat_priv *bat_priv) +{ + return 1; +} + +static inline void bla_free(struct bat_priv *bat_priv) +{ +} #endif /* ifdef CONFIG_BATMAN_ADV_BLA */