Date: Mon, 5 Feb 2007 15:30:31 GMT From: Craig Rodrigues <rodrigc@crodrigues.org> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/108751: mount_msdosfs chokes on "noauto" fstab option Message-ID: <200702051530.l15FUVZ1048183@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/108751; it has been noted by GNATS. From: Craig Rodrigues <rodrigc@crodrigues.org> To: Neil Hoggarth <neil@hoggarth.me.uk> Cc: bug-followup@freebsd.org Subject: Re: bin/108751: mount_msdosfs chokes on "noauto" fstab option Date: Mon, 5 Feb 2007 10:24:22 -0500 --NzB8fVQJ5HfG6fxh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Feb 04, 2007 at 11:36:58AM +0000, Neil Hoggarth wrote: > and the following kernel error is logged: > > mount option <auto> is unknown > Can you try the attached patch to mount? -- Craig Rodrigues rodrigc@crodrigues.org --NzB8fVQJ5HfG6fxh Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="a.txt" Index: mount.c =================================================================== RCS file: /home/ncvs/src/sbin/mount/mount.c,v retrieving revision 1.69.2.5 diff -u -u -r1.69.2.5 mount.c --- mount.c 28 Jan 2007 01:24:57 -0000 1.69.2.5 +++ mount.c 5 Feb 2007 15:23:25 -0000 @@ -74,7 +74,7 @@ int hasopt(const char *, const char *); int ismounted(struct fstab *, struct statfs *, int); int isremountable(const char *); -void mangle(char *, int *, const char **); +void mangle(char *, int *, char *[]); char *update_options(char *, char *, int); int mountfs(const char *, const char *, const char *, int, const char *, const char *); @@ -120,6 +120,9 @@ 0 }; +static const char userquotaeq[] = "userquota="; +static const char groupquotaeq[] = "groupquota="; + static int specified_ro(const char *arg) { @@ -431,7 +434,7 @@ const char *vfstype, *spec, *name, *options, *mntopts; int flags; { - const char *argv[100]; + char *argv[100]; struct statfs sf; pid_t pid; int argc, i, status; @@ -483,8 +486,8 @@ argc = 0; argv[argc++] = execname; mangle(optbuf, &argc, argv); - argv[argc++] = spec; - argv[argc++] = name; + argv[argc++] = strdup(spec); + argv[argc++] = strdup(name); argv[argc] = NULL; if (debug) { @@ -631,10 +634,7 @@ } void -mangle(options, argcp, argv) - char *options; - int *argcp; - const char **argv; +mangle(char *options, int *argcp, char *argv[]) { char *p, *s; int argc; @@ -642,16 +642,43 @@ argc = *argcp; for (s = options; (p = strsep(&s, ",")) != NULL;) if (*p != '\0') { - if (*p == '-') { + if (strcmp(p, "noauto") == 0) { + /* + * Do not pass noauto option to nmount(). + * or external mount program. noauto is + * only used to prevent mounting a file system + * when 'mount -a' is specified, and is + * not a real mount option. + */ + continue; + } else if (strcmp(p, "late") == 0) { + /* + * "late" is used to prevent certain file + * systems from being mounted before late + * in the boot cycle; for instance, + * loopback NFS mounts can't be mounted + * before mountd starts. + */ + continue; + } else if (strcmp(p, "userquota") == 0) { + continue; + } else if (strncmp(p, userquotaeq, + sizeof(userquotaeq) - 1) == 0) { + continue; + } else if (strcmp(p, "groupquota") == 0) { + continue; + } else if (strncmp(p, groupquotaeq, + sizeof(groupquotaeq) - 1) == 0) { + continue; + } else if (*p == '-') { argv[argc++] = p; p = strchr(p, '='); if (p != NULL) { *p = '\0'; argv[argc++] = p+1; } - } else if (strcmp(p, "rw") != 0 && - strcmp(p, "late") != 0) { - argv[argc++] = "-o"; + } else { + argv[argc++] = strdup("-o"); argv[argc++] = p; } } --NzB8fVQJ5HfG6fxh--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200702051530.l15FUVZ1048183>