From patchwork Sun Jun 4 09:51:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murphy Zhou X-Patchwork-Id: 1790040 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=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=SolBnglG; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (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 4QYsSw3MF3z20Tj for ; Sun, 4 Jun 2023 19:51:28 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id C172B3CCBB0 for ; Sun, 4 Jun 2023 11:51:25 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [IPv6:2001:4b78:1:20::5]) (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 picard.linux.it (Postfix) with ESMTPS id 2980F3CB881 for ; Sun, 4 Jun 2023 11:51:23 +0200 (CEST) Received: from mail-qv1-xf2b.google.com (mail-qv1-xf2b.google.com [IPv6:2607:f8b0:4864:20::f2b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id 4821E600705 for ; Sun, 4 Jun 2023 11:51:23 +0200 (CEST) Received: by mail-qv1-xf2b.google.com with SMTP id 6a1803df08f44-6261367d2f1so29624706d6.3 for ; Sun, 04 Jun 2023 02:51:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685872282; x=1688464282; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=zYzanZ3RY4epTMb+rA9DzLCzNCNbAajOhuDfDo/mPuc=; b=SolBnglG+hyGPA6JLFWlosgaSKzQxj+klsUFo/+pGnxK3gyt49nNSZ5EZ+RT6zstvi nfWIzvZ/rKZmg9EVOoGqtkRpG56QER/drAT4csLwan5aTAAbHKzwBJCPSdo+YiQKot0Q YVq9+w16ArLqkmjnyw4rSekH4RTgXCiMlX5uI5iyQi5wM/gaUMW/sMXH6rH92xN7oBsj FyoLgLRO/0AIikn8iCHmeeND/QHSStR+eRVUtI4Zz4QdsQLUSZZKW8Le52jNnGphz+/b uZQuZAbLKXQI7jMl5hofDrqY4Z4xgi/ShMpxCGVCIVwm7Xg8q7lz/rN1iIKL4TruVo3Q 6oOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685872282; x=1688464282; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zYzanZ3RY4epTMb+rA9DzLCzNCNbAajOhuDfDo/mPuc=; b=X+JWIA1dU+7w7qnDfILup2y2ZxoRqwtQrfMHViRBK0oeo5Qu5s6W176d6ZyB34oIBe AH09aa/Zls2X8CxpxpYgRbOwuGIz2PcTypPuDa3pFfgUTjafFSqu+ZYN2EuidxcIBvRk SZ1E5JO9TDkog4fBF5mwTLFikq/pwjpG0092Cw6YQBZCA+LNIPmP+Vvg6WjWvcqCkR0j sGlO/iCluMJ+eMbDAoRks4oa6z+hHSycA1g3TpJCBLu6ZYkFNM8jjwz+03WAix+Ie8Sg EAUQIW0YUNjpfdJ4ZAhmlkkGz0WOcl0HfX0ISXATS0FtawtIJro9hJMYgV7VThps5YCt MQiw== X-Gm-Message-State: AC+VfDwD8NVYwZNqyT/pQL5/GiZja5naY+25S7kuKsl4qUfj0sdpCSzx HzCHnvo+EWgs55I4oRwyPVAtjiF2kMw= X-Google-Smtp-Source: ACHHUZ7sAWyv4WhpgflXCJDwijSNKBJT2znDTX+fFWa8JRd3yLGcce+2N7lh3xq/95OjmYtWmp855Q== X-Received: by 2002:a05:6214:cce:b0:623:638e:aa20 with SMTP id 14-20020a0562140cce00b00623638eaa20mr4444280qvx.51.1685872282058; Sun, 04 Jun 2023 02:51:22 -0700 (PDT) Received: from xzhouw.hosts.qa.psi.rdu2.redhat.com ([66.187.232.127]) by smtp.gmail.com with ESMTPSA id d21-20020a0caa15000000b0061b2a2f949bsm3141335qvb.61.2023.06.04.02.51.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Jun 2023 02:51:21 -0700 (PDT) From: Murphy Zhou To: ltp@lists.linux.it Date: Sun, 4 Jun 2023 17:51:17 +0800 Message-Id: <20230604095117.3543342-1-jencce.kernel@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 1.0.1 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH] SAFE_MOUNT: print debug info about mounting operation X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Murphy Zhou --- lib/safe_macros.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/safe_macros.c b/lib/safe_macros.c index af6dd0716..a66285a0e 100644 --- a/lib/safe_macros.c +++ b/lib/safe_macros.c @@ -898,7 +898,24 @@ int safe_mount(const char *file, const int lineno, void (*cleanup_fn)(void), const void *data) { int rval = -1; + char cdir[PATH_MAX], mpath[PATH_MAX]; + if (!getcwd(cdir, PATH_MAX)) { + tst_resm(TWARN | TERRNO, "Failed to find current directory"); + return 0; + } + + rval = snprintf(mpath, PATH_MAX, "%s/%s", cdir, target); + if (rval < 0 || rval >= PATH_MAX) { + tst_resm(TWARN | TERRNO, + "snprintf() should have returned %d instead of %d", + PATH_MAX, rval); + return 0; + } + + tst_resm_(file, lineno, TINFO, + "Mounting %s to %s fstyp=%s flags=%x", + source, mpath, filesystemtype, mountflags); /* * Don't try using the kernel's NTFS driver when mounting NTFS, since * the kernel's NTFS driver doesn't have proper write support.