From patchwork Sat Jan 21 20:31:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730046 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=qM+qDqyq; dkim-atps=neutral Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7Q16mhz23hM for ; Sun, 22 Jan 2023 07:36:49 +1100 (AEDT) Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7M2GCwz4y0C for ; Sun, 22 Jan 2023 07:36:47 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7M2CZjz4y0G; Sun, 22 Jan 2023 07:36:47 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=qM+qDqyq; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7M27Q1z4y0C for ; Sun, 22 Jan 2023 07:36:47 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229875AbjAUUgo (ORCPT ); Sat, 21 Jan 2023 15:36:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229493AbjAUUgm (ORCPT ); Sat, 21 Jan 2023 15:36:42 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23B8729142 for ; Sat, 21 Jan 2023 12:36:41 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C1E13B80862 for ; Sat, 21 Jan 2023 20:36:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65963C4339C for ; Sat, 21 Jan 2023 20:36:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333398; bh=EQHzEyg22Gzigjwzdy0o6sn2XHp/O9QfU3MfLeTNFFo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=qM+qDqyqo8KmF+CBMm9hznOW4N7MOxBVr5noMBwNX0bgEI14unmx2wgKGagRxQ1RX PT0LQ4Od6C4kOVqU5ALTqvoo75TozxvOz8sqWUCJvbUrznqfZHBk3kZ00IN5DA801S s4w1XTu0WEt2M4ixqcBcK3aYr+RFjBWEEJFuGZliVes6gvZ2kXQE8bXEOfsJwJQ/R3 saTgF6o9ITd+s+EAQTRyIYWM0F5Vmrbc7BMcdjLYwNOgBJZwPTPM+yTMQO17wRF9H+ FTz/8kNm42jK9VexMLvY6GkpGkkO/8YMmoWD52Ve9pn9hADP+PbCjO/tAZExg65/y5 uZSsetWs/wA6A== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 01/38] configure.ac: only use Windows I/O manager on native Windows Date: Sat, 21 Jan 2023 12:31:53 -0800 Message-Id: <20230121203230.27624-2-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers Cygwin and MSYS2 are UNIX-compatible platforms on top of Windows, so they should use the UNIX I/O manager, not the Windows I/O manager. (Note that "cygwin" was misspelled as "cigwin", so the code did not have the intended effect anyway.) Fixes: d1d44c146a5e ("ext2fs: compile the io implementation according to os") Signed-off-by: Eric Biggers --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 78f71fd8e..5f440f1fc 100644 --- a/configure.ac +++ b/configure.ac @@ -1826,7 +1826,7 @@ dnl Adjust the compiled files if we are on windows vs everywhere else dnl OS_IO_FILE="" [case "$host_os" in - cigwin*|mingw*|msys*) + mingw*) OS_IO_FILE=windows_io ;; *) From patchwork Sat Jan 21 20:31:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730054 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=150.107.74.76; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=Sd0eWdH5; dkim-atps=neutral Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7X0L9bz23hQ for ; Sun, 22 Jan 2023 07:36:56 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7W71KDz4xN1 for ; Sun, 22 Jan 2023 07:36:55 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7W6z5qz4y06; Sun, 22 Jan 2023 07:36:55 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=Sd0eWdH5; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7W6tbDz4xN1 for ; Sun, 22 Jan 2023 07:36:55 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230036AbjAUUgz (ORCPT ); Sat, 21 Jan 2023 15:36:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229709AbjAUUgr (ORCPT ); Sat, 21 Jan 2023 15:36:47 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62F8B29149 for ; Sat, 21 Jan 2023 12:36:42 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 93CEBCE0A19 for ; Sat, 21 Jan 2023 20:36:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9684DC433EF for ; Sat, 21 Jan 2023 20:36:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333398; bh=nHfz2otl4U+5Pr63vSB63sCCWYB9/BfF30kLLccFCno=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Sd0eWdH5u6kem3h3qzFW5pDw4LaRSeVAQOu/OG9q+aEkumJYx3uSjOHRXpK0svnUA VPiLoOQaIa8EmXqUGBL86aSu1xAkgiim2Tb5WL/ITjsmD82MeKYZyEZFkLZt1YtdfX XoYk0PhuHfX4RZSo47tXOOeDeU9NbHTNBjUMmbQnAd88L2obInmPTpkS0hR+FVgL3M k/CEx4z/vb7qU2C702451osJ6bSBG2Ir+6/unTDrXkQhwbzTezVh568n38Ek2LbvIq zolUy0s8YYSDHmDv8hPwZA0oDDf3k+SiYSz0bP8VVloZ/0dZ3BSHU6FUNUMSe2rUTi XiqGBiVOmWd0Q== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 02/38] configure.ac: disable tdb by default on Windows Date: Sat, 21 Jan 2023 12:31:54 -0800 Message-Id: <20230121203230.27624-3-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers The tdb support does not build for Windows, due to the use of various UNIX-isms, so disable it by default when building for Windows. Signed-off-by: Eric Biggers --- configure.ac | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index 5f440f1fc..e3884db60 100644 --- a/configure.ac +++ b/configure.ac @@ -845,23 +845,39 @@ dnl AH_TEMPLATE([CONFIG_TDB], [Define to 1 to enable tdb support]) AC_ARG_ENABLE([tdb], AS_HELP_STRING([--disable-tdb],[disable tdb support]), +[ if test "$enableval" = "no" then AC_MSG_RESULT([Disabling tdb support]) - TDB_CMT="#" - TDB_MAN_COMMENT='.\"' + CONFIG_TDB=0 else AC_MSG_RESULT([Enabling tdb support]) + CONFIG_TDB=1 +fi +] +, +[ +case "$host_os" in +mingw*) + AC_MSG_RESULT([Disabling tdb support by default]) + CONFIG_TDB=0 + ;; +*) + AC_MSG_RESULT([Enabling tdb support by default]) + CONFIG_TDB=1 + ;; +esac +] +) +if test "$CONFIG_TDB" = "1" +then AC_DEFINE(CONFIG_TDB, 1) TDB_CMT="" TDB_MAN_COMMENT="" +else + TDB_CMT="#" + TDB_MAN_COMMENT='.\"' fi -, -AC_MSG_RESULT([Enabling mmp support by default]) -AC_DEFINE(CONFIG_TDB, 1) -TDB_CMT="" -TDB_MAN_COMMENT="" -) AC_SUBST(TDB_CMT) AC_SUBST(TDB_MAN_COMMENT) dnl From patchwork Sat Jan 21 20:31:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730042 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=150.107.74.76; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=lISjL/TW; dkim-atps=neutral Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7M5JG5z23gY for ; Sun, 22 Jan 2023 07:36:47 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7M3vvzz4y0G for ; Sun, 22 Jan 2023 07:36:47 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7M3nbSz4y0L; Sun, 22 Jan 2023 07:36:47 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=lISjL/TW; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7M3jcpz4y0G for ; Sun, 22 Jan 2023 07:36:47 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229880AbjAUUgp (ORCPT ); Sat, 21 Jan 2023 15:36:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229709AbjAUUgm (ORCPT ); Sat, 21 Jan 2023 15:36:42 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7607629146 for ; Sat, 21 Jan 2023 12:36:41 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2B24DB807E4 for ; Sat, 21 Jan 2023 20:36:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7594C433A0 for ; Sat, 21 Jan 2023 20:36:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333398; bh=g/X1fsEW6TIot+jRGRs90ZiT5k6YYFv8xrkvOgmtZfw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=lISjL/TWjrBuLZswQvq07ULddsrgSHDuQnFHlbKCRVTfSMs6IBb7kdikyqmvEBiBv daDmP5VXrGo+NIsLTeypLPTnmHbt1FK9dUiH/ndN615RupUhmL0vY3q75A9vfo0Lin QmWVmG1WmnbrTEKfmevwZyAvT4a/UTCONYQLB0cqJPsj4g9KM1gqK72zFY2kZ9mSzo il2Mv37SOYNE8M4jAJeg4SVkHZ/+XjD4VwSUjYKmLr4LLy0efnjZuFejguRblm9jTP g5BtAwiNeL2Fdxt87yPZ9EzAZNOfCZIK5Oub2ggP5MUkKdmselrj2KSmPxgzjlp5UF Y1FFdsxcjaydg== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 03/38] configure.ac: automatically add include/mingw/ headers Date: Sat, 21 Jan 2023 12:31:55 -0800 Message-Id: <20230121203230.27624-4-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers Since the include/mingw/ directory needs to be on the include path when building for Windows with MinGW, add it to INCLUDES automatically, and AC_DEFINE the corresponding HAVE_*_H constants. Signed-off-by: Eric Biggers --- configure.ac | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/configure.ac b/configure.ac index e3884db60..d62d99dc8 100644 --- a/configure.ac +++ b/configure.ac @@ -1036,6 +1036,17 @@ AC_CHECK_HEADERS(m4_flatten([ sys/wait.h sys/xattr.h ])) +case "$host_os" in +mingw*) + # The above checks only detect system headers, not the headers in + # ./include/mingw/, so explicitly define them to be available. + AC_DEFINE(HAVE_LINUX_TYPES_H, 1) + AC_DEFINE(HAVE_SYS_STAT_H, 1) + AC_DEFINE(HAVE_SYS_SYSMACROS_H, 1) + AC_DEFINE(HAVE_SYS_TYPES_H, 1) + AC_DEFINE(HAVE_UNISTD_H, 1) + ;; +esac dnl Check where to find a dd(1) that supports iflag=fullblock dnl and oflag=append AC_MSG_CHECKING([for a dd(1) program that supports iflag=fullblock]) @@ -1710,6 +1721,11 @@ fi if test -n "$WITH_DIET_LIBC" ; then INCLUDES="$INCLUDES -D_REENTRANT" fi +case "$host_os" in +mingw*) + INCLUDES=$INCLUDES' -I$(top_srcdir)/include/mingw' + ;; +esac AC_SUBST(INCLUDES) dnl dnl Build CFLAGS From patchwork Sat Jan 21 20:31:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730049 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=Ab3AdBBP; dkim-atps=neutral Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7S0yytz23hS for ; Sun, 22 Jan 2023 07:36:52 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7S0XG8z4y06 for ; Sun, 22 Jan 2023 07:36:52 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7S0Szlz4xN1; Sun, 22 Jan 2023 07:36:52 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=Ab3AdBBP; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7R60Plz4y06 for ; Sun, 22 Jan 2023 07:36:51 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229840AbjAUUgv (ORCPT ); Sat, 21 Jan 2023 15:36:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229794AbjAUUgn (ORCPT ); Sat, 21 Jan 2023 15:36:43 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49AE7234F0 for ; Sat, 21 Jan 2023 12:36:40 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AC32F60B07 for ; Sat, 21 Jan 2023 20:36:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04E13C4339E for ; Sat, 21 Jan 2023 20:36:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333399; bh=usC3ErxE65Df7UPBOXOdQN0qOu+GA9KnpST6HfshhsU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Ab3AdBBPVh1dsiy8OsFFrTlfB0uqpHZHiHUdNzVrphJC7XHhBjVu26GAIvKvMNqKN JkGEkddjPPL8QlUAY5TDPz5qU4d3OIZvJHfszHN+Pgt/fZITUzV+pkmW+oU8fMODjk ogbHtKsDpjmdPPUESudD9pu3nh0LOXUe3sZonYrientH+CyxIFXqapUOv7gz6ESM0U NukITAu6hOKGCXp/en+iKu6o7m3Sos7LgYpY57gc74c591htWu8+Z4AaaQqBqlfL4o JTiD/JYRFcrAPSVHng/zyzLFghJ0hgClNxCN8dxBTz7FimgG7b2AbQTwyaNZSN3VAC 5uYzRShoNFWkQ== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 04/38] configure: regenerate Date: Sat, 21 Jan 2023 12:31:56 -0800 Message-Id: <20230121203230.27624-5-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers Run autoreconf. Signed-off-by: Eric Biggers --- aclocal.m4 | 180 ++++++++++++++++++++++++++---------------------- configure | 105 +++++++++++++++++++++------- lib/config.h.in | 100 ++++++++++++++++++++++----- 3 files changed, 262 insertions(+), 123 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index bd5778d57..af10b6afe 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -535,7 +535,7 @@ fi AC_LANG_POP ])dnl AX_PTHREAD -# gettext.m4 serial 71 (gettext-0.20.2) +# gettext.m4 serial 72 (gettext-0.21.1) dnl Copyright (C) 1995-2014, 2016, 2018-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -592,22 +592,22 @@ dnl AC_DEFUN([AM_GNU_GETTEXT], [ dnl Argument checking. - ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [use-libtool], , + m4_if([$1], [], , [m4_if([$1], [external], , [m4_if([$1], [use-libtool], , [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT ])])])]) - ifelse(ifelse([$1], [], [old])[]ifelse([$1], [no-libtool], [old]), [old], + m4_if(m4_if([$1], [], [old])[]m4_if([$1], [no-libtool], [old]), [old], [errprint([ERROR: Use of AM_GNU_GETTEXT without [external] argument is no longer supported. ])]) - ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , + m4_if([$2], [], , [m4_if([$2], [need-ngettext], , [m4_if([$2], [need-formatstring-macros], , [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT ])])])]) define([gt_included_intl], - ifelse([$1], [external], [no], [yes])) + m4_if([$1], [external], [no], [yes])) gt_NEEDS_INIT AM_GNU_GETTEXT_NEED([$2]) AC_REQUIRE([AM_PO_SUBDIRS])dnl - ifelse(gt_included_intl, yes, [ + m4_if(gt_included_intl, yes, [ AC_REQUIRE([AM_INTL_SUBDIR])dnl ]) @@ -625,7 +625,7 @@ AC_DEFUN([AM_GNU_GETTEXT], dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. dnl Since AC_PROVIDE_IFELSE is not documented, we avoid it. - ifelse(gt_included_intl, yes, , [ + m4_if(gt_included_intl, yes, , [ AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) ]) @@ -635,7 +635,7 @@ AC_DEFUN([AM_GNU_GETTEXT], dnl Set USE_NLS. AC_REQUIRE([AM_NLS]) - ifelse(gt_included_intl, yes, [ + m4_if(gt_included_intl, yes, [ BUILD_INCLUDED_LIBINTL=no USE_INCLUDED_LIBINTL=no ]) @@ -655,7 +655,7 @@ AC_DEFUN([AM_GNU_GETTEXT], dnl If we use NLS figure out what method if test "$USE_NLS" = "yes"; then gt_use_preinstalled_gnugettext=no - ifelse(gt_included_intl, yes, [ + m4_if(gt_included_intl, yes, [ AC_MSG_CHECKING([whether included gettext is requested]) AC_ARG_WITH([included-gettext], [ --with-included-gettext use the GNU gettext library included here], @@ -711,7 +711,7 @@ return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then dnl Sometimes libintl requires libiconv, so first search for libiconv. - ifelse(gt_included_intl, yes, , [ + m4_if(gt_included_intl, yes, , [ AM_ICONV_LINK ]) dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL @@ -798,7 +798,7 @@ return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION INCINTL= fi - ifelse(gt_included_intl, yes, [ + m4_if(gt_included_intl, yes, [ if test "$gt_use_preinstalled_gnugettext" != "yes"; then dnl GNU gettext is not found in the C library. dnl Fall back on included GNU gettext library. @@ -810,8 +810,8 @@ return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION dnl Mark actions used to generate GNU NLS library. BUILD_INCLUDED_LIBINTL=yes USE_INCLUDED_LIBINTL=yes - LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.la $LIBICONV $LIBTHREAD" - LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.la $LTLIBICONV $LTLIBTHREAD" + LIBINTL="m4_if([$3],[],\${top_builddir}/intl,[$3])/libintl.la $LIBICONV $LIBTHREAD" + LTLIBINTL="m4_if([$3],[],\${top_builddir}/intl,[$3])/libintl.la $LTLIBICONV $LTLIBTHREAD" LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` fi @@ -878,7 +878,7 @@ return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION POSUB=po fi - ifelse(gt_included_intl, yes, [ + m4_if(gt_included_intl, yes, [ dnl In GNU gettext we have to set BUILD_INCLUDED_LIBINTL to 'yes' dnl because some of the testsuite requires it. BUILD_INCLUDED_LIBINTL=yes @@ -922,8 +922,8 @@ AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) dnl Usage: AM_GNU_GETTEXT_REQUIRE_VERSION([gettext-version]) AC_DEFUN([AM_GNU_GETTEXT_REQUIRE_VERSION], []) -# host-cpu-c-abi.m4 serial 13 -dnl Copyright (C) 2002-2020 Free Software Foundation, Inc. +# host-cpu-c-abi.m4 serial 15 +dnl Copyright (C) 2002-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -1135,7 +1135,7 @@ changequote([,])dnl # be generating 64-bit code. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( - [[#if defined __powerpc64__ || defined _ARCH_PPC64 + [[#if defined __powerpc64__ || defined __LP64__ int ok; #else error fail @@ -1306,6 +1306,9 @@ EOF #ifndef __ia64__ #undef __ia64__ #endif +#ifndef __loongarch64__ +#undef __loongarch64__ +#endif #ifndef __m68k__ #undef __m68k__ #endif @@ -1529,7 +1532,7 @@ changequote([,])dnl # be generating 64-bit code. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( - [[#if defined __powerpc64__ || defined _ARCH_PPC64 + [[#if defined __powerpc64__ || defined __LP64__ int ok; #else error fail @@ -1598,8 +1601,8 @@ changequote([,])dnl HOST_CPU_C_ABI_32BIT="$gl_cv_host_cpu_c_abi_32bit" ]) -# iconv.m4 serial 21 -dnl Copyright (C) 2000-2002, 2007-2014, 2016-2020 Free Software Foundation, +# iconv.m4 serial 24 +dnl Copyright (C) 2000-2002, 2007-2014, 2016-2022 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -1607,6 +1610,12 @@ dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. +AC_PREREQ([2.64]) + +dnl Note: AM_ICONV is documented in the GNU gettext manual +dnl . +dnl Don't make changes that are incompatible with that documentation! + AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], [ dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. @@ -1686,8 +1695,9 @@ AC_DEFUN([AM_ICONV_LINK], #endif ]], [[int result = 0; - /* Test against AIX 5.1 bug: Failures are not distinguishable from successful - returns. */ + /* Test against AIX 5.1...7.2 bug: Failures are not distinguishable from + successful returns. This is even documented in + */ { iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); if (cd_utf8_to_88591 != (iconv_t)(-1)) @@ -1825,8 +1835,7 @@ AC_DEFUN([AM_ICONV_LINK], AC_SUBST([LTLIBICONV]) ]) -dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to -dnl avoid warnings like +dnl Define AM_ICONV using AC_DEFUN_ONCE, in order to avoid warnings like dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required". dnl This is tricky because of the way 'aclocal' is implemented: dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN. @@ -1834,61 +1843,50 @@ dnl Otherwise aclocal's initial scan pass would miss the macro definition. dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions. dnl Otherwise aclocal would emit many "Use of uninitialized value $1" dnl warnings. -m4_define([gl_iconv_AC_DEFUN], - m4_version_prereq([2.64], - [[AC_DEFUN_ONCE( - [$1], [$2])]], - [m4_ifdef([gl_00GNULIB], - [[AC_DEFUN_ONCE( - [$1], [$2])]], - [[AC_DEFUN( - [$1], [$2])]])])) -gl_iconv_AC_DEFUN([AM_ICONV], +AC_DEFUN_ONCE([AM_ICONV], [ AM_ICONV_LINK if test "$am_cv_func_iconv" = yes; then - AC_MSG_CHECKING([for iconv declaration]) - AC_CACHE_VAL([am_cv_proto_iconv], [ - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[ + AC_CACHE_CHECK([whether iconv is compatible with its POSIX signature], + [gl_cv_iconv_nonconst], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ #include #include extern #ifdef __cplusplus "C" #endif -#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); -#else -size_t iconv(); -#endif - ]], - [[]])], - [am_cv_proto_iconv_arg1=""], - [am_cv_proto_iconv_arg1="const"]) - am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) - am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` - AC_MSG_RESULT([ - $am_cv_proto_iconv]) + ]], + [[]])], + [gl_cv_iconv_nonconst=yes], + [gl_cv_iconv_nonconst=no]) + ]) else dnl When compiling GNU libiconv on a system that does not have iconv yet, dnl pick the POSIX compliant declaration without 'const'. - am_cv_proto_iconv_arg1="" + gl_cv_iconv_nonconst=yes fi - AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1], + if test $gl_cv_iconv_nonconst = yes; then + iconv_arg1="" + else + iconv_arg1="const" + fi + AC_DEFINE_UNQUOTED([ICONV_CONST], [$iconv_arg1], [Define as const if the declaration of iconv() needs const.]) dnl Also substitute ICONV_CONST in the gnulib generated . m4_ifdef([gl_ICONV_H_DEFAULTS], [AC_REQUIRE([gl_ICONV_H_DEFAULTS]) - if test -n "$am_cv_proto_iconv_arg1"; then + if test $gl_cv_iconv_nonconst != yes; then ICONV_CONST="const" fi ]) ]) # intlmacosx.m4 serial 8 (gettext-0.20.2) -dnl Copyright (C) 2004-2014, 2016, 2019-2020 Free Software Foundation, Inc. +dnl Copyright (C) 2004-2014, 2016, 2019-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -1953,8 +1951,8 @@ AC_DEFUN([gt_INTL_MACOSX], AC_SUBST([INTL_MACOSX_LIBS]) ]) -# lib-ld.m4 serial 9 -dnl Copyright (C) 1996-2003, 2009-2020 Free Software Foundation, Inc. +# lib-ld.m4 serial 10 +dnl Copyright (C) 1996-2003, 2009-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -2077,7 +2075,7 @@ else *-*-aix*) AC_COMPILE_IFELSE( [AC_LANG_SOURCE( - [[#if defined __powerpc64__ || defined _ARCH_PPC64 + [[#if defined __powerpc64__ || defined __LP64__ int ok; #else error fail @@ -2122,8 +2120,8 @@ fi AC_LIB_PROG_LD_GNU ]) -# lib-link.m4 serial 31 -dnl Copyright (C) 2001-2020 Free Software Foundation, Inc. +# lib-link.m4 serial 33 +dnl Copyright (C) 2001-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -2320,8 +2318,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" ]) AC_ARG_WITH(PACK[-prefix], -[[ --with-]]PACK[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib - --without-]]PACK[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]], +[[ --with-]]PACK[[-prefix[=DIR] search for ]]PACKLIBS[[ in DIR/include and DIR/lib + --without-]]PACK[[-prefix don't search for ]]PACKLIBS[[ in includedir and libdir]], [ if test "X$withval" = "Xno"; then use_additional=no @@ -2755,7 +2753,20 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], ;; -l*) dnl Handle this in the next round. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + dnl But on GNU systems, ignore -lc options, because + dnl - linking with libc is the default anyway, + dnl - linking with libc.a may produce an error + dnl "/usr/bin/ld: dynamic STT_GNU_IFUNC symbol `strcmp' with pointer equality in `/usr/lib/libc.a(strcmp.o)' can not be used when making an executable; recompile with -fPIE and relink with -pie" + dnl or may produce an executable that always crashes, see + dnl . + dep=`echo "X$dep" | sed -e 's/^X-l//'` + if test "X$dep" != Xc \ + || case $host_os in + linux* | gnu* | k*bsd*-gnu) false ;; + *) true ;; + esac; then + names_next_round="$names_next_round $dep" + fi ;; *.la) dnl Handle this in the next round. Throw away the .la's @@ -2923,8 +2934,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], AC_SUBST([$1]) ]) -# lib-prefix.m4 serial 17 -dnl Copyright (C) 2001-2005, 2008-2020 Free Software Foundation, Inc. +# lib-prefix.m4 serial 20 +dnl Copyright (C) 2001-2005, 2008-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -3099,14 +3110,14 @@ AC_DEFUN([AC_LIB_PREPARE_MULTILIB], AC_CACHE_CHECK([for ELF binary format], [gl_cv_elf], [AC_EGREP_CPP([Extensible Linking Format], - [#ifdef __ELF__ + [#if defined __ELF__ || (defined __linux__ && defined __EDG__) Extensible Linking Format #endif ], [gl_cv_elf=yes], [gl_cv_elf=no]) - ]) - if test $gl_cv_elf; then + ]) + if test $gl_cv_elf = yes; then # Extract the ELF class of a file (5th byte) in decimal. # Cf. https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header if od -A x < /dev/null >/dev/null 2>/dev/null; then @@ -3123,20 +3134,23 @@ AC_DEFUN([AC_LIB_PREPARE_MULTILIB], echo } fi + # Use 'expr', not 'test', to compare the values of func_elfclass, because on + # Solaris 11 OpenIndiana and Solaris 11 OmniOS, the result is 001 or 002, + # not 1 or 2. changequote(,)dnl case $HOST_CPU_C_ABI_32BIT in yes) # 32-bit ABI. acl_is_expected_elfclass () { - test "`func_elfclass | sed -e 's/[ ]//g'`" = 1 + expr "`func_elfclass | sed -e 's/[ ]//g'`" = 1 > /dev/null } ;; no) # 64-bit ABI. acl_is_expected_elfclass () { - test "`func_elfclass | sed -e 's/[ ]//g'`" = 2 + expr "`func_elfclass | sed -e 's/[ ]//g'`" = 2 > /dev/null } ;; *) @@ -3245,7 +3259,7 @@ changequote([,])dnl ]) # nls.m4 serial 6 (gettext-0.20.2) -dnl Copyright (C) 1995-2003, 2005-2006, 2008-2014, 2016, 2019-2020 Free +dnl Copyright (C) 1995-2003, 2005-2006, 2008-2014, 2016, 2019-2022 Free dnl Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -3621,8 +3635,8 @@ AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"], [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])]) ])dnl PKG_HAVE_DEFINE_WITH_MODULES -# po.m4 serial 31 (gettext-0.20.2) -dnl Copyright (C) 1995-2014, 2016, 2018-2020 Free Software Foundation, Inc. +# po.m4 serial 32 (gettext-0.21.1) +dnl Copyright (C) 1995-2014, 2016, 2018-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -3802,7 +3816,9 @@ changequote([,])dnl # presentlang can be used as a fallback for messages # which are not translated in the desiredlang catalog). case "$desiredlang" in - "$presentlang"*) useit=yes;; + "$presentlang" | "$presentlang"_* | "$presentlang".* | "$presentlang"@*) + useit=yes + ;; esac done if test $useit = yes; then @@ -4002,7 +4018,9 @@ changequote([,])dnl # presentlang can be used as a fallback for messages # which are not translated in the desiredlang catalog). case "$desiredlang" in - "$presentlang"*) useit=yes;; + "$presentlang" | "$presentlang"_* | "$presentlang".* | "$presentlang"@*) + useit=yes + ;; esac done if test $useit = yes; then @@ -4072,8 +4090,8 @@ AC_DEFUN([AM_XGETTEXT_OPTION], XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS $1" ]) -# progtest.m4 serial 8 (gettext-0.20.2) -dnl Copyright (C) 1996-2003, 2005, 2008-2020 Free Software Foundation, Inc. +# progtest.m4 serial 9 (gettext-0.21.1) +dnl Copyright (C) 1996-2003, 2005, 2008-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -4090,7 +4108,7 @@ dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper , 1996. -AC_PREREQ([2.50]) +AC_PREREQ([2.53]) # Search path for a program which passes the given test. @@ -4135,7 +4153,7 @@ AC_CACHE_VAL([ac_cv_path_$1], ;; *) ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in ifelse([$5], , $PATH, [$5]); do + for ac_dir in m4_if([$5], , $PATH, [$5]); do IFS="$ac_save_IFS" test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do @@ -4151,12 +4169,12 @@ AC_CACHE_VAL([ac_cv_path_$1], IFS="$ac_save_IFS" dnl If no 4th arg is given, leave the cache variable unset, dnl so AC_PATH_PROGS will keep looking. -ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" +m4_if([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" ])dnl ;; esac])dnl $1="$ac_cv_path_$1" -if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then +if test m4_if([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then AC_MSG_RESULT([$][$1]) else AC_MSG_RESULT([no]) diff --git a/configure b/configure index 493542367..eaeb3d305 100755 --- a/configure +++ b/configure @@ -7956,31 +7956,47 @@ fi # Check whether --enable-tdb was given. if test ${enable_tdb+y} then : - enableval=$enable_tdb; if test "$enableval" = "no" + enableval=$enable_tdb; +if test "$enableval" = "no" then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Disabling tdb support" >&5 printf "%s\n" "Disabling tdb support" >&6; } - TDB_CMT="#" - TDB_MAN_COMMENT='.\"' + CONFIG_TDB=0 else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Enabling tdb support" >&5 printf "%s\n" "Enabling tdb support" >&6; } - printf "%s\n" "#define CONFIG_TDB 1" >>confdefs.h - - TDB_CMT="" - TDB_MAN_COMMENT="" + CONFIG_TDB=1 fi + else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Enabling mmp support by default" >&5 -printf "%s\n" "Enabling mmp support by default" >&6; } -printf "%s\n" "#define CONFIG_TDB 1" >>confdefs.h -TDB_CMT="" -TDB_MAN_COMMENT="" +case "$host_os" in +mingw*) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Disabling tdb support by default" >&5 +printf "%s\n" "Disabling tdb support by default" >&6; } + CONFIG_TDB=0 + ;; +*) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Enabling tdb support by default" >&5 +printf "%s\n" "Enabling tdb support by default" >&6; } + CONFIG_TDB=1 + ;; +esac + fi +if test "$CONFIG_TDB" = "1" +then + printf "%s\n" "#define CONFIG_TDB 1" >>confdefs.h + + TDB_CMT="" + TDB_MAN_COMMENT="" +else + TDB_CMT="#" + TDB_MAN_COMMENT='.\"' +fi @@ -8660,7 +8676,7 @@ else $as_nop *-*-aix*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#if defined __powerpc64__ || defined _ARCH_PPC64 +#if defined __powerpc64__ || defined __LP64__ int ok; #else error fail @@ -8951,7 +8967,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext # be generating 64-bit code. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#if defined __powerpc64__ || defined _ARCH_PPC64 +#if defined __powerpc64__ || defined __LP64__ int ok; #else error fail @@ -9058,7 +9074,7 @@ then : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __ELF__ +#if defined __ELF__ || (defined __linux__ && defined __EDG__) Extensible Linking Format #endif @@ -9076,7 +9092,7 @@ rm -rf conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_elf" >&5 printf "%s\n" "$gl_cv_elf" >&6; } - if test $gl_cv_elf; then + if test $gl_cv_elf = yes; then # Extract the ELF class of a file (5th byte) in decimal. # Cf. https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header if od -A x < /dev/null >/dev/null 2>/dev/null; then @@ -9093,19 +9109,22 @@ printf "%s\n" "$gl_cv_elf" >&6; } echo } fi + # Use 'expr', not 'test', to compare the values of func_elfclass, because on + # Solaris 11 OpenIndiana and Solaris 11 OmniOS, the result is 001 or 002, + # not 1 or 2. case $HOST_CPU_C_ABI_32BIT in yes) # 32-bit ABI. acl_is_expected_elfclass () { - test "`func_elfclass | sed -e 's/[ ]//g'`" = 1 + expr "`func_elfclass | sed -e 's/[ ]//g'`" = 1 > /dev/null } ;; no) # 64-bit ABI. acl_is_expected_elfclass () { - test "`func_elfclass | sed -e 's/[ ]//g'`" = 2 + expr "`func_elfclass | sed -e 's/[ ]//g'`" = 2 > /dev/null } ;; *) @@ -9635,7 +9654,14 @@ fi fi ;; -l*) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + dep=`echo "X$dep" | sed -e 's/^X-l//'` + if test "X$dep" != Xc \ + || case $host_os in + linux* | gnu* | k*bsd*-gnu) false ;; + *) true ;; + esac; then + names_next_round="$names_next_round $dep" + fi ;; *.la) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` @@ -9997,8 +10023,9 @@ int main (void) { int result = 0; - /* Test against AIX 5.1 bug: Failures are not distinguishable from successful - returns. */ + /* Test against AIX 5.1...7.2 bug: Failures are not distinguishable from + successful returns. This is even documented in + */ { iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); if (cd_utf8_to_88591 != (iconv_t)(-1)) @@ -10580,7 +10607,14 @@ fi fi ;; -l*) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + dep=`echo "X$dep" | sed -e 's/^X-l//'` + if test "X$dep" != Xc \ + || case $host_os in + linux* | gnu* | k*bsd*-gnu) false ;; + *) true ;; + esac; then + names_next_round="$names_next_round $dep" + fi ;; *.la) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` @@ -12117,6 +12151,22 @@ then : fi +case "$host_os" in +mingw*) + # The above checks only detect system headers, not the headers in + # ./include/mingw/, so explicitly define them to be available. + printf "%s\n" "#define HAVE_LINUX_TYPES_H 1" >>confdefs.h + + printf "%s\n" "#define HAVE_SYS_STAT_H 1" >>confdefs.h + + printf "%s\n" "#define HAVE_SYS_SYSMACROS_H 1" >>confdefs.h + + printf "%s\n" "#define HAVE_SYS_TYPES_H 1" >>confdefs.h + + printf "%s\n" "#define HAVE_UNISTD_H 1" >>confdefs.h + + ;; +esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a dd(1) program that supports iflag=fullblock" >&5 printf %s "checking for a dd(1) program that supports iflag=fullblock... " >&6; } DD= @@ -14963,6 +15013,11 @@ fi if test -n "$WITH_DIET_LIBC" ; then INCLUDES="$INCLUDES -D_REENTRANT" fi +case "$host_os" in +mingw*) + INCLUDES=$INCLUDES' -I$(top_srcdir)/include/mingw' + ;; +esac if test $cross_compiling = no; then BUILD_CFLAGS="$CFLAGS $CPPFLAGS $INCLUDES -DHAVE_CONFIG_H" @@ -15268,7 +15323,7 @@ fi OS_IO_FILE="" case "$host_os" in - cigwin*|mingw*|msys*) + mingw*) OS_IO_FILE=windows_io ;; *) @@ -16692,7 +16747,9 @@ printf "%s\n" "$as_me: executing $ac_file commands" >&6;} # presentlang can be used as a fallback for messages # which are not translated in the desiredlang catalog). case "$desiredlang" in - "$presentlang"*) useit=yes;; + "$presentlang" | "$presentlang"_* | "$presentlang".* | "$presentlang"@*) + useit=yes + ;; esac done if test $useit = yes; then diff --git a/lib/config.h.in b/lib/config.h.in index b5856bb57..cba347b49 100644 --- a/lib/config.h.in +++ b/lib/config.h.in @@ -220,12 +220,12 @@ /* Define to 1 if you have the `memalign' function. */ #undef HAVE_MEMALIGN -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - /* Define to 1 if you have the `mempcpy' function. */ #undef HAVE_MEMPCPY +/* Define to 1 if you have the header file. */ +#undef HAVE_MINIX_CONFIG_H + /* Define to 1 if you have the `mmap' function. */ #undef HAVE_MMAP @@ -343,6 +343,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H @@ -478,6 +481,9 @@ /* Define to 1 if you have the `vprintf' function. */ #undef HAVE_VPRINTF +/* Define to 1 if you have the header file. */ +#undef HAVE_WCHAR_H + /* Define to 1 if you have the `__secure_getenv' function. */ #undef HAVE___SECURE_GETENV @@ -524,7 +530,9 @@ /* The size of `time_t', as computed by sizeof. */ #undef SIZEOF_TIME_T -/* Define to 1 if you have the ANSI C header files. */ +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ #undef STDC_HEADERS /* If the compiler supports a TLS storage class define it to that here */ @@ -534,21 +542,87 @@ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif +/* Enable general extensions on macOS. */ +#ifndef _DARWIN_C_SOURCE +# undef _DARWIN_C_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif -/* Enable threading extensions on Solaris. */ +/* Enable X/Open compliant socket functions that do not require linking + with -lxnet on HP-UX 11.11. */ +#ifndef _HPUX_ALT_XOPEN_SOCKET_API +# undef _HPUX_ALT_XOPEN_SOCKET_API +#endif +/* Identify the host operating system as Minix. + This macro does not affect the system headers' behavior. + A future release of Autoconf may stop defining this macro. */ +#ifndef _MINIX +# undef _MINIX +#endif +/* Enable general extensions on NetBSD. + Enable NetBSD compatibility extensions on Minix. */ +#ifndef _NETBSD_SOURCE +# undef _NETBSD_SOURCE +#endif +/* Enable OpenBSD compatibility extensions on NetBSD. + Oddly enough, this does nothing on OpenBSD. */ +#ifndef _OPENBSD_SOURCE +# undef _OPENBSD_SOURCE +#endif +/* Define to 1 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_SOURCE +# undef _POSIX_SOURCE +#endif +/* Define to 2 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_1_SOURCE +# undef _POSIX_1_SOURCE +#endif +/* Enable POSIX-compatible threading on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif +/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ +#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ +#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ +# undef __STDC_WANT_IEC_60559_BFP_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ +#ifndef __STDC_WANT_IEC_60559_DFP_EXT__ +# undef __STDC_WANT_IEC_60559_DFP_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ +#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ +# undef __STDC_WANT_IEC_60559_FUNCS_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ +#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ +# undef __STDC_WANT_IEC_60559_TYPES_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ +#ifndef __STDC_WANT_LIB_EXT2__ +# undef __STDC_WANT_LIB_EXT2__ +#endif +/* Enable extensions specified by ISO/IEC 24747:2009. */ +#ifndef __STDC_WANT_MATH_SPEC_FUNCS__ +# undef __STDC_WANT_MATH_SPEC_FUNCS__ +#endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ +/* Enable X/Open extensions. Define to 500 only if necessary + to make mbstate_t available. */ +#ifndef _XOPEN_SOURCE +# undef _XOPEN_SOURCE #endif @@ -573,14 +647,4 @@ /* Define to 1 if Apple Darwin libintl workaround is needed */ #undef _INTL_REDIRECT_MACROS -/* Define to 1 if on MINIX. */ -#undef _MINIX - -/* Define to 2 if the system does not provide POSIX.1 features except with - this defined. */ -#undef _POSIX_1_SOURCE - -/* Define to 1 if you need to in order for `stat' and other things to work. */ -#undef _POSIX_SOURCE - #include From patchwork Sat Jan 21 20:31:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730052 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=LQoRe2SK; dkim-atps=neutral Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7T1rhCz23gY for ; Sun, 22 Jan 2023 07:36:53 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7T1QT4z4xN1 for ; Sun, 22 Jan 2023 07:36:53 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7T1MX2z4y06; Sun, 22 Jan 2023 07:36:53 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=LQoRe2SK; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7S6zKMz4xN1 for ; Sun, 22 Jan 2023 07:36:52 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230020AbjAUUgv (ORCPT ); Sat, 21 Jan 2023 15:36:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229850AbjAUUgo (ORCPT ); Sat, 21 Jan 2023 15:36:44 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1DDD28D3B for ; Sat, 21 Jan 2023 12:36:40 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5405B60B67 for ; Sat, 21 Jan 2023 20:36:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E9C1C433A1 for ; Sat, 21 Jan 2023 20:36:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333399; bh=AgmHiIs2J6FuFyZRjrQINs9UznUsQbN9FZ8mbWSnQac=; h=From:To:Subject:Date:In-Reply-To:References:From; b=LQoRe2SKGeBgIKTqP51sQMiHBPWICKm8rCclnmKFTrsMY06gf2PoX5tkVqHbXavcz G/8RkAEVlbqJ4Qd6NRz8SYUN4hZ9t0+7PMhH6G0lw7Qg0j5EPdbW0KbWbmtnkrHmAn tP4aeo6C/iEcuiKLmXuBSO+UPsIAPTAFO0I/ugnFRmlcB/jafh9dCEUgfZ3e91UkuF o8/xeTaWVgYY5jYFCzeKHTHLbeviecJ41n87B0AIegiY1Ojw7f4bsmz5Rux6IsxiBO 1h6oNJ+9/nzjdMnxccAzKNsy1Gug5QzUJKyDUD2G8YkWgpLvKS8QgGeX90CKX+BG0D gNuGgM92u4sOw== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 05/38] config/install-sh: update to latest version Date: Sat, 21 Jan 2023 12:31:57 -0800 Message-Id: <20230121203230.27624-6-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers The version of install-sh in the source tree is extremely old and doesn't work when passed multiple path arguments, which breaks 'make install' on macOS. Therefore, delete this file and run 'autoreconf -i' to update it to the latest version. Signed-off-by: Eric Biggers --- config/install-sh | 683 +++++++++++++++++++++++++++++++++------------- 1 file changed, 493 insertions(+), 190 deletions(-) diff --git a/config/install-sh b/config/install-sh index 89fc9b098..ec298b537 100755 --- a/config/install-sh +++ b/config/install-sh @@ -1,238 +1,541 @@ -#! /bin/sh -# +#!/bin/sh # install - install a program, script, or datafile -# This comes from X11R5. + +scriptversion=2020-11-14.01; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it +# 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. -# +tab=' ' +nl=' +' +IFS=" $tab$nl" + +# Set DOITPROG to "echo" to test this script. + +doit=${DOITPROG-} +doit_exec=${doit:-exec} -# set DOITPROG to echo to test this script +# Put in absolute file names if you don't have them in your path; +# or use environment vars. -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} +posix_mkdir= -# put in absolute paths if you don't have them in your path; or use env. vars. +# Desired mode of installed file. +mode=0755 -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" +# Create dirs (including intermediate dirs) using mode 755. +# This is like GNU 'install' as of coreutils 8.32 (2020). +mkdir_umask=22 -tranformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" +backupsuffix= +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done +stripcmd= -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi +src= +dst= +dir_arg= +dst_arg= -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - else - instcmd=mkdir - fi -else +copy_on_change=false +is_target_a_directory=possibly -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic +Options: + --help display this help and exit. + --version display version info and exit. - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi + -c (ignored) + -C install only if different (preserve data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -p pass -p to $cpprog. + -s $stripprog installed files. + -S SUFFIX attempt to back up existing files, with suffix SUFFIX. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script +By default, rm is invoked with -f; when overridden with RMPROG, +it's up to you to specify -f if you want it. -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" +If -S is not specified, no backups are attempted. -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" +Email bug reports to bug-automake@gnu.org. +Automake home page: https://www.gnu.org/software/automake/ +" -pathcomp='' +while test $# -ne 0; do + case $1 in + -c) ;; -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift + -C) copy_on_change=true;; - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi + -d) dir_arg=true;; - pathcomp="${pathcomp}/" -done -fi + -g) chgrpcmd="$chgrpprog $2" + shift;; -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && + --help) echo "$usage"; exit $?;; - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else + -m) mode=$2 + case $mode in + *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; -# If we're going to rename the final executable, determine the name now. + -o) chowncmd="$chownprog $2" + shift;; - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi + -p) cpprog="$cpprog -p";; -# don't allow the sed command to completely eliminate the filename + -s) stripcmd=$stripprog;; - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi + -S) backupsuffix="$2" + shift;; -# Make a temp file name in the proper directory. + -t) + is_target_a_directory=always + dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; - dsttmp=$dstdir/#inst.$$# + -T) is_target_a_directory=never;; -# Move or copy the file name to the temp name + --version) echo "$0 $scriptversion"; exit $?;; - $doit $instcmd $src $dsttmp && + --) shift + break;; - trap "rm -f ${dsttmp}" 0 && + -*) echo "$0: invalid option: $1" >&2 + exit 1;; -# and set any options; do chmod last to preserve setuid bits + *) break;; + esac + shift +done -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. +# We allow the use of options -d and -T together, by making -d +# take the precedence; this is for compatibility with GNU install. - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && +if test -n "$dir_arg"; then + if test -n "$dst_arg"; then + echo "$0: target directory not allowed when installing a directory." >&2 + exit 1 + fi +fi -# Now rename the file to the real destination. +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + done +fi - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call 'install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi -fi && +if test -z "$dir_arg"; then + if test $# -gt 1 || test "$is_target_a_directory" = always; then + if test ! -d "$dst_arg"; then + echo "$0: $dst_arg: Is not a directory." >&2 + exit 1 + fi + fi +fi + +if test -z "$dir_arg"; then + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi +for src +do + # Protect names problematic for 'test' and other utilities. + case $src in + -* | [=\(\)!]) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + # Don't chown directories that already exist. + if test $dstdir_status = 0; then + chowncmd="" + fi + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + dst=$dst_arg + + # If destination is a directory, append the input filename. + if test -d "$dst"; then + if test "$is_target_a_directory" = never; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dstbase=`basename "$src"` + case $dst in + */) dst=$dst$dstbase;; + *) dst=$dst/$dstbase;; + esac + dstdir_status=0 + else + dstdir=`dirname "$dst"` + test -d "$dstdir" + dstdir_status=$? + fi + fi + + case $dstdir in + */) dstdirslash=$dstdir;; + *) dstdirslash=$dstdir/;; + esac + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + # The $RANDOM variable is not portable (e.g., dash). Use it + # here however when possible just to lower collision chance. + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + + trap ' + ret=$? + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null + exit $ret + ' 0 + + # Because "mkdir -p" follows existing symlinks and we likely work + # directly in world-writeable /tmp, make sure that the '$tmpdir' + # directory is successfully created first before we actually test + # 'mkdir -p'. + if (umask $mkdir_umask && + $mkdirprog $mkdir_mode "$tmpdir" && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + test_tmpdir="$tmpdir/a" + ls_ld_tmpdir=`ls -ld "$test_tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null + fi + trap '' 0;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; + esac + + oIFS=$IFS + IFS=/ + set -f + set fnord $dstdir + shift + set +f + IFS=$oIFS + + prefixes= + + for d + do + test X"$d" = X && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=${dstdirslash}_inst.$$_ + rmtmp=${dstdirslash}_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && + { test -z "$stripcmd" || { + # Create $dsttmp read-write so that cp doesn't create it read-only, + # which would cause strip to fail. + if test -z "$doit"; then + : >"$dsttmp" # No need to fork-exec 'touch'. + else + $doit touch "$dsttmp" + fi + } + } && + $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + set +f && + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # If $backupsuffix is set, and the file being installed + # already exists, attempt a backup. Don't worry if it fails, + # e.g., if mv doesn't support -f. + if test -n "$backupsuffix" && test -f "$dst"; then + $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null + fi + + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done -exit 0 +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: From patchwork Sat Jan 21 20:31:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730045 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=uYK9Ybb9; dkim-atps=neutral Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7Q0ysLz23gY for ; Sun, 22 Jan 2023 07:36:49 +1100 (AEDT) Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7K5yJVz4xN1 for ; Sun, 22 Jan 2023 07:36:45 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7K5dHkz4y03; Sun, 22 Jan 2023 07:36:45 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=uYK9Ybb9; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7K5WJVz4xN1 for ; Sun, 22 Jan 2023 07:36:45 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229680AbjAUUgm (ORCPT ); Sat, 21 Jan 2023 15:36:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229493AbjAUUgl (ORCPT ); Sat, 21 Jan 2023 15:36:41 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8A3128D32 for ; Sat, 21 Jan 2023 12:36:40 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 60B4960B6A for ; Sat, 21 Jan 2023 20:36:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FCD3C433A4 for ; Sat, 21 Jan 2023 20:36:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333399; bh=HX09Cuo3sj19yD8wnataeATkDbzkFtj6TJWC2V9XPIc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=uYK9Ybb9I7MRM7DKODLzf3D4azE9ezFH8wlQXSZ1fn0XX8nobVsK4SF0I+8kH0FXi 9lZkWeAfZeVujd2DnO3zVyDNP3qYb902BsjO+cR+O9g+koxBHNkixL9wPzdeXeKQeI /TzWwQO93ytSUNTkiZyQm+xDzOXK8KIAIhxTQaVRQ+xLkrwI9lUiIXRD23uG93GpBB /qTqo/b3JWIfvovv3ak8kNNYywLtirRhPmISF6H5UCDbL5amAU8Ck7whO9VouI2EGQ 6mlnwFaH36abt2WoVx8DDBMeyBXjhG/HnVZcVfGtUX+pYS5evBf9UVZOPZpypKEcll 5fNDfoQCS+tVQ== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 06/38] lib, misc: eliminate dependency on Winsock Date: Sat, 21 Jan 2023 12:31:58 -0800 Message-Id: <20230121203230.27624-7-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers Currently Windows builds of e2fsprogs rely on the Windows Socket API (Winsock) to provide htonl() and ntohl(). For this to actually work, though, HAVE_WINSOCK_H needs to be defined, and the binaries need to be linked to -lws2_32. The Android.bp files do this; however, the autotools-based build system does not. Since htonl() and ntohl() are trivial, let's instead just add a file include/mingw/arpa/inet.h with definitions for these. Signed-off-by: Eric Biggers --- include/mingw/arpa/inet.h | 5 +++++ lib/e2p/Android.bp | 4 ---- lib/ext2fs/Android.bp | 2 -- lib/ext2fs/jfs_compat.h | 4 ---- misc/Android.bp | 1 - util/android_config.h | 1 - 6 files changed, 5 insertions(+), 12 deletions(-) create mode 100644 include/mingw/arpa/inet.h diff --git a/include/mingw/arpa/inet.h b/include/mingw/arpa/inet.h new file mode 100644 index 000000000..55dfa3691 --- /dev/null +++ b/include/mingw/arpa/inet.h @@ -0,0 +1,5 @@ +#pragma once + +/* Windows is always little endian. */ +#define htonl __builtin_bswap32 +#define ntohl __builtin_bswap32 diff --git a/lib/e2p/Android.bp b/lib/e2p/Android.bp index 6f0620af0..050d869b3 100644 --- a/lib/e2p/Android.bp +++ b/lib/e2p/Android.bp @@ -59,10 +59,6 @@ cc_library { "-Wno-unused-variable", "-Wno-error=typedef-redefinition", ], - - host_ldlibs: [ - "-lws2_32", - ], }, }, diff --git a/lib/ext2fs/Android.bp b/lib/ext2fs/Android.bp index 365ca709f..eb4482d79 100644 --- a/lib/ext2fs/Android.bp +++ b/lib/ext2fs/Android.bp @@ -126,8 +126,6 @@ cc_library { "-Wno-unused-variable", "-Wno-error=typedef-redefinition", ], - - host_ldlibs: ["-lws2_32"], }, }, diff --git a/lib/ext2fs/jfs_compat.h b/lib/ext2fs/jfs_compat.h index e11cf494e..0e96b56c1 100644 --- a/lib/ext2fs/jfs_compat.h +++ b/lib/ext2fs/jfs_compat.h @@ -7,11 +7,7 @@ #ifdef HAVE_NETINET_IN_H #include #endif -#ifdef HAVE_WINSOCK_H -#include -#else #include -#endif #include #define printk printf diff --git a/misc/Android.bp b/misc/Android.bp index 78e18e420..2baeac2ad 100644 --- a/misc/Android.bp +++ b/misc/Android.bp @@ -91,7 +91,6 @@ cc_binary { "-Wno-error" ], ldflags: ["-static"], - host_ldlibs: ["-lws2_32"], enabled: true }, android: { diff --git a/util/android_config.h b/util/android_config.h index 6ac16fec1..90b8f8a8f 100644 --- a/util/android_config.h +++ b/util/android_config.h @@ -36,7 +36,6 @@ #if defined(_WIN32) # define HAVE_LINUX_TYPES_H 1 -# define HAVE_WINSOCK_H 1 #endif #if defined(__APPLE__) || defined(__linux__) # define HAVE_FCNTL 1 From patchwork Sat Jan 21 20:31:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730053 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=se023mMt; dkim-atps=neutral Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7W17w3z23hP for ; Sun, 22 Jan 2023 07:36:55 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7W0jPbz4xN1 for ; Sun, 22 Jan 2023 07:36:55 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7W0gHCz4y06; Sun, 22 Jan 2023 07:36:55 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=se023mMt; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7W0W6Wz4xN1 for ; Sun, 22 Jan 2023 07:36:55 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230034AbjAUUgy (ORCPT ); Sat, 21 Jan 2023 15:36:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229881AbjAUUgr (ORCPT ); Sat, 21 Jan 2023 15:36:47 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6811D2914B for ; Sat, 21 Jan 2023 12:36:42 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1E3C1B80880 for ; Sat, 21 Jan 2023 20:36:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A120FC433A7 for ; Sat, 21 Jan 2023 20:36:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333399; bh=whuH9yPE9amH85pSRITB4jYCMo0rheLcLtdVhHG7Hys=; h=From:To:Subject:Date:In-Reply-To:References:From; b=se023mMtw7kiavtRInQkp0DCu741IFudNClGUlnCC+Cg3oAoIpTRR5Xl37rHAl5du QRROlYJATJCZMhBmYIu7VoO1t06cKaUKjNTRFNHUPJ4CFBPSXYYjgXcAKds8HMYlKL n99iAZ1LAk0imUyooq9fmhuPj+M6Ufq0mIZLKgK96MKAB99z6w8ddpHD9gPHnHlmI8 uMLk9Jk6gubyAZGUWlAb6H5SckWgSqcs+/XFdEOeom6zgjMlth5/v35iSrJquSUuSd HQTfZ/P1WwRxW0E9w6XxHUnfCT69jYcoIIVfH9GKA5Acd8dep0qnlkfzcDAmNiKU2Z xaP7GwifDH7lA== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 07/38] lib/blkid: remove 32-bit x86 byteswap assembly Date: Sat, 21 Jan 2023 12:31:59 -0800 Message-Id: <20230121203230.27624-8-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers libblkid contains 32-bit x86 assembly language implementations of 16-bit and 32-bit byteswaps. However, modern compilers can easily generate the bswap instruction automatically from the corresponding C expression. And no one ever bothered to add assembly for x86_64 or other architectures, anyway. So let's just remove this outdated code, which was maybe useful in the 90s, but is no longer useful. Signed-off-by: Eric Biggers Reviewed-by: Andreas Dilger --- lib/blkid/probe.h | 43 ------------------------------------------- 1 file changed, 43 deletions(-) diff --git a/lib/blkid/probe.h b/lib/blkid/probe.h index dea4081d0..063a5b5c0 100644 --- a/lib/blkid/probe.h +++ b/lib/blkid/probe.h @@ -814,46 +814,6 @@ struct exfat_entry_label { #define _INLINE_ static inline #endif -static __u16 blkid_swab16(__u16 val); -static __u32 blkid_swab32(__u32 val); -static __u64 blkid_swab64(__u64 val); - -#if ((defined __GNUC__) && \ - (defined(__i386__) || defined(__i486__) || defined(__i586__))) - -#define _BLKID_HAVE_ASM_BITOPS_ - -_INLINE_ __u32 blkid_swab32(__u32 val) -{ -#ifdef EXT2FS_REQUIRE_486 - __asm__("bswap %0" : "=r" (val) : "0" (val)); -#else - __asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */ - "rorl $16,%0\n\t" /* swap words */ - "xchgb %b0,%h0" /* swap higher bytes */ - :"=q" (val) - : "0" (val)); -#endif - return val; -} - -_INLINE_ __u16 blkid_swab16(__u16 val) -{ - __asm__("xchgb %b0,%h0" /* swap bytes */ \ - : "=q" (val) \ - : "0" (val)); \ - return val; -} - -_INLINE_ __u64 blkid_swab64(__u64 val) -{ - return (blkid_swab32(val >> 32) | - (((__u64) blkid_swab32(val & 0xFFFFFFFFUL)) << 32)); -} -#endif - -#if !defined(_BLKID_HAVE_ASM_BITOPS_) - _INLINE_ __u16 blkid_swab16(__u16 val) { return (val >> 8) | (val << 8); @@ -870,9 +830,6 @@ _INLINE_ __u64 blkid_swab64(__u64 val) return (blkid_swab32(val >> 32) | (((__u64) blkid_swab32(val & 0xFFFFFFFFUL)) << 32)); } -#endif - - #ifdef WORDS_BIGENDIAN #define blkid_le16(x) blkid_swab16(x) From patchwork Sat Jan 21 20:32:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730043 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=150.107.74.76; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=hB2pT9Io; dkim-atps=neutral Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7M6fRfz23hM for ; Sun, 22 Jan 2023 07:36:47 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7L53WYz4y06 for ; Sun, 22 Jan 2023 07:36:46 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7L4s6Fz4y0B; Sun, 22 Jan 2023 07:36:46 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=hB2pT9Io; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7L4gKnz4y06 for ; Sun, 22 Jan 2023 07:36:46 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229764AbjAUUgn (ORCPT ); Sat, 21 Jan 2023 15:36:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229687AbjAUUgm (ORCPT ); Sat, 21 Jan 2023 15:36:42 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0263D28D3E for ; Sat, 21 Jan 2023 12:36:41 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8038760ADD for ; Sat, 21 Jan 2023 20:36:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2018C4339E for ; Sat, 21 Jan 2023 20:36:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333399; bh=IRtFKx1Qv/BeXJIpY4N5ZFn3oUsQkx1zaMi9+y9XAAM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=hB2pT9IoMRtbID42+4+nFdbMbwplG3jCUwO0ij0o4ve/PNKvbjsQBlYzj5ma+ik8g xGik4EKvKiSMhzlVVK/vPy9SkbkvN7sYsifzgxzfqu8/9C8qTvel+Igi3+Ki5L0qav fcAT0I5z95hYrlNsdmFs5+mXrdSe9EVayWFUqbQ0bTrDcoNzsgajFvN5JsbAiKlVe9 KSxGdYRyRbrGWR5GMSwSx27ETD1DGHpEL0X3YlZUXAURFLJMnMkcAmUiwW5akO4zgt skWcIE+Gt5m987ED18uG731+aXr3HIHOxtm4iNLu9uXaba0IldYYWOWXbCYE6zAOAh 82IUYX2AIfJKg== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 08/38] lib/blkid: fix unaligned access to hfs_mdb Date: Sat, 21 Jan 2023 12:32:00 -0800 Message-Id: <20230121203230.27624-9-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers With -Wall, gcc warns: ./probe.c:1209:42: error: taking address of packed member of 'struct hfs_mdb' may result in an unaligned pointer value This seems to be a real unaligned memory access bug, as the offset of the 64-bit value from the start of the buffer is 116, which is not a multiple of 8. Fix it by using memcpy(). Do the same for hfsplus to fix the same warning, though in that case the offset is a multiple of 8 so it was defined behavior. Signed-off-by: Eric Biggers --- lib/blkid/probe.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/blkid/probe.c b/lib/blkid/probe.c index b8b6558e3..6a3bb2478 100644 --- a/lib/blkid/probe.c +++ b/lib/blkid/probe.c @@ -1198,7 +1198,6 @@ static int probe_hfs(struct blkid_probe *probe __BLKID_ATTR((unused)), unsigned char *buf) { struct hfs_mdb *hfs = (struct hfs_mdb *)buf; - unsigned long long *uuid_ptr; char uuid_str[17]; __u64 uuid; @@ -1206,8 +1205,8 @@ static int probe_hfs(struct blkid_probe *probe __BLKID_ATTR((unused)), (memcmp(hfs->embed_sig, "HX", 2) == 0)) return 1; /* Not hfs, but an embedded HFS+ */ - uuid_ptr = (unsigned long long *)hfs->finder_info.id; - uuid = blkid_le64(*uuid_ptr); + memcpy(&uuid, hfs->finder_info.id, 8); + uuid = blkid_le64(uuid); if (uuid) { sprintf(uuid_str, "%016llX", uuid); blkid_set_tag(probe->dev, "UUID", uuid_str, 0); @@ -1243,7 +1242,6 @@ static int probe_hfsplus(struct blkid_probe *probe, unsigned int leaf_node_size; unsigned int leaf_block; unsigned int label_len; - unsigned long long *uuid_ptr; __u64 leaf_off, uuid; char uuid_str[17], label[512]; int ext; @@ -1274,8 +1272,8 @@ static int probe_hfsplus(struct blkid_probe *probe, (memcmp(hfsplus->signature, "HX", 2) != 0)) return 1; - uuid_ptr = (unsigned long long *)hfsplus->finder_info.id; - uuid = blkid_le64(*uuid_ptr); + memcpy(&uuid, hfsplus->finder_info.id, 8); + uuid = blkid_le64(uuid); if (uuid) { sprintf(uuid_str, "%016llX", uuid); blkid_set_tag(probe->dev, "UUID", uuid_str, 0); From patchwork Sat Jan 21 20:32:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730059 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=VSW/sBKW; dkim-atps=neutral Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7d032Gz23gY for ; Sun, 22 Jan 2023 07:37:01 +1100 (AEDT) Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7c6k5mz4xN1 for ; Sun, 22 Jan 2023 07:37:00 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7c6ghQz4y03; Sun, 22 Jan 2023 07:37:00 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=VSW/sBKW; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7c6ZrYz4xN1 for ; Sun, 22 Jan 2023 07:37:00 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229901AbjAUUg7 (ORCPT ); Sat, 21 Jan 2023 15:36:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229942AbjAUUgs (ORCPT ); Sat, 21 Jan 2023 15:36:48 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87BB429152 for ; Sat, 21 Jan 2023 12:36:43 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id CB0EACE0923 for ; Sat, 21 Jan 2023 20:36:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EDC4C4339C for ; Sat, 21 Jan 2023 20:36:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333400; bh=YZ2pKcUw+HsnTmBeblDkOs6JI46xxZANugYMD/K+Xx8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=VSW/sBKWD/bDQogPkisFfT1wugXETv4b0mRPPP9wfivhvFAMM1LFUwufl4xodTFOr MllNP/WdaCEMYHgndUk9BaQMupSZzTxwCJ0iz3K2kE8NBYaE8rQv/O4d0tSRB8qah7 c2nIvKLz2h65bcBcB5M02gnm0daZsog7/Ow1CIeYhxbBy0CMCvi4qI4gzagXmsTN3S i1QPpBuCvk++vZePQJH3jdQejYrCIASOL39WuCJh4nAWdM8FWUXAgg3T2DXGj84qQC xhML605IPjZCQqpnixsFhrYKlSNTBHVkjfSHQom/mNzV1X5F00i/jw9hhoqfPQTs2K N8+5sN3t5UyJw== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 09/38] lib/blkid: fix -Wunused-variable warning in blkid_get_dev_size() Date: Sat, 21 Jan 2023 12:32:01 -0800 Message-Id: <20230121203230.27624-10-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers This showed up when building for Windows. It's hard to conditionally define this variable, so use the 'unused' attribute. Signed-off-by: Eric Biggers --- lib/blkid/Android.bp | 1 - lib/blkid/getsize.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/blkid/Android.bp b/lib/blkid/Android.bp index a40113193..f5d25da4f 100644 --- a/lib/blkid/Android.bp +++ b/lib/blkid/Android.bp @@ -42,7 +42,6 @@ cc_library { include_dirs: ["external/e2fsprogs/include/mingw"], cflags: [ "-Wno-pointer-to-int-cast", - "-Wno-unused-variable", "-Wno-error=typedef-redefinition", ], diff --git a/lib/blkid/getsize.c b/lib/blkid/getsize.c index 75f21d5c1..7a6e6fd86 100644 --- a/lib/blkid/getsize.c +++ b/lib/blkid/getsize.c @@ -75,7 +75,7 @@ static int valid_offset(int fd, blkid_loff_t offset) */ blkid_loff_t blkid_get_dev_size(int fd) { - unsigned long long size64; + unsigned long long size64 __BLKID_ATTR((unused)); blkid_loff_t high, low; #if defined DKIOCGETBLOCKCOUNT && defined DKIOCGETBLOCKSIZE /* For Apple Darwin */ From patchwork Sat Jan 21 20:32:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730050 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=jJ7MmG54; dkim-atps=neutral Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7R61v6z23hR for ; Sun, 22 Jan 2023 07:36:51 +1100 (AEDT) Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7R36gJz4xN1 for ; Sun, 22 Jan 2023 07:36:51 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7R34Bpz4y06; Sun, 22 Jan 2023 07:36:51 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=jJ7MmG54; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7R2zwQz4xN1 for ; Sun, 22 Jan 2023 07:36:51 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230017AbjAUUgu (ORCPT ); Sat, 21 Jan 2023 15:36:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229840AbjAUUgn (ORCPT ); Sat, 21 Jan 2023 15:36:43 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1528829147 for ; Sat, 21 Jan 2023 12:36:42 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E1ED260B72 for ; Sat, 21 Jan 2023 20:36:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F82CC433A8 for ; Sat, 21 Jan 2023 20:36:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333400; bh=U7wI4qHzRE7/py31orTHfxUE3tXqYIJBmnHYRx8/5Ac=; h=From:To:Subject:Date:In-Reply-To:References:From; b=jJ7MmG54Gh4jMe3/+sOba4oPma8Y3PlfXtkIIpi50jgXko230QTGP5NXMmFHyWnkL BV/DYbFxRGH46Oo7WGctwKH8QwFsP5511vYGL9Q4x+I/oqWlgsrtB/LRYXhBRm1cnt pvHBwmJ9dWWi897+4Ad5vCOrbdukWCicJaM6mkCsIJJ4z15/kgbGlYcJ+5dVSTSJj5 uZGMiSLDnKd5D5TUAGUV96vrf8OM1gqQiy/d91Zc3+bQYJ4mv1vykR1MtOpqkisp7Q cvjaBs6dNs25oJ4vMZRa/aKk3nV6dYxrKZNCy2E4CLk9A9WhP5JgPZ6TD4noGR5SMe wkQuoSSXuUgmw== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 10/38] lib/blkid: suppress -Wunused-result warning in blkid_flush_cache() Date: Sat, 21 Jan 2023 12:32:02 -0800 Message-Id: <20230121203230.27624-11-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers When _FORTIFY_SOURCE is defined, glibc annotates link() with the warn_unused_result function attribute. With gcc, that makes '(void) link()' cause a -Wunused-result warning, despite the explicit cast to void. That's annoying, since the use case in lib/blkid/save.c is legitimate (opportunistic backup). So let's suppress this warning. Signed-off-by: Eric Biggers --- lib/blkid/save.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/blkid/save.c b/lib/blkid/save.c index 036f07a4a..6f4499cfd 100644 --- a/lib/blkid/save.c +++ b/lib/blkid/save.c @@ -154,7 +154,15 @@ int blkid_flush_cache(blkid_cache cache) if (backup) { sprintf(backup, "%s.old", filename); unlink(backup); +#if defined(__GNUC__) && __GNUC__ >= 5 +/* explicit (void) cast is not enough with glibc and _FORTIFY_SOURCE */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" +#endif (void) link(filename, backup); +#if defined(__GNUC__) && __GNUC__ >= 5 +#pragma GCC diagnostic pop +#endif free(backup); } if (rename(opened, filename) < 0) From patchwork Sat Jan 21 20:32:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730044 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=150.107.74.76; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=JCzwUxp8; dkim-atps=neutral Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7M6jG0z23hP for ; Sun, 22 Jan 2023 07:36:47 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7M0gz1z4y0B for ; Sun, 22 Jan 2023 07:36:47 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7M0dV6z4y0C; Sun, 22 Jan 2023 07:36:47 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=JCzwUxp8; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7M0Y3Xz4y0B for ; Sun, 22 Jan 2023 07:36:47 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229866AbjAUUgo (ORCPT ); Sat, 21 Jan 2023 15:36:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229706AbjAUUgm (ORCPT ); Sat, 21 Jan 2023 15:36:42 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23CB829143 for ; Sat, 21 Jan 2023 12:36:41 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A81AD60B6C for ; Sat, 21 Jan 2023 20:36:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70472C4339B for ; Sat, 21 Jan 2023 20:36:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333400; bh=6vaEcMU11C00JgLvJinTeK77gDvStZvOlqFTbREyXSM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=JCzwUxp8O1RrY0XzQ5C/7gJrIHHCf8jyBgR90U1nLLGr8upbLKds6GGt7zg+Slrsc WlOdC6xvOOw4QnSMb3Wrjb30k/6SvPRJ3N2wMpmolR2sihQ31MVwqjSpUYvQQ63cX1 0be6GKhf3pKlZpTmT2azYEP0ZDp7YRLZRJYovJook9uQo1M15AqeOquBxcos85oJ8i RACvb+k4fmD2IE/so4YHFLtfMUKVzWQit/NuwI/lJyG7RZN4elkpbqNSHx+P6RIUgH INHixUNzYuDdGAC9CK8n1w3rHyGqHXqvaFY/+wP9snUceth1PtgaIsJFnbivv41RG5 UcB4sxFbD51Hw== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 11/38] lib/blkid: suppress -Wstringop-truncation warning in blkid_strndup() Date: Sat, 21 Jan 2023 12:32:03 -0800 Message-Id: <20230121203230.27624-12-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers Unfortunately, gcc gets confused by blkid_strndup() and incorrectly thinks the destination string is not being null-terminated. This is part of -Wstringop-truncation, enabled automatically by -Wall in gcc 8 and later. Let's just suppress this warning here. Signed-off-by: Eric Biggers --- lib/blkid/devno.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/blkid/devno.c b/lib/blkid/devno.c index 34ceb3c48..b1cadc9df 100644 --- a/lib/blkid/devno.c +++ b/lib/blkid/devno.c @@ -37,6 +37,12 @@ #include "blkidP.h" +#if defined(__GNUC__) && __GNUC__ >= 8 +/* gcc incorrectly thinks the destination string is not being null-terminated */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-truncation" +#endif + char *blkid_strndup(const char *s, int length) { char *ret; @@ -55,6 +61,10 @@ char *blkid_strndup(const char *s, int length) return ret; } +#if defined(__GNUC__) && __GNUC__ >= 8 +#pragma GCC diagnostic pop +#endif + char *blkid_strdup(const char *s) { return blkid_strndup(s, 0); From patchwork Sat Jan 21 20:32:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730048 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=150.107.74.76; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=merEyI3S; dkim-atps=neutral Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7Q5qctz23hQ for ; Sun, 22 Jan 2023 07:36:50 +1100 (AEDT) Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7Q5PzXz4xN1 for ; Sun, 22 Jan 2023 07:36:50 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7Q5Mj9z4y06; Sun, 22 Jan 2023 07:36:50 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=merEyI3S; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7Q5HZ0z4xN1 for ; Sun, 22 Jan 2023 07:36:50 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229995AbjAUUgt (ORCPT ); Sat, 21 Jan 2023 15:36:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229687AbjAUUgn (ORCPT ); Sat, 21 Jan 2023 15:36:43 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1369F28D32 for ; Sat, 21 Jan 2023 12:36:42 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D930E60B6E for ; Sat, 21 Jan 2023 20:36:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0FEFC4339E for ; Sat, 21 Jan 2023 20:36:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333400; bh=cetx1mAkAWZjY6IHf+Af5VO4OdrotI1R9aiRjV/sLsM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=merEyI3StstuHSbg9s1J8ptsLAuRAdufsgHoW10gKV+ioKSpGPZrMckBJA+AQG908 W4WfkYC6Itv3EY3xXoILRllRSce+YhZ2LKl6XsFJeyJCr06XbPlyWW6zzC5YLTWL7W uyooZNRLuNTOnUYcERQYGdf/PFEowCuLsAKMpjoOHtOuJbyKAnbI6yXKCagVnH5U5u IW7fZA7D/+lBEO+kgF0GuSp/UJGoXwgIq5AeIr2uHrn5fcDKGRvH3Blx+aBn3GQHan UI/dTer4lD+Tmx2bDYu9l+uG48Zgl26A7wUYo63rWxsHe0Ht5K5QtLlD4aNniDx+Ho QAzs99yNlVKyQ== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 12/38] lib/e2p: fix a -Wunused-variable warning in getflags() Date: Sat, 21 Jan 2023 12:32:04 -0800 Message-Id: <20230121203230.27624-13-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers This affected Windows builds. Signed-off-by: Eric Biggers --- lib/e2p/getflags.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/e2p/getflags.c b/lib/e2p/getflags.c index e4e2ad735..6708cd68b 100644 --- a/lib/e2p/getflags.c +++ b/lib/e2p/getflags.c @@ -30,8 +30,8 @@ int getflags (int fd, unsigned long * flags) { - struct stat buf; #if HAVE_STAT_FLAGS + struct stat buf; if (fstat (fd, &buf) == -1) return -1; @@ -53,6 +53,7 @@ int getflags (int fd, unsigned long * flags) return 0; #else #if HAVE_EXT2_IOCTLS + struct stat buf; int r, f; if (!fstat(fd, &buf) && From patchwork Sat Jan 21 20:32:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730055 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=150.107.74.76; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=N6SGpLC8; dkim-atps=neutral Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7Y2pshz23hR for ; Sun, 22 Jan 2023 07:36:57 +1100 (AEDT) Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7Y2Pstz4y03 for ; Sun, 22 Jan 2023 07:36:57 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7Y2MmYz4y06; Sun, 22 Jan 2023 07:36:57 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=N6SGpLC8; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7Y2HGWz4y03 for ; Sun, 22 Jan 2023 07:36:57 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229986AbjAUUgz (ORCPT ); Sat, 21 Jan 2023 15:36:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229888AbjAUUgr (ORCPT ); Sat, 21 Jan 2023 15:36:47 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB49E28D3E for ; Sat, 21 Jan 2023 12:36:42 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 174ED60B76 for ; Sat, 21 Jan 2023 20:36:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2001C433A0 for ; Sat, 21 Jan 2023 20:36:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333400; bh=VvXtES7I3U2zXIiT7Pdtpoc8YGQ5YDLdeE5z3UJnzRs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=N6SGpLC8wn1UXK0IDZdDiL5bYEOigGxIKc97BYDlS0VI6wvDdKlnUWaB1ESpHVxzp xO/84GBZIKoYI6b7I+J+/2MAlM1x6AvyR9EQgZJTBhTshYJOq8O498ejTtcpcn+qeg xJug+D9WdzpKl+jRqzSMDkkn9k53ygL3EBOQzga3grDHkcV+EvEtuOkrYPdBBgEEO9 FTKE1bfjFwf2u0+KAxQip9Sy0rlCRy64m1/kPLvvMeiQfoMsdLpztLvUTn/106aruE Gge7jIbx2Twoeo2pvLXdzu3/DuMSCOcTOPvLwZy0aAaZ8UVzBx52q1arXsBDHnHXJe RYkJQb+86rymQ== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 13/38] lib/{e2p,ss}: remove manual declarations of errno Date: Sat, 21 Jan 2023 12:32:05 -0800 Message-Id: <20230121203230.27624-14-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers As per 'man 3 errno': On some ancient systems, was not present or did not declare errno, so that it was necessary to declare errno manually (i.e., extern int errno). **Do not do this**. It long ago ceased to be necessary, and it will cause problems with modern versions of the C library. One of the platforms it causes a problem on is Windows: In file included from fgetversion.c:28: fgetversion.c: In function ‘fgetversion’: fgetversion.c:68:20: warning: ‘_errno’ redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] 68 | extern int errno; | ^~~~~ Just remove these obsolete manual declarations of errno. Signed-off-by: Eric Biggers --- lib/e2p/fgetversion.c | 2 -- lib/e2p/fsetversion.c | 1 - lib/e2p/getversion.c | 1 - lib/e2p/setversion.c | 1 - lib/ss/execute_cmd.c | 2 -- lib/ss/help.c | 2 -- lib/ss/pager.c | 2 -- 7 files changed, 11 deletions(-) diff --git a/lib/e2p/fgetversion.c b/lib/e2p/fgetversion.c index a65e9a5c5..f3a5b4cdf 100644 --- a/lib/e2p/fgetversion.c +++ b/lib/e2p/fgetversion.c @@ -65,8 +65,6 @@ int fgetversion(const char *name, unsigned long *version) rc = syscall(SYS_fsctl, name, EXT2_IOC_GETVERSION, &ver, 0); # endif /* !APPLE_DARWIN */ #else /* ! HAVE_EXT2_IOCTLS */ - extern int errno; - errno = EOPNOTSUPP; #endif /* ! HAVE_EXT2_IOCTLS */ if (rc == 0) diff --git a/lib/e2p/fsetversion.c b/lib/e2p/fsetversion.c index c2e045591..5f844b55e 100644 --- a/lib/e2p/fsetversion.c +++ b/lib/e2p/fsetversion.c @@ -65,7 +65,6 @@ int fsetversion (const char * name, unsigned long version) return syscall(SYS_fsctl, name, EXT2_IOC_SETVERSION, &ver, 0); #endif #else /* ! HAVE_EXT2_IOCTLS */ - extern int errno; errno = EOPNOTSUPP; return -1; #endif /* ! HAVE_EXT2_IOCTLS */ diff --git a/lib/e2p/getversion.c b/lib/e2p/getversion.c index 9f719b4a9..d374a0ea7 100644 --- a/lib/e2p/getversion.c +++ b/lib/e2p/getversion.c @@ -35,7 +35,6 @@ int getversion (int fd, unsigned long * version) *version = ver; return r; #else /* ! HAVE_EXT2_IOCTLS */ - extern int errno; errno = EOPNOTSUPP; return -1; #endif /* ! HAVE_EXT2_IOCTLS */ diff --git a/lib/e2p/setversion.c b/lib/e2p/setversion.c index 2bc933749..dd4a3f06b 100644 --- a/lib/e2p/setversion.c +++ b/lib/e2p/setversion.c @@ -34,7 +34,6 @@ int setversion (int fd, unsigned long version) ver = (int) version; return ioctl (fd, EXT2_IOC_SETVERSION, &ver); #else /* ! HAVE_EXT2_IOCTLS */ - extern int errno; errno = EOPNOTSUPP; return -1; #endif /* ! HAVE_EXT2_IOCTLS */ diff --git a/lib/ss/execute_cmd.c b/lib/ss/execute_cmd.c index 2e2c8cfa0..d092134a3 100644 --- a/lib/ss/execute_cmd.c +++ b/lib/ss/execute_cmd.c @@ -17,8 +17,6 @@ #endif #ifdef HAVE_ERRNO_H #include -#else -extern int errno; #endif #include "ss_internal.h" #include diff --git a/lib/ss/help.c b/lib/ss/help.c index a22b40178..54c78f239 100644 --- a/lib/ss/help.c +++ b/lib/ss/help.c @@ -20,8 +20,6 @@ #endif #ifdef HAVE_ERRNO_H #include -#else -extern int errno; #endif #include #include diff --git a/lib/ss/pager.c b/lib/ss/pager.c index b9b889962..ba32b2019 100644 --- a/lib/ss/pager.c +++ b/lib/ss/pager.c @@ -20,8 +20,6 @@ #endif #ifdef HAVE_ERRNO_H #include -#else -extern int errno; #endif #include "ss_internal.h" From patchwork Sat Jan 21 20:32:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730058 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=150.107.74.76; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=vDnOI5zF; dkim-atps=neutral Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7b0R2Nz23hP for ; Sun, 22 Jan 2023 07:36:59 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7b01bPz4y03 for ; Sun, 22 Jan 2023 07:36:59 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7Z75HBz4y06; Sun, 22 Jan 2023 07:36:58 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=vDnOI5zF; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7Z70w7z4y03 for ; Sun, 22 Jan 2023 07:36:58 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229911AbjAUUg6 (ORCPT ); Sat, 21 Jan 2023 15:36:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229901AbjAUUgs (ORCPT ); Sat, 21 Jan 2023 15:36:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E75582914D for ; Sat, 21 Jan 2023 12:36:42 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 46FF860B6F for ; Sat, 21 Jan 2023 20:36:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10359C4339B for ; Sat, 21 Jan 2023 20:36:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333401; bh=M78gt9zP9T00zp2vGV3Z7oX3MalKPygbcYQUv4SYmTc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=vDnOI5zFKGXdDTNP9yxRoPmdcE3DnAyZ6wDT6xAtHJ5XKFxnhfMCMcqep/uehJPa6 MxFPk07ndofVA+oNYpmRDefAt3MtBr5J7zBx9hBnVfNlz4Nva6SoEhsWDDxgCfwLLQ 0O56ySD/MoInsjUaUrcjaDe6l1gIuzQalR5JAChAGQobClHvE1cK/Ce1EQw0yAobAM wlx+lXLrQmIhOr5IsCMNdmlbajB94gKcdTzWjwqsnp8C9k/oVm3UQZV62/Z+10k3nW 0jXED/hpyRZeEGrU1cE19UAyYaJ7Hs5bD56QxwDwAzb8zGM8n/Z2eIH9nbzehvig/R HVJsyDxft3XPA== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 14/38] lib/et: fix "unused variable" warnings when !HAVE_FCNTL Date: Sat, 21 Jan 2023 12:32:06 -0800 Message-Id: <20230121203230.27624-15-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers In init_debug(), avoid -Wunused-variable and -Wunused-but-set-variable warnings when HAVE_FCNTL is not defined by only declaring 'fd' and 'flags' when HAVE_FCNTL is defined. This affected Windows builds. Signed-off-by: Eric Biggers --- lib/et/Android.bp | 3 --- lib/et/error_message.c | 10 +++++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/et/Android.bp b/lib/et/Android.bp index 07f3c277e..565feb594 100644 --- a/lib/et/Android.bp +++ b/lib/et/Android.bp @@ -31,9 +31,6 @@ cc_library { target: { windows: { enabled: true, - cflags: [ - "-Wno-unused-variable", - ], }, }, diff --git a/lib/et/error_message.c b/lib/et/error_message.c index cd9f57f56..8b9474ffa 100644 --- a/lib/et/error_message.c +++ b/lib/et/error_message.c @@ -235,7 +235,6 @@ static FILE *debug_f = 0; static void init_debug(void) { char *dstr, *fn, *tmp; - int fd, flags; if (debug_mask & DEBUG_INIT) return; @@ -257,10 +256,12 @@ static void init_debug(void) if (!debug_f) debug_f = fopen("/dev/tty", "a"); if (debug_f) { - fd = fileno(debug_f); -#if defined(HAVE_FCNTL) +#ifdef HAVE_FCNTL + int fd = fileno(debug_f); + if (fd >= 0) { - flags = fcntl(fd, F_GETFD); + int flags = fcntl(fd, F_GETFD); + if (flags >= 0) flags = fcntl(fd, F_SETFD, flags | FD_CLOEXEC); if (flags < 0) { @@ -274,7 +275,6 @@ static void init_debug(void) #endif } else debug_mask = DEBUG_INIT; - } /* From patchwork Sat Jan 21 20:32:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730060 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=SnMJMRek; dkim-atps=neutral Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7d305sz23hM for ; Sun, 22 Jan 2023 07:37:01 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7d2bGjz4xN1 for ; Sun, 22 Jan 2023 07:37:01 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7d2Y3sz4y03; Sun, 22 Jan 2023 07:37:01 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=SnMJMRek; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7d2SFSz4xN1 for ; Sun, 22 Jan 2023 07:37:01 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229963AbjAUUhA (ORCPT ); Sat, 21 Jan 2023 15:37:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229947AbjAUUgs (ORCPT ); Sat, 21 Jan 2023 15:36:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E75D72914E for ; Sat, 21 Jan 2023 12:36:42 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7961F60B7B for ; Sat, 21 Jan 2023 20:36:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41232C433EF for ; Sat, 21 Jan 2023 20:36:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333401; bh=JJxKR1qmF1fpj6MF1LNU0zO21axSqPlQdcLzTLWTYyU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=SnMJMRekj8eUv7CSQDBY6RxsiPn5plpXGdJj3A7/bJTa/xtTzPpiDlv4fjHErQcb1 ykQg7BLKAB8/BhA4wFZDKVXQZ9MFRs4VwgF2QeQQ/AqKtNfhODBkjG3M4J8OhkGrAW PBLulBsxt+Unfeqxjf1X5tx6DkGITX3LAHs/Frjp0CPIMv4pgKu3Th8g/wNCFsNQQP 6+ynXNd3vf2bYn7WMsnYeDQl5eTWpICTutDvlmFQoHfZE1ifY9kJ/OrG3BGApH7SUS e7OD5x6NuQzz+wquHc7EM9CL6IE09ulEsT3EzlXg30M7XP+hmaJ3aj7Y6iuKbyjtxT Pc/a3pDMPXRXw== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 15/38] lib/ext2fs: remove 32-bit x86 bitops assembly Date: Sat, 21 Jan 2023 12:32:07 -0800 Message-Id: <20230121203230.27624-16-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers The EXT2FS_ADDR() macro is causing -Warray-bounds warnings because it (sort of) dereferences past the end of the input array. It's not a "real" dereference, since the result is passed as a memory operand to inline asm. But in the C language sense, it is a dereference. Instead of trying to fix this code, let's consider that libext2fs *only* implements the bit operations in assembly for 32-bit x86, which is rarely used anymore. The fact that compilers have also improved, and no one has implemented these for another architecture, even x86_64, suggests it's not useful either. So, let's just remove this outdated code, which was maybe useful in the 90s, but now just causes problems. Signed-off-by: Eric Biggers --- lib/ext2fs/bitops.c | 14 +------ lib/ext2fs/bitops.h | 97 --------------------------------------------- 2 files changed, 2 insertions(+), 109 deletions(-) diff --git a/lib/ext2fs/bitops.c b/lib/ext2fs/bitops.c index c4a1d4e09..ce2acc460 100644 --- a/lib/ext2fs/bitops.c +++ b/lib/ext2fs/bitops.c @@ -19,14 +19,8 @@ #include "ext2_fs.h" #include "ext2fs.h" -#ifndef _EXT2_HAVE_ASM_BITOPS_ - /* - * For the benefit of those who are trying to port Linux to another - * architecture, here are some C-language equivalents. You should - * recode these in the native assembly language, if at all possible. - * - * C language equivalents written by Theodore Ts'o, 9/26/92. + * C language bitmap functions written by Theodore Ts'o, 9/26/92. * Modified by Pete A. Zaitcev 7/14/95 to be portable to big endian * systems, as well as non-32 bit systems. */ @@ -65,8 +59,6 @@ int ext2fs_test_bit(unsigned int nr, const void * addr) return (mask & *ADDR); } -#endif /* !_EXT2_HAVE_ASM_BITOPS_ */ - void ext2fs_warn_bitmap(errcode_t errcode, unsigned long arg, const char *description) { @@ -78,9 +70,7 @@ void ext2fs_warn_bitmap(errcode_t errcode, unsigned long arg, #endif } -/* - * C-only 64 bit ops. - */ +/* Bitmap functions that take a 64-bit offset */ int ext2fs_set_bit64(__u64 nr, void * addr) { diff --git a/lib/ext2fs/bitops.h b/lib/ext2fs/bitops.h index 505b3c9c3..9edf59447 100644 --- a/lib/ext2fs/bitops.h +++ b/lib/ext2fs/bitops.h @@ -219,14 +219,6 @@ extern errcode_t ext2fs_find_first_set_generic_bmap(ext2fs_generic_bitmap bitmap * functions at all; they will be included as normal functions in * inline.c */ -#ifdef NO_INLINE_FUNCS -#if (defined(__GNUC__) && (defined(__i386__) || defined(__i486__) || \ - defined(__i586__))) - /* This prevents bitops.c from trying to include the C */ - /* function version of these functions */ -#define _EXT2_HAVE_ASM_BITOPS_ -#endif -#endif /* NO_INLINE_FUNCS */ #if (defined(INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS)) #ifdef INCLUDE_INLINE_FUNCS @@ -285,90 +277,6 @@ _INLINE_ void ext2fs_fast_clear_bit64(__u64 nr, void * addr) *ADDR &= (unsigned char) ~(1 << (nr & 0x07)); } - -#if ((defined __GNUC__) && !defined(_EXT2_USE_C_VERSIONS_) && \ - (defined(__i386__) || defined(__i486__) || defined(__i586__))) - -#define _EXT2_HAVE_ASM_BITOPS_ -#define _EXT2_HAVE_ASM_SWAB_ - -/* - * These are done by inline assembly for speed reasons..... - * - * All bitoperations return 0 if the bit was cleared before the - * operation and != 0 if it was not. Bit 0 is the LSB of addr; bit 32 - * is the LSB of (addr+1). - */ - -/* - * Some hacks to defeat gcc over-optimizations.. - */ -struct __dummy_h { unsigned long a[100]; }; -#define EXT2FS_ADDR (*(struct __dummy_h *) addr) -#define EXT2FS_CONST_ADDR (*(const struct __dummy_h *) addr) - -_INLINE_ int ext2fs_set_bit(unsigned int nr, void * addr) -{ - int oldbit; - - addr = (void *) (((unsigned char *) addr) + (nr >> 3)); - __asm__ __volatile__("btsl %2,%1\n\tsbbl %0,%0" - :"=r" (oldbit),"+m" (EXT2FS_ADDR) - :"r" (nr & 7)); - return oldbit; -} - -_INLINE_ int ext2fs_clear_bit(unsigned int nr, void * addr) -{ - int oldbit; - - addr = (void *) (((unsigned char *) addr) + (nr >> 3)); - __asm__ __volatile__("btrl %2,%1\n\tsbbl %0,%0" - :"=r" (oldbit),"+m" (EXT2FS_ADDR) - :"r" (nr & 7)); - return oldbit; -} - -_INLINE_ int ext2fs_test_bit(unsigned int nr, const void * addr) -{ - int oldbit; - - addr = (const void *) (((const unsigned char *) addr) + (nr >> 3)); - __asm__ __volatile__("btl %2,%1\n\tsbbl %0,%0" - :"=r" (oldbit) - :"m" (EXT2FS_CONST_ADDR),"r" (nr & 7)); - return oldbit; -} - -_INLINE_ __u32 ext2fs_swab32(__u32 val) -{ -#ifdef EXT2FS_REQUIRE_486 - __asm__("bswap %0" : "=r" (val) : "0" (val)); -#else - __asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */ - "rorl $16,%0\n\t" /* swap words */ - "xchgb %b0,%h0" /* swap higher bytes */ - :"=q" (val) - : "0" (val)); -#endif - return val; -} - -_INLINE_ __u16 ext2fs_swab16(__u16 val) -{ - __asm__("xchgb %b0,%h0" /* swap bytes */ \ - : "=q" (val) \ - : "0" (val)); \ - return val; -} - -#undef EXT2FS_ADDR - -#endif /* i386 */ - - -#if !defined(_EXT2_HAVE_ASM_SWAB_) - _INLINE_ __u16 ext2fs_swab16(__u16 val) { return (val >> 8) | (__u16) (val << 8); @@ -380,8 +288,6 @@ _INLINE_ __u32 ext2fs_swab32(__u32 val) ((val<<8)&0xFF0000) | (val<<24)); } -#endif /* !_EXT2_HAVE_ASM_SWAB */ - _INLINE_ __u64 ext2fs_swab64(__u64 val) { return (ext2fs_swab32((__u32) (val >> 32)) | @@ -691,12 +597,9 @@ _INLINE_ void ext2fs_fast_unmark_block_bitmap_range2(ext2fs_block_bitmap bitmap, #undef _INLINE_ #endif -#ifndef _EXT2_HAVE_ASM_BITOPS_ extern int ext2fs_set_bit(unsigned int nr,void * addr); extern int ext2fs_clear_bit(unsigned int nr, void * addr); extern int ext2fs_test_bit(unsigned int nr, const void * addr); -#endif - extern int ext2fs_set_bit64(__u64 nr,void * addr); extern int ext2fs_clear_bit64(__u64 nr, void * addr); extern int ext2fs_test_bit64(__u64 nr, const void * addr); From patchwork Sat Jan 21 20:32:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730051 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=150.107.74.76; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=Zy9E218R; dkim-atps=neutral Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7T69Snz23hM for ; Sun, 22 Jan 2023 07:36:53 +1100 (AEDT) Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7T5kp0z4xN1 for ; Sun, 22 Jan 2023 07:36:53 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7T5hfhz4y06; Sun, 22 Jan 2023 07:36:53 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=Zy9E218R; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7T5cJkz4xN1 for ; Sun, 22 Jan 2023 07:36:53 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230021AbjAUUgw (ORCPT ); Sat, 21 Jan 2023 15:36:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229883AbjAUUgr (ORCPT ); Sat, 21 Jan 2023 15:36:47 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E65C029143 for ; Sat, 21 Jan 2023 12:36:42 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B10D260B6A for ; Sat, 21 Jan 2023 20:36:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 724ADC4339E; Sat, 21 Jan 2023 20:36:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333401; bh=mYuMEikLUJ9WzfsPcciIqqBc8WId6z72Oq+uxwsfhkI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zy9E218R/rcw9ngYvrn+HubwFzeqNRyNtQ9+8i8c3lVWXyvJVa6ZzCbrA+XRsRqEb C4bQXu4t7VICDdZlDP3Lucyn/bCHVW5HN+5Yqg9ERzPcWbsu3vfJpyKbC/0qbDBQez RRBmPnvPHZnCyC7pXT2TmWB/1LQOsUKxBGb0wi+laB3xHWsrg0AYR88yak8CUz4vSA b3yLQSJBW/8/l2n9YGco8p9gGiHs0/TQMrDKzuED7tgJJK6nM8nfcwPVd1hM8RW+T3 JgkGiL0fHyi660SQbz7mEM07FgnI803KCD77Az0BxtcPpfsbJkC6wa5wNvLUPR0m+j b7pfvZcoNlszw== From: Eric Biggers To: linux-ext4@vger.kernel.org Cc: Lukas Czerner Subject: [PATCH 16/38] lib/ext2fs: consistently use #ifdefs in ext2fs_print_bmap_statistics() Date: Sat, 21 Jan 2023 12:32:08 -0800 Message-Id: <20230121203230.27624-17-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers Since the 'now' variable is only used to calculate 'inuse', and 'inuse' is only used when defined(ENABLE_BMAP_STATS_OPS), it makes sense to guard the declaration and initialization of 'now' and 'inuse' by the same condition, just like the '*_perc' variables in the same function. This addresses the following compiler warning with clang -Wall: gen_bitmap64.c:187:9: warning: variable 'inuse' set but not used [-Wunused-but-set-variable] double inuse; ^ Reviewed-by: Lukas Czerner Signed-off-by: Eric Biggers --- lib/ext2fs/gen_bitmap64.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/ext2fs/gen_bitmap64.c b/lib/ext2fs/gen_bitmap64.c index c860c10ed..1a1eeefeb 100644 --- a/lib/ext2fs/gen_bitmap64.c +++ b/lib/ext2fs/gen_bitmap64.c @@ -183,11 +183,9 @@ static void ext2fs_print_bmap_statistics(ext2fs_generic_bitmap_64 bitmap) #ifdef ENABLE_BMAP_STATS_OPS float mark_seq_perc = 0.0, test_seq_perc = 0.0; float mark_back_perc = 0.0, test_back_perc = 0.0; -#endif - double inuse; struct timeval now; + double inuse; -#ifdef ENABLE_BMAP_STATS_OPS if (stats->test_count) { test_seq_perc = ((float)stats->test_seq / stats->test_count) * 100; @@ -201,7 +199,6 @@ static void ext2fs_print_bmap_statistics(ext2fs_generic_bitmap_64 bitmap) mark_back_perc = ((float)stats->mark_back / stats->mark_count) * 100; } -#endif if (gettimeofday(&now, (struct timezone *) NULL) == -1) { perror("gettimeofday"); @@ -212,6 +209,7 @@ static void ext2fs_print_bmap_statistics(ext2fs_generic_bitmap_64 bitmap) (((double) now.tv_usec) * 0.000001); inuse -= (double) stats->created.tv_sec + \ (((double) stats->created.tv_usec) * 0.000001); +#endif /* ENABLE_BMAP_STATS_OPS */ fprintf(stderr, "\n[+] %s bitmap (type %d)\n", bitmap->description, stats->type); From patchwork Sat Jan 21 20:32:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730057 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=150.107.74.76; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=Ca5WJoT/; dkim-atps=neutral Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7Z4V3Pz23hM for ; Sun, 22 Jan 2023 07:36:58 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7Z45Mfz4y03 for ; Sun, 22 Jan 2023 07:36:58 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7Z435rz4y06; Sun, 22 Jan 2023 07:36:58 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=Ca5WJoT/; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7Z3ywQz4y03 for ; Sun, 22 Jan 2023 07:36:58 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230040AbjAUUg6 (ORCPT ); Sat, 21 Jan 2023 15:36:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229911AbjAUUgs (ORCPT ); Sat, 21 Jan 2023 15:36:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9160029154 for ; Sat, 21 Jan 2023 12:36:43 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F01E560B7C for ; Sat, 21 Jan 2023 20:36:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA06AC4339B; Sat, 21 Jan 2023 20:36:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333401; bh=+eGPEt51BBekWdXR79kV7nTD9loilI/eFpEPnjT8EvQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ca5WJoT/bSu14MaHRbJjdoRmRhTv3DstH89xoXENj2ge+vwr/NEge81cIGarWfFnu OfY6QWZ3J5WVfgyen1BN7yqSiHrqvrHf04LVAb9MCD5yJoAv8dnf2hTy5Sk/oq3a01 9PcBINYjB2pQ9S25Sefm7niim6CzvmqnJzBFYDp7KOLAW6HGcwSDSPD+Z/Z6kLU9ay 9l5vuel2mr4GgBBIhv7fIhni7MsF4sG4ETxW/erberD+F9O+h/y04Ny74dZOTaHGkv 2geyEHKa2lnTGKRcBPwV2tVZvS1KfKJkk4B+X3UyxLnK1rd2AS6iyarnFuNvCZF9T1 ZkbToXp/oS2Cg== From: Eric Biggers To: linux-ext4@vger.kernel.org Cc: Andreas Dilger , Lukas Czerner Subject: [PATCH 17/38] lib/ext2fs: remove unused variable in ext2fs_xattrs_read_inode() Date: Sat, 21 Jan 2023 12:32:09 -0800 Message-Id: <20230121203230.27624-18-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers Address the following compiler warning with gcc -Wall: ext_attr.c: In function ‘ext2fs_xattrs_read_inode’: ext_attr.c:1000:16: warning: unused variable ‘i’ [-Wunused-variable] 1000 | size_t i; | ^ Cc: Andreas Dilger Reviewed-by: Lukas Czerner Signed-off-by: Eric Biggers --- lib/ext2fs/ext_attr.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/ext2fs/ext_attr.c b/lib/ext2fs/ext_attr.c index d36fe68dd..359c8e3cb 100644 --- a/lib/ext2fs/ext_attr.c +++ b/lib/ext2fs/ext_attr.c @@ -991,13 +991,11 @@ static void xattrs_free_keys(struct ext2_xattr_handle *h) errcode_t ext2fs_xattrs_read_inode(struct ext2_xattr_handle *handle, struct ext2_inode_large *inode) { - struct ext2_ext_attr_header *header; __u32 ea_inode_magic; unsigned int storage_size; char *start, *block_buf = NULL; blk64_t blk; - size_t i; errcode_t err = 0; EXT2_CHECK_MAGIC(handle, EXT2_ET_MAGIC_EA_HANDLE); From patchwork Sat Jan 21 20:32:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730056 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=d06zKSJ6; dkim-atps=neutral Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7Z0N9gz23gY for ; Sun, 22 Jan 2023 07:36:58 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7Y72ZHz4y03 for ; Sun, 22 Jan 2023 07:36:57 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7Y70qQz4y06; Sun, 22 Jan 2023 07:36:57 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=d06zKSJ6; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7Y6wSnz4y03 for ; Sun, 22 Jan 2023 07:36:57 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230038AbjAUUg5 (ORCPT ); Sat, 21 Jan 2023 15:36:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229922AbjAUUgs (ORCPT ); Sat, 21 Jan 2023 15:36:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C407029158 for ; Sat, 21 Jan 2023 12:36:43 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2C41860B7A for ; Sat, 21 Jan 2023 20:36:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8752C433EF for ; Sat, 21 Jan 2023 20:36:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333402; bh=+mTd8IgdCLykkHo8OjOUrcA2S6yRkqQ7cxfnuRQtaiY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=d06zKSJ6QAd/dY1oXLAuH08Yt1/CIp8NbW7Ktwa3bwT/u+d1Y8EDtuzMr0ahV3t+F UNbIeXESZPpvart8z1mhkBsMB/biLiP6NKN7vY/FC3SQcFtr2LDsXsiivRmmG0ZKvv VmTMbR+FkZcwgtKrhl5RzY2GTxw6BEa5fj5GWXzN/ZEfr7rsU2KAJrCVXNzIvAA96P u3MXGgNI1x1dQB9jXXJ7CT/7AMOfUSA/KM93GyuEkDQp6gAxObb4m0lLofCrU5j4+5 lsylCZfJdzThIHLQYX2NB8tcOZIaHGEJpG6n8mkcoE0511joR/WsBV4I27wNQe6gEZ gy9RIFGKhpmQw== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 18/38] lib/ext2fs: fix a printf format specifier in file_test() Date: Sat, 21 Jan 2023 12:32:10 -0800 Message-Id: <20230121203230.27624-19-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers size_t should be matched by %zu, not %lu. This fixes a -Wformat warning when building for 32-bit x86. Signed-off-by: Eric Biggers --- lib/ext2fs/inline_data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ext2fs/inline_data.c b/lib/ext2fs/inline_data.c index b62fb6769..bd52e3770 100644 --- a/lib/ext2fs/inline_data.c +++ b/lib/ext2fs/inline_data.c @@ -653,7 +653,7 @@ static errcode_t file_test(ext2_filsys fs) if (size != BUFF_SIZE) { fprintf(stderr, - "tst_inline_data: size %lu != buflen %u\n", + "tst_inline_data: size %zu != buflen %u\n", size, BUFF_SIZE); retval = 1; goto err; From patchwork Sat Jan 21 20:32:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730070 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=i0LG2n5m; dkim-atps=neutral Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7r0vV5z23hM for ; Sun, 22 Jan 2023 07:37:12 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7r0SjNz4xN1 for ; Sun, 22 Jan 2023 07:37:12 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7r0Mx9z4y03; Sun, 22 Jan 2023 07:37:12 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=i0LG2n5m; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7r0Hxwz4xN1 for ; Sun, 22 Jan 2023 07:37:12 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230002AbjAUUhL (ORCPT ); Sat, 21 Jan 2023 15:37:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229991AbjAUUgt (ORCPT ); Sat, 21 Jan 2023 15:36:49 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CADC42916E for ; Sat, 21 Jan 2023 12:36:44 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7C88FB807E4 for ; Sat, 21 Jan 2023 20:36:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 252ADC433A0 for ; Sat, 21 Jan 2023 20:36:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333402; bh=kKpY6N1wjkPqyVf8e/HsPEpKOt8PNFJDIyv9bhAd80w=; h=From:To:Subject:Date:In-Reply-To:References:From; b=i0LG2n5m0wq9iDttGSX96j5HWfoiUpGAj2KE0FfI+q+MrEOwHkqERPCqCA3HGlYQw KwQzf92tdO8+dt7xnG2+8TnoE+XeOOimktxqDgwwEMgdPa2gyJa9Hf4TWgwTKeqUpd H4umUyH6gmp5ohTKX6j5kw4Ow5aQ6B1JUyX1b8KROFFH/4eZrwEHBjrECutMzx1OIA Kgesr9TnVfpTHX24HhLXj8wLDB2wRDO0xJVq3kWZZBRfnnBUIojI/0WPq+5Zsf83Gf fIJci506dqInUOlamVkrVtsAt0ClD3uFaYlw2jPK+eLJE1idDwVVN2wZJrBPAdHodV 5pwzlJCAmN9BQ== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 19/38] lib/ext2fs: fix two compiler warnings in windows_io.c Date: Sat, 21 Jan 2023 12:32:11 -0800 Message-Id: <20230121203230.27624-20-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers init_private_data() triggers a -Wstringop-truncation warning, due to a real bug. Fix it. windows_open() has a -Wunused-variable warning because some macOS-specific code was copied there for no reason. Remove it. Signed-off-by: Eric Biggers --- lib/ext2fs/windows_io.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/lib/ext2fs/windows_io.c b/lib/ext2fs/windows_io.c index 68b5571bb..83aea68b6 100644 --- a/lib/ext2fs/windows_io.c +++ b/lib/ext2fs/windows_io.c @@ -499,9 +499,6 @@ static errcode_t windows_open_channel(struct windows_private_data *data, #if defined(O_DIRECT) if (flags & IO_FLAG_DIRECT_IO) io->align = ext2fs_get_dio_alignment(data->dev); -#elif defined(F_NOCACHE) - if (flags & IO_FLAG_DIRECT_IO) - io->align = 4096; #endif /* @@ -609,7 +606,7 @@ static struct windows_private_data *init_private_data(const char *name, int flag return NULL; memset(data, 0, sizeof(struct windows_private_data)); - strncpy(data->name, name, sizeof(data->name)); + strncpy(data->name, name, sizeof(data->name) - 1); data->magic = EXT2_ET_MAGIC_WINDOWS_IO_CHANNEL; data->io_stats.num_fields = 2; data->flags = flags; @@ -620,7 +617,6 @@ static struct windows_private_data *init_private_data(const char *name, int flag static errcode_t windows_open(const char *name, int flags, io_channel *channel) { - int fd = -1; int open_flags; struct windows_private_data *data; @@ -644,12 +640,6 @@ static errcode_t windows_open(const char *name, int flags, io_channel *channel) return EXT2_ET_BAD_DEVICE_NAME; } -#if defined(F_NOCACHE) && !defined(IO_DIRECT) - if (flags & IO_FLAG_DIRECT_IO) { - if (fcntl(fd, F_NOCACHE, 1) < 0) - return errno; - } -#endif return windows_open_channel(data, flags, channel, windows_io_manager); } From patchwork Sat Jan 21 20:32:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730071 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=ocdmFbJB; dkim-atps=neutral Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7s60W9z23gY for ; Sun, 22 Jan 2023 07:37:13 +1100 (AEDT) Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7s5Y9dz4xN1 for ; Sun, 22 Jan 2023 07:37:13 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7s5Vw0z4y03; Sun, 22 Jan 2023 07:37:13 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=ocdmFbJB; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7s5QjYz4xN1 for ; Sun, 22 Jan 2023 07:37:13 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229866AbjAUUhM (ORCPT ); Sat, 21 Jan 2023 15:37:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229999AbjAUUgt (ORCPT ); Sat, 21 Jan 2023 15:36:49 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04C5A29170 for ; Sat, 21 Jan 2023 12:36:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AA55CB80185 for ; Sat, 21 Jan 2023 20:36:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55CDBC4339C for ; Sat, 21 Jan 2023 20:36:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333402; bh=Za1y6KOTR72/moNo6qJUUNZ6vY4nnIf8oortRhSYW7Y=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ocdmFbJBnzfzYh+6YwWQtcfmWvSiU+SxaS1vSAN+SiinWXzQbc5eQSHyYm7b2f4W2 nNEwFt6Ud0E0Dtn0Xa3PkN46oE4aO/wbo8TDPg1X4+3VexlVkqvuDdVDK05IkscbBH rZkQ8lVrUg9dx4bEon7C9f33KJy1yr82vus20+j9e4zjHJ3rL8oF/2Xqe08Y2ubgoo XipmwpFGzsde/Q+qjIJ4qt/myQewiQhYkiBgCUmMZmKLe490R579V2dt9+VyIXtqMY PXAIb6D/sytdWF7w3RPX/vcSTOGEh7ZJTjb2j6rv3Q5d2zz613k+r915589y642llj VcvayxV+33lvQ== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 20/38] lib/ext2fs: fix a -Wpointer-sign warning in ext2fs_mmp_start() Date: Sat, 21 Jan 2023 12:32:12 -0800 Message-Id: <20230121203230.27624-21-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers This showed up when building for Windows. Signed-off-by: Eric Biggers --- lib/ext2fs/mmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ext2fs/mmp.c b/lib/ext2fs/mmp.c index 7970aac27..9491fbd5c 100644 --- a/lib/ext2fs/mmp.c +++ b/lib/ext2fs/mmp.c @@ -356,7 +356,7 @@ clean_seq: #ifdef HAVE_GETHOSTNAME gethostname((char *) mmp_s->mmp_nodename, sizeof(mmp_s->mmp_nodename)); #else - strcpy(mmp_s->mmp_nodename, "unknown host"); + strcpy((char *) mmp_s->mmp_nodename, "unknown host"); #endif strncpy((char *) mmp_s->mmp_bdevname, fs->device_name, sizeof(mmp_s->mmp_bdevname)); From patchwork Sat Jan 21 20:32:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730061 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=qqTxfQxM; dkim-atps=neutral Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7f0WGWz23gY for ; Sun, 22 Jan 2023 07:37:02 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7f05y7z4xN1 for ; Sun, 22 Jan 2023 07:37:02 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7f03Lbz4y03; Sun, 22 Jan 2023 07:37:02 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=qqTxfQxM; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7d6zJrz4xN1 for ; Sun, 22 Jan 2023 07:37:01 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229938AbjAUUhB (ORCPT ); Sat, 21 Jan 2023 15:37:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229954AbjAUUgs (ORCPT ); Sat, 21 Jan 2023 15:36:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9CDA2915C for ; Sat, 21 Jan 2023 12:36:43 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 31E6360B6C for ; Sat, 21 Jan 2023 20:36:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8684DC433EF; Sat, 21 Jan 2023 20:36:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333402; bh=XVz2+p5U48l2k+zbRqxcCF7PmaY2bieBDbEEFlMUd+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qqTxfQxMMiLZl7xWOdb+S+fRpvkyEIMqmEqFgMZTp0g/Ed0Dv8qeL15aqz/wvRMXc 8Kfi1zeMoDnCAiKHs/FR7xrv000OIj+la7ZrvwaZigx2KXnvUh6oBLdNzq5rfZjWOa kss1rRD/nniI/grvz7BdXWV8ihQhKPXvA5V2VLGcC1O8fwe00irzGHW96V4vYD43R5 tvr5H5WvYm8dBVfCK0FqCGGLubB0yw6M4sFkI3hyXNA80dM/z6Zvc1Hrp38x4KS+EN ROo7s+K/mao6ONL+PbFy/7208GKjRpf6XfCjK3gvQJLtOgBk7vk99Tt6feXb3X3jWa 9ijXYKDXIxt5A== From: Eric Biggers To: linux-ext4@vger.kernel.org Cc: Paulo Antonio Alvarez Subject: [PATCH 21/38] lib/{ext2fs,support}: fix 32-bit Windows build Date: Sat, 21 Jan 2023 12:32:13 -0800 Message-Id: <20230121203230.27624-22-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers _WIN32 is the standard macro to detect (native) 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: 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 Signed-off-by: Eric Biggers --- 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 3a461eb9c..bd978c530 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 bbed2a70a..349aa2c4f 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 c0eda5cf8..be2a0dda4 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 From patchwork Sat Jan 21 20:32:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730063 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=150.107.74.76; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=eIoZ9d+D; dkim-atps=neutral Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7g3xYbz23hM for ; Sun, 22 Jan 2023 07:37:03 +1100 (AEDT) Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7g3Vygz4xN1 for ; Sun, 22 Jan 2023 07:37:03 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7g3SBDz4y03; Sun, 22 Jan 2023 07:37:03 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=eIoZ9d+D; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7g3HlVz4xN1 for ; Sun, 22 Jan 2023 07:37:03 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230041AbjAUUhC (ORCPT ); Sat, 21 Jan 2023 15:37:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229967AbjAUUgs (ORCPT ); Sat, 21 Jan 2023 15:36:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A680329157 for ; Sat, 21 Jan 2023 12:36:43 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 61A6660B7F for ; Sat, 21 Jan 2023 20:36:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE496C4339B for ; Sat, 21 Jan 2023 20:36:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333402; bh=biRELdgM3R8+fJoxOyh4m11cf4MkKzKLRr029v4SWCI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=eIoZ9d+DoTRYjPLaw1hpknbgKnpPJMUXnAsTXIDcm6GjMuqkMBvNixZ6hI8xeMkKo s0I9FRx0L8tn1wOB43t2VjQFUQ8KPYibCYNrTxH7P32HfY+90PgR3jDpCLKeFa+66b mM7MQS15uWVvbclB6RQERwYvI8TZTm8ycOwsHvQo1k9MkSMWLAlfHzmnxd7wGtoM2C 2kNZJRFmc1xkvLVtXTNZ1b+jQbYIxyTPQ2P3ZtCd9tFHfN2Vnz0zlCicm21kb9icoM sXf2pqX03VYaOm+Rd57mm1L2+ac/tedtr27dq1Dxs0+/MBKKfkWPouAv95EO7lWhFH K24f2TRpsenWw== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 22/38] lib/ss: fix 'make install' by creating man1dir Date: Sat, 21 Jan 2023 12:32:14 -0800 Message-Id: <20230121203230.27624-23-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers 'make install' does not work because libss tries to install a man page without creating the directory first. Fix this. Signed-off-by: Eric Biggers --- lib/ss/Makefile.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/ss/Makefile.in b/lib/ss/Makefile.in index 40294db0b..bb5041893 100644 --- a/lib/ss/Makefile.in +++ b/lib/ss/Makefile.in @@ -125,10 +125,11 @@ ss.pc: $(srcdir)/ss.pc.in $(top_builddir)/config.status $(Q) cd $(top_builddir); CONFIG_FILES=lib/ss/ss.pc ./config.status installdirs:: - $(E) " MKDIR_P $(libdir) $(includedir)/ss $(datadir)/ss $(bindir)" + $(E) " MKDIR_P $(libdir) $(includedir)/ss $(datadir)/ss $(bindir) $(pkgconfigdir) $(man1dir)" $(Q) $(MKDIR_P) $(DESTDIR)$(libdir) \ $(DESTDIR)$(includedir)/ss $(DESTDIR)$(datadir)/ss \ - $(DESTDIR)$(bindir) $(DESTDIR)$(pkgconfigdir) + $(DESTDIR)$(bindir) $(DESTDIR)$(pkgconfigdir) \ + $(DESTDIR)$(man1dir) install:: libss.a $(INSTALL_HFILES) installdirs ss_err.h mk_cmds ss.pc $(E) " INSTALL_DATA $(DESTDIR)$(libdir)/libss.a" From patchwork Sat Jan 21 20:32:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730078 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=oXP2lFEm; dkim-atps=neutral Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp8C2zPXz23gY for ; Sun, 22 Jan 2023 07:37:31 +1100 (AEDT) Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp8C2YGjz4xN1 for ; Sun, 22 Jan 2023 07:37:31 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp8C2WPRz4y03; Sun, 22 Jan 2023 07:37:31 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=oXP2lFEm; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp8C2QHXz4xN1 for ; Sun, 22 Jan 2023 07:37:31 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229980AbjAUUh3 (ORCPT ); Sat, 21 Jan 2023 15:37:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229687AbjAUUgt (ORCPT ); Sat, 21 Jan 2023 15:36:49 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD88E29401 for ; Sat, 21 Jan 2023 12:36:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5F799B80880 for ; Sat, 21 Jan 2023 20:36:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EEFC1C433A4; Sat, 21 Jan 2023 20:36:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333403; bh=nZolUev9y8vGyoa8mztER7yXUdthugp/QkTK4SWdr5o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oXP2lFEmSIJuACU2+meYlEBLshtyUJNYwdLygZPo1oRSCh+zZc3XNl/LH1REwKzLr wThPOFIJGwr2I6aDkIHDy34M2EITXXCoCsZkG7MYYMMNyPAr5uts4+ZrfVXBLWjdFu 8NLbAlOe3U5zN9qFzDxG8FoadGzp9rX/DGT7jcpn5rew5UXSCVvjb0lfhoAbCMCOoZ 7HaQ4SSWlhTQzyX741wHhSBUlO36Tz9l5NxWz4NzilGuvHrnbxOG7q8V5gp60DC7u0 K5D+feHCeuhVyxhzPsRCVwdmTPrEVLddlPyQrYAI5kZgVhhsTCQgsf56ke+SzpWPEu lGOgIPdmBX1Ow== From: Eric Biggers To: linux-ext4@vger.kernel.org Cc: Lukas Czerner Subject: [PATCH 23/38] lib/support: remove unused label in get_devname() Date: Sat, 21 Jan 2023 12:32:15 -0800 Message-Id: <20230121203230.27624-24-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers Address the following compiler warning with gcc -Wall: devname.c: In function ‘get_devname’: devname.c:61:1: warning: label ‘out_strdup’ defined but not used [-Wunused-label] 61 | out_strdup: | ^~~~~~~~~~ Reviewed-by: Lukas Czerner Signed-off-by: Eric Biggers --- lib/support/devname.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/support/devname.c b/lib/support/devname.c index 8c2349a32..e0306ddfb 100644 --- a/lib/support/devname.c +++ b/lib/support/devname.c @@ -58,7 +58,6 @@ char *get_devname(blkid_cache cache, const char *token, const char *value) goto out; } -out_strdup: if (is_file) ret = strdup(token); out: From patchwork Sat Jan 21 20:32:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730064 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=PyyguBZm; dkim-atps=neutral Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7h13kRz23gY for ; Sun, 22 Jan 2023 07:37:04 +1100 (AEDT) Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7h0bsLz4y03 for ; Sun, 22 Jan 2023 07:37:04 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7h0Yp9z4y06; Sun, 22 Jan 2023 07:37:04 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=PyyguBZm; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7h0Sq3z4y03 for ; Sun, 22 Jan 2023 07:37:04 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229764AbjAUUhD (ORCPT ); Sat, 21 Jan 2023 15:37:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229970AbjAUUgs (ORCPT ); Sat, 21 Jan 2023 15:36:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F7032915E for ; Sat, 21 Jan 2023 12:36:43 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 72C9460ADD for ; Sat, 21 Jan 2023 20:36:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32B8DC433A7; Sat, 21 Jan 2023 20:36:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333403; bh=js4EoiNuVDSE622JrtozM8VHganSNbk0FH7XROPaiHw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PyyguBZmVU9j5aXZQqlkKXqpe1FGMjJ6MajMTNdEExVyeuwm3JS/lUgxRE83JymcV 8d0h/CUJSCAJclO2uNMmYyuGAb+c354mMmOMtuVGbqPX+y3W5HWneVZe3KFD7qIcAf rvncf+XCWf9BRayiC1zXmhFClqdntko1ju38R7lMgY+ph+YMLgakBW9XSp/gd3Gj0o B7rQzazvfswf5R6KbBU8kxiJluibBzTJJ6zrE5FWH4UivA464k0t/0rX7OHU7nEpHm skMrlZzM63Bbf2ToVVI6zLivdRH9nYIvNlvqvP5TQDBmuFLIRYNwageEIe1ptva/o+ +R8fQtok6AuyA== From: Eric Biggers To: linux-ext4@vger.kernel.org Cc: Lukas Czerner Subject: [PATCH 24/38] lib/support: clean up definition of flags_array Date: Sat, 21 Jan 2023 12:32:16 -0800 Message-Id: <20230121203230.27624-25-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,UPPERCASE_50_75 autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers Add braces to address the following compiler warning with gcc -Wall: print_fs_flags.c:24:42: warning: missing braces around initializer [-Wmissing-braces] 24 | static struct flags_name flags_array[] = { | ^ Also add 'const', and add an explicit NULL in the last entry. Reviewed-by: Lukas Czerner Signed-off-by: Eric Biggers --- lib/support/print_fs_flags.c | 60 ++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/lib/support/print_fs_flags.c b/lib/support/print_fs_flags.c index e54acc04b..f47cd6653 100644 --- a/lib/support/print_fs_flags.c +++ b/lib/support/print_fs_flags.c @@ -21,40 +21,40 @@ struct flags_name { const char *name; }; -static struct flags_name flags_array[] = { - EXT2_FLAG_RW, "EXT2_FLAG_RW", - EXT2_FLAG_CHANGED, "EXT2_FLAG_CHANGED", - EXT2_FLAG_DIRTY, "EXT2_FLAG_DIRTY", - EXT2_FLAG_VALID, "EXT2_FLAG_VALID", - EXT2_FLAG_IB_DIRTY, "EXT2_FLAG_IB_DIRTY", - EXT2_FLAG_BB_DIRTY, "EXT2_FLAG_BB_DIRTY", - EXT2_FLAG_SWAP_BYTES, "EXT2_FLAG_SWAP_BYTES", - EXT2_FLAG_SWAP_BYTES_READ, "EXT2_FLAG_SWAP_BYTES_READ", - EXT2_FLAG_SWAP_BYTES_WRITE, "EXT2_FLAG_SWAP_BYTES_WRITE", - EXT2_FLAG_MASTER_SB_ONLY, "EXT2_FLAG_MASTER_SB_ONLY", - EXT2_FLAG_FORCE, "EXT2_FLAG_FORCE", - EXT2_FLAG_SUPER_ONLY, "EXT2_FLAG_SUPER_ONLY", - EXT2_FLAG_JOURNAL_DEV_OK, "EXT2_FLAG_JOURNAL_DEV_OK", - EXT2_FLAG_IMAGE_FILE, "EXT2_FLAG_IMAGE_FILE", - EXT2_FLAG_EXCLUSIVE, "EXT2_FLAG_EXCLUSIVE", - EXT2_FLAG_SOFTSUPP_FEATURES, "EXT2_FLAG_SOFTSUPP_FEATURES", - EXT2_FLAG_NOFREE_ON_ERROR, "EXT2_FLAG_NOFREE_ON_ERROR", - EXT2_FLAG_64BITS, "EXT2_FLAG_64BITS", - EXT2_FLAG_PRINT_PROGRESS, "EXT2_FLAG_PRINT_PROGRESS", - EXT2_FLAG_DIRECT_IO, "EXT2_FLAG_DIRECT_IO", - EXT2_FLAG_SKIP_MMP, "EXT2_FLAG_SKIP_MMP", - EXT2_FLAG_IGNORE_CSUM_ERRORS, "EXT2_FLAG_IGNORE_CSUM_ERRORS", - EXT2_FLAG_SHARE_DUP, "EXT2_FLAG_SHARE_DUP", - EXT2_FLAG_IGNORE_SB_ERRORS, "EXT2_FLAG_IGNORE_SB_ERRORS", - EXT2_FLAG_BBITMAP_TAIL_PROBLEM, "EXT2_FLAG_BBITMAP_TAIL_PROBLEM", - EXT2_FLAG_IBITMAP_TAIL_PROBLEM, "EXT2_FLAG_IBITMAP_TAIL_PROBLEM", - EXT2_FLAG_THREADS, "EXT2_FLAG_THREADS", - 0 +static const struct flags_name flags_array[] = { + { EXT2_FLAG_RW, "EXT2_FLAG_RW" }, + { EXT2_FLAG_CHANGED, "EXT2_FLAG_CHANGED" }, + { EXT2_FLAG_DIRTY, "EXT2_FLAG_DIRTY" }, + { EXT2_FLAG_VALID, "EXT2_FLAG_VALID" }, + { EXT2_FLAG_IB_DIRTY, "EXT2_FLAG_IB_DIRTY" }, + { EXT2_FLAG_BB_DIRTY, "EXT2_FLAG_BB_DIRTY" }, + { EXT2_FLAG_SWAP_BYTES, "EXT2_FLAG_SWAP_BYTES" }, + { EXT2_FLAG_SWAP_BYTES_READ, "EXT2_FLAG_SWAP_BYTES_READ" }, + { EXT2_FLAG_SWAP_BYTES_WRITE, "EXT2_FLAG_SWAP_BYTES_WRITE" }, + { EXT2_FLAG_MASTER_SB_ONLY, "EXT2_FLAG_MASTER_SB_ONLY" }, + { EXT2_FLAG_FORCE, "EXT2_FLAG_FORCE" }, + { EXT2_FLAG_SUPER_ONLY, "EXT2_FLAG_SUPER_ONLY" }, + { EXT2_FLAG_JOURNAL_DEV_OK, "EXT2_FLAG_JOURNAL_DEV_OK" }, + { EXT2_FLAG_IMAGE_FILE, "EXT2_FLAG_IMAGE_FILE" }, + { EXT2_FLAG_EXCLUSIVE, "EXT2_FLAG_EXCLUSIVE" }, + { EXT2_FLAG_SOFTSUPP_FEATURES, "EXT2_FLAG_SOFTSUPP_FEATURES" }, + { EXT2_FLAG_NOFREE_ON_ERROR, "EXT2_FLAG_NOFREE_ON_ERROR" }, + { EXT2_FLAG_64BITS, "EXT2_FLAG_64BITS" }, + { EXT2_FLAG_PRINT_PROGRESS, "EXT2_FLAG_PRINT_PROGRESS" }, + { EXT2_FLAG_DIRECT_IO, "EXT2_FLAG_DIRECT_IO" }, + { EXT2_FLAG_SKIP_MMP, "EXT2_FLAG_SKIP_MMP" }, + { EXT2_FLAG_IGNORE_CSUM_ERRORS, "EXT2_FLAG_IGNORE_CSUM_ERRORS" }, + { EXT2_FLAG_SHARE_DUP, "EXT2_FLAG_SHARE_DUP" }, + { EXT2_FLAG_IGNORE_SB_ERRORS, "EXT2_FLAG_IGNORE_SB_ERRORS" }, + { EXT2_FLAG_BBITMAP_TAIL_PROBLEM, "EXT2_FLAG_BBITMAP_TAIL_PROBLEM" }, + { EXT2_FLAG_IBITMAP_TAIL_PROBLEM, "EXT2_FLAG_IBITMAP_TAIL_PROBLEM" }, + { EXT2_FLAG_THREADS, "EXT2_FLAG_THREADS" }, + { 0, NULL }, }; void print_fs_flags(FILE * f, unsigned long flags) { - struct flags_name *fp; + const struct flags_name *fp; int first = 1, pos = 16; for (fp = flags_array; fp->flag != 0; fp++) { From patchwork Sat Jan 21 20:32:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730062 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=P34F22tT; dkim-atps=neutral Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7g0sfzz23gY for ; Sun, 22 Jan 2023 07:37:03 +1100 (AEDT) Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7g0QqZz4xN1 for ; Sun, 22 Jan 2023 07:37:03 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7g0NJ4z4y03; Sun, 22 Jan 2023 07:37:03 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=P34F22tT; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7g0Hysz4xN1 for ; Sun, 22 Jan 2023 07:37:03 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229954AbjAUUhB (ORCPT ); Sat, 21 Jan 2023 15:37:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229961AbjAUUgs (ORCPT ); Sat, 21 Jan 2023 15:36:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17C0D2915F for ; Sat, 21 Jan 2023 12:36:44 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A0BD060B72 for ; Sat, 21 Jan 2023 20:36:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69F83C433A1 for ; Sat, 21 Jan 2023 20:36:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333403; bh=kti/DpdHfEfhMTbcC9Le45ZXZpgKFpFCpFhO0AZSpFA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=P34F22tT9UjTGKAW/2Wd7b4EtRI/q4FG55U0pPnOv/L0Soe4P+3zz0gnxJDP0sN1Q 7qiVnAc268Fa0XSdVzL8opY4/RM0Q0O4st9+UThnCTLyvFbw7/zW0TcZD0Rbwc1C6q /8Gn877NsRHZTepoa826DpJreFOOKrpdl3R4VIFp4c/NZEmYlsjKyt3Dfqhdxm7mBI ktXa+1AgJf73inqmf2/p0HzX8KWBegWDUhEQn2l+n+Y9ZZ/QarRRUSeoOy9SJwnLx2 UDmPO7Cxfjf/4ugUPkHU3Tzff+QjLugMm/8qAIQC9oF6AVoofBdGPG8rjiEuCogsU/ gqrwg6VVYV1/A== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 25/38] lib/uuid: remove conflicting Windows implementation of gettimeofday() Date: Sat, 21 Jan 2023 12:32:17 -0800 Message-Id: <20230121203230.27624-26-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers When building libuuid for Windows with MinGW with the default settings, there is a build error in lib/uuid/gen_uuid.c because the explicit definition of gettimeofday() conflicts with MinGW's declaration of gettimeofday(). gen_uuid.c apparently expects USE_MINGW to be defined to avoid that, but the build system doesn't actually do that. Since native Windows builds of e2fsprogs are currently only supported via MinGW anyway (in particular, Visual Studio is not supported), let's fix this by just removing our own definition of gettimeofday(). Signed-off-by: Eric Biggers --- lib/uuid/gen_uuid.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/lib/uuid/gen_uuid.c b/lib/uuid/gen_uuid.c index 14c98eb4a..a2225ccee 100644 --- a/lib/uuid/gen_uuid.c +++ b/lib/uuid/gen_uuid.c @@ -117,27 +117,6 @@ THREAD_LOCAL unsigned short jrand_seed[3]; #endif -#ifdef _WIN32 -#ifndef USE_MINGW -static void gettimeofday (struct timeval *tv, void *dummy) -{ - FILETIME ftime; - uint64_t n; - - GetSystemTimeAsFileTime (&ftime); - n = (((uint64_t) ftime.dwHighDateTime << 32) - + (uint64_t) ftime.dwLowDateTime); - if (n) { - n /= 10; - n -= ((369 * 365 + 89) * (uint64_t) 86400) * 1000000; - } - - tv->tv_sec = n / 1000000; - tv->tv_usec = n % 1000000; -} -#endif -#endif - static int get_random_fd(void) { struct timeval tv; From patchwork Sat Jan 21 20:32:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730065 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=AkG7qmr1; dkim-atps=neutral Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7j2H8Xz23gY for ; Sun, 22 Jan 2023 07:37:05 +1100 (AEDT) Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7j1t1Xz4y03 for ; Sun, 22 Jan 2023 07:37:05 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7j1qx3z4y06; Sun, 22 Jan 2023 07:37:05 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=AkG7qmr1; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7j1lr1z4y03 for ; Sun, 22 Jan 2023 07:37:05 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229966AbjAUUhE (ORCPT ); Sat, 21 Jan 2023 15:37:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229789AbjAUUgs (ORCPT ); Sat, 21 Jan 2023 15:36:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51BDF29162 for ; Sat, 21 Jan 2023 12:36:44 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D73C860B82 for ; Sat, 21 Jan 2023 20:36:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AA18C433AE for ; Sat, 21 Jan 2023 20:36:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333403; bh=NubxdydFKlAsKZc1R6sME1DJ73Ww+oGasw368sh41fw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=AkG7qmr1RmwGU36v2RyzrMYCS7uOoADjl47u3jhauirNJHQfh61EPqxoU+6+v37Lj tcatyzmqB6ItsBaxP/xWLHO0W4eG/+raEfce96xhGqiNxo5iTc4PwnFfSLz3STRpoG tXii4GHeoaXZ6+upX9KuX5i1RA/eCHcC9w7rZb6m/6/3HOVarIqQtkn2/e9VO2wbMR gLMG10LAGzFoJI+OlWtMp5yOuoWkRLVil+fi/NAkqe/QuwffPJclVZ45683uZKT7ro 5rWotzLSS14uPtQDDODJq7eYP/FH7Hw4nwz2Lw4M3CPZfoJtXotOb/AH2jf5iP/4F7 ALS9SZ9r3aRRQ== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 26/38] e2fsck: use real functions for kernel slab functions Date: Sat, 21 Jan 2023 12:32:18 -0800 Message-Id: <20230121203230.27624-27-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers The macros that e2fsck uses to implement kmalloc et al. use only some of their arguments, so unlike standard function calls, they can cause compiler warnings like: ./../e2fsck/revoke.c:141:8: warning: variable 'gfp_mask' set but not used [-Wunused-but-set-variable] Fix this by providing a proper definition for each function, making sure to match the function prototypes used in the kernel. Remove the kmem_cache_t typedef, as it doesn't exist in the kernel. Signed-off-by: Eric Biggers --- e2fsck/jfs_user.h | 62 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 45 insertions(+), 17 deletions(-) diff --git a/e2fsck/jfs_user.h b/e2fsck/jfs_user.h index 969cd1b92..1167c80d3 100644 --- a/e2fsck/jfs_user.h +++ b/e2fsck/jfs_user.h @@ -82,16 +82,9 @@ struct kdev_s { #define buffer_req(bh) 1 #define do_readahead(journal, start) do {} while (0) -typedef struct kmem_cache { - int object_length; -} kmem_cache_t; - -#define kmem_cache_alloc(cache, flags) malloc((cache)->object_length) -#define kmem_cache_free(cache, obj) free(obj) -#define kmem_cache_create(name, len, a, b, c) do_cache_create(len) -#define kmem_cache_destroy(cache) do_cache_destroy(cache) -#define kmalloc(len, flags) malloc(len) -#define kfree(p) free(p) +struct kmem_cache { + unsigned int object_size; +}; #define cond_resched() do { } while (0) @@ -107,8 +100,16 @@ typedef struct kmem_cache { * functions. */ #ifdef NO_INLINE_FUNCS -extern kmem_cache_t *do_cache_create(int len); -extern void do_cache_destroy(kmem_cache_t *cache); +extern struct kmem_cache *kmem_cache_create(const char *name, + unsigned int size, + unsigned int align, + unsigned int flags, + void (*ctor)(void *)); +extern void kmem_cache_destroy(struct kmem_cache *s); +extern void *kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags); +extern void kmem_cache_free(struct kmem_cache *s, void *objp); +extern void *kmalloc(size_t size, gfp_t flags); +extern void kfree(const void *objp); extern size_t journal_tag_bytes(journal_t *journal); extern __u32 __hash_32(__u32 val); extern __u32 hash_32(__u32 val, unsigned int bits); @@ -139,19 +140,46 @@ extern void jbd2_descriptor_block_csum_set(journal_t *j, #endif /* __STDC_VERSION__ >= 199901L */ #endif /* E2FSCK_INCLUDE_INLINE_FUNCS */ -_INLINE_ kmem_cache_t *do_cache_create(int len) +_INLINE_ struct kmem_cache * +kmem_cache_create(const char *name EXT2FS_ATTR((unused)), + unsigned int size, + unsigned int align EXT2FS_ATTR((unused)), + unsigned int flags EXT2FS_ATTR((unused)), + void (*ctor)(void *) EXT2FS_ATTR((unused))) { - kmem_cache_t *new_cache; + struct kmem_cache *new_cache; new_cache = malloc(sizeof(*new_cache)); if (new_cache) - new_cache->object_length = len; + new_cache->object_size = size; return new_cache; } -_INLINE_ void do_cache_destroy(kmem_cache_t *cache) +_INLINE_ void kmem_cache_destroy(struct kmem_cache *s) +{ + free(s); +} + +_INLINE_ void *kmem_cache_alloc(struct kmem_cache *cachep, + gfp_t flags EXT2FS_ATTR((unused))) +{ + return malloc(cachep->object_size); +} + +_INLINE_ void kmem_cache_free(struct kmem_cache *s EXT2FS_ATTR((unused)), + void *objp) +{ + free(objp); +} + +_INLINE_ void *kmalloc(size_t size, gfp_t flags EXT2FS_ATTR((unused))) +{ + return malloc(size); +} + +_INLINE_ void kfree(const void *objp) { - free(cache); + free((void *)objp); } /* generic hashing taken from the Linux kernel */ From patchwork Sat Jan 21 20:32:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730066 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=150.107.74.76; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=mcP8bPJ3; dkim-atps=neutral Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7j5GQmz23hM for ; Sun, 22 Jan 2023 07:37:05 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7j4sCNz4y03 for ; Sun, 22 Jan 2023 07:37:05 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7j4pskz4y06; Sun, 22 Jan 2023 07:37:05 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=mcP8bPJ3; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7j4lTcz4y03 for ; Sun, 22 Jan 2023 07:37:05 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229825AbjAUUhF (ORCPT ); Sat, 21 Jan 2023 15:37:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229984AbjAUUgt (ORCPT ); Sat, 21 Jan 2023 15:36:49 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE93C29169 for ; Sat, 21 Jan 2023 12:36:44 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 11CDB60B81 for ; Sat, 21 Jan 2023 20:36:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CEDF6C433A8 for ; Sat, 21 Jan 2023 20:36:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333403; bh=RnNP8QvLhZniSZKh7fzsGa9zTQXAgXo++gBVjqnTZ6w=; h=From:To:Subject:Date:In-Reply-To:References:From; b=mcP8bPJ3DHQCgFXNQmaAfRMCYoeCtsY7eQypIBh4vqaJx45NIYIKsVTprnSYL3wMb /jqZnm2y2R0aLeeTedPzCflLbbgy5aB6v1Mq9v/BqfsJ6zs2GuH5ieZ+1jrQlV3vnp yM3GV/HpkUucaGqEPJ5w3yfvn7RyJ+r3Y8g34sFeYjUrX9z2fJQ3ALjZiZWD4F9zce 5sQICO6YSttL9+WtA0IGZ3YUJy10nnfiUCo/2u1SnKSocOuUSYtRjktry4GQiE06wQ JAN8WzBO0R7aBUWZAxtYSQz3uUQosXleR6nKTs0qw+X959EuHj0Je4DV3+iSA/Sczi ACE8pTpxPy0xg== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 27/38] misc/create_inode: fix -Wunused-variable warnings in __populate_fs() Date: Sat, 21 Jan 2023 12:32:19 -0800 Message-Id: <20230121203230.27624-28-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers These showed up when building for Windows. Signed-off-by: Eric Biggers --- misc/create_inode.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/misc/create_inode.c b/misc/create_inode.c index c00d54588..7ce69c2b0 100644 --- a/misc/create_inode.c +++ b/misc/create_inode.c @@ -813,11 +813,9 @@ static errcode_t __populate_fs(ext2_filsys fs, ext2_ino_t parent_ino, const char *name; struct dirent **dent; struct stat st; - char *ln_target = NULL; unsigned int save_inode; ext2_ino_t ino; errcode_t retval = 0; - int read_cnt; int hdlink; size_t cur_dir_path_len; int i, num_dents; @@ -900,7 +898,10 @@ static errcode_t __populate_fs(ext2_filsys fs, ext2_ino_t parent_ino, goto out; } break; - case S_IFLNK: + case S_IFLNK: { + char *ln_target; + int read_cnt; + ln_target = malloc(st.st_size + 1); if (ln_target == NULL) { com_err(__func__, retval, @@ -935,7 +936,8 @@ static errcode_t __populate_fs(ext2_filsys fs, ext2_ino_t parent_ino, goto out; } break; -#endif + } +#endif /* !_WIN32 */ case S_IFREG: retval = do_write_internal(fs, parent_ino, name, name, root); From patchwork Sat Jan 21 20:32:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730067 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=DQo9lfAP; dkim-atps=neutral Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7n4Zlcz23gY for ; Sun, 22 Jan 2023 07:37:09 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7n47z2z4y03 for ; Sun, 22 Jan 2023 07:37:09 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7n45Bvz4y06; Sun, 22 Jan 2023 07:37:09 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=DQo9lfAP; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7n415mz4y03 for ; Sun, 22 Jan 2023 07:37:09 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230063AbjAUUhI (ORCPT ); Sat, 21 Jan 2023 15:37:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229985AbjAUUgt (ORCPT ); Sat, 21 Jan 2023 15:36:49 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 647A929164 for ; Sat, 21 Jan 2023 12:36:44 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 453F060B6A for ; Sat, 21 Jan 2023 20:36:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B469C433A7 for ; Sat, 21 Jan 2023 20:36:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333404; bh=k/zPJBS29Jxqgu03dWEGg+K+owm+W0mnZF+A3RqTr1w=; h=From:To:Subject:Date:In-Reply-To:References:From; b=DQo9lfAPKDj4fJnTkGP6VMNJwsmsJHVbGD2bu3T4YJfcEZIJ+Vj/XymJuoD3+waPq T6lkDmKfzf63vxJPQnC5i0utBzhXA1Qqv2eYFZp2eyTuE+G+67OEh/brhMnmXid1f3 rFDKaMKeIJHQ5+1r+bZHbPJs1h9ZlSaPJ4+OfSmuLtzF5vXDIpCTlP7sA9Yv94/STu Ra/6oOSzjiE2+BCaHa5WLbcv3s6yfAekorO2bwQ+lsSO/3IKgeKtdon3KJbKbl6hu+ 3/wVUhy+WbhZfwfQts4axGlVtm128bKT5dwW9BFE6jMIJAUSxzxkq5Cz5T9SGW0iSF eA9aOHti9qFFw== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 28/38] misc/create_inode: simplify logic in scandir() Date: Sat, 21 Jan 2023 12:32:20 -0800 Message-Id: <20230121203230.27624-29-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers The control flow in scandir() (only used on Windows) confuses gcc into thinking that *name_list is not always set on success, which causes a -Wmaybe-uninitialized warning in __populate_fs(). As far as I can tell it's a false positive; however, avoid it by cleanly separating the success and failure cases in scandir(). Signed-off-by: Eric Biggers --- misc/create_inode.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/misc/create_inode.c b/misc/create_inode.c index 7ce69c2b0..6e61d98e6 100644 --- a/misc/create_inode.c +++ b/misc/create_inode.c @@ -763,39 +763,33 @@ static int scandir(const char *dir_name, struct dirent ***name_list, size_t new_list_size = temp_list_size + 32; struct dirent **new_list = (struct dirent**)realloc( temp_list, new_list_size * sizeof(struct dirent*)); - if (new_list == NULL) { - goto out; - } + if (new_list == NULL) + goto out_err; temp_list_size = new_list_size; temp_list = new_list; } // add the copy of dirent to the list temp_list[num_dent] = (struct dirent*)malloc((dent->d_reclen + 3) & ~3); if (!temp_list[num_dent]) - goto out; + goto out_err; memcpy(temp_list[num_dent], dent, dent->d_reclen); num_dent++; } + closedir(dir); if (compar != NULL) { qsort(temp_list, num_dent, sizeof(struct dirent*), (int (*)(const void*, const void*))compar); } - - // release the temp list *name_list = temp_list; - temp_list = NULL; + return num_dent; -out: - if (temp_list != NULL) { - while (num_dent > 0) { - free(temp_list[--num_dent]); - } - free(temp_list); - num_dent = -1; - } +out_err: closedir(dir); - return num_dent; + while (num_dent > 0) + free(temp_list[--num_dent]); + free(temp_list); + return -1; } static int alphasort(const struct dirent **a, const struct dirent **b) { From patchwork Sat Jan 21 20:32:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730068 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=150.107.74.76; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=RN0PH/lP; dkim-atps=neutral Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7p3sB2z23gY for ; Sun, 22 Jan 2023 07:37:10 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7p3NDBz4xN1 for ; Sun, 22 Jan 2023 07:37:10 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7p3KJMz4y03; Sun, 22 Jan 2023 07:37:10 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=RN0PH/lP; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7p3Fdqz4xN1 for ; Sun, 22 Jan 2023 07:37:10 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230083AbjAUUhJ (ORCPT ); Sat, 21 Jan 2023 15:37:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229989AbjAUUgt (ORCPT ); Sat, 21 Jan 2023 15:36:49 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEB252916C for ; Sat, 21 Jan 2023 12:36:44 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 73B4160B76 for ; Sat, 21 Jan 2023 20:36:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C25DC4339C for ; Sat, 21 Jan 2023 20:36:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333404; bh=IF0tzK9qzRjNcfSVZjyoBUt3GW1r1KZLNwT9shnLSiw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=RN0PH/lPg6F1oUwkbqvwSa2X2ZeXvzvTJeWqmKoWTl+iVPDqxCf3xjD2sfzJMBd37 9TVE4z4BNCFYqRKrPRu6Ekyxi+mL46rr+tsdoFHQxyoJ2dcUseArpzuyQH8i4bURD7 8Eg5W63g1E6xLzfsZCMlAToSV7ozC989NRPlezL7qLeRnZcdge54Tlt+2OX1aRSAOQ Pu/Ku1cMzjqZLy9kJ40tRPfZl6TZJjV9HQQMcccDvs7hLsTaaLXh8vs3RwBDuVc3yP hRjZKa4aiJZOfN89czSi/hVEJtEYI05B1sSzswB/gxeszA/X6Jd0U62XiAsPRbd33L HwXUtbVQiXUIg== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 29/38] misc/e4defrag: fix -Wstringop-truncation warnings Date: Sat, 21 Jan 2023 12:32:21 -0800 Message-Id: <20230121203230.27624-30-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers Fix two -Wstringop-truncation warnings in is_ext4() by simplifying how how mnt_type is handled and by using the correct bound for mnt_fsname. Fix a -Wstringop-truncation warning in main() by replacing the fragile pattern 'strncpy(dst, src, strnlen(src, N))', which doesn't null-terminate the destination string, with a standard string copy. (It happened to work anyway because dst happens to be zero-initialized.) These warnings showed up when building with -Wall with gcc 8 or later. Signed-off-by: Eric Biggers --- misc/e4defrag.c | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/misc/e4defrag.c b/misc/e4defrag.c index 9ec265f2e..33bd05d2c 100644 --- a/misc/e4defrag.c +++ b/misc/e4defrag.c @@ -258,12 +258,12 @@ static int get_mount_point(const char *devname, char *mount_point, * * @file: the file's name. */ -static int is_ext4(const char *file, char *devname) +static int is_ext4(const char *file, char devname[PATH_MAX + 1]) { int maxlen = 0; int len, ret; + int type_is_ext4 = 0; FILE *fp = NULL; - char *mnt_type = NULL; /* Refer to /etc/mtab */ const char *mtab = MOUNTED; char file_path[PATH_MAX + 1]; @@ -307,26 +307,16 @@ static int is_ext4(const char *file, char *devname) maxlen = len; - mnt_type = realloc(mnt_type, strlen(mnt->mnt_type) + 1); - if (mnt_type == NULL) { - endmntent(fp); - return -1; - } - memset(mnt_type, 0, strlen(mnt->mnt_type) + 1); - strncpy(mnt_type, mnt->mnt_type, strlen(mnt->mnt_type)); + type_is_ext4 = !strcmp(mnt->mnt_type, FS_EXT4); strncpy(lost_found_dir, mnt->mnt_dir, PATH_MAX); - strncpy(devname, mnt->mnt_fsname, strlen(mnt->mnt_fsname) + 1); + strncpy(devname, mnt->mnt_fsname, PATH_MAX); } endmntent(fp); - if (mnt_type && strcmp(mnt_type, FS_EXT4) == 0) { - FREE(mnt_type); + if (type_is_ext4) return 0; - } else { - FREE(mnt_type); - PRINT_ERR_MSG(NGMSG_EXT4); - return -1; - } + PRINT_ERR_MSG(NGMSG_EXT4); + return -1; } /* @@ -1865,11 +1855,9 @@ int main(int argc, char *argv[]) /* fall through */ case DEVNAME: if (arg_type == DEVNAME) { - strncpy(lost_found_dir, dir_name, - strnlen(dir_name, PATH_MAX)); + strcpy(lost_found_dir, dir_name); strncat(lost_found_dir, "/lost+found/", - PATH_MAX - strnlen(lost_found_dir, - PATH_MAX)); + PATH_MAX - strlen(lost_found_dir)); } nftw64(dir_name, calc_entry_counts, FTW_OPEN_FD, flags); From patchwork Sat Jan 21 20:32:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730074 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=150.107.74.76; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=QKTyeFqK; dkim-atps=neutral Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7x51sbz23gY for ; Sun, 22 Jan 2023 07:37:17 +1100 (AEDT) Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7x4bJBz4xN1 for ; Sun, 22 Jan 2023 07:37:17 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7x4Xrtz4y03; Sun, 22 Jan 2023 07:37:17 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=QKTyeFqK; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7x4RXmz4xN1 for ; Sun, 22 Jan 2023 07:37:17 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229895AbjAUUhP (ORCPT ); Sat, 21 Jan 2023 15:37:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230006AbjAUUgt (ORCPT ); Sat, 21 Jan 2023 15:36:49 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14A9329176 for ; Sat, 21 Jan 2023 12:36:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A43AA60B92 for ; Sat, 21 Jan 2023 20:36:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CAE9C433EF for ; Sat, 21 Jan 2023 20:36:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333404; bh=VEkoFq9DgQ/t9PgvjnI05sXJeWdbDnvI1z7dx9j6ORI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=QKTyeFqKJTgVz/2ybdDJkBkseGND2s+vADrnwlaxeOWHgPD9nSHGVJO8xCllOakid YhIiPDI2wi5RMCI5N7tC9tfXiLHoj4Io34/bjy+1dxGHWhBxyTPVGFaUl/H0N7SwDi KLjWD5begeqGBXpWj4AqBsgrU0+vd87JPiGHb/LpNNhbasTWT2fTVWHHzEB21ifqP2 yErNCS8ZltB/OnPZk0fY8Y92q5Kp/cF0P6PpG7nUI8uXq4uY7UIh8qKpXSGytaaU58 nSYP5Ce9QpkkV9MQAnY4Cm1Kp1ph1PM9FVnJddp3FJy1XcWdKHCe8SL2vvM+BzBMNQ B5J+is2gez01g== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 30/38] misc/fuse2fs: avoid error-prone strncpy() pattern Date: Sat, 21 Jan 2023 12:32:22 -0800 Message-Id: <20230121203230.27624-31-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers 'strncpy(dst, src, strlen(src))' is usually wrong, as it doesn't copy the null terminator. For this reason, it causes a -Wstringop-truncation warning with gcc 8 and later. The code happens to be correct anyway, since the destination buffer is zero-initialized. But to avoid relying on this, let's just copy the terminating null. Signed-off-by: Eric Biggers --- misc/fuse2fs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c index c59572129..6d4bcf4fd 100644 --- a/misc/fuse2fs.c +++ b/misc/fuse2fs.c @@ -2508,9 +2508,10 @@ static int copy_names(char *name, char *value EXT2FS_ATTR((unused)), size_t value_len EXT2FS_ATTR((unused)), void *data) { char **b = data; + size_t name_len = strlen(name); - strncpy(*b, name, strlen(name)); - *b = *b + strlen(name) + 1; + memcpy(*b, name, name_len + 1); + *b = *b + name_len + 1; return 0; } From patchwork Sat Jan 21 20:32:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730072 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=SElDR4tz; dkim-atps=neutral Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7t6PC8z23gY for ; Sun, 22 Jan 2023 07:37:14 +1100 (AEDT) Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7t5xM7z4xN1 for ; Sun, 22 Jan 2023 07:37:14 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7t5tFRz4y03; Sun, 22 Jan 2023 07:37:14 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=SElDR4tz; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7t5npFz4xN1 for ; Sun, 22 Jan 2023 07:37:14 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229999AbjAUUhN (ORCPT ); Sat, 21 Jan 2023 15:37:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230007AbjAUUgt (ORCPT ); Sat, 21 Jan 2023 15:36:49 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63DB529159 for ; Sat, 21 Jan 2023 12:36:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4539A60B6C for ; Sat, 21 Jan 2023 20:36:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D56DC433A0 for ; Sat, 21 Jan 2023 20:36:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333404; bh=8LlzNr1p4aIHut3osN9IQPBEXbEaaKXew3NWPyMdKLE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=SElDR4tz/GFSd+m+EflkfxpIPk813f0fLyp7PmUaFCtmgR7G7fIKfJYflQuaLgpYY iooUWnjboewpUnWrSjD7xLoeVYfMHOPLjLEu5+aX1lvU6IjOxgWtW0E76W9TNHeTHD ObpH4CJV+j25RORMeMqJS7XD10J9jwmT8UUdsmzsr2TlVrz2gxKL8o71UugEqMWsqQ ieVYmV9ME6hFytcYHKlzHnzrH4MQZJJLQZ4cDXEFBt8i1mE6pv5UdwE5CE781Z48iM GDtRw4bGyHl1Eupa61Ofb2hIMsrExe4DJDtbB5gL72UZuBrqY6MFs0q0aSFU86Vbyp TREQmo+8nXtpw== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 31/38] misc/mk_hugefiles: simplify get_partition_start() Date: Sat, 21 Jan 2023 12:32:23 -0800 Message-Id: <20230121203230.27624-32-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers search_sysfs_block() is causing -Wformat-truncation warnings. These could be fixed by checking the return value of snprintf(), instead of doing buggy checks like 'strlen(p_de->d_name) > SYSFS_PATH_LEN - strlen(path) - 32', which has an integer underflow bug. However, the only purpose of search_sysfs_block() is to find the sysfs directory for a block device by device number. That can trivially be done using /sys/dev/block/$major:$minor. So just do that instead. Also make get_partition_start() explicitly Linux-only, as it has never worked anywhere else. Signed-off-by: Eric Biggers --- include/mingw/sys/sysmacros.h | 8 +- misc/mk_hugefiles.c | 134 +++------------------------------- 2 files changed, 10 insertions(+), 132 deletions(-) diff --git a/include/mingw/sys/sysmacros.h b/include/mingw/sys/sysmacros.h index 18fcaaa34..a790cb2f6 100644 --- a/include/mingw/sys/sysmacros.h +++ b/include/mingw/sys/sysmacros.h @@ -1,11 +1,5 @@ - #pragma once -/* - * Fall back to Linux's definitions of makedev and major are needed. - * The search_sysfs_block() function is highly unlikely to work on - * non-Linux systems anyway. - */ #ifndef makedev #define makedev(maj, min) (((maj) << 8) + (min)) -#endif \ No newline at end of file +#endif diff --git a/misc/mk_hugefiles.c b/misc/mk_hugefiles.c index 0280b41e7..3caaf1b68 100644 --- a/misc/mk_hugefiles.c +++ b/misc/mk_hugefiles.c @@ -2,13 +2,8 @@ * mk_hugefiles.c -- create huge files */ -#define _XOPEN_SOURCE 600 /* for inclusion of PATH_MAX in Solaris */ -#define _BSD_SOURCE /* for makedev() and major() */ -#define _DEFAULT_SOURCE /* since glibc 2.20 _BSD_SOURCE is deprecated */ - #include "config.h" #include -#include #include #include #include @@ -68,141 +63,30 @@ static char *fn_buf; static char *fn_numbuf; int zero_hugefile = 1; -#define SYSFS_PATH_LEN 300 -typedef char sysfs_path_t[SYSFS_PATH_LEN]; - -#ifndef HAVE_SNPRINTF -/* - * We are very careful to avoid needing to worry about buffer - * overflows, so we don't really need to use snprintf() except as an - * additional safety check. So if snprintf() is not present, it's - * safe to fall back to vsprintf(). This provides portability since - * vsprintf() is guaranteed by C89, while snprintf() is only - * guaranteed by C99 --- which for example, Microsoft Visual Studio - * has *still* not bothered to implement. :-/ (Not that I expect - * mke2fs to be ported to MS Visual Studio any time soon, but - * libext2fs *does* get built on Microsoft platforms, and we might - * want to move this into libext2fs some day.) - */ -static int my_snprintf(char *str, size_t size, const char *format, ...) -{ - va_list ap; - int ret; - - va_start(ap, format); - ret = vsprintf(str, format, ap); - va_end(ap); - return ret; -} - -#define snprintf my_snprintf -#endif - -/* - * Fall back to Linux's definitions of makedev and major are needed. - * The search_sysfs_block() function is highly unlikely to work on - * non-Linux systems anyway. - */ -#ifndef makedev -#define makedev(maj, min) (((maj) << 8) + (min)) -#endif - -static char *search_sysfs_block(dev_t devno, sysfs_path_t ret_path) -{ - struct dirent *de, *p_de; - DIR *dir = NULL, *p_dir = NULL; - FILE *f; - sysfs_path_t path, p_path; - unsigned int major, minor; - char *ret = ret_path; - - ret_path[0] = 0; - if ((dir = opendir("/sys/block")) == NULL) - return NULL; - while ((de = readdir(dir)) != NULL) { - if (!strcmp(de->d_name, ".") || !strcmp(de->d_name, "..") || - strlen(de->d_name) > sizeof(path)-32) - continue; - snprintf(path, SYSFS_PATH_LEN, - "/sys/block/%s/dev", de->d_name); - f = fopen(path, "r"); - if (f && - (fscanf(f, "%u:%u", &major, &minor) == 2)) { - fclose(f); f = NULL; - if (makedev(major, minor) == devno) { - snprintf(ret_path, SYSFS_PATH_LEN, - "/sys/block/%s", de->d_name); - goto success; - } -#ifdef major - if (major(devno) != major) - continue; -#endif - } - if (f) - fclose(f); - - snprintf(path, SYSFS_PATH_LEN, "/sys/block/%s", de->d_name); - - if (p_dir) - closedir(p_dir); - if ((p_dir = opendir(path)) == NULL) - continue; - while ((p_de = readdir(p_dir)) != NULL) { - if (!strcmp(p_de->d_name, ".") || - !strcmp(p_de->d_name, "..") || - (strlen(p_de->d_name) > - SYSFS_PATH_LEN - strlen(path) - 32)) - continue; - snprintf(p_path, SYSFS_PATH_LEN, "%s/%s/dev", - path, p_de->d_name); - - f = fopen(p_path, "r"); - if (f && - (fscanf(f, "%u:%u", &major, &minor) == 2) && - (((major << 8) + minor) == devno)) { - fclose(f); - snprintf(ret_path, SYSFS_PATH_LEN, "%s/%s", - path, p_de->d_name); - goto success; - } - if (f) - fclose(f); - } - } - ret = NULL; -success: - if (dir) - closedir(dir); - if (p_dir) - closedir(p_dir); - return ret; -} - -static blk64_t get_partition_start(const char *device_name) +static blk64_t +get_partition_start(const char *device_name EXT2FS_ATTR((unused))) { +#ifdef __linux__ unsigned long long start; - sysfs_path_t path; + char path[128]; struct stat st; FILE *f; - char *cp; int n; if ((stat(device_name, &st) < 0) || !S_ISBLK(st.st_mode)) return 0; - cp = search_sysfs_block(st.st_rdev, path); - if (!cp) - return 0; - if (strlen(path) > SYSFS_PATH_LEN - sizeof("/start")) - return 0; - strcat(path, "/start"); + sprintf(path, "/sys/dev/block/%d:%d/start", + major(st.st_rdev), minor(st.st_rdev)); f = fopen(path, "r"); if (!f) return 0; n = fscanf(f, "%llu", &start); fclose(f); return (n == 1) ? start : 0; +#else + return 0; +#endif } static errcode_t create_directory(ext2_filsys fs, char *dir, From patchwork Sat Jan 21 20:32:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730069 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=VbYgZSBh; dkim-atps=neutral Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7q4pcLz23gY for ; Sun, 22 Jan 2023 07:37:11 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7q4KVsz4xN1 for ; Sun, 22 Jan 2023 07:37:11 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7q4HGFz4y03; Sun, 22 Jan 2023 07:37:11 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=VbYgZSBh; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7q4CXYz4xN1 for ; Sun, 22 Jan 2023 07:37:11 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230084AbjAUUhK (ORCPT ); Sat, 21 Jan 2023 15:37:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230002AbjAUUgt (ORCPT ); Sat, 21 Jan 2023 15:36:49 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B5162917E for ; Sat, 21 Jan 2023 12:36:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7CBA360B6E for ; Sat, 21 Jan 2023 20:36:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE9DFC4339C; Sat, 21 Jan 2023 20:36:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333404; bh=omOEh/OU/autDrsEmmKxzE47wZxPhhPXi4Sar7ryPus=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VbYgZSBhwIEW8/lslE2qXsqF/04GnDQzSBm6AI1SGVyrynhXdB6JN7cOfMKc5z6C1 FAB/a2XC+QVxjh9fr/kjXaN8ddqRZOGjVrEVLR8F6cWejuOi3UbgZm4uxPXy0IpKFM RnHPRpOCdyqlp5v4tCzqbYSGwUVzviko7Gr3nRBiL6VxKRHL/4MJzViPelaHXzfVxo tmLa3En1iGg64j5rfmzQY2YPUzWXSa9GZmtIyWHPNaIPJCOkGY4AJpkyjSEuq2NbPi QFCuhXVBH2QKoBEoT08Ksmot8lgcGXiJsdQWoKwWXwFNo5UQScA4Sp8arUnkqJJCkX XlSxm/ZNoBQzg== From: Eric Biggers To: linux-ext4@vger.kernel.org Cc: Paulo Antonio Alvarez Subject: [PATCH 32/38] misc/mke2fs: fix Windows build Date: Sat, 21 Jan 2023 12:32:24 -0800 Message-Id: <20230121203230.27624-33-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers 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 --- 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 8fe5b3235..679184e39 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 349aa2c4f..65a6b2e14 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 bde1e582e..24cc14750 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -1950,10 +1950,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); @@ -2736,7 +2736,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) || @@ -3041,10 +3041,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); @@ -3449,7 +3449,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"), From patchwork Sat Jan 21 20:32:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730076 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=aZOCkfwB; dkim-atps=neutral Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7z3dHfz23gY for ; Sun, 22 Jan 2023 07:37:19 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7z39twz4xN1 for ; Sun, 22 Jan 2023 07:37:19 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7z37Fnz4y03; Sun, 22 Jan 2023 07:37:19 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=aZOCkfwB; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7z32zYz4xN1 for ; Sun, 22 Jan 2023 07:37:19 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230086AbjAUUhS (ORCPT ); Sat, 21 Jan 2023 15:37:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230011AbjAUUgt (ORCPT ); Sat, 21 Jan 2023 15:36:49 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD9D829403 for ; Sat, 21 Jan 2023 12:36:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B218760B07 for ; Sat, 21 Jan 2023 20:36:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 129D5C433EF for ; Sat, 21 Jan 2023 20:36:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333405; bh=BHlFdsm+U4LzKUPj9OwfoZOYeQ7WU/+UY8dOM0bSebE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=aZOCkfwBZxehZlEDlb0iP79onRFrHkhJO8rA+SSkNh+8e2UbKGRSg5oiD83Sd/3Zs XYDnQBRNBk34f6icbcWNOr9vPD2QGvBWANZqtjILTFPokkE2X9ABZ1al5eGOYp0Xvi EajX28hjAqSHPBCBrxmrDJD52aanPO/mEyh+r7iuGIGYTuNUph6qr/yoEsqdNiuDsH 0HXmywRF04JUzfLMQM4LaKGAvFdAe23+8332s/kvrEs0zHZPd6p3Pp5j1O/gMfLrJR 5oJyo49sArVBZa8S5Quthosz27TyH2pUMaAjc96Dhr+SjzJAqGQMMO4b5jcECdxgfo X5BLtQE/Go0MQ== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 33/38] misc/mke2fs: fix a -Wunused-variable warning in PRS() Date: Sat, 21 Jan 2023 12:32:25 -0800 Message-Id: <20230121203230.27624-34-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers This showed up when building for Windows. Signed-off-by: Eric Biggers --- misc/mke2fs.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 24cc14750..7028d3935 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -1598,7 +1598,6 @@ static void PRS(int argc, char *argv[]) * Finally, we complain about fs_blocks_count > 2^32 on a non-64bit fs. */ blk64_t fs_blocks_count = 0; - long sysval; int s_opt = -1, r_opt = -1; char *fs_features = 0; int fs_features_size = 0; @@ -1632,9 +1631,12 @@ static void PRS(int argc, char *argv[]) #define _SC_PAGESIZE _SC_PAGE_SIZE #endif #ifdef _SC_PAGESIZE - sysval = sysconf(_SC_PAGESIZE); - if (sysval > 0) - sys_page_size = sysval; + { + long sysval = sysconf(_SC_PAGESIZE); + + if (sysval > 0) + sys_page_size = sysval; + } #endif /* _SC_PAGESIZE */ #endif /* HAVE_SYSCONF */ From patchwork Sat Jan 21 20:32:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730075 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=BHs72LE4; dkim-atps=neutral Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7y2zCVz23gY for ; Sun, 22 Jan 2023 07:37:18 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7y2Xhvz4xN1 for ; Sun, 22 Jan 2023 07:37:18 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7y2VbBz4y03; Sun, 22 Jan 2023 07:37:18 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=BHs72LE4; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7y2PtNz4xN1 for ; Sun, 22 Jan 2023 07:37:18 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230007AbjAUUhR (ORCPT ); Sat, 21 Jan 2023 15:37:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230008AbjAUUgt (ORCPT ); Sat, 21 Jan 2023 15:36:49 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD80B29400 for ; Sat, 21 Jan 2023 12:36:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8873D60B6F for ; Sat, 21 Jan 2023 20:36:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43D36C433A1; Sat, 21 Jan 2023 20:36:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333405; bh=SBCJzKRGKr2mo1lvVTXZL+ohtZ1777FKKIEY4Px0uhE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BHs72LE4o1ibFawv7A/FhoCcxlwJ1R3iEZTIsZZdjVUX/ZTTFjIq6W3xNHyqiqmp0 n8WkiOtqi+pNVNpGI20MhmwFIQmTv8g6nvf4K6yM6HUnUZl+wAnFZ0pCCzsHGqAaVq SwLwmWEBS4gGQPEg5c5ynmrMpDw/5+9R9qoT4emukMHfjthqw0SBxOXH/r5kmq6ec2 tOAqpUlQflwkcgqJyoat3iim5Tgy4uuEnTtYNc7LQnL9iJiJmxWLOt8atGpymiQ+o/ VITT1Ztj0uhpoeKWGojEO8gRiRO3XWorx+H9ruQ73+df1ccOhUXNFUKgglY2M1BDlC 1ER8YhRRDI8OA== From: Eric Biggers To: linux-ext4@vger.kernel.org Cc: Jeremy Bongio , Lukas Czerner Subject: [PATCH 34/38] misc/tune2fs: fix setting fsuuid::fsu_len Date: Sat, 21 Jan 2023 12:32:26 -0800 Message-Id: <20230121203230.27624-35-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers Minus does not mean equals. Besides fixing an obvious bug, this avoids the following compiler warning with clang -Wall: tune2fs.c:3625:20: warning: expression result unused [-Wunused-value] fsuuid->fsu_len - UUID_SIZE; ~~~~~~~~~~~~~~~ ^ ~~~~~~~~~ Fixes: a83e199da0ca ("tune2fs: Add support for get/set UUID ioctls.") Reviewed-by: Jeremy Bongio Reviewed-by: Lukas Czerner Signed-off-by: Eric Biggers --- misc/tune2fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/tune2fs.c b/misc/tune2fs.c index 088f87e53..7937b8b56 100644 --- a/misc/tune2fs.c +++ b/misc/tune2fs.c @@ -3622,7 +3622,7 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n" ret = -1; #ifdef __linux__ if (fsuuid) { - fsuuid->fsu_len - UUID_SIZE; + fsuuid->fsu_len = UUID_SIZE; fsuuid->fsu_flags = 0; memcpy(&fsuuid->fsu_uuid, new_uuid, UUID_SIZE); ret = ioctl(fd, EXT4_IOC_SETFSUUID, fsuuid); From patchwork Sat Jan 21 20:32:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730073 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=KYR8tvYE; dkim-atps=neutral Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp7v3nhPz23gY for ; Sun, 22 Jan 2023 07:37:15 +1100 (AEDT) Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7v3KYNz4xN1 for ; Sun, 22 Jan 2023 07:37:15 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp7v3GZJz4y03; Sun, 22 Jan 2023 07:37:15 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=KYR8tvYE; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp7v2rJhz4xN1 for ; Sun, 22 Jan 2023 07:37:15 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229879AbjAUUhO (ORCPT ); Sat, 21 Jan 2023 15:37:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230010AbjAUUgt (ORCPT ); Sat, 21 Jan 2023 15:36:49 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDAF629404 for ; Sat, 21 Jan 2023 12:36:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BBF0960B7A for ; Sat, 21 Jan 2023 20:36:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 820D4C433A0 for ; Sat, 21 Jan 2023 20:36:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333405; bh=oQmgzUdIgg73PPkYMSSJW+stji+THJwg5Hc1tvFGtRQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=KYR8tvYEsRdC/Z+h3m5wsozooMCuJ+GmPQbOoSO1xR3OmvI9qEheLI7iq+EmoAQyH 8zPTR0E8RZ+eOGG7HsjxkOtYIYg1jVaTmKBNraOezWXmfN+jqwt1To8yZa46evlviq Vr+7jQWLy3vzNy6w7wyTiirp49DNYEgQBQdO63B2dHOr5UFnbrbPiRwIoGSjqubpEN dvyZtpHbQaIBIBx8y//TeogBIG05/vSqFQhP1DFgUYCJp8QdloacBopjhNAC/9TNRG tWFKAP2m7gfRIFrxGERTZcetSfHV1Dfm8kB+QKfDf5XxsLPhknhoi21WPjGa+qF7h6 ND3PbYIyugBzw== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 35/38] misc/tune2fs: fix -Wunused-variable warnings in handle_fslabel() Date: Sat, 21 Jan 2023 12:32:27 -0800 Message-Id: <20230121203230.27624-36-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers These warnings show up in non-Linux builds. To fix them, only declare local variables when they are needed. While we're here, also make handle_fslabel() static. Signed-off-by: Eric Biggers --- misc/tune2fs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/misc/tune2fs.c b/misc/tune2fs.c index 7937b8b56..d3258149e 100644 --- a/misc/tune2fs.c +++ b/misc/tune2fs.c @@ -3082,14 +3082,15 @@ fs_update_journal_user(struct ext2_super_block *sb, __u8 old_uuid[UUID_SIZE]) * 1 on error * -1 when the old method should be used */ -int handle_fslabel(int setlabel) { +static int handle_fslabel(int setlabel) +{ +#ifdef __linux__ errcode_t ret; int mnt_flags, fd; char label[FSLABEL_MAX]; int maxlen = FSLABEL_MAX - 1; char mntpt[PATH_MAX + 1]; -#ifdef __linux__ ret = ext2fs_check_mount_point(device_name, &mnt_flags, mntpt, sizeof(mntpt)); if (ret) { From patchwork Sat Jan 21 20:32:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730077 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=150.107.74.76; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=DgIWQhX0; dkim-atps=neutral Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp80515fz23gY for ; Sun, 22 Jan 2023 07:37:20 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp804bbgz4xN1 for ; Sun, 22 Jan 2023 07:37:20 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp804YDbz4y03; Sun, 22 Jan 2023 07:37:20 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=DgIWQhX0; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp804SWDz4xN1 for ; Sun, 22 Jan 2023 07:37:20 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230090AbjAUUhT (ORCPT ); Sat, 21 Jan 2023 15:37:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229853AbjAUUgt (ORCPT ); Sat, 21 Jan 2023 15:36:49 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2208F29405 for ; Sat, 21 Jan 2023 12:36:46 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E98E760ADD for ; Sat, 21 Jan 2023 20:36:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2D3EC4339C for ; Sat, 21 Jan 2023 20:36:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333405; bh=G0jzgh7IdyeVDxBwCIN9i7zDEFV94xVS5Dm7rVHXGvg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=DgIWQhX0aeqPT2Z52629tb6cjTmogpUQW4d0K7jr+2bQUKxa74nK+NdZ5rftILrWP nQ4xvUY9gmknrHLnHB1fjAXJ2ScF2FzDew4byX+wr15Fgjqyub2dNJWWHJWeDDtuj7 WTL3OKqBf8PvcLJog+v8AHGPmVP1yzuY2/t/VmVXxDBt8377x3z0mDh2gA1J9DkQtQ uGAbeG1T6hESgvMW8l/gH8IdDADhBjxSJOlVm81l3D7tXOo21fa/y5qIkMYqD3usio hyWhl2cpcoj/OwBQZ2HbQ3cHiuX8092P9oRIHfx8yY3EnQum2Y1HXrVuSP7AToBzXE r7f3QvjzU0QyA== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 36/38] misc/util.c: enable MinGW alarm() when building for Windows Date: Sat, 21 Jan 2023 12:32:28 -0800 Message-Id: <20230121203230.27624-37-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers To compile for Windows, this file needs MinGW's implementation of alarm(). To expose that definition, some macros must be defined before including the system headers. This was done in Android.bp, but it was not done in the autotools-based build system. Define these macros in the source file itself so that all build systems work. Signed-off-by: Eric Biggers --- misc/Android.bp | 2 -- misc/util.c | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/misc/Android.bp b/misc/Android.bp index 2baeac2ad..2b1620ac6 100644 --- a/misc/Android.bp +++ b/misc/Android.bp @@ -83,8 +83,6 @@ cc_binary { windows: { include_dirs: [ "external/e2fsprogs/include/mingw" ], cflags: [ - "-D_POSIX", - "-D__USE_MINGW_ALARM", // mke2fs.c has a warning from gcc which cannot be suppressed: // passing argument 3 of 'ext2fs_get_device_size' from // incompatible pointer type diff --git a/misc/util.c b/misc/util.c index e84ebab5b..3e83169f1 100644 --- a/misc/util.c +++ b/misc/util.c @@ -16,6 +16,11 @@ #define _LARGEFILE64_SOURCE #endif +#ifdef _WIN32 +#define _POSIX +#define __USE_MINGW_ALARM +#endif + #include "config.h" #include #include From patchwork Sat Jan 21 20:32:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730079 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=rBo37R+t; dkim-atps=neutral Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp8D0V0Wz23gY for ; Sun, 22 Jan 2023 07:37:32 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp8D048vz4xN1 for ; Sun, 22 Jan 2023 07:37:32 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp8D01mhz4y03; Sun, 22 Jan 2023 07:37:32 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=rBo37R+t; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp8C72wsz4xN1 for ; Sun, 22 Jan 2023 07:37:31 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229883AbjAUUhb (ORCPT ); Sat, 21 Jan 2023 15:37:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230022AbjAUUgx (ORCPT ); Sat, 21 Jan 2023 15:36:53 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8F2829409 for ; Sat, 21 Jan 2023 12:36:46 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8AE5E60B6C for ; Sat, 21 Jan 2023 20:36:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3D27C4339B; Sat, 21 Jan 2023 20:36:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333406; bh=AnN2GfP9pe+y/8eQBQy8xcWtCw/5pKPMCwPQ4aCKKko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rBo37R+tumOJ7TCJmhI8k+XiLQ8zXEK0xWskVtMJroc9vog+RuAzMCwGVU71Unn9i mHarNFBjd18SLi5KiV1FB39izahaMLFFZ538FPK9yVYTmeZ5E5uJvx9jtE/oIF1BI3 lH4cl7tv0gdPdCQPVSmnUAHO8alIhpkpLFhkk98Iil1v/iTc/r2ewwJmNorgnY4cq7 6nhH+sZzUryU32lIQHXav+OpCq30zJevYzb8dJVfqXBZSGbm4QwB7/0VND9TEz3XNC fCfuPs4d6LrHBEDQGBXTbD80bs7O6Ke+Qa8COIGEB+7G4AM+XByq3qbHvTO19NWMvy znULM0wUNzF/A== From: Eric Biggers To: linux-ext4@vger.kernel.org Cc: Lukas Czerner Subject: [PATCH 37/38] resize2fs: remove unused variable from adjust_superblock() Date: Sat, 21 Jan 2023 12:32:29 -0800 Message-Id: <20230121203230.27624-38-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers In adjust_superblock(), the 'group_block' variable is declared and set, but it is never actually used. Remove it. This addresses the following compiler warning with clang -Wall: resize2fs.c:1119:11: warning: variable 'group_block' set but not used [-Wunused-but-set-variable] blk64_t group_block; ^ Reviewed-by: Lukas Czerner Signed-off-by: Eric Biggers --- resize/resize2fs.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/resize/resize2fs.c b/resize/resize2fs.c index 243cd777d..5eeb7d446 100644 --- a/resize/resize2fs.c +++ b/resize/resize2fs.c @@ -1116,7 +1116,6 @@ static errcode_t adjust_superblock(ext2_resize_t rfs, blk64_t new_size) ext2_filsys fs = rfs->new_fs; int adj = 0; errcode_t retval; - blk64_t group_block; unsigned long i; unsigned long max_group; @@ -1181,8 +1180,6 @@ static errcode_t adjust_superblock(ext2_resize_t rfs, blk64_t new_size) goto errout; memset(rfs->itable_buf, 0, fs->blocksize * fs->inode_blocks_per_group); - group_block = ext2fs_group_first_block2(fs, - rfs->old_fs->group_desc_count); adj = rfs->old_fs->group_desc_count; max_group = fs->group_desc_count - adj; if (rfs->progress) { @@ -1209,7 +1206,6 @@ static errcode_t adjust_superblock(ext2_resize_t rfs, blk64_t new_size) if (retval) goto errout; } - group_block += fs->super->s_blocks_per_group; } io_channel_flush(fs->io); retval = 0; From patchwork Sat Jan 21 20:32:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 1730080 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=150.107.74.76; helo=gandalf.ozlabs.org; envelope-from=srs0=gbep=5s=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=lr3yH7gZ; dkim-atps=neutral Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nzp8D65FCz23hM for ; Sun, 22 Jan 2023 07:37:32 +1100 (AEDT) Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp8D5cCpz4xN1 for ; Sun, 22 Jan 2023 07:37:32 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Nzp8D5YZbz4y03; Sun, 22 Jan 2023 07:37:32 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=lr3yH7gZ; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Nzp8D5Sddz4xN1 for ; Sun, 22 Jan 2023 07:37:32 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229988AbjAUUhb (ORCPT ); Sat, 21 Jan 2023 15:37:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230026AbjAUUgx (ORCPT ); Sat, 21 Jan 2023 15:36:53 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A919429147 for ; Sat, 21 Jan 2023 12:36:49 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id F344FCE0923 for ; Sat, 21 Jan 2023 20:36:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27774C4339C for ; Sat, 21 Jan 2023 20:36:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333406; bh=B9R8R3t5HPAhhdCpD8MlmH+F8GSfsOpGUd7azl8fQOo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=lr3yH7gZO82KIIcWf3zYwg87Lzrbb5wTG5TdFsB7siJ29LcL6a+ylTO6rM8jeeAvf e25hbAyeVLaCSw/Sq5R1yMbD9V8ZjKST+gMWFkmDbnEHXKLT8S8BtvbWLecEi/vriO 2dSVk75fHbJsZIg+b7LQfhbGAtsMIwlUl1RIExtUlkFaHtCGgTt4pp7pw2EJ3HLqEK PVOENDIE92dnbBC3C4Y5LFJK7rLCQLSOUa165lFdK+ZvVvCyqr5fUvz0NV1W6/SnYz umoKlTx5tZb2q4cNQF8SUYmLDyuwxvZhPoy1MC2ZWzVz7H0jyuiRDF8lqK6ka8ICsv x280nSatBCK9w== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 38/38] Add a configuration file for GitHub Actions Date: Sat, 21 Jan 2023 12:32:30 -0800 Message-Id: <20230121203230.27624-39-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers Add a workflow file for GitHub Actions, with jobs that build and test e2fsprogs on various platforms with various options. The workflow is configured to run on pushes only, since e2fsprogs does not use GitHub pull requests. This will work on any e2fsprogs fork on Github that has GitHub Actions enabled. For example, the results for the testing I've been doing are at https://github.com/ebiggers/e2fsprogs/actions. Signed-off-by: Eric Biggers --- .github/workflows/ci.yml | 116 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..29482178d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,116 @@ +name: CI +on: [push] +env: + DEF_CFLAGS: -O2 -g -Wall + +jobs: + gcc-build-and-test: + name: Build and test with gcc + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: ./configure CC=gcc CFLAGS="$DEF_CFLAGS" + - run: make -j8 check V=1 CFLAGS="$DEF_CFLAGS -Werror" + - run: make -j8 install V=1 DESTDIR=$PWD/installdir + - run: make -j8 uninstall V=1 DESTDIR=$PWD/installdir + + clang-build-and-test: + name: Build and test with clang + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y clang + - run: ./configure CC=clang CFLAGS="$DEF_CFLAGS" + - run: make -j8 check V=1 CFLAGS="$DEF_CFLAGS -Werror" + - run: make -j8 install V=1 DESTDIR=$PWD/installdir + - run: make -j8 uninstall V=1 DESTDIR=$PWD/installdir + + i386-build-and-test: + name: Build and test with gcc -m32 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y gcc-multilib + - run: ./configure CC=gcc CFLAGS="$DEF_CFLAGS -m32" LDFLAGS="-m32" + - run: make -j8 check V=1 CFLAGS="$DEF_CFLAGS -m32 -Werror" + - run: make -j8 install V=1 DESTDIR=$PWD/installdir + - run: make -j8 uninstall V=1 DESTDIR=$PWD/installdir + + asan-build-and-test: + name: Build and test with ASAN enabled + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y clang + - run: echo "ASAN_CFLAGS=$DEF_CFLAGS -fsanitize=address -fno-sanitize-recover=address" >> $GITHUB_ENV + - run: ./configure CC=clang CFLAGS="$ASAN_CFLAGS" LDFLAGS="$ASAN_CFLAGS" + - run: make -j8 check V=1 CFLAGS="$ASAN_CFLAGS -Werror" + + ubsan-build-and-test: + name: Build and test with UBSAN enabled + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y clang + - run: echo "UBSAN_CFLAGS=$DEF_CFLAGS -fsanitize=undefined -fno-sanitize-recover=undefined" >> $GITHUB_ENV + - run: ./configure CC=clang CFLAGS="$UBSAN_CFLAGS" LDFLAGS="$UBSAN_CFLAGS" + - run: make -j8 check V=1 CFLAGS="$UBSAN_CFLAGS -Werror" + + macos-build-and-test: + name: Build and test on macOS + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - run: ./configure CFLAGS="$DEF_CFLAGS" + # -Wno-error=deprecated-declarations is needed to suppress known warnings + # due to e2fsprogs' use of sbrk(0) and daemon(). + - run: make -j8 check V=1 CFLAGS="$DEF_CFLAGS -Werror -Wno-error=deprecated-declarations" + - run: make -j8 install DESTDIR=$PWD/installdir + - run: make -j8 uninstall DESTDIR=$PWD/installdir + + windows-msys2-build: + name: Build mke2fs on Windows with ${{matrix.sys}} + runs-on: windows-latest + strategy: + matrix: + include: + - { sys: mingw32, env: i686 } + - { sys: mingw64, env: x86_64 } + defaults: + run: + shell: msys2 {0} + steps: + - uses: actions/checkout@v2 + - uses: msys2/setup-msys2@v2 + with: + msystem: ${{matrix.sys}} + update: true + install: > + make + mingw-w64-${{matrix.env}}-cc + # For now the only parts that actually build for Windows are mke2fs and its + # dependencies: all libraries except libss. The build system doesn't want + # to build just those parts, though, so do it one step at a time... + - run: ./configure CFLAGS="$DEF_CFLAGS" + - run: make -j8 subs V=1 CFLAGS="$DEF_CFLAGS -Werror" + - run: make -j8 -C lib/et/ all V=1 CFLAGS="$DEF_CFLAGS -Werror" + - run: make -j8 -C lib/uuid/ all V=1 CFLAGS="$DEF_CFLAGS -Werror" + - run: make -j8 -C lib/blkid/ all V=1 CFLAGS="$DEF_CFLAGS -Werror" + - run: make -j8 -C lib/ext2fs/ all V=1 CFLAGS="$DEF_CFLAGS -Werror" + - run: make -j8 -C lib/support/ all V=1 CFLAGS="$DEF_CFLAGS -Werror" + - run: make -j8 -C lib/e2p/ all V=1 CFLAGS="$DEF_CFLAGS -Werror" + - run: make -j8 -C misc/ mke2fs V=1 CFLAGS="$DEF_CFLAGS -Werror" + - run: touch image.ext4 + - run: misc/mke2fs.exe -T ext4 image.ext4 128M