From patchwork Tue Dec 20 11:33:14 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Lindner X-Patchwork-Id: 1481 Return-Path: Received: from nm8-vm0.bullet.mail.ukl.yahoo.com (nm8-vm0.bullet.mail.ukl.yahoo.com [217.146.183.238]) by open-mesh.org (Postfix) with SMTP id 1B10A6006D4 for ; Tue, 20 Dec 2011 12:33:23 +0100 (CET) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@yahoo.de; dkim-adsp=none Received: from [217.146.183.181] by nm8.bullet.mail.ukl.yahoo.com with NNFMP; 20 Dec 2011 11:33:22 -0000 Received: from [77.238.184.70] by tm12.bullet.mail.ukl.yahoo.com with NNFMP; 20 Dec 2011 11:33:22 -0000 Received: from [127.0.0.1] by smtp139.mail.ukl.yahoo.com with NNFMP; 20 Dec 2011 11:33:22 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s1024; t=1324380802; bh=O/AQNScuec3zcQo+2fHanxSVn8F0vyPtxeh7leGfAsU=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer; b=6jo/hu/TQ06onZOGLyyD+bUgYjLuZ0NtYfX42Y7chpI9LA1hbshdT0NHxqKsS8YIsu1C1mwvitcjBfuQmXtIFtwcHj1YLp/j2O0R0UvMtpdqqM50/+i1HaGi2817YiBhQvjLLFiyYP0fRct4H+l3hPrXFAxs2Tspze1iz0ATuy8= X-Yahoo-Newman-Id: 410924.74262.bm@smtp139.mail.ukl.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: um_soKgVM1kQlFgKtlgrzlyECUuc29DpO.KdyI8tBnnzN_7 K6pISb13G5tTVRLt_l.wvy8xxPfIN4xXkCvMUaOR6zLC5zS6Yz0qYF9vmFa_ KKBdC46YTzmebyDvmhGXRZBZjOSLyaIAdwCIVlyT7ONRVrR3rmynsbIryF9D EjFvvvVzxfGKpDyoiq7hIhJrdPzgFQMPx17Y2DNaPifIUNbJDDArZjBV5pB6 7ARtPWPGm7CO28c3nq3f_LRm5V3eiTmdHVZ.kSEsz2C4Sepvk5Nk4i2NZc4. d8nNZpAWxzACeUKmoZu6Ku1j7sHmT91EibzsZRr8m3_zFiHw4mc9g3Tn5a82 Br7DcgWnU_sX0mmVneASyKJ0n2N60bFWWpyZWmQrqhd_peNd8 X-Yahoo-SMTP: tW.h3tiswBBMXO2coYcbPigGD5Lt6zY_.Zc- Received: from localhost (lindner_marek@217.85.82.213 with plain) by smtp139.mail.ukl.yahoo.com with SMTP; 20 Dec 2011 11:33:21 +0000 GMT From: Marek Lindner To: b.a.t.m.a.n@lists.open-mesh.org Date: Tue, 20 Dec 2011 19:33:14 +0800 Message-Id: <1324380794-2971-1-git-send-email-lindner_marek@yahoo.de> X-Mailer: git-send-email 1.7.5.4 Cc: Marek Lindner Subject: [B.A.T.M.A.N.] [PATCH] batman-adv: convert time_after instances to has_timed_out 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: Tue, 20 Dec 2011 11:33:23 -0000 To increase readability the has_timed_out() functions has been introduced. This patch converts existing time_after() calls to use this wrapper function (if applicable). Signed-off-by: Marek Lindner --- originator.c | 11 ++++------- routing.c | 3 +-- soft-interface.c | 4 ++-- vis.c | 3 +-- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/originator.c b/originator.c index 847ff7e..1161f27 100644 --- a/originator.c +++ b/originator.c @@ -282,8 +282,7 @@ static bool purge_orig_neighbors(struct bat_priv *bat_priv, hlist_for_each_entry_safe(neigh_node, node, node_tmp, &orig_node->neigh_list, list) { - if ((time_after(jiffies, - neigh_node->last_valid + PURGE_TIMEOUT * HZ)) || + if ((has_timed_out(neigh_node->last_valid, PURGE_TIMEOUT)) || (neigh_node->if_incoming->if_status == IF_INACTIVE) || (neigh_node->if_incoming->if_status == IF_NOT_IN_USE) || (neigh_node->if_incoming->if_status == IF_TO_BE_REMOVED)) { @@ -327,9 +326,7 @@ static bool purge_orig_node(struct bat_priv *bat_priv, { struct neigh_node *best_neigh_node; - if (time_after(jiffies, - orig_node->last_valid + 2 * PURGE_TIMEOUT * HZ)) { - + if (has_timed_out(orig_node->last_valid, 2 * PURGE_TIMEOUT)) { bat_dbg(DBG_BATMAN, bat_priv, "Originator timeout: originator %pM, last_valid %lu\n", orig_node->orig, (orig_node->last_valid / HZ)); @@ -372,8 +369,8 @@ static void _purge_orig(struct bat_priv *bat_priv) continue; } - if (time_after(jiffies, orig_node->last_frag_packet + - msecs_to_jiffies(FRAG_TIMEOUT))) + if (has_timed_out(orig_node->last_frag_packet, + FRAG_TIMEOUT)) frag_list_free(&orig_node->frag_list); } spin_unlock_bh(list_lock); diff --git a/routing.c b/routing.c index 5bc41c8..87b95a2 100644 --- a/routing.c +++ b/routing.c @@ -232,8 +232,7 @@ int window_protected(struct bat_priv *bat_priv, int32_t seq_num_diff, { if ((seq_num_diff <= -TQ_LOCAL_WINDOW_SIZE) || (seq_num_diff >= EXPECTED_SEQNO_RANGE)) { - if (time_after(jiffies, *last_reset + - msecs_to_jiffies(RESET_PROTECTION_MS))) { + if (has_timed_out(*last_reset, RESET_PROTECTION_MS)) { *last_reset = jiffies; bat_dbg(DBG_BATMAN, bat_priv, diff --git a/soft-interface.c b/soft-interface.c index bd8c7cf..51788db 100644 --- a/soft-interface.c +++ b/soft-interface.c @@ -396,8 +396,8 @@ void softif_neigh_purge(struct bat_priv *bat_priv) hlist_for_each_entry_safe(softif_neigh, node_tmp, node_tmp2, &softif_neigh_vid->softif_neigh_list, list) { - if ((!time_after(jiffies, softif_neigh->last_seen + - msecs_to_jiffies(SOFTIF_NEIGH_TIMEOUT))) && + if ((!has_timed_out(softif_neigh->last_seen, + SOFTIF_NEIGH_TIMEOUT)) && (atomic_read(&bat_priv->mesh_state) == MESH_ACTIVE)) continue; diff --git a/vis.c b/vis.c index ac7e661..4f4b2a0 100644 --- a/vis.c +++ b/vis.c @@ -714,8 +714,7 @@ static void purge_vis_packets(struct bat_priv *bat_priv) if (info == bat_priv->my_vis_info) continue; - if (time_after(jiffies, - info->first_seen + VIS_TIMEOUT * HZ)) { + if (has_timed_out(info->first_seen, VIS_TIMEOUT)) { hlist_del(node); send_list_del(info); kref_put(&info->refcount, free_info);