Received: by 2002:a05:7412:8d11:b0:fa:4934:9f with SMTP id bj17csp614390rdb; Mon, 15 Jan 2024 07:57:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IHnRU/+OwlEG0OJue2D1sxLEIc4NzCTPWyTILwdFP7QnfNjIGmR6GzthDrq1MNvQDHBbBJq X-Received: by 2002:a05:6402:b0b:b0:557:4a8:e122 with SMTP id bm11-20020a0564020b0b00b0055704a8e122mr1349661edb.2.1705334235176; Mon, 15 Jan 2024 07:57:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705334235; cv=none; d=google.com; s=arc-20160816; b=hC4nuH/X/3Bhx7DM5q7Hl6cTHts1DBWTQ9ULtnFUEbMG13e29vk528DsImEvqR+e15 zdi46+iIbvhzeK3OVi38o8PpiJvag0G9D+ZD0D4MSZugdwANa7JVTZOlX0bcFWeS+wt7 /26ayt1vUxoVe0Jw7hQ6lsrt08DdkDtcuHj/MpTBZSdyRZ0YdUtwmFi/BDybsRe9qk4T qwAGWIePI3GwkyFF2W7e6uaKrftE3zERfDUqhXz3NKfxa33Fgy5j/nQpQWOIP/Iu/5aj ebfsFwidUoVJTD0MS6Q5zOCx4j2IjJIlFjnIyPWaWvpke5vw/0L62hVfZ899v7VLxNKG 1sKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:message-id:date :subject:cc:to:from; bh=kXAvpbGnGuMNJRdIHXRdIiSaEZig1OHbIKQQ8NUslKU=; fh=r6InKNl6pZSMuJIEc/FATFtEaSaWrkkEKBCrqWCyiRM=; b=0MPV/U04U33iB7cHavSVMQqKkSd4YcKZQUoZ+ljkZHCd5ajw6UefJMU7BHXUGKatpD V4JkLZvlSWK29b8ufCXZK6lf1J4YKdPeTcgHbULK6to64coR8tyC07T7DpyhRlhXKKQv 9pB/9EHHF0m9I0qQfvf+FQcKS8Q5ikEBhyq+6Nep7x4n5t+TrtFUk2BdWb6sKSLlQsWE znDLFvuhgrT3LQf9BaKjdtDMHOsa05jSPguuFd7ADCF8IgeZZ38gGk1bSxvuIZs6AsqF ON592hReFUdDpYP647ySV7MQYFxHIKf2Gg33nOj19IlLcCX7FJrzuen6C8tbRUAfhoNW xsDQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-26204-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26204-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id cs14-20020a0564020c4e00b005589cfeb911si4070115edb.560.2024.01.15.07.57.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 07:57:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26204-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-26204-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26204-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E7F251F22699 for ; Mon, 15 Jan 2024 15:57:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C848C1803E; Mon, 15 Jan 2024 15:56:14 +0000 (UTC) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 25FB817C70; Mon, 15 Jan 2024 15:56:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=heusel.eu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=heusel.eu Received: from meterpeter.INF524.stwhd ([141.70.80.5]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N5VLY-1r6Fsk23Kc-016uBC; Mon, 15 Jan 2024 16:55:48 +0100 From: Christian Heusel To: Anton Altaparmakov , Namjae Jeon , linux-ntfs-dev@lists.sourceforge.net, linux-kernel@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, Christian Heusel Subject: [PATCH] ntfs: print symbolic error name instead of error code Date: Mon, 15 Jan 2024 16:55:38 +0100 Message-ID: <20240115155540.94127-1-christian@heusel.eu> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:8Cj9rg6OYmZJSHmw+KpGRyrT/3xXnK/X35tHaWFT4Z017Ota8AT +UpSs8EPfJNryBWCRdJ7rI9VvFTg5c6Vc5VpE3p4Hp4ckDB1SDYl+R2QmnAQs2sS1UR11L7 hyQSXn72ht4wi6xeYDPjrlSgcqmCHltgg0OQ5L7f/BjZIKoYKMMQSif/AlihCZsZRY2gLH2 vlSHgaRvde2FmeVPkE51w== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:HwgHyQdHjo0=;jxlGXhDLZbiOF1B/xDBM50aA2KY zWyHHrEqyatDBGIGDUEcFoGI21HDR9Q/nGqA4vb+ivICx/7fT5DRt+zDCouoOkITgv8XVUYlr iRFflzvbJdkky+YkhamV43XnrC80z9R/4/TtUqOXmnBVbA6cmcPpWndPF23Z7uBQSI3aBIrFP C/wiB/Gx4xerESBXA3xKVgU4vs71yIS60BkRINWc3kDI2g0V3o1gzkiD4cRKifNhm293sAtOB EphknbmvEtoctkIUfjYwr1SSpw6GTayFCrzcwfSgn/p+AV/L8PA3P86zFTfNgXeLvllAPF4Ai aBjFLKFKMylTvlUw1M+7dxZp41zxs38Bvk6oiV4WKv7M4W9EGYs8HYAq+eDbhhO0KB9YwFZZq AZGHe5ME4hQpWnWjNI5ulSXPKPFzEcbDYGqWLhzI43S15WP6lKmSgbOneJn0IabHhGO7W135W FKdZSViAEnR3yQLlkzgCJ9gG7TnREQXrl8G2U1CCld5ArdDVbKaXpZnaJhUHArvSqUiAXr+bR aUIPSjZ3xy5cvYb8k3R8bt0SYZTRFuAwnQlJjn2+j93xcJu/AEPhEpajh1oJg9Ghp1vP6MQnF s3L+KWUYtmAImr3EMsDD2wGu/QRKYEjJtlYZY2K2tgc0ySn6PPSXQVsvVjqIt83HRaWZwjgCX tmqESg26ir8zM6T4TXRLMeL7kFazP6v4IUytGBoOXBX/G2JjlAtsIpRkETr8nID66ZCi4c4Zq IqNYndy2WK5CldCQmd7TirQMG3fBaTU+q764y6ZF+uB8MGKxDPqoIYYkR+AZq6Z5K/DaMisOU OhvZEiOHwzJ324eryJrxL5fgqiz5CJx3p9B8IE+CFrXwcL+EfarX1QrQ3jlevJKAffcHToKwX kSk8CnZV3UnvRhA== Utilize the %pe print specifier in multiple log messages to get the symbolic error name as a string (i.e "-ENOMEM") instead of the error code to increase the log messages readablility. This change was suggested in https://lore.kernel.org/all/92972476-0b1f-4d0a-9951-af3fc8bc6e65@suswa.mountain/ Signed-off-by: Christian Heusel --- fs/ntfs/dir.c | 12 ++++-------- fs/ntfs/index.c | 6 ++---- fs/ntfs/mft.c | 6 +++--- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/fs/ntfs/dir.c b/fs/ntfs/dir.c index 629723a8d712..8df4f233969d 100644 --- a/fs/ntfs/dir.c +++ b/fs/ntfs/dir.c @@ -88,8 +88,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const ntfschar *uname, /* Get hold of the mft record for the directory. */ m = map_mft_record(dir_ni); if (IS_ERR(m)) { - ntfs_error(sb, "map_mft_record() failed with error code %ld.", - -PTR_ERR(m)); + ntfs_error(sb, "map_mft_record() failed with error %pe.", m); return ERR_MREF(PTR_ERR(m)); } ctx = ntfs_attr_get_search_ctx(dir_ni, m); @@ -308,8 +307,7 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const ntfschar *uname, page = ntfs_map_page(ia_mapping, vcn << dir_ni->itype.index.vcn_size_bits >> PAGE_SHIFT); if (IS_ERR(page)) { - ntfs_error(sb, "Failed to map directory index page, error %ld.", - -PTR_ERR(page)); + ntfs_error(sb, "Failed to map directory index page, error %pe.", page); err = PTR_ERR(page); goto err_out; } @@ -639,8 +637,7 @@ u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const ntfschar *uname, /* Get hold of the mft record for the directory. */ m = map_mft_record(dir_ni); if (IS_ERR(m)) { - ntfs_error(sb, "map_mft_record() failed with error code %ld.", - -PTR_ERR(m)); + ntfs_error(sb, "map_mft_record() failed with error %pe.", m); return ERR_MREF(PTR_ERR(m)); } ctx = ntfs_attr_get_search_ctx(dir_ni, m); @@ -786,8 +783,7 @@ u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const ntfschar *uname, page = ntfs_map_page(ia_mapping, vcn << dir_ni->itype.index.vcn_size_bits >> PAGE_SHIFT); if (IS_ERR(page)) { - ntfs_error(sb, "Failed to map directory index page, error %ld.", - -PTR_ERR(page)); + ntfs_error(sb, "Failed to map directory index page, error %pe.", page); err = PTR_ERR(page); goto err_out; } diff --git a/fs/ntfs/index.c b/fs/ntfs/index.c index d46c2c03a032..777bbd4548ad 100644 --- a/fs/ntfs/index.c +++ b/fs/ntfs/index.c @@ -137,8 +137,7 @@ int ntfs_index_lookup(const void *key, const int key_len, /* Get hold of the mft record for the index inode. */ m = map_mft_record(base_ni); if (IS_ERR(m)) { - ntfs_error(sb, "map_mft_record() failed with error code %ld.", - -PTR_ERR(m)); + ntfs_error(sb, "map_mft_record() failed with code %pe.", m); return PTR_ERR(m); } actx = ntfs_attr_get_search_ctx(base_ni, m); @@ -264,8 +263,7 @@ int ntfs_index_lookup(const void *key, const int key_len, page = ntfs_map_page(ia_mapping, vcn << idx_ni->itype.index.vcn_size_bits >> PAGE_SHIFT); if (IS_ERR(page)) { - ntfs_error(sb, "Failed to map index page, error %ld.", - -PTR_ERR(page)); + ntfs_error(sb, "Failed to map index page, error %pe.", page); err = PTR_ERR(page); goto err_out; } diff --git a/fs/ntfs/mft.c b/fs/ntfs/mft.c index 6fd1dc4b08c8..fed9abc3ff1f 100644 --- a/fs/ntfs/mft.c +++ b/fs/ntfs/mft.c @@ -159,7 +159,7 @@ MFT_RECORD *map_mft_record(ntfs_inode *ni) mutex_unlock(&ni->mrec_lock); atomic_dec(&ni->count); - ntfs_error(ni->vol->sb, "Failed with error code %lu.", -PTR_ERR(m)); + ntfs_error(ni->vol->sb, "Failed with error %pe.", m); return m; } @@ -285,8 +285,8 @@ MFT_RECORD *map_extent_mft_record(ntfs_inode *base_ni, MFT_REF mref, return ERR_PTR(-EIO); } map_err_out: - ntfs_error(base_ni->vol->sb, "Failed to map extent " - "mft record, error code %ld.", -PTR_ERR(m)); + ntfs_error(base_ni->vol->sb, + "Failed to map extent mft record, error %pe.", m); return m; } /* Record wasn't there. Get a new ntfs inode and initialize it. */ -- 2.43.0