From owner-p4-projects@FreeBSD.ORG Wed Nov 19 19:06:15 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 6020C1065677; Wed, 19 Nov 2008 19:06:15 +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 E179F106564A for ; Wed, 19 Nov 2008 19:06:14 +0000 (UTC) (envelope-from csjp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id D174B8FC13 for ; Wed, 19 Nov 2008 19:06:14 +0000 (UTC) (envelope-from csjp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJJ6EI9051975 for ; Wed, 19 Nov 2008 19:06:14 GMT (envelope-from csjp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id mAJJ6EZU051973 for perforce@freebsd.org; Wed, 19 Nov 2008 19:06:14 GMT (envelope-from csjp@freebsd.org) Date: Wed, 19 Nov 2008 19:06:14 GMT Message-Id: <200811191906.mAJJ6EZU051973@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to csjp@freebsd.org using -f From: "Christian S.J. Peron" To: Perforce Change Reviews Cc: Subject: PERFORCE change 153229 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: Wed, 19 Nov 2008 19:06:15 -0000 http://perforce.freebsd.org/chv.cgi?CH=153229 Change 153229 by csjp@hvm02 on 2008/11/19 19:05:15 Add a method to garbage collect all caches. Affected files ... .. //depot/projects/trustedbsd/bsmtrace/fcache.c#2 edit Differences ... ==== //depot/projects/trustedbsd/bsmtrace/fcache.c#2 (text+ko) ==== @@ -48,6 +48,24 @@ } void +fcache_destroy(void) +{ + struct fcache *fcp, *next_fcp; + struct dev_list *dp, *dp2; + + TAILQ_FOREACH_SAFE(dp, &cache_head, d_glue, dp2) { + for (fcp = RB_MIN(btree, &dp->d_btree); fcp != NULL; + fcp = next_fcp) { + next_fcp = RB_NEXT(btree, &dp->d_btree, fcp); + RB_REMOVE(btree, &dp->d_btree, fcp); + free(fcp); + } + TAILQ_REMOVE(&cache_head, dp, d_glue); + free(dp); + } +} + +void fcache_init(void) {