From patchwork Tue Dec 25 09:03:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Lindner X-Patchwork-Id: 2640 Return-Path: Received: from nm25-vm6.bullet.mail.ukl.yahoo.com (nm25-vm6.bullet.mail.ukl.yahoo.com [217.146.177.150]) by open-mesh.org (Postfix) with ESMTPS id 0A5876019F8 for ; Tue, 25 Dec 2012 10:03:55 +0100 (CET) Received: from [217.146.183.214] by nm25.bullet.mail.ukl.yahoo.com with NNFMP; 25 Dec 2012 09:03:55 -0000 Received: from [217.146.183.128] by tm7.bullet.mail.ukl.yahoo.com with NNFMP; 25 Dec 2012 09:03:55 -0000 Received: from [127.0.0.1] by smtp113.mail.ukl.yahoo.com with NNFMP; 25 Dec 2012 09:03:55 -0000 X-Yahoo-Newman-Id: 715388.84818.bm@smtp113.mail.ukl.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: 0CV3jiUVM1lvHjStg0Cn_.Q0MetSOuYAPtxGK4r9aBs9HaA WibUSRaUgKXtkGAFva9dUdtnZ6iSVRsUIafCoXf_JwCw86FzkTwejyqBblZx rbkOJ0XXlyFvS1Oy8AHsYMLlw0gHq4dUYT3l_1Xf5DKHLbAkgkwVe0XUtVoW H0a2o9ghTOdhJqmkvjb44XQsepoKn9Y7aOFvRNCY.cmsf9Bs91bgmuZiEmTM kGDkeZNGwlENOc0X.HGp_nkhcAKcB5V8ChHaOfyUZ7NlfOyxaFNXR0PiE0aL zwpNABv9DJpYlyVWy6DqsDbzhviwnRP0AejiL4uw3tiD2cY8Z2GHnvnKJu.h 3BMhOVDW.ivdShaja43idQ4JOF1.EQlqDTfzil60OXY6EJrHjdM24d237x9M qLq4uKGYyl9zoklXgDUz4_rEsYplNIvzVqaXDwZbvc7yRnVuOrtps7zVALxj g56P53eA7ugcYlYH7Q9LQ X-Yahoo-SMTP: tW.h3tiswBBMXO2coYcbPigGD5Lt6zY_.Zc- Received: from localhost (lindner_marek@79.205.251.202 with plain) by smtp113.mail.ukl.yahoo.com with SMTP; 25 Dec 2012 01:03:55 -0800 PST From: Marek Lindner To: b.a.t.m.a.n@lists.open-mesh.org Date: Tue, 25 Dec 2012 17:03:20 +0800 Message-Id: <1356426206-8667-2-git-send-email-lindner_marek@yahoo.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1356426206-8667-1-git-send-email-lindner_marek@yahoo.de> References: <1356426206-8667-1-git-send-email-lindner_marek@yahoo.de> Cc: Marek Lindner Subject: [B.A.T.M.A.N.] [PATCH 2/8] batman-adv: mark debug_log struct as bat_priv only struct X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.15 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: Tue, 25 Dec 2012 09:03:56 -0000 Signed-off-by: Marek Lindner --- debugfs.c | 13 +++++++------ types.h | 25 +++++++++++++------------ 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/debugfs.c b/debugfs.c index 55a9007..e47555b 100644 --- a/debugfs.c +++ b/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/types.h b/types.h index dffbdff..db3fb25 100644 --- a/types.h +++ b/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;