From patchwork Sat Jan 15 09:56:24 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 674 Return-Path: Received: from v3-1039.vlinux.de (narfation.org [79.140.41.39]) by open-mesh.org (Postfix) with ESMTPS id C740E154235 for ; Sat, 15 Jan 2011 10:56:33 +0100 (CET) Received: from sven-desktop.lazhur.ath.cx (i59F6DE8E.versanet.de [89.246.222.142]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id 308F894058; Sat, 15 Jan 2011 10:56:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=narfation.org; s=mail; t=1295085417; bh=ai2rbZYNtKuhWDe+bnA36CTMxxR+g2pF/a7Nkv7504c=; h=From:To:Cc:Subject:Date:Message-Id; b=rlCOrJxe+ZSm5eGnL0Un4EalghwvJUv7qpho9J0VlNutB/0NqAr4a9WdqNBW5a5x+ Tdn5wz8Q5crtKX2EhLWyRw7DZBEbARhV8LqX9kF+oU5ZkB17HNQMZM/pqZXAkDqG9A CVDPvjw1OljikBwHWYyuFaXxFXPikWDHSFVtgZPM= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Sat, 15 Jan 2011 10:56:24 +0100 Message-Id: <1295085384-23195-1-git-send-email-sven@narfation.org> X-Mailer: git-send-email 1.7.2.3 Subject: [B.A.T.M.A.N.] [PATCH] batman-adv: Use "__attribute__" shortcut macros X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.11 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, 15 Jan 2011 09:56:35 -0000 Linux 2.6.21 defines different macros for __attribute__ which are also used inside batman-adv. The next version of checkpatch.pl warns about the usage of __attribute__((packed))). Linux 2.6.33 defines an extra macro __always_unused which is used to assist source code analyzers and can be used to removed the last existing __attribute__ inside the source code. Signed-off-by: Sven Eckelmann --- batman-adv/compat.h | 6 ++++++ batman-adv/main.h | 6 +++--- batman-adv/packet.h | 14 +++++++------- batman-adv/types.h | 4 ++-- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/batman-adv/compat.h b/batman-adv/compat.h index b01455f..6074969 100644 --- a/batman-adv/compat.h +++ b/batman-adv/compat.h @@ -264,4 +264,10 @@ int bat_seq_printf(struct seq_file *m, const char *f, ...); #endif /* < KERNEL_VERSION(2, 6, 29) */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33) + +#define __always_unused __attribute__((unused)) + +#endif /* < KERNEL_VERSION(2, 6, 33) */ + #endif /* _NET_BATMAN_ADV_COMPAT_H_ */ diff --git a/batman-adv/main.h b/batman-adv/main.h index a362433..c239c97 100644 --- a/batman-adv/main.h +++ b/batman-adv/main.h @@ -153,9 +153,9 @@ int debug_log(struct bat_priv *bat_priv, char *fmt, ...); } \ while (0) #else /* !CONFIG_BATMAN_ADV_DEBUG */ -static inline void bat_dbg(char type __attribute__((unused)), - struct bat_priv *bat_priv __attribute__((unused)), - char *fmt __attribute__((unused)), ...) +static inline void bat_dbg(char type __always_unused, + struct bat_priv *bat_priv __always_unused, + char *fmt __always_unused, ...) { } #endif diff --git a/batman-adv/packet.h b/batman-adv/packet.h index b49fdf7..2284e81 100644 --- a/batman-adv/packet.h +++ b/batman-adv/packet.h @@ -63,7 +63,7 @@ struct batman_packet { uint8_t num_hna; uint8_t gw_flags; /* flags related to gateway class */ uint8_t align; -} __attribute__((packed)); +} __packed; #define BAT_PACKET_LEN sizeof(struct batman_packet) @@ -76,7 +76,7 @@ struct icmp_packet { uint8_t orig[6]; uint16_t seqno; uint8_t uid; -} __attribute__((packed)); +} __packed; #define BAT_RR_LEN 16 @@ -93,14 +93,14 @@ struct icmp_packet_rr { uint8_t uid; uint8_t rr_cur; uint8_t rr[BAT_RR_LEN][ETH_ALEN]; -} __attribute__((packed)); +} __packed; struct unicast_packet { uint8_t packet_type; uint8_t version; /* batman version field */ uint8_t dest[6]; uint8_t ttl; -} __attribute__((packed)); +} __packed; struct unicast_frag_packet { uint8_t packet_type; @@ -110,7 +110,7 @@ struct unicast_frag_packet { uint8_t flags; uint8_t orig[6]; uint16_t seqno; -} __attribute__((packed)); +} __packed; struct bcast_packet { uint8_t packet_type; @@ -118,7 +118,7 @@ struct bcast_packet { uint8_t orig[6]; uint8_t ttl; uint32_t seqno; -} __attribute__((packed)); +} __packed; struct vis_packet { uint8_t packet_type; @@ -131,6 +131,6 @@ struct vis_packet { * neighbors */ uint8_t target_orig[6]; /* who should receive this packet */ uint8_t sender_orig[6]; /* who sent or rebroadcasted this packet */ -} __attribute__((packed)); +} __packed; #endif /* _NET_BATMAN_ADV_PACKET_H_ */ diff --git a/batman-adv/types.h b/batman-adv/types.h index 09d18d8..9e636c2 100644 --- a/batman-adv/types.h +++ b/batman-adv/types.h @@ -249,13 +249,13 @@ struct vis_info { /* this packet might be part of the vis send queue. */ struct sk_buff *skb_packet; /* vis_info may follow here*/ -} __attribute__((packed)); +} __packed; struct vis_info_entry { uint8_t src[ETH_ALEN]; uint8_t dest[ETH_ALEN]; uint8_t quality; /* quality = 0 means HNA */ -} __attribute__((packed)); +} __packed; struct recvlist_node { struct list_head list;