Linux-CIFS Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] Add support for smb3 alias/fstype in mount.cifs.c
@ 2019-11-13 17:01 Kenneth D'souza
  2019-12-13  0:25 ` Pavel Shilovsky
  0 siblings, 1 reply; 2+ messages in thread
From: Kenneth D'souza @ 2019-11-13 17:01 UTC (permalink / raw)
  To: linux-cifs; +Cc: piastryyy, smfrench, lsahlber

As we will slowly move towards smb3 filesystem,
supporting through "mount -t smb3" is important.

Signed-off-by: Kenneth D'souza <kdsouza@redhat.com>
---
 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
-- 
2.21.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Add support for smb3 alias/fstype in mount.cifs.c
  2019-11-13 17:01 [PATCH] Add support for smb3 alias/fstype in mount.cifs.c Kenneth D'souza
@ 2019-12-13  0:25 ` Pavel Shilovsky
  0 siblings, 0 replies; 2+ messages in thread
From: Pavel Shilovsky @ 2019-12-13  0:25 UTC (permalink / raw)
  To: Kenneth D'souza; +Cc: linux-cifs, Steve French, Ronnie Sahlberg

ср, 13 нояб. 2019 г. в 09:01, Kenneth D'souza <kdsouza@redhat.com>:
>
> As we will slowly move towards smb3 filesystem,
> supporting through "mount -t smb3" is important.
>
> Signed-off-by: Kenneth D'souza <kdsouza@redhat.com>
> ---
>  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
> --
> 2.21.0
>

Merged, thanks.
--
Best regards,
Pavel Shilovsky

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-13 17:01 [PATCH] Add support for smb3 alias/fstype in mount.cifs.c Kenneth D'souza
2019-12-13  0:25 ` Pavel Shilovsky

Linux-CIFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-cifs/0 linux-cifs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-cifs linux-cifs/ https://lore.kernel.org/linux-cifs \
		linux-cifs@vger.kernel.org
	public-inbox-index linux-cifs

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-cifs


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git