From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753341AbbIBNjg (ORCPT ); Wed, 2 Sep 2015 09:39:36 -0400 Received: from mail.kernel.org ([198.145.29.136]:59407 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751894AbbIBNjf (ORCPT ); Wed, 2 Sep 2015 09:39:35 -0400 Date: Wed, 2 Sep 2015 10:39:31 -0300 From: Arnaldo Carvalho de Melo To: Jiri Olsa Cc: lkml , David Ahern , Ingo Molnar , Namhyung Kim , Peter Zijlstra , Matt Fleming , =?iso-8859-1?Q?Rapha=EBl?= Beamonte , Steven Rostedt Subject: Re: [PATCH 12/15] tools lib api: Add configured support for fs Message-ID: <20150902133931.GH12722@kernel.org> References: <1441180605-24737-1-git-send-email-jolsa@kernel.org> <1441180605-24737-13-git-send-email-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1441180605-24737-13-git-send-email-jolsa@kernel.org> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Wed, Sep 02, 2015 at 09:56:42AM +0200, Jiri Olsa escreveu: > Adding name__mount (where name is in sysfs,procfs,debugfs,tracefs) > interface that returns bool state of the filesystem mount: > true - mounted, false - not mounted Well, why not take the opportunity and call it... name__mounted()? "__configured()" is too vague... Also there was some cut'n'pasting mistake here... if you agree I can fix it all up and make this change, well, I'm doing it on my local tree, holler if you have any objection :) - Arnaldo > It will not try to mount the filesystem. No FSTYPE__configured() (to-be FSTYPE__mounted()) doesn't mount anything, that is what FSTYPE__mount() does :-) - Arnaldo > Link: http://lkml.kernel.org/n/tip-csvlq2hr43ys3u7nfs2up9y9@git.kernel.org > Signed-off-by: Jiri Olsa > --- > tools/lib/api/fs/fs.c | 23 ++++++++++++++--------- > tools/lib/api/fs/fs.h | 5 ++++- > 2 files changed, 18 insertions(+), 10 deletions(-) > > diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c > index bc93baf33fff..8afe08a99bc6 100644 > --- a/tools/lib/api/fs/fs.c > +++ b/tools/lib/api/fs/fs.c > @@ -244,15 +244,20 @@ static const char *fs__mount(int idx) > return fs__check_mounts(fs) ? fs->path : NULL; > } > > -#define FS(name, idx) \ > -const char *name##__mountpoint(void) \ > -{ \ > - return fs__mountpoint(idx); \ > -} \ > - \ > -const char *name##__mount(void) \ > -{ \ > - return fs__mount(idx); \ > +#define FS(name, idx) \ > +const char *name##__mountpoint(void) \ > +{ \ > + return fs__mountpoint(idx); \ > +} \ > + \ > +const char *name##__mount(void) \ > +{ \ > + return fs__mount(idx); \ > +} \ > + \ > +bool name##__configured(void) \ > +{ \ > + return name##__mountpoint() != NULL; \ > } > > FS(sysfs, FS__SYSFS); > diff --git a/tools/lib/api/fs/fs.h b/tools/lib/api/fs/fs.h > index a9627ea5e6ae..f654bcb99d1e 100644 > --- a/tools/lib/api/fs/fs.h > +++ b/tools/lib/api/fs/fs.h > @@ -1,6 +1,8 @@ > #ifndef __API_FS__ > #define __API_FS__ > > +#include > + > /* > * On most systems would have given us this, but not on some systems > * (e.g. GNU/Hurd). > @@ -11,7 +13,8 @@ > > #define FS(name) \ > const char *name##__mountpoint(void); \ > - const char *name##__mount(void); > + const char *name##__mount(void); \ > + bool name##__configured(void); \ > > FS(sysfs) > FS(procfs) > -- > 2.4.3