Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Aug 2007 18:29:46 GMT
From:      Fredrik Lindberg <fli@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 124744 for review
Message-ID:  <200708051829.l75ITk3u040467@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
+}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200708051829.l75ITk3u040467>