From patchwork Tue May 20 03:54:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 4207241 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EF3AA9F32A for ; Tue, 20 May 2014 03:54:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 36F8E202F0 for ; Tue, 20 May 2014 03:54:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 61B87202A7 for ; Tue, 20 May 2014 03:54:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932071AbaETDyh (ORCPT ); Mon, 19 May 2014 23:54:37 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:57645 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932070AbaETDyh (ORCPT ); Mon, 19 May 2014 23:54:37 -0400 Received: by mail-pa0-f47.google.com with SMTP id lf10so6669838pab.34 for ; Mon, 19 May 2014 20:54:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; bh=1XFx06hJe3lhN3bBphze4eZfaRCTiYJ/sLlpp4TivMc=; b=j6C2KC/yR61cW/242bpYlFgPSTbNDwEfxTymrRufqDaTqkjfAaVxmUbicUZbyIn5gl 60nkhIqxrI+1SbnCZbodeqACJZpsmg0lMZKozKtjo/EKauS974/yylTd+klrsQf2E7hF 4D3P1WQZetmJahROHnbNBslWDXIHwsfsUA7cUheVkkT76ywQtATJY+4r1YG96AKqAovf QSvrLdL/u0roR6GiWgXp2HPslSe+Gj5YFaExIPdIC5tLf7YVUSL5cmZxnsVParCxXoD9 9aabPdV8M0JaEtO1tB5T5lHmLAeNSFMMAGf5ucbTSIuXUxDJdcPeVQYJxvyLXZwIZs9e pxbA== X-Received: by 10.66.141.12 with SMTP id rk12mr47442045pab.152.1400558076753; Mon, 19 May 2014 20:54:36 -0700 (PDT) Received: from [192.168.31.158] ([110.190.112.123]) by mx.google.com with ESMTPSA id ci4sm438829pbb.50.2014.05.19.20.54.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 19 May 2014 20:54:35 -0700 (PDT) Message-ID: <537AD1E7.6080404@gmail.com> Date: Tue, 20 May 2014 11:54:15 +0800 From: Kinglong Mee User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Steve Dickson CC: linux-nfs@vger.kernel.org, kinglongmee@gmail.com Subject: [PATCH] mount.nfs: print more useful error message Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When mounting spec of a regular file, mount.nfs print error message as, # mount -t nfs 127.0.0.1:/root/testfile /mnt/ mount.nfs: mount point /mnt is not a directory # mount -t nfs 127.0.0.1:/root/testfile /mnt/testfile mount.nfs: mount point /mnt/testfile is not a directory This patch lets mount.nfs print more useful message, # mount -t nfs 127.0.0.1:/root/testfile /mnt/ mount.nfs: mount spec 127.0.0.1:/root/testfile or point /mnt is not a directory # mount -t nfs 127.0.0.1:/root/testfile /mnt/testfile mount.nfs: mount point /mnt/testfile is not a directory Signed-off-by: Kinglong Mee --- utils/mount/error.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/utils/mount/error.c b/utils/mount/error.c index f8fc13f..e06f598 100644 --- a/utils/mount/error.c +++ b/utils/mount/error.c @@ -215,8 +215,12 @@ void mount_error(const char *spec, const char *mount_point, int error) progname); break; case ENOTDIR: - nfs_error(_("%s: mount point %s is not a directory"), - progname, mount_point); + if (spec) + nfs_error(_("%s: mount spec %s or point %s is not a " + "directory"), progname, spec, mount_point); + else + nfs_error(_("%s: mount point %s is not a directory"), + progname, mount_point); break; case EBUSY: nfs_error(_("%s: %s is busy or already mounted"),