Received: by 10.192.165.148 with SMTP id m20csp3767675imm; Mon, 23 Apr 2018 12:00:49 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+y1lkuUt4gLCjhlcmbJlxDqxo1WnoelbouRpyH6COxwLYooCKSosco1YWeuWQD+sFXllCK X-Received: by 2002:a17:902:82c4:: with SMTP id u4-v6mr22015720plz.160.1524510049440; Mon, 23 Apr 2018 12:00:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524510049; cv=none; d=google.com; s=arc-20160816; b=OX+1VBNMjI2FbKrQVvKIDK7H0dvVJ1MoAW3ee5Pw+GeTBbZXZAQnYOnvPg0HaMIq2Y JZ4UrUrhtN4MCh4cgkZd0Zw6jPerZWJzAX3rpuNx+a4bOzJ8QYS+pfPV20lcKLrD3KtY G6uWIodxtxUtyrSceLSsi+y7ESdWPpEQQqL8UKcZtdYSAq9U/DUGNDrcnDouDFNwa4Gx jcKzsyP7N/M53sYjA5mzG7qqO8jiRo+aDMVM8SqGRtvs4vB/QhdhXWt8AWfSISPaacGn TOqWo9xXSPKJGoLI2ljHLW/ElG9XC1rv3Cp0kbN/AqI8e7d0y/8ctFUXy5qV2l4Tao0b eJow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dmarc-filter:arc-authentication-results; bh=KRpabnZ2WpJukr6DDHbqcLJ8XlFcloMPSU3+ohfIF88=; b=Vke5LwdZwK735uGnmp5XAakWDxV10TVS4Xh+G4OkMlNSOrkSbac9Hla8qYfOQNG+WY 9D8XsN9fRnDVVnqOD7zgb/PLQw0/lCgtgwLhbyxW3Fc8YEe6DYRdR/bewAwU5bMqOFyp SH6fa5f9dOOxpY00vMj4qbbuIRmkcPoVZ+lDmrrDdzPIW1acMGgo4iPSQnoOXoG3HAE0 Lxq9ofSJJu7CpZgSU3w8TzA6wq2mEPgeCVfBxvzNdBrhET2DeM/xGXTNZFPdaYmZl3Qf v5BQCzwrO8HlhZziKt9ay79jHP86sNr5SOCqwqwGbXV6T5K/m4MglgYjSyX7OEHFj3Rb Kb7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x189si10218470pgb.384.2018.04.23.12.00.33; Mon, 23 Apr 2018 12:00:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932289AbeDWS71 (ORCPT + 99 others); Mon, 23 Apr 2018 14:59:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:35728 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932085AbeDWS70 (ORCPT ); Mon, 23 Apr 2018 14:59:26 -0400 Received: from jouet.infradead.org (unknown [190.15.121.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8015321782; Mon, 23 Apr 2018 18:59:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8015321782 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=acme@kernel.org Received: by jouet.infradead.org (Postfix, from userid 1000) id 53F071457B2; Mon, 23 Apr 2018 15:59:23 -0300 (-03) Date: Mon, 23 Apr 2018 15:59:23 -0300 From: Arnaldo Carvalho de Melo To: Ravi Bangoria Cc: mhiramat@kernel.org, jolsa@redhat.com, acme@redhat.com, kstewart@linuxfoundation.org, tglx@linutronix.de, pombredanne@nexb.com, linux-kernel@vger.kernel.org, peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com, namhyung@kernel.org, uneedsihyeon@gmail.com, kjlx@templeofstupid.com Subject: Re: [PATCH v2 3/3] perf/buildid-cache: Support --purge-all option Message-ID: <20180423185923.GB3788@kernel.org> References: <20180417041346.5617-1-ravi.bangoria@linux.vnet.ibm.com> <20180417041346.5617-4-ravi.bangoria@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180417041346.5617-4-ravi.bangoria@linux.vnet.ibm.com> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Tue, Apr 17, 2018 at 09:43:46AM +0530, Ravi Bangoria escreveu: > User can remove files from cache using --remove/--purge options > but both needs list of files as an argument. It's not convenient > when you want to flush out entire cache. Add an option to purge > all files from cache. > > Ex, > # perf buildid-cache -l > 8a86ef73e44067bca52cc3f6cd3e5446c783391c /tmp/a.out > ebe71fdcf4b366518cc154d570a33cd461a51c36 /tmp/a.out.1 > # perf buildid-cache -P -v > Removing /tmp/a.out (8a86ef73e44067bca52cc3f6cd3e5446c783391c): Ok > Removing /tmp/a.out.1 (ebe71fdcf4b366518cc154d570a33cd461a51c36): Ok > Purged all: Ok > > Signed-off-by: Ravi Bangoria > --- > tools/perf/Documentation/perf-buildid-cache.txt | 3 +++ > tools/perf/builtin-buildid-cache.c | 36 ++++++++++++++++++++++++- > 2 files changed, 38 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/Documentation/perf-buildid-cache.txt b/tools/perf/Documentation/perf-buildid-cache.txt > index 3f285ba6e1f9..f6de0952ff3c 100644 > --- a/tools/perf/Documentation/perf-buildid-cache.txt > +++ b/tools/perf/Documentation/perf-buildid-cache.txt > @@ -48,6 +48,9 @@ OPTIONS > --purge=:: > Purge all cached binaries including older caches which have specified > path from the cache. > +-P:: > +--purge-all:: > + Purge all cached binaries. This will flush out entire cache. > -M:: > --missing=:: > List missing build ids in the cache for the specified file. > diff --git a/tools/perf/builtin-buildid-cache.c b/tools/perf/builtin-buildid-cache.c > index fd0a08661b42..d11226f76fbc 100644 > --- a/tools/perf/builtin-buildid-cache.c > +++ b/tools/perf/builtin-buildid-cache.c > @@ -240,6 +240,34 @@ static int build_id_cache__purge_path(const char *pathname, struct nsinfo *nsi) > return err; > } > > +static int build_id_cache__purge_all(void) > +{ > + struct strlist *list; > + struct str_node *pos; > + int err; > + char *buf; > + > + list = build_id_cache__list_all(false); > + if (!list) { > + pr_debug("Failed to get buildids: -%d\n", errno); > + return -EINVAL; > + } > + > + strlist__for_each_entry(pos, list) { > + buf = build_id_cache__origname(pos->s); > + err = build_id_cache__remove_s(pos->s); > + pr_debug("Removing %s (%s): %s\n", buf, pos->s, > + err ? "FAIL" : "Ok"); > + free(buf); > + if (err) > + break; > + } > + strlist__delete(list); > + > + pr_debug("Purged all: %s\n", err ? "FAIL" : "Ok"); > + return err; > +} err may be used uninitialized, and debian:7 complains with: CC /tmp/build/perf/util/ctype.o builtin-buildid-cache.c: In function 'cmd_buildid_cache': builtin-buildid-cache.c:267:2: error: 'err' may be used uninitialized in this function [-Werror=uninitialized] builtin-buildid-cache.c:247:6: note: 'err' was declared here MKDIR /tmp/build/perf/util/ cc1: all warnings being treated as errors CC /tmp/build/perf/util/db-export.o mv: cannot stat `/tmp/build/perf/.builtin-buildid-cache.o.tmp': No such file or directory make[3]: *** [/tmp/build/perf/builtin-buildid-cache.o] Error 1 make[3]: *** Waiting for unfinished jobs.... I'm initializing it to zero. - Arnaldo