From patchwork Sat Jan 19 13:27:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 213850 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 1F93E2C007B for ; Sun, 20 Jan 2013 00:29:43 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751531Ab3ASN3j (ORCPT ); Sat, 19 Jan 2013 08:29:39 -0500 Received: from latitanza.investici.org ([82.94.249.234]:57671 "EHLO latitanza.investici.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751226Ab3ASN3i (ORCPT ); Sat, 19 Jan 2013 08:29:38 -0500 Received: from [82.94.249.234] (latitanza [82.94.249.234]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id E8ECD98037; Sat, 19 Jan 2013 13:29:33 +0000 (UTC) X-DKIM: Sendmail DKIM Filter v2.8.2 latitanza.investici.org E8ECD98037 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1358602176; bh=awoLBH0ukZ3WN97zEyO56/0+OZ2kgSaQUQIvLWpiPRs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=DC8s7YhMwBhoj6NWZIGPDMATjcH7cPBkar0tXKWQqNZ2omreSpldRhR7VGZOllkP6 EU10zVO5wSsskIN112dPR+ZiIR9HtWfz/+Z74XeCZriB+iESAoYbFqTMjyNsRS0+9O bYOynNwFPAjq0Z/ob/LthSly4jvwQrJ38S6DsMrc= From: Antonio Quartulli To: davem@davemloft.net Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org, Marek Lindner , Antonio Quartulli Subject: [PATCH 03/13] batman-adv: mark debug_log struct as bat_priv only struct Date: Sat, 19 Jan 2013 21:27:49 +0800 Message-Id: <1358602079-24024-4-git-send-email-ordex@autistici.org> X-Mailer: git-send-email 1.8.0.2 In-Reply-To: <1358602079-24024-1-git-send-email-ordex@autistici.org> References: <1358602079-24024-1-git-send-email-ordex@autistici.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Marek Lindner Signed-off-by: Marek Lindner Signed-off-by: Antonio Quartulli --- net/batman-adv/debugfs.c | 13 +++++++------ net/batman-adv/types.h | 25 +++++++++++++------------ 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/net/batman-adv/debugfs.c b/net/batman-adv/debugfs.c index 55a9007..e47555b 100644 --- a/net/batman-adv/debugfs.c +++ b/net/batman-adv/debugfs.c @@ -40,13 +40,14 @@ static struct dentry *batadv_debugfs; static const int batadv_log_buff_len = BATADV_LOG_BUF_LEN; -static char *batadv_log_char_addr(struct batadv_debug_log *debug_log, +static char *batadv_log_char_addr(struct batadv_priv_debug_log *debug_log, size_t idx) { return &debug_log->log_buff[idx & BATADV_LOG_BUFF_MASK]; } -static void batadv_emit_log_char(struct batadv_debug_log *debug_log, char c) +static void batadv_emit_log_char(struct batadv_priv_debug_log *debug_log, + char c) { char *char_addr; @@ -59,7 +60,7 @@ static void batadv_emit_log_char(struct batadv_debug_log *debug_log, char c) } __printf(2, 3) -static int batadv_fdebug_log(struct batadv_debug_log *debug_log, +static int batadv_fdebug_log(struct batadv_priv_debug_log *debug_log, const char *fmt, ...) { va_list args; @@ -114,7 +115,7 @@ static int batadv_log_release(struct inode *inode, struct file *file) return 0; } -static int batadv_log_empty(struct batadv_debug_log *debug_log) +static int batadv_log_empty(struct batadv_priv_debug_log *debug_log) { return !(debug_log->log_start - debug_log->log_end); } @@ -123,7 +124,7 @@ static ssize_t batadv_log_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { struct batadv_priv *bat_priv = file->private_data; - struct batadv_debug_log *debug_log = bat_priv->debug_log; + struct batadv_priv_debug_log *debug_log = bat_priv->debug_log; int error, i = 0; char *char_addr; char c; @@ -177,7 +178,7 @@ static ssize_t batadv_log_read(struct file *file, char __user *buf, static unsigned int batadv_log_poll(struct file *file, poll_table *wait) { struct batadv_priv *bat_priv = file->private_data; - struct batadv_debug_log *debug_log = bat_priv->debug_log; + struct batadv_priv_debug_log *debug_log = bat_priv->debug_log; poll_wait(file, &debug_log->queue_wait, wait); diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h index dffbdff..db3fb25 100644 --- a/net/batman-adv/types.h +++ b/net/batman-adv/types.h @@ -233,6 +233,16 @@ struct batadv_priv_bla { }; #endif +#ifdef CONFIG_BATMAN_ADV_DEBUG +struct batadv_priv_debug_log { + char log_buff[BATADV_LOG_BUF_LEN]; + unsigned long log_start; + unsigned long log_end; + spinlock_t lock; /* protects log_buff, log_start and log_end */ + wait_queue_head_t queue_wait; +}; +#endif + struct batadv_priv_gw { struct hlist_head list; spinlock_t list_lock; /* protects gw_list and curr_gw */ @@ -290,9 +300,6 @@ struct batadv_priv { atomic_t bcast_queue_left; atomic_t batman_queue_left; char num_ifaces; -#ifdef CONFIG_BATMAN_ADV_DEBUG - struct batadv_debug_log *debug_log; -#endif struct kobject *mesh_obj; struct dentry *debug_dir; struct hlist_head forw_bat_list; @@ -306,6 +313,9 @@ struct batadv_priv { #ifdef CONFIG_BATMAN_ADV_BLA struct batadv_priv_bla bla; #endif +#ifdef CONFIG_BATMAN_ADV_DEBUG + struct batadv_priv_debug_log *debug_log; +#endif struct batadv_priv_gw gw; struct batadv_priv_tt tt; struct batadv_priv_vis vis; @@ -425,15 +435,6 @@ struct batadv_if_list_entry { bool primary; struct hlist_node list; }; - -struct batadv_debug_log { - char log_buff[BATADV_LOG_BUF_LEN]; - unsigned long log_start; - unsigned long log_end; - spinlock_t lock; /* protects log_buff, log_start and log_end */ - wait_queue_head_t queue_wait; -}; - struct batadv_frag_packet_list_entry { struct list_head list; uint16_t seqno;