From 70cbe94019cd24018d28887cf79953a0b41f4bee Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sat, 21 Jan 2023 12:32:24 -0800 Subject: [PATCH] misc/mke2fs: fix Windows build unix_io_manager is no longer available on Windows. windows_io_manager must be used instead. Fixes: 86b6db9f5a43 ("libext2fs: code adaptation to use the Windows IO manager") Cc: Paulo Antonio Alvarez Signed-off-by: Eric Biggers Signed-off-by: Theodore Ts'o --- lib/ext2fs/ext2_io.h | 2 ++ lib/support/plausible.c | 7 +------ misc/mke2fs.c | 12 ++++++------ 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/lib/ext2fs/ext2_io.h b/lib/ext2fs/ext2_io.h index 8fe5b32..679184e 100644 --- a/lib/ext2fs/ext2_io.h +++ b/lib/ext2fs/ext2_io.h @@ -145,10 +145,12 @@ extern errcode_t io_channel_cache_readahead(io_channel io, #ifdef _WIN32 /* windows_io.c */ extern io_manager windows_io_manager; +#define default_io_manager windows_io_manager #else /* unix_io.c */ extern io_manager unix_io_manager; extern io_manager unixfd_io_manager; +#define default_io_manager unix_io_manager #endif /* sparse_io.c */ diff --git a/lib/support/plausible.c b/lib/support/plausible.c index 349aa2c..65a6b2e 100644 --- a/lib/support/plausible.c +++ b/lib/support/plausible.c @@ -103,12 +103,7 @@ static void print_ext2_info(const char *device) time_t tm; retval = ext2fs_open2(device, 0, EXT2_FLAG_64BITS, 0, 0, -#ifdef _WIN32 - windows_io_manager, -#else - unix_io_manager, -#endif - &fs); + default_io_manager, &fs); if (retval) return; sb = fs->super; diff --git a/misc/mke2fs.c b/misc/mke2fs.c index d69b8ec..f486de8 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -1924,10 +1924,10 @@ profile_error: #ifdef CONFIG_TESTIO_DEBUG if (getenv("TEST_IO_FLAGS") || getenv("TEST_IO_BLOCK")) { io_ptr = test_io_manager; - test_io_backing_manager = unix_io_manager; + test_io_backing_manager = default_io_manager; } else #endif - io_ptr = unix_io_manager; + io_ptr = default_io_manager; retval = ext2fs_open(journal_device, EXT2_FLAG_JOURNAL_DEV_OK, 0, 0, io_ptr, &jfs); @@ -2694,7 +2694,7 @@ static int should_do_undo(const char *name) io_channel channel; __u16 s_magic; struct ext2_super_block super; - io_manager manager = unix_io_manager; + io_manager manager = default_io_manager; int csum_flag, force_undo; csum_flag = ext2fs_has_feature_metadata_csum(&fs_param) || @@ -2999,10 +2999,10 @@ int main (int argc, char *argv[]) #ifdef CONFIG_TESTIO_DEBUG if (getenv("TEST_IO_FLAGS") || getenv("TEST_IO_BLOCK")) { io_ptr = test_io_manager; - test_io_backing_manager = unix_io_manager; + test_io_backing_manager = default_io_manager; } else #endif - io_ptr = unix_io_manager; + io_ptr = default_io_manager; if (undo_file != NULL || should_do_undo(device_name)) { retval = mke2fs_setup_tdb(device_name, &io_ptr); @@ -3395,7 +3395,7 @@ int main (int argc, char *argv[]) retval = ext2fs_open(journal_device, EXT2_FLAG_RW| EXT2_FLAG_JOURNAL_DEV_OK, 0, - fs->blocksize, unix_io_manager, &jfs); + fs->blocksize, default_io_manager, &jfs); if (retval) { com_err(program_name, retval, _("while trying to open journal device %s\n"), -- 1.8.3.1