public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Eric Biggers <ebiggers@kernel.org>
Cc: linux-ext4@vger.kernel.org,
	Paulo Antonio Alvarez <pauloaalvarez@gmail.com>
Subject: Re: [e2fsprogs PATCH] libext2fs: fix 32-bit Windows build
Date: Wed, 4 Jan 2023 08:54:27 -0800	[thread overview]
Message-ID: <Y7WvQ9cqOZuF0YJR@magnolia> (raw)
In-Reply-To: <20230104090301.275976-1-ebiggers@kernel.org>

On Wed, Jan 04, 2023 at 01:03:01AM -0800, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> _WIN32 is the standard macro to detect Windows, regardless of 32-bit or
> 64-bit.  _WIN64 is for 64-bit Windows only.  Use _WIN32 where _WIN64 was
> incorrectly being used.
> 
> This fixes several 32-bit Windows build errors, for example this one:

Color me impressed, I would have applied to deprecate Windows support
entirely, particularly given the existence of WSL.

That said ... back in the day, IIRC it was _WINDOWS that one was
supposed to check for a Windows build, and the _WIN{16,32,64} variants
existed to detect specific variants of it.  But, that was 25 years ago;
for all I know that's passé and _WIN32 is fine.

--D

> plausible.c: In function ‘print_ext2_info’:
> plausible.c:109:31: error: ‘unix_io_manager’ undeclared (first use in this function); did you mean ‘undo_io_manager’?
>   109 |                               unix_io_manager,
>       |                               ^~~~~~~~~~~~~~~
>       |                               undo_io_manager
> 
> Fixes: 86b6db9f5a43 ("libext2fs: code adaptation to use the Windows IO manager")
> Cc: Paulo Antonio Alvarez <pauloaalvarez@gmail.com>
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
>  lib/ext2fs/getsectsize.c | 12 ++++++------
>  lib/support/plausible.c  |  2 +-
>  util/subst.c             |  4 ++--
>  3 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/lib/ext2fs/getsectsize.c b/lib/ext2fs/getsectsize.c
> index 3a461eb9..bd978c53 100644
> --- a/lib/ext2fs/getsectsize.c
> +++ b/lib/ext2fs/getsectsize.c
> @@ -51,10 +51,10 @@
>   */
>  errcode_t ext2fs_get_device_sectsize(const char *file, int *sectsize)
>  {
> -#ifdef _WIN64
> +#ifdef _WIN32
>  	*sectsize = 512; // just guessing
>  	return 0;
> -#else // not _WIN64
> +#else // not _WIN32
>  
>  	int	fd;
>  
> @@ -78,7 +78,7 @@ errcode_t ext2fs_get_device_sectsize(const char *file, int *sectsize)
>  	close(fd);
>  	return 0;
>  
> -#endif // ifdef _WIN64
> +#endif // ifdef _WIN32
>  }
>  
>  /*
> @@ -117,11 +117,11 @@ int ext2fs_get_dio_alignment(int fd)
>   */
>  errcode_t ext2fs_get_device_phys_sectsize(const char *file, int *sectsize)
>  {
> -#ifdef _WIN64
> +#ifdef _WIN32
>  
>  	return ext2fs_get_device_sectsize(file, sectsize);
>  
> -#else // not _WIN64
> +#else // not _WIN32
>  
>  	int	fd;
>  
> @@ -147,5 +147,5 @@ errcode_t ext2fs_get_device_phys_sectsize(const char *file, int *sectsize)
>  	close(fd);
>  	return 0;
>  
> -#endif // ifdef _WIN64
> +#endif // ifdef _WIN32
>  }
> diff --git a/lib/support/plausible.c b/lib/support/plausible.c
> index bbed2a70..349aa2c4 100644
> --- a/lib/support/plausible.c
> +++ b/lib/support/plausible.c
> @@ -103,7 +103,7 @@ static void print_ext2_info(const char *device)
>  	time_t			tm;
>  
>  	retval = ext2fs_open2(device, 0, EXT2_FLAG_64BITS, 0, 0,
> -#ifdef _WIN64
> +#ifdef _WIN32
>  			      windows_io_manager,
>  #else
>  			      unix_io_manager,
> diff --git a/util/subst.c b/util/subst.c
> index c0eda5cf..be2a0dda 100644
> --- a/util/subst.c
> +++ b/util/subst.c
> @@ -434,7 +434,7 @@ int main(int argc, char **argv)
>  					printf("Using original atime\n");
>  				set_utimes(outfn, fileno(old), tv);
>  			}
> -#ifndef _WIN64
> +#ifndef _WIN32
>  			if (ofd >= 0)
>  				(void) fchmod(ofd, 0444);
>  #endif
> @@ -444,7 +444,7 @@ int main(int argc, char **argv)
>  		} else {
>  			if (verbose)
>  				printf("Creating or replacing %s.\n", outfn);
> -#ifndef _WIN64
> +#ifndef _WIN32
>  			if (ofd >= 0)
>  				(void) fchmod(ofd, 0444);
>  #endif
> -- 
> 2.39.0
> 

  reply	other threads:[~2023-01-04 16:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-04  9:03 [e2fsprogs PATCH] libext2fs: fix 32-bit Windows build Eric Biggers
2023-01-04 16:54 ` Darrick J. Wong [this message]
2023-01-04 20:05   ` Eric Biggers
2023-01-04 20:53     ` Eric Biggers

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=Y7WvQ9cqOZuF0YJR@magnolia \
    --to=djwong@kernel.org \
    --cc=ebiggers@kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=pauloaalvarez@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