linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Argument type for FS_IOC_GETFLAGS/FS_IOC_SETFLAGS ioctls
@ 2013-11-26 20:05 Aurelien Jarno
  2013-11-27  1:01 ` Darrick J. Wong
  2013-11-27 10:15 ` Christoph Hellwig
  0 siblings, 2 replies; 20+ messages in thread
From: Aurelien Jarno @ 2013-11-26 20:05 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, Robert Edmonds, Rob Browning

[-- Attachment #1: Type: text/plain, Size: 1291 bytes --]

Hi,

If I understand correctly how ioctl declarations works, FS_IOC_GETFLAGS
and FS_IOC_SETFLAGS ioctls take a pointer to a long argument, at least
according to include/uapi/linux/fs.h:

| #define FS_IOC_GETFLAGS                 _IOR('f', 1, long)
| #define FS_IOC_SETFLAGS                 _IOW('f', 2, long)

Not also the 32-bit compat versions of the ioctls takes an int:

| #define FS_IOC32_GETFLAGS               _IOR('f', 1, int)
| #define FS_IOC32_SETFLAGS               _IOW('f', 2, int)

However on the kernel side, all the filesystem interpret these values as
an int. For example in fs/ext4/ioctl.c:

|        unsigned int flags;
| ...
|                 return put_user(flags, (int __user *) arg);
| ...
|                 if (get_user(flags, (int __user *) arg))
| ...

Most of the userland code seems to pass an int to this ioctl, but a few
others (e.g.: bup, libexplain) passes a long. While it doesn't make a
difference on little endian machines, it does make a difference on
64-bit big endian machines.

Could you please tell me if I am wrong in my analysis or if there is a
actually real problem?

Thanks,
Aurelien

-- 
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 190 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2014-06-30 22:59 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).