Received: by 10.223.176.5 with SMTP id f5csp1930030wra; Thu, 8 Feb 2018 05:57:00 -0800 (PST) X-Google-Smtp-Source: AH8x227bhNF3TQnbLVJoqRRAB0eXcOD/xNbDOHxZrwCqVmMdP3XUmXAhixRLAEVRVo4gCLdCEhKB X-Received: by 10.101.70.12 with SMTP id v12mr585304pgq.327.1518098220242; Thu, 08 Feb 2018 05:57:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518098220; cv=none; d=google.com; s=arc-20160816; b=Nr5owbOM3GUMyjh50U51gg6Wp/hvukBRpgJyfOXN1pRG0nHKwmicbaE1VgYWRui4yi +Us3B+HA5uy7vs5N6Rcv7x9LwmHQsruiilDFoQF8Q4T6d/yLn33RUFm6IGeTtoqgSLnL z8rsWWEiT5DSRpbeSgFP640S6elyz/tYQrSHlGlQ+XJGxEkz8La/oo9yYmRzVL+U2Q9b VIMKp/GgiHacHA0KWy12L2JxfiVVXI4CIWDORdmUouknNWMFa+kyPqg5Hhq4ZEQnRqih Aa8GN61OYgUJvCLTZnvqji3MideK0rkW9+cU7wr9qHMqg+pVC4E9sWPvTwJ5uPug4JKt zn3w== 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:arc-authentication-results; bh=FzsEjSi+bsp8tUYAx5dBhfY40B+nRxacD3uxOF/D6cE=; b=XvHRIwmJxM+TahzaGXXR32LZtHqq2JzRBmdo5bLHE2RpXqTd0fR9PRfQFQEoGn/MoB K++bhlrTvfAbT5HfRWSdwEDkuvYhdvLa7MDjq1SHefvQ7JBpk/dk+TLfM7HZ4vlBDQoG UdPsXxHmgMGGvby6d8RMH+R/NOYI5k+MZt0sCXI46NNdQx2h1govi7/yfOCikrOAdZom VGqc6rCGmmBDVSek17tPHY0wPJJZ0E6fkGsRX0RyDVo5s1wO0DVM37ao7o9H2e478NZ7 KwdMhBxHTpgK4RR+FuNNdN0QUGZCfEFDm4RHzq3OteNaSBwrc8PcnKwDqTNA5lv5LLWe bYAQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q25si25588pfh.116.2018.02.08.05.56.46; Thu, 08 Feb 2018 05:57:00 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752519AbeBHNzi (ORCPT + 99 others); Thu, 8 Feb 2018 08:55:38 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35330 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751343AbeBHNzg (ORCPT ); Thu, 8 Feb 2018 08:55:36 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3110FEB712; Thu, 8 Feb 2018 13:55:36 +0000 (UTC) Received: from krava (unknown [10.43.17.63]) by smtp.corp.redhat.com (Postfix) with SMTP id 4C3DF10073BB; Thu, 8 Feb 2018 13:55:34 +0000 (UTC) Date: Thu, 8 Feb 2018 14:55:33 +0100 From: Jiri Olsa To: John Garry Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com, namhyung@kernel.org, ak@linux.intel.com, wcohen@redhat.com, will.deacon@arm.com, ganapatrao.kulkarni@cavium.com, linux-kernel@vger.kernel.org, linuxarm@huawei.com, zhangshaokun@hisilicon.com, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 5/9] perf utils: add support for arch standard events Message-ID: <20180208135533.GI10234@krava> References: <1517939104-230881-1-git-send-email-john.garry@huawei.com> <1517939104-230881-6-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1517939104-230881-6-git-send-email-john.garry@huawei.com> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 08 Feb 2018 13:55:36 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 08 Feb 2018 13:55:36 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jolsa@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 07, 2018 at 01:45:00AM +0800, John Garry wrote: SNIP > > +static int is_json_file(const char *name) > +{ > + const char *suffix; > + > + if (strlen(name) < 5) > + return 0; > + > + suffix = name + strlen(name) - 5; > + > + if (strncmp(suffix, ".json", 5) == 0) > + return 1; > + return 0; > +} > + > +static int preprocess_arch_std_files(const char *fpath, const struct stat *sb, > + int typeflag, struct FTW *ftwbuf) > +{ > + int level = ftwbuf->level; > + int is_file = typeflag == FTW_F; > + > + if (level == 1 && is_file && is_json_file(fpath)) > + return json_events(fpath, save_arch_std_events, (void *)sb); so any .json file will pass.. just wondering you'd want to put some name restriction for recomended events file like this -recomended suffix you used later.. but that can be added later in case we'll need some other json files in here ;-) jirka