xfs
[Top] [All Lists]

Re: [PATCH] xfsprogs: remove setfl from xfs_io

To: Eric Sandeen <sandeen@xxxxxxxxxxx>
Subject: Re: [PATCH] xfsprogs: remove setfl from xfs_io
From: Carlos Maiolino <cmaiolino@xxxxxxxxxx>
Date: Thu, 17 Jan 2013 09:30:58 -0500
Cc: xfs-oss <xfs@xxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <50C3AB0E.3050006@xxxxxxxxxxx>
References: <50C39123.6050303@xxxxxxxxxxx> <50C3AB0E.3050006@xxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
Mark looks to have it stacked just needing reviews.


So, the patch looks good, feel free to add:

Reviewed-by: Carlos Maiolino <cmaiolino@xxxxxxxxxx>
On Sat, Dec 08, 2012 at 03:03:10PM -0600, Eric Sandeen wrote:
> Doesn't seem to have worked for ages, and is (therefore)
> apparently not ever used:
> 
> xfs_io> setfl
> xfs_io> help setfl
> setfl [-adx] -- set/clear append/direct flags on the open file
> xfs_io> setfl -a
> bad argument count 1 to setfl, expected 0 arguments
> xfs_io> setfl -d
> bad argument count 1 to setfl, expected 0 arguments
> xfs_io> setfl
> xfs_io> 
> 
> At best, it seems intended to toggle the flag state, but
> gives no feedback about current state.  -x is in help but
> not implemented, etc.
> 
> Just remove it.
> 
> Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
> ---
> 
> diff --git a/io/open.c b/io/open.c
> index 46538ba..cc677e6 100644
> --- a/io/open.c
> +++ b/io/open.c
> @@ -25,7 +25,6 @@
>  static cmdinfo_t open_cmd;
>  static cmdinfo_t stat_cmd;
>  static cmdinfo_t close_cmd;
> -static cmdinfo_t setfl_cmd;
>  static cmdinfo_t statfs_cmd;
>  static cmdinfo_t chproj_cmd;
>  static cmdinfo_t lsproj_cmd;
> @@ -668,45 +667,6 @@ extsize_f(
>  }
>  
>  static int
> -setfl_f(
> -     int                     argc,
> -     char                    **argv)
> -{
> -     int                     c, flags;
> -
> -     flags = fcntl(file->fd, F_GETFL, 0);
> -     if (flags < 0) {
> -             perror("fcntl(F_GETFL)");
> -             return 0;
> -     }
> -
> -     while ((c = getopt(argc, argv, "ad")) != EOF) {
> -             switch (c) {
> -             case 'a':
> -                     if (flags & O_APPEND)
> -                             flags |= O_APPEND;
> -                     else
> -                             flags &= ~O_APPEND;
> -                     break;
> -             case 'd':
> -                     if (flags & O_DIRECT)
> -                             flags |= O_DIRECT;
> -                     else
> -                             flags &= ~O_DIRECT;
> -                     break;
> -             default:
> -                     printf(_("invalid setfl argument -- '%c'\n"), c);
> -                     return 0;
> -             }
> -     }
> -
> -     if (fcntl(file->fd, F_SETFL, flags)  < 0)
> -             perror("fcntl(F_SETFL)");
> -
> -     return 0;
> -}
> -
> -static int
>  statfs_f(
>       int                     argc,
>       char                    **argv)
> @@ -791,13 +751,6 @@ open_init(void)
>       close_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK;
>       close_cmd.oneline = _("close the current open file");
>  
> -     setfl_cmd.name = "setfl";
> -     setfl_cmd.cfunc = setfl_f;
> -     setfl_cmd.args = _("[-adx]");
> -     setfl_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK;
> -     setfl_cmd.oneline =
> -             _("set/clear append/direct flags on the open file");
> -
>       statfs_cmd.name = "statfs";
>       statfs_cmd.cfunc = statfs_f;
>       statfs_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK;
> @@ -837,7 +790,6 @@ open_init(void)
>       add_command(&open_cmd);
>       add_command(&stat_cmd);
>       add_command(&close_cmd);
> -     add_command(&setfl_cmd);
>       add_command(&statfs_cmd);
>       add_command(&chproj_cmd);
>       add_command(&lsproj_cmd);
> 
> _______________________________________________
> xfs mailing list
> xfs@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs

-- 
Carlos

<Prev in Thread] Current Thread [Next in Thread>