linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Theodore Ts'o <tytso@mit.edu>
Cc: Andreas Dilger <adilger@dilger.ca>,
	"Darrick J. Wong" <darrick.wong@oracle.com>,
	Aurelien Jarno <aurelien@aurel32.net>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Robert Edmonds <edmonds@debian.org>,
	Rob Browning <rlb@defaultvalue.org>
Subject: Re: Argument type for FS_IOC_GETFLAGS/FS_IOC_SETFLAGS ioctls
Date: Fri, 29 Nov 2013 16:27:48 +1100	[thread overview]
Message-ID: <20131129052748.GV10988@dastard> (raw)
In-Reply-To: <20131129045412.GA18142@thunk.org>

On Thu, Nov 28, 2013 at 11:54:12PM -0500, Theodore Ts'o wrote:
> On Thu, Nov 28, 2013 at 05:53:10PM -0700, Andreas Dilger wrote:
> > 
> > Note that there are already FS_IOC32_{GET,SET}{VERSION,FLAGS} ioctl
> > definitions for  that date back to 2.6.19 or so that correctly use "int"
> > for the size argument.  Those are unfortunately(?) under CONFIG_COMPAT
> > instead of just being inline with the normal ioctl definitions, so I'm
> > not sure if those are available on the systems in question.  CONFIG_COMPAT
> > was the default for RHEL5 and SLES10 kernels, but the compat ioctl code
> > was only in ext4 and not ext3 in RHEL5 at least.
> 
> This were introduced to support 32-bit userspace programs (where
> sizeof(long) == sizeof(int) == 4) with a 64-bit kernel.  The intent
> was not to "fix" the ioctl, so much as it was to enable 32-bit
> programs.  The compat code is in ext3 as well, although it uses
> EXT3_IOC32_[SG]ETFLAGS.
> 
> > I suspect those have already been around long enough for chattr/lsattr to
> > start trying to use them first, and fall back to using the "broken" IOC
> > numbers if they fail.
> 
> Nope, chattr/lsattr does not try using them first, because the intent
> wasn't to "fix" the "broken" IOC numbers.  If you look in the sources,
> e2fsprogs is only using EXT2_IOC_[SG]ETFLAGS.  (These ioctls were
> originally only defined for ext2, and intended for use only for
> ext[23].  They got adopted by other file systems, and then they get
> moved into linux/fs..)
> 
> > > P.S.  If we were going to create a new ioctl, what I'd suggest is that
> > > the new ioctl explicitly use a 64-bit type, instead of using "long" or
> > > "int", to avoid the compat ioctl hair to allow 64-bit kernels to
> > > support 32-bit userspace programs.
> > 
> > Unfortunately, I don't think it would be possible to just use:
> > 
> > #define FS_IOC_GETFLAGS_NEW		_IOR('f', 1, __u64)
> > 
> > since this would conflict with the existing "long" definition on 64-bit
> > platforms that actually expect an "int" argument.  It definitely would
> > be desirable to get a 64-bit attributes API, since we are very close to
> > running out of space in the 32-bit flags definitions.
> 
> Sure, I was thinking about doing something like this instead:
> 
> #define FS_IOC_GETFLAGS_WIDE		_IOR('f', 32, __u64)
> #define FS_IOC_SETFLAGS_WIDE		_IOR('f', 32, __u64)
> 
> And I agree that a good reason to do this is to get 64 bits worth of
> attributes....

Why create a new ioctl for getting these generic attributes out of
the kernel? Isn't that the problem xstat() is supposed to solve?

And if it's truly generic stuff, then a syscall pair with enough
bitmap space for the forseeable future is more appropriate than a
new ioctl....

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2013-11-29  5:27 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-26 20:05 Argument type for FS_IOC_GETFLAGS/FS_IOC_SETFLAGS ioctls Aurelien Jarno
2013-11-27  1:01 ` Darrick J. Wong
2013-11-27  4:00   ` Theodore Ts'o
2013-11-27 10:03     ` Aurelien Jarno
2013-11-27 13:34       ` Theodore Ts'o
2013-11-27 18:14         ` Robert Edmonds
2013-11-27 23:14         ` Aurelien Jarno
2013-11-29  0:53     ` Andreas Dilger
2013-11-29  4:54       ` Theodore Ts'o
2013-11-29  5:27         ` Dave Chinner [this message]
2013-11-29 14:22           ` Theodore Ts'o
2013-11-29 16:32             ` Rob Browning
2013-12-01 22:20             ` Dave Chinner
2013-12-02  4:52               ` Theodore Ts'o
2013-12-02 22:30                 ` Dave Chinner
2013-11-29 21:55           ` Andreas Dilger
2013-12-19 18:20   ` Rob Browning
2013-12-19 23:30     ` Darrick J. Wong
2013-11-27 10:15 ` Christoph Hellwig
2014-06-30 22:51   ` Rob Browning

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=20131129052748.GV10988@dastard \
    --to=david@fromorbit.com \
    --cc=adilger@dilger.ca \
    --cc=aurelien@aurel32.net \
    --cc=darrick.wong@oracle.com \
    --cc=edmonds@debian.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=rlb@defaultvalue.org \
    --cc=tytso@mit.edu \
    --cc=viro@zeniv.linux.org.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).