From patchwork Wed Nov 13 17:01:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kenneth Dsouza X-Patchwork-Id: 11242339 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D49A76C1 for ; Wed, 13 Nov 2019 17:01:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7CB95206D6 for ; Wed, 13 Nov 2019 17:01:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="MXMd9xA2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728681AbfKMRBg (ORCPT ); Wed, 13 Nov 2019 12:01:36 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:29737 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726195AbfKMRBg (ORCPT ); Wed, 13 Nov 2019 12:01:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573664495; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=H58pRbcmI7yOqwI1XRhs6dzljYSSojBMh1mx9wvEIzc=; b=MXMd9xA2zrdfMyea2Z8dioua9gsPBxFnRBjkaBMIzb7k3PtyzMFSbtRK5VG9UBW37zJwOh SPsa2so6WVFGARqC5FxjilM24VtGhHxZaPJGMLHBSx+Msw6A6XT9sgpzpbtAQxL+hoHoUs 8mp2aVOKvD1WSlUPxpS7HU2z1ODx50Y= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-157-cCkpSdLxOX69Aatpv6nQNA-1; Wed, 13 Nov 2019 12:01:32 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 666238E7EF3; Wed, 13 Nov 2019 17:01:31 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.76.0.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id A853F60BD7; Wed, 13 Nov 2019 17:01:29 +0000 (UTC) From: Kenneth D'souza To: linux-cifs@vger.kernel.org Cc: piastryyy@gmail.com, smfrench@gmail.com, lsahlber@redhat.com Subject: [PATCH] Add support for smb3 alias/fstype in mount.cifs.c Date: Wed, 13 Nov 2019 22:31:26 +0530 Message-Id: <20191113170126.23372-1-kdsouza@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: cCkpSdLxOX69Aatpv6nQNA-1 X-Mimecast-Spam-Score: 0 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org As we will slowly move towards smb3 filesystem, supporting through "mount -t smb3" is important. Signed-off-by: Kenneth D'souza --- Makefile.am | 4 ++++ mount.cifs.c | 8 +++++++- mount.cifs.rst | 12 +++++++++--- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Makefile.am b/Makefile.am index 8291b99..1af2573 100644 --- a/Makefile.am +++ b/Makefile.am @@ -111,3 +111,7 @@ CLEANFILES += $(rst_man_pages) endif SUBDIRS = contrib + +install-exec-hook: + (cd $(ROOTSBINDIR) && ln -sf mount.cifs mount.smb3) + (cd $(man8dir) && ln -sf mount.cifs.8 mount.smb3.8) diff --git a/mount.cifs.c b/mount.cifs.c index 6935fe1..0ed9d0a 100644 --- a/mount.cifs.c +++ b/mount.cifs.c @@ -192,7 +192,7 @@ struct parsed_mount_info { }; static const char *thisprogram; -static const char *cifs_fstype = "cifs"; +static const char *cifs_fstype; static int parse_unc(const char *unc_name, struct parsed_mount_info *parsed_info); @@ -1986,6 +1986,12 @@ int main(int argc, char **argv) if (thisprogram == NULL) thisprogram = "mount.cifs"; + if(strcmp(thisprogram, "mount.cifs") == 0) + cifs_fstype = "cifs"; + + if(strcmp(thisprogram, "mount.smb3") == 0) + cifs_fstype = "smb3"; + /* allocate parsed_info as shared anonymous memory range */ parsed_info = mmap((void *)0, sizeof(*parsed_info), PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_SHARED, -1, 0); diff --git a/mount.cifs.rst b/mount.cifs.rst index ee5086c..67ec629 100644 --- a/mount.cifs.rst +++ b/mount.cifs.rst @@ -1,6 +1,6 @@ -========== -mount.cifs -========== +===================== +mount.cifs mount.smb3 +===================== -------------------------------------------------- mount using the Common Internet File System (CIFS) @@ -23,6 +23,12 @@ protocol and is supported by most Windows servers, Azure (cloud storage), Macs and many other commercial servers and Network Attached Storage appliances as well as by the popular Open Source server Samba. +``mount.smb3`` mounts only SMB3 filesystem. It is usually invoked +indirectly by the mount(8) command when using the "-t smb3" option. +The ``smb3`` filesystem type was added in kernel-4.18 and above. +It works in a similar fashion as mount.cifs except it passes filesystem +type as smb3. + The mount.cifs utility attaches the UNC name (exported network resource) specified as service (using ``//server/share`` syntax, where "server" is the server name or IP address and "share" is the name of