From: "Darrick J. Wong" <djwong@kernel.org>
To: Disha Goel <disgoel@linux.ibm.com>
Cc: fstests@vger.kernel.org, ojaswin@linux.ibm.com, ritesh.list@gmail.com
Subject: Re: [PATCH] xfstests: replace custom __u64 definition with uint64_t
Date: Thu, 21 Dec 2023 09:12:47 -0800 [thread overview]
Message-ID: <20231221171247.GB108281@frogsfrogsfrogs> (raw)
In-Reply-To: <20231221061231.44347-1-disgoel@linux.ibm.com>
On Thu, Dec 21, 2023 at 11:42:31AM +0530, Disha Goel wrote:
> In some distributions, __u64 is already defined in system header files,
> causing compilation errors when building xfstest.
>
> # make
> [CC] ext4_resize
> ext4_resize.c:17:28: error: conflicting types for '__u64'
> typedef unsigned long long __u64;
> ^~~~~
> In file included from /usr/include/asm/types.h:26:0,
> from /usr/include/linux/types.h:5,
> from /usr/include/linux/mount.h:4,
> from /usr/include/sys/mount.h:32,
> from ext4_resize.c:15:
> /usr/include/asm-generic/int-l64.h:30:23: note: previous declaration of '__u64' was here
> typedef unsigned long __u64;
> ^~~~~
>
> To address this issue, replace the custom definition of __u64 with the
> standard uint64_t type from <stdint.h>. uint64_t is part of the C99
> standard, offering a standardised approach for representing unsigned
> 64-bit integers. This modification enhances code consistency and
> ensures compatibility with standard types.
...but isn't consistent with the definition in the kernel uapi headers.
ioctls explicitly use __u64, not uint64_t, and there are a few arches
(apparently) where __u64 ends up an unsigned long long but uint64_t ends
up an unsigned long, and the reverse.
> Tested on various distributions on Power architecture, by successfully
> compiling xfstest. Additionally, verified the compatibility by running
> ext4/033 and ext4/056 tests, both of which use ext4_resize and
> observed successful test execution.
>
> # make
> [CC] detached_mounts_propagation
> [CC] ext4_resize
> [CC] t_readdir_3
>
> Signed-off-by: Disha Goel <disgoel@linux.ibm.com>
> ---
> src/ext4_resize.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/src/ext4_resize.c b/src/ext4_resize.c
> index 78b66432..6e60ee5b 100644
> --- a/src/ext4_resize.c
> +++ b/src/ext4_resize.c
> @@ -14,10 +14,8 @@
> #include <sys/ioctl.h>
> #include <sys/mount.h>
Why not #include <linux/ext4.h>, which gets you both the __u64 typedef
and EXT4_IOC_RESIZE_FS?
--D
>
> -typedef unsigned long long __u64;
> -
> #ifndef EXT4_IOC_RESIZE_FS
> -#define EXT4_IOC_RESIZE_FS _IOW('f', 16, __u64)
> +#define EXT4_IOC_RESIZE_FS _IOW('f', 16, uint64_t)
> #endif
>
> #define pr_error(fmt, ...) do { \
> @@ -31,7 +29,7 @@ static void usage(void)
>
> int main(int argc, char **argv)
> {
> - __u64 new_size;
> + uint64_t new_size;
> int error, fd;
> char *mnt_dir = NULL, *tmp = NULL;
>
> --
> 2.39.1
>
>
next prev parent reply other threads:[~2023-12-21 17:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-21 6:12 [PATCH] xfstests: replace custom __u64 definition with uint64_t Disha Goel
2023-12-21 17:12 ` Darrick J. Wong [this message]
2023-12-26 8:44 ` Disha Goel
2023-12-26 17:52 ` Darrick J. Wong
2024-01-03 12:20 ` Disha Goel
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=20231221171247.GB108281@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=disgoel@linux.ibm.com \
--cc=fstests@vger.kernel.org \
--cc=ojaswin@linux.ibm.com \
--cc=ritesh.list@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox