From owner-p4-projects@FreeBSD.ORG Sun Aug 5 18:29:47 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4A25516A474; Sun, 5 Aug 2007 18:29:47 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F36B916A468 for ; Sun, 5 Aug 2007 18:29:46 +0000 (UTC) (envelope-from fli@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id EE87313C457 for ; Sun, 5 Aug 2007 18:29:46 +0000 (UTC) (envelope-from fli@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id l75ITku8040470 for ; Sun, 5 Aug 2007 18:29:46 GMT (envelope-from fli@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id l75ITk3u040467 for perforce@freebsd.org; Sun, 5 Aug 2007 18:29:46 GMT (envelope-from fli@FreeBSD.org) Date: Sun, 5 Aug 2007 18:29:46 GMT Message-Id: <200708051829.l75ITk3u040467@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to fli@FreeBSD.org using -f From: Fredrik Lindberg To: Perforce Change Reviews Cc: Subject: PERFORCE change 124744 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2007 18:29:47 -0000 http://perforce.freebsd.org/chv.cgi?CH=124744 Change 124744 by fli@fli_nexus on 2007/08/05 18:28:58 - Add cache_flush() that flushes all entries in the cache. - Whitespace fixes. Affected files ... .. //depot/projects/soc2007/fli-mdns_sd/mdnsd/cache.c#5 edit Differences ... ==== //depot/projects/soc2007/fli-mdns_sd/mdnsd/cache.c#5 (text+ko) ==== @@ -85,7 +85,7 @@ { records_init(&c->c_recs, mdns_c_in); TAILQ_INIT(&c->c_list); - c->c_queries = q; + c->c_queries = q; } void @@ -213,7 +213,7 @@ rs.r_ttl = 0; rs.r_class = mdns_c_in; rs.r_type = rt->rt_type; - rs.r_data = rr->rr_data; + rs.r_data = rr->rr_data; rs.r_datalen = rr->rr_len; query_notify(c->c_queries, &rs, 0, 0, 0); } @@ -310,3 +310,18 @@ cr->cr_ttl_rel = ttl; enqueue_ttl(c, cr); } + +/* + * Flush all cache entries ignoring TTL + * c - Cache handle + */ +void +cache_flush(struct cache *c) +{ + struct cache_res *cr, *cr2; + + TAILQ_FOREACH_SAFE(cr, &c->c_list, cr_next, cr2) { + cache_del(c, &cr->cr_res); + } + dprintf(DEBUG_CACHE, "Flushed all cache entries c=%x", c); +}