Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp5189741pxu; Tue, 22 Dec 2020 10:25:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJz0b1+pXxXZbUEdRyOPxxaLU/MfJpTEPWDlo/hsaIVvLsQWQmdQY2T6EvmuG9XHZpBBpmxi X-Received: by 2002:a05:6402:1d18:: with SMTP id dg24mr21232097edb.221.1608661500345; Tue, 22 Dec 2020 10:25:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608661500; cv=none; d=google.com; s=arc-20160816; b=cWAXf6gDiGh7TpR+ahAiKB1eKPipa/9wv4FPZLhZwM22Wz3aL3WCzRXmCVjPBNKpXT Js7ts7kVXWFVDSQIZH0ODgs+8aeypjPTEvL1uJKT8EeBxfrF4z6d/FgPL2iktKVuCesn DM5MqlGvr0ezLuZyN+LJvY4MpctrQRSRgRVKFXqdL7s/+xOibWWILe4ZR6jQ8g7wvfYa wKC0ENf2+++ELgLF7djmyHumZm7iRylZnDPp+7oXvyd7MxOfzmWulVp+D4gPOa16VBTi 3BrTDskb+Qun/rz+4OeA0Vvk3dS+CO0USu9BH4RWFEY6mi+62pX47ky21oaPED0Ms9VU XcJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=gOzWnAnu9R1ZixMb8XXxaTqMnMVtshMHnCyEACK7hAs=; b=eBYM0VeoRiOnoxxHj2iqq2QU1yT8cmNZ2GLa21Jk2tZW+gVB9++2v1pwQT+khfgYnb AOZvmv7Jui5wetZLkubMh4TN/jugwvT5Ay+zBhOqWNR5h0UDCQQGaYZFxNN9pR9EgiWE A4KB89yclTQ5p98ySkZpCteeKfJSmbDZg1Pbhj8diW8DEVuvAd5JA6NK/p6Y23yDTA1x 6XEOH+xSkK8Qwm7cqPiPX9yjkpeoKONgKMqj7nnmKSv9AYEztJwkCkki47OpfKOfnAD6 d8z2ipiMYOwVcupLRzYk0NRFCL3BZn0yvWj2epUxqFhKT3jlLu4bfNupMCheEE8DtjgY y6KA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=tse.jus.br Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v16si10925446eja.188.2020.12.22.10.24.36; Tue, 22 Dec 2020 10:25:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=tse.jus.br Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725994AbgLVSYa (ORCPT + 99 others); Tue, 22 Dec 2020 13:24:30 -0500 Received: from tina.tse.jus.br ([187.4.152.236]:39280 "EHLO tse.jus.br" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725961AbgLVSYa (ORCPT ); Tue, 22 Dec 2020 13:24:30 -0500 Received: from EXCH01.tse.gov.br (unknown [10.30.1.221]) by Forcepoint Email with ESMTP id 1DCE3CCEFB84766E24CD; Tue, 22 Dec 2020 15:16:29 -0300 (-03) Received: from tsesevinl73.tse.jus.br (10.30.32.51) by EXCH01.tse.gov.br (10.30.1.221) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 22 Dec 2020 15:16:28 -0300 From: To: CC: Paulo Antonio Alvarez Subject: [PATCH 3/3] Compile the io implementation according to os Date: Tue, 22 Dec 2020 15:15:52 -0300 Message-ID: <20201222181552.11267-4-paulo.alvarez@tse.jus.br> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201222181552.11267-1-paulo.alvarez@tse.jus.br> References: <20201222181552.11267-1-paulo.alvarez@tse.jus.br> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.30.32.51] Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Paulo Antonio Alvarez In mingw and cygwin, compile the windows_io manager, compile the unix_io everywhere else. --- configure | 56 ++++++++++++++++++++++++++++++++++++++++-- configure.ac | 13 ++++++++++ lib/ext2fs/Makefile.in | 13 +++++++--- 3 files changed, 76 insertions(+), 6 deletions(-) diff --git a/configure b/configure index d90188af..655da228 100755 --- a/configure +++ b/configure @@ -625,6 +625,7 @@ gl_use_threads_default= ac_func_list= ac_subst_vars='LTLIBOBJS LIBOBJS +OS_IO_FILE systemd_system_unit_dir have_systemd systemd_LIBS @@ -7338,8 +7339,6 @@ main () if (*(data + i) != *(data3 + i)) return 14; close (fd); - free (data); - free (data3); return 0; } _ACEOF @@ -13180,6 +13179,48 @@ if test "x$ac_cv_lib_blkid_blkid_probe_get_topology" = xyes; then : $as_echo "#define HAVE_BLKID_PROBE_GET_TOPOLOGY 1" >>confdefs.h +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for blkid_topology_get_dax in -lblkid" >&5 +$as_echo_n "checking for blkid_topology_get_dax in -lblkid... " >&6; } +if ${ac_cv_lib_blkid_blkid_topology_get_dax+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lblkid $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char blkid_topology_get_dax (); +int +main () +{ +return blkid_topology_get_dax (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_blkid_blkid_topology_get_dax=yes +else + ac_cv_lib_blkid_blkid_topology_get_dax=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_blkid_blkid_topology_get_dax" >&5 +$as_echo "$ac_cv_lib_blkid_blkid_topology_get_dax" >&6; } +if test "x$ac_cv_lib_blkid_blkid_topology_get_dax" = xyes; then : + +$as_echo "#define HAVE_BLKID_TOPOLOGY_GET_DAX 1" >>confdefs.h + fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for blkid_probe_enable_partitions in -lblkid" >&5 @@ -14647,6 +14688,17 @@ fi +OS_IO_FILE="" +case "$host_os" in + cigwin*|mingw*|msys*) + OS_IO_FILE=windows_io + ;; + *) + OS_IO_FILE=unix_io + ;; +esac + + test -d lib || mkdir lib test -d include || mkdir include test -d include/linux || mkdir include/linux diff --git a/configure.ac b/configure.ac index 7d921074..57eead0e 100644 --- a/configure.ac +++ b/configure.ac @@ -1756,6 +1756,19 @@ AS_IF([test "x${with_systemd_unit_dir}" != "xno"], ]) AC_SUBST(have_systemd) AC_SUBST(systemd_system_unit_dir) +dnl Adjust the compiled files if we are on windows vs everywhere else +dnl + +OS_IO_FILE="" +[case "$host_os" in + cigwin*|mingw*|msys*) + OS_IO_FILE=windows_io + ;; + *) + OS_IO_FILE=unix_io + ;; +esac] +AC_SUBST(OS_IO_FILE) dnl dnl Make our output files, being sure that we create the some miscellaneous diff --git a/lib/ext2fs/Makefile.in b/lib/ext2fs/Makefile.in index f754b952..67957183 100644 --- a/lib/ext2fs/Makefile.in +++ b/lib/ext2fs/Makefile.in @@ -126,7 +126,7 @@ OBJS= $(DEBUGFS_LIB_OBJS) $(RESIZE_LIB_OBJS) $(E2IMAGE_LIB_OBJS) \ symlink.o \ $(TDB_OBJ) \ undo_io.o \ - unix_io.o \ + @OS_IO_FILE@.o \ sparse_io.o \ unlink.o \ valid_blk.o \ @@ -216,7 +216,7 @@ SRCS= ext2_err.c \ $(srcdir)/tst_getsize.c \ $(srcdir)/tst_iscan.c \ $(srcdir)/undo_io.c \ - $(srcdir)/unix_io.c \ + $(srcdir)/@OS_IO_FILE@.c \ $(srcdir)/sparse_io.c \ $(srcdir)/unlink.c \ $(srcdir)/valid_blk.c \ @@ -1150,8 +1150,13 @@ unix_io.o: $(srcdir)/unix_io.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/ext2fs.h \ $(srcdir)/ext2_fs.h $(srcdir)/ext3_extents.h $(top_srcdir)/lib/et/com_err.h \ $(srcdir)/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \ - $(srcdir)/ext2_ext_attr.h $(srcdir)/hashmap.h $(srcdir)/bitops.h \ - $(srcdir)/ext2fsP.h + $(srcdir)/ext2_ext_attr.h $(srcdir)/bitops.h $(srcdir)/ext2fsP.h +windows_io.o: $(srcdir)/windows_io.c $(top_builddir)/lib/config.h \ + $(top_builddir)/lib/dirpaths.h $(srcdir)/ext2_fs.h \ + $(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/ext2fs.h \ + $(srcdir)/ext2_fs.h $(srcdir)/ext3_extents.h $(top_srcdir)/lib/et/com_err.h \ + $(srcdir)/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \ + $(srcdir)/ext2_ext_attr.h $(srcdir)/bitops.h $(srcdir)/ext2fsP.h sparse_io.o: $(srcdir)/sparse_io.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/ext2_fs.h \ $(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/ext2fs.h \ -- 2.17.1