Skip to contentSkip to conversation

mount.cifs: add support for -s option

PATCH In review Jeff Layton 1 participant 2 messages Mar 24, 2012 – Mar 28, 2012 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mount.cifs: add support for -s option

autofs generally calls mount helpers with '-s'. Handle that the same way we do for NFS -- append ",sloppy" option to the mount options.

The kernel can look for that option to decide whether to ignore unknown mount options, warn, or error out.

---
 mount.cifs.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
mount.cifs.c +9 -1
index 824cd3a..c0aea35 100644
@@ -1438,6 +1438,7 @@ static struct option longopts[] = {
 	{"pass", 1, NULL, 'p'},
 	{"credentials", 1, NULL, 'c'},
 	{"port", 1, NULL, 'P'},
+	{"sloppy", 0, NULL, 's'},
 	{NULL, 0, NULL, 0}
 };
 
@@ -1863,6 +1864,7 @@ int main(int argc, char **argv)
 	char *currentaddress, *nextaddress;
 	int rc = 0;
 	int already_uppercased = 0;
+	int sloppy = 0;
 	size_t options_size = MAX_OPTIONS_LEN;
 	struct parsed_mount_info *parsed_info = NULL;
 	pid_t pid;
@@ -1900,7 +1902,7 @@ int main(int argc, char **argv)
 	}
 
 	/* add sharename in opts string as unc= parm */
-	while ((c = getopt_long(argc, argv, "?fhno:rvVw",
+	while ((c = getopt_long(argc, argv, "?fhno:rsvVw",
 				longopts, NULL)) != -1) {
 		switch (c) {
 		case '?':
@@ -1932,6 +1934,9 @@ int main(int argc, char **argv)
 		case 'f':
 			++parsed_info->fakemnt;
 			break;
+		case 's':
+			++sloppy;
+			break;
 		default:
 			fprintf(stderr, "unknown command-line option: %c\n", c);
 			rc = mount_usage(stderr);
@@ -2037,6 +2042,9 @@ mount_retry:
 		strlcat(options, parsed_info->prefix, options_size);
 	}
 
+	if (sloppy)
+		strlcat(options, ",sloppy", options_size);
+
 	if (parsed_info->verboseflag)
 		fprintf(stderr, "%s kernel mount options: %s",
 			thisprogram, options);
Signature · 1 line
1.7.7.6
#2 lore raw
In reply to a message not in the archive

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 51 lines · On Sat, 24 Mar 2012 08:26:59 -0400 Jeff Layton <[email protected]> wrote:

autofs generally calls mount helpers with '-s'. Handle that the same way we do for NFS -- append ",sloppy" option to the mount options.

The kernel can look for that option to decide whether to ignore unknown mount options, warn, or error out.

---
 mount.cifs.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
mount.cifs.c +6 -1
index 824cd3a..c0aea35 100644
@@ -1438,6 +1438,7 @@ static struct option longopts[] = {
 	{"pass", 1, NULL, 'p'},
 	{"credentials", 1, NULL, 'c'},
 	{"port", 1, NULL, 'P'},
+	{"sloppy", 0, NULL, 's'},
 	{NULL, 0, NULL, 0}
 };
 
@@ -1863,6 +1864,7 @@ int main(int argc, char **argv)
 	char *currentaddress, *nextaddress;
 	int rc = 0;
 	int already_uppercased = 0;
+	int sloppy = 0;
 	size_t options_size = MAX_OPTIONS_LEN;
 	struct parsed_mount_info *parsed_info = NULL;
 	pid_t pid;
@@ -1900,7 +1902,7 @@ int main(int argc, char **argv)
 	}
 
 	/* add sharename in opts string as unc= parm */
-	while ((c = getopt_long(argc, argv, "?fhno:rvVw",
+	while ((c = getopt_long(argc, argv, "?fhno:rsvVw",
 				longopts, NULL)) != -1) {
 		switch (c) {
 		case '?':
@@ -1932,6 +1934,9 @@ int main(int argc, char **argv)
 		case 'f':
 			++parsed_info->fakemnt;
 			break;
+		case 's':
+			++sloppy;
+			break;
 		default:
 			fprintf(stderr, "unknown command-line option: %c\n", c);
 			rc = mount_usage(stderr);

mount.cifs.c mount_retry: · line 2050

Quoted 9 lines
mount.cifs.c +3 -0
@@ -2037,6 +2042,9 @@ mount_retry:
 		strlcat(options, parsed_info->prefix, options_size);
 	}
 
+	if (sloppy)
+		strlcat(options, ",sloppy", options_size);
+
 	if (parsed_info->verboseflag)
 		fprintf(stderr, "%s kernel mount options: %s",
 			thisprogram, options);

Merged...
- --
Jeff Layton <[email protected]>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)

iQIcBAEBAgAGBQJPcvneAAoJEAAOaEEZVoIVTmYQAKJOQeWa6eP8bcLhlAdF7FGx zPPI/u9aYn+XjrS/cnQK6zCQBXf2WyemUCaKWM8oqz7M+PJiICYQVtbkVBsKz0VW XlpruyU+3hogLXMEC9pLROIjcNAnML7MFi/amPV7vrPt7U3zfhO/6sOMwzSA+3Ik CAhtkCSWlSysfIyu92MgSjeAS25eTjqumWPfTdVE9L0xoBCoZfDzmDFMbkdsvlmg bRXHc+mJ9d65RdvGIOYZYOdLr+CdGB4J2WHoAehuC8HWua8TO9+Xxj2ARIPWxJ/c ADEE9EwEtTgE2nPA0WUySVP9RxkvarYAPJiAZy8gOPlQ/QDI1Gh4PEEf1GS1CtiR 9OQ5515L53BQrZlFbxqpwsmJz+IrUkKnAd1SJCMk3Quxx3TI5siK+6CYfaac1VAt OX5kRsvhjLgyh0vxDWJlGF37LdBqJeeBN90NzYp7jnTWHaTSk2YVXwzmeTgR4PqQ PYyDwSHwx+6Fr2SviO/w+LYObfxJ5ZdJ8LiWQSnFrgFABBSI2LFYyogVLzyayKpM J125DkY6uX/mZVWula4n9jBgt1+9JUn7glul/PGAnn58c8mEThdWizfjVdIIdX/k hUAffmwb4lbC0S7PDjk5od4g+rg8tZZ9eQMzw8hYVhHsFwLgPgp2c7JTxpO9dw9C lY3W6rZAOapYXB6rFXlF
=kehk
-----END PGP SIGNATURE-----