Deleted Added
full compact
vfs_mount.c (156451) vfs_mount.c (156685)
1/*-
2 * Copyright (c) 1999-2004 Poul-Henning Kamp
3 * Copyright (c) 1999 Michael Smith
4 * Copyright (c) 1989, 1993
5 * The Regents of the University of California. All rights reserved.
6 * (c) UNIX System Laboratories, Inc.
7 * All or some portions of this file are derived from material licensed
8 * to the University of California by American Telephone and Telegraph

--- 21 unchanged lines hidden (view full) ---

30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 */
36
37#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1999-2004 Poul-Henning Kamp
3 * Copyright (c) 1999 Michael Smith
4 * Copyright (c) 1989, 1993
5 * The Regents of the University of California. All rights reserved.
6 * (c) UNIX System Laboratories, Inc.
7 * All or some portions of this file are derived from material licensed
8 * to the University of California by American Telephone and Telegraph

--- 21 unchanged lines hidden (view full) ---

30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 */
36
37#include <sys/cdefs.h>
38__FBSDID("$FreeBSD: head/sys/kern/vfs_mount.c 156451 2006-03-08 23:43:39Z tegge $");
38__FBSDID("$FreeBSD: head/sys/kern/vfs_mount.c 156685 2006-03-13 14:58:37Z ru $");
39
40#include <sys/param.h>
41#include <sys/conf.h>
42#include <sys/jail.h>
43#include <sys/kernel.h>
44#include <sys/libkern.h>
45#include <sys/mac.h>
46#include <sys/malloc.h>

--- 488 unchanged lines hidden (view full) ---

535 crfree(mp->mnt_cred);
536 free(mp, M_MOUNT);
537}
538
539static int
540vfs_donmount(struct thread *td, int fsflags, struct uio *fsoptions)
541{
542 struct vfsoptlist *optlist;
39
40#include <sys/param.h>
41#include <sys/conf.h>
42#include <sys/jail.h>
43#include <sys/kernel.h>
44#include <sys/libkern.h>
45#include <sys/mac.h>
46#include <sys/malloc.h>

--- 488 unchanged lines hidden (view full) ---

535 crfree(mp->mnt_cred);
536 free(mp, M_MOUNT);
537}
538
539static int
540vfs_donmount(struct thread *td, int fsflags, struct uio *fsoptions)
541{
542 struct vfsoptlist *optlist;
543 struct vfsopt *opt;
543 char *fstype, *fspath, *errmsg;
544 int error, fstypelen, fspathlen, errmsg_len, errmsg_pos;
545
546 errmsg_len = 0;
547 errmsg_pos = -1;
548
549 error = vfs_buildopts(fsoptions, &optlist);
550 if (error)

--- 27 unchanged lines hidden (view full) ---

578 }
579
580 /*
581 * We need to see if we have the "update" option
582 * before we call vfs_domount(), since vfs_domount() has special
583 * logic based on MNT_UPDATE. This is very important
584 * when we want to update the root filesystem.
585 */
544 char *fstype, *fspath, *errmsg;
545 int error, fstypelen, fspathlen, errmsg_len, errmsg_pos;
546
547 errmsg_len = 0;
548 errmsg_pos = -1;
549
550 error = vfs_buildopts(fsoptions, &optlist);
551 if (error)

--- 27 unchanged lines hidden (view full) ---

579 }
580
581 /*
582 * We need to see if we have the "update" option
583 * before we call vfs_domount(), since vfs_domount() has special
584 * logic based on MNT_UPDATE. This is very important
585 * when we want to update the root filesystem.
586 */
586 if (vfs_getopt(optlist, "update", NULL, NULL) == 0)
587 fsflags |= MNT_UPDATE;
587 TAILQ_FOREACH(opt, optlist, link) {
588 if (strcmp(opt->name, "update") == 0)
589 fsflags |= MNT_UPDATE;
590 else if (strcmp(opt->name, "async") == 0)
591 fsflags |= MNT_ASYNC;
592 else if (strcmp(opt->name, "force") == 0)
593 fsflags |= MNT_FORCE;
594 else if (strcmp(opt->name, "multilabel") == 0)
595 fsflags |= MNT_MULTILABEL;
596 else if (strcmp(opt->name, "noasync") == 0)
597 fsflags &= ~MNT_ASYNC;
598 else if (strcmp(opt->name, "noatime") == 0)
599 fsflags |= MNT_NOATIME;
600 else if (strcmp(opt->name, "noclusterr") == 0)
601 fsflags |= MNT_NOCLUSTERR;
602 else if (strcmp(opt->name, "noclusterw") == 0)
603 fsflags |= MNT_NOCLUSTERW;
604 else if (strcmp(opt->name, "noexec") == 0)
605 fsflags |= MNT_NOEXEC;
606 else if (strcmp(opt->name, "nosuid") == 0)
607 fsflags |= MNT_NOSUID;
608 else if (strcmp(opt->name, "nosymfollow") == 0)
609 fsflags |= MNT_NOSYMFOLLOW;
610 else if (strcmp(opt->name, "noro") == 0 ||
611 strcmp(opt->name, "rw") == 0)
612 fsflags &= ~MNT_RDONLY;
613 else if (strcmp(opt->name, "ro") == 0 ||
614 strcmp(opt->name, "rdonly") == 0)
615 fsflags |= MNT_RDONLY;
616 else if (strcmp(opt->name, "snapshot") == 0)
617 fsflags |= MNT_SNAPSHOT;
618 else if (strcmp(opt->name, "suiddir") == 0)
619 fsflags |= MNT_SUIDDIR;
620 else if (strcmp(opt->name, "sync") == 0)
621 fsflags |= MNT_SYNCHRONOUS;
622 else if (strcmp(opt->name, "union") == 0)
623 fsflags |= MNT_UNION;
624 }
588
625
589 if (vfs_getopt(optlist, "async", NULL, NULL) == 0)
590 fsflags |= MNT_ASYNC;
591
592 if (vfs_getopt(optlist, "force", NULL, NULL) == 0)
593 fsflags |= MNT_FORCE;
594
595 if (vfs_getopt(optlist, "multilabel", NULL, NULL) == 0)
596 fsflags |= MNT_MULTILABEL;
597
598 if (vfs_getopt(optlist, "noasync", NULL, NULL) == 0)
599 fsflags &= ~MNT_ASYNC;
600
601 if (vfs_getopt(optlist, "noatime", NULL, NULL) == 0)
602 fsflags |= MNT_NOATIME;
603
604 if (vfs_getopt(optlist, "noclusterr", NULL, NULL) == 0)
605 fsflags |= MNT_NOCLUSTERR;
606
607 if (vfs_getopt(optlist, "noclusterw", NULL, NULL) == 0)
608 fsflags |= MNT_NOCLUSTERW;
609
610 if (vfs_getopt(optlist, "noexec", NULL, NULL) == 0)
611 fsflags |= MNT_NOEXEC;
612
613 if (vfs_getopt(optlist, "nosuid", NULL, NULL) == 0)
614 fsflags |= MNT_NOSUID;
615
616 if (vfs_getopt(optlist, "nosymfollow", NULL, NULL) == 0)
617 fsflags |= MNT_NOSYMFOLLOW;
618
619 if (vfs_getopt(optlist, "noro", NULL, NULL) == 0)
620 fsflags &= ~MNT_RDONLY;
621
622 if (vfs_getopt(optlist, "ro", NULL, NULL) == 0)
623 fsflags |= MNT_RDONLY;
624
625 if (vfs_getopt(optlist, "rdonly", NULL, NULL) == 0)
626 fsflags |= MNT_RDONLY;
627
628 if (vfs_getopt(optlist, "rw", NULL, NULL) == 0)
629 fsflags &= ~MNT_RDONLY;
630
631 if (vfs_getopt(optlist, "snapshot", NULL, NULL) == 0)
632 fsflags |= MNT_SNAPSHOT;
633
634 if (vfs_getopt(optlist, "suiddir", NULL, NULL) == 0)
635 fsflags |= MNT_SUIDDIR;
636
637 if (vfs_getopt(optlist, "sync", NULL, NULL) == 0)
638 fsflags |= MNT_SYNCHRONOUS;
639
640 if (vfs_getopt(optlist, "union", NULL, NULL) == 0)
641 fsflags |= MNT_UNION;
642
643 /*
644 * Be ultra-paranoid about making sure the type and fspath
645 * variables will fit in our mp buffers, including the
646 * terminating NUL.
647 */
648 if (fstypelen >= MFSNAMELEN - 1 || fspathlen >= MNAMELEN - 1) {
649 error = ENAMETOOLONG;
650 goto bail;

--- 1409 unchanged lines hidden ---
626 /*
627 * Be ultra-paranoid about making sure the type and fspath
628 * variables will fit in our mp buffers, including the
629 * terminating NUL.
630 */
631 if (fstypelen >= MFSNAMELEN - 1 || fspathlen >= MNAMELEN - 1) {
632 error = ENAMETOOLONG;
633 goto bail;

--- 1409 unchanged lines hidden ---