From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aurelien Jarno Subject: Argument type for FS_IOC_GETFLAGS/FS_IOC_SETFLAGS ioctls Date: Tue, 26 Nov 2013 21:05:59 +0100 Message-ID: <20131126200559.GH20559@hall.aurel32.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="pY3vCvL1qV+PayAL" Cc: linux-fsdevel@vger.kernel.org, Robert Edmonds , Rob Browning To: Alexander Viro Return-path: Received: from hall.aurel32.net ([195.154.112.97]:51719 "EHLO hall.aurel32.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753053Ab3KZU2S (ORCPT ); Tue, 26 Nov 2013 15:28:18 -0500 Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-ID: --pY3vCvL1qV+PayAL Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 --=20 Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net --pY3vCvL1qV+PayAL Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iD8DBQFSlP8nw3ao2vG823MRAlDhAJ9+iFu/sumu2cDCbSVBghqru0+ZmACaAwlH eG4AsVlp6ARUDueTmdyzAac= =5k33 -----END PGP SIGNATURE----- --pY3vCvL1qV+PayAL--