Add support for smb3 alias/fstype in mount.cifs.c
Subsystems (3)
PATCH 1/1 Add support for smb3 alias/fstype in mount.cifs.c
As we will slowly move towards smb3 filesystem,
supporting through "mount -t smb3" is important.
Signed-off-by Kenneth D'souza <[email protected]>
--- Makefile.am | 4 ++++ mount.cifs.c | 8 +++++++- mount.cifs.rst | 12 +++++++++--- 3 files changed, 20 insertions(+), 4 deletions(-)
Makefile.am +4 -0
@@ -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)
mount.cifs.c +7 -1
@@ -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 );
mount.cifs.rst +9 -3
@@ -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
Signature · 1 line
2.21.0
ср, 13 нояб. 2019 г. в 09:01, Kenneth D'souza <[email protected]>:
Quoted 77 lines
As we will slowly move towards smb3 filesystem,
supporting through "mount -t smb3" is important.Signed-off-by Kenneth D'souza <[email protected]>--- Makefile.am | 4 ++++ mount.cifs.c | 8 +++++++- mount.cifs.rst | 12 +++++++++--- 3 files changed, 20 insertions(+), 4 deletions(-)Makefile.am +4
-0@@ -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)mount.cifs.c +7
-1@@ -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 );mount.cifs.rst +9
-4@@ -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 --
Quoted 2 lines
2.21.0
Merged, thanks.
--
Best regards,
Pavel Shilovsky