From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751566AbdJXH0X (ORCPT ); Tue, 24 Oct 2017 03:26:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60816 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750868AbdJXH0V (ORCPT ); Tue, 24 Oct 2017 03:26:21 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B82DFC0272C6 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jolsa@redhat.com Date: Tue, 24 Oct 2017 09:26:15 +0200 From: Jiri Olsa To: "Liang, Kan" Cc: "acme@kernel.org" , "mingo@redhat.com" , "linux-kernel@vger.kernel.org" , "peterz@infradead.org" , "jolsa@kernel.org" , "wangnan0@huawei.com" , "hekuang@huawei.com" , "namhyung@kernel.org" , "alexander.shishkin@linux.intel.com" , "Hunter, Adrian" , "ak@linux.intel.com" Subject: Re: [PATCH V3 4/6] perf tools: add perf_data_file__open_tmp Message-ID: <20171024072615.GC27972@krava> References: <1508529934-369393-1-git-send-email-kan.liang@intel.com> <1508529934-369393-5-git-send-email-kan.liang@intel.com> <20171023161327.GA13456@krava> <37D7C6CF3E00A74B8858931C1DB2F077537D8814@SHSMSX103.ccr.corp.intel.com> <20171023162658.GA13620@krava> <37D7C6CF3E00A74B8858931C1DB2F077537D88EF@SHSMSX103.ccr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <37D7C6CF3E00A74B8858931C1DB2F077537D88EF@SHSMSX103.ccr.corp.intel.com> User-Agent: Mutt/1.9.1 (2017-09-22) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 24 Oct 2017 07:26:20 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 23, 2017 at 06:05:12PM +0000, Liang, Kan wrote: > > SNIP > > > > > > > ssize_t perf_data_file__write(struct perf_data_file *file, diff > > > > > --git a/tools/perf/util/data.h b/tools/perf/util/data.h index > > > > > ae510ce..892b3d5 100644 > > > > > --- a/tools/perf/util/data.h > > > > > +++ b/tools/perf/util/data.h > > > > > @@ -10,6 +10,7 @@ enum perf_data_mode { > > > > > > > > > > struct perf_data_file { > > > > > const char *path; > > > > > + char *tmp_path; > > > > > > > > could we add is_tmp instead of new path pointer and keep the path > > > > for the name..? > > > > > > The 'path' is const char. I think it's not good for tmp file which > > > generate the file name in real time. > > > > then change path to 'char *' ? I just dont think having > > 2 name pointers for path will keep this simple > > > > I tried, but it will impact almost all the perf tools. > The input/output file name is const char*, which means that the file > name should not be change. > I just don't think it's right to cast it to char *. ok, then the original approach does not look that bad now ;-) jirka