All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Bill O'Donnell" <billodo@redhat.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH v3 2/2] xfs_quota: additional changes to allow use on ext4
Date: Tue, 23 Aug 2016 14:11:56 -0500	[thread overview]
Message-ID: <20160823191156.GA1358@redhat.com> (raw)
In-Reply-To: <07c520b8-ead6-4ff9-cc8c-463cc2c33d47@sandeen.net>

On Tue, Aug 23, 2016 at 11:54:48AM -0500, Eric Sandeen wrote:
> 
> 
> On 8/23/16 11:40 AM, Bill O'Donnell wrote:
> > Further changes to allow xfs_quota to be used on foreign filesystem(s)
> > (e.g. ext4) for project quota testing in xfstests.
> > 
> > Add CMD_SKIP_CHECK to enable "generic" xfs_quota commands (help and
> > quit) when xfs_quota is run on foreign filesystems.
> > Use CMD_FLAG_FOREIGN_OK on commands suitable for foreign filesystems.
> > Refactor init_check_command in quota/init.c for clarity.
> > 
> > Signed-off-by: Bill O'Donnell <billodo@redhat.com>
> > ---
> >  libxcmd/help.c |  4 +++-
> >  libxcmd/quit.c |  4 +++-
> >  quota/init.c   | 29 ++++++++++++++++++++---------
> >  quota/init.h   |  2 ++
> >  4 files changed, 28 insertions(+), 11 deletions(-)
> > 
> > diff --git a/libxcmd/help.c b/libxcmd/help.c
> > index fad0ab9..d2e72a0 100644
> > --- a/libxcmd/help.c
> > +++ b/libxcmd/help.c
> > @@ -18,6 +18,7 @@
> >  
> >  #include "platform_defs.h"
> >  #include "command.h"
> > +#include "../quota/init.h"
> >  
> >  static cmdinfo_t help_cmd;
> >  static void help_onecmd(const char *cmd, const cmdinfo_t *ct);
> > @@ -88,7 +89,8 @@ help_init(void)
> >  	help_cmd.cfunc = help_f;
> >  	help_cmd.argmin = 0;
> >  	help_cmd.argmax = 1;
> > -	help_cmd.flags = CMD_FLAG_GLOBAL;
> > +	help_cmd.flags = CMD_FLAG_GLOBAL | CMD_FLAG_FOREIGN_OK |
> > +		CMD_SKIP_CHECK;
> 
> Nitpick, but no need to set both FOREIGN_OK and SKIP_CHECK, right?
> If the first is set, the 2nd is never tested (below), I think?

Yes. Good catch.

> 
> >  	help_cmd.args = _("[command]");
> >  	help_cmd.oneline = _("help for one or all commands");
> >  
> > diff --git a/libxcmd/quit.c b/libxcmd/quit.c
> > index 0183b8f..9dbd29a 100644
> > --- a/libxcmd/quit.c
> > +++ b/libxcmd/quit.c
> > @@ -18,6 +18,7 @@
> >  
> >  #include "platform_defs.h"
> >  #include "command.h"
> > +#include "../quota/init.h"
> >  
> >  static cmdinfo_t quit_cmd;
> >  
> > @@ -38,7 +39,8 @@ quit_init(void)
> >  	quit_cmd.cfunc = quit_f;
> >  	quit_cmd.argmin = -1;
> >  	quit_cmd.argmax = -1;
> > -	quit_cmd.flags = CMD_FLAG_GLOBAL;
> > +	quit_cmd.flags = CMD_FLAG_GLOBAL | CMD_FLAG_FOREIGN_OK |
> > +		CMD_SKIP_CHECK;
> >  	quit_cmd.oneline = _("exit the program");
> >  
> >  	add_command(&quit_cmd);
> > diff --git a/quota/init.c b/quota/init.c
> > index 137cd68..b487dd5 100644
> > --- a/quota/init.c
> > +++ b/quota/init.c
> > @@ -109,15 +109,26 @@ static int
> >  init_check_command(
> >  	const cmdinfo_t	*ct)
> >  {
> > -	if (fs_path &&
> > -	    !(ct->flags & CMD_FLAG_FOREIGN_OK) &&
> > -	     (fs_path->fs_flags & FS_FOREIGN)) {
> > -		fprintf(stderr,
> > -	_("foreign mount active, %s command is for XFS filesystems only\n"),
> > -			ct->name);
> > -		return 0;
> > -	}
> > -	return 1;
> > +	if (!fs_path)
> > +		return 1;
> > +
> > +	/* Always run commands that we are told to skip here */
> > +	if (ct->flags & CMD_SKIP_CHECK)
> > +		return 1;
> > +
> > +	/* if it's an XFS filesystem, always run the command */
> > +	if (!(fs_path->fs_flags & FS_FOREIGN))
> > +		return 1;
> > +
> > +	/* If the user specified foreign filesysetms are ok, run it */
> > +	if (foreign_allowed &&
> > +	    (ct->flags & CMD_FLAG_FOREIGN_OK))
> > +		return 1;
> > +
> > +	/* foreign filesystem and it's no a valid command! */
> 
> s/no/not/ while you're at it :)
> 
Yep.

> > +	fprintf(stderr, _("%s command is for XFS filesystems only\n"),
> > +		ct->name);
> > +	return 0;
> >  }
> >  
> >  static void
> > diff --git a/quota/init.h b/quota/init.h
> > index 6879855..aa1cc51 100644
> > --- a/quota/init.h
> > +++ b/quota/init.h
> > @@ -31,3 +31,5 @@ extern void	report_init(void);
> >  extern void	state_init(void);
> >  
> >  extern void init_cvtnum(unsigned int *, unsigned int *);
> > +
> > +#define CMD_SKIP_CHECK	(1<<0) /* command is always run */
> 
> how about "always available" - it's not run unless it's invoked.  ;)

Agreed.

Thanks for the review-
Bill

> 
> -Eric
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

      reply	other threads:[~2016-08-23 19:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-23 16:40 [PATCH v3 0/3] xfs_quota: allow operation on ext4 for project quotas Bill O'Donnell
2016-08-23 16:40 ` [PATCH v3 1/2] xfs_quota: add capabilities for use on ext4 Bill O'Donnell
2016-08-23 16:40 ` [PATCH v3 2/2] xfs_quota: additional changes to allow " Bill O'Donnell
2016-08-23 16:54   ` Eric Sandeen
2016-08-23 19:11     ` Bill O'Donnell [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160823191156.GA1358@redhat.com \
    --to=billodo@redhat.com \
    --cc=sandeen@sandeen.net \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.