Lines Matching +full:conf +full:- +full:mdio
1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
5 * Copyright (c) 1999-2004 Poul-Henning Kamp
43 #include <sys/conf.h>
158 sbuf_printf(&sb, "%s", h->who); in sysctl_vfs_root_mount_hold()
175 h->flags = RH_ALLOC; in root_mount_hold()
176 h->who = identifier; in root_mount_hold()
191 h->flags = RH_ARG; in root_mount_hold_token()
192 h->who = identifier; in root_mount_hold_token()
211 if (h == NULL || h->flags == RH_FREE) in root_mount_rel()
219 if (h->flags == RH_ALLOC) { in root_mount_rel()
222 h->flags = RH_FREE; in root_mount_rel()
269 mp = vfs_mount_alloc(NULLVP, vfsp, "/dev", td->td_ucred); in vfs_mountroot_devfs()
276 error = VFS_STATFS(mp, &mp->mnt_stat); in vfs_mountroot_devfs()
283 mp->mnt_opt = opts; in vfs_mountroot_devfs()
298 printf("kern_symlink /dev -> / returns %d\n", error); in vfs_mountroot_devfs()
333 vporoot->v_iflag &= ~VI_MOUNT; in vfs_mountroot_shuffle()
335 vporoot->v_mountedhere = NULL; in vfs_mountroot_shuffle()
337 mporoot->mnt_flag &= ~MNT_ROOTFS; in vfs_mountroot_shuffle()
338 mporoot->mnt_vnodecovered = NULL; in vfs_mountroot_shuffle()
342 mpnroot->mnt_vnodecovered = NULL; in vfs_mountroot_shuffle()
344 cache_purgevfs(rootvnode->v_mount); in vfs_mountroot_shuffle()
360 error = (vp->v_type == VDIR) ? 0 : ENOTDIR; in vfs_mountroot_shuffle()
366 mporoot->mnt_vnodecovered = vp; in vfs_mountroot_shuffle()
368 vp->v_mountedhere = mporoot; in vfs_mountroot_shuffle()
369 strlcpy(mporoot->mnt_stat.f_mntonname, in vfs_mountroot_shuffle()
388 error = (vp->v_type == VDIR) ? 0 : ENOTDIR; in vfs_mountroot_shuffle()
392 vpdevfs = mpdevfs->mnt_vnodecovered; in vfs_mountroot_shuffle()
397 vpdevfs->v_mountedhere = NULL; in vfs_mountroot_shuffle()
402 mpdevfs->mnt_vnodecovered = vp; in vfs_mountroot_shuffle()
404 vp->v_mountedhere = mpdevfs; in vfs_mountroot_shuffle()
416 /* Unlink the no longer needed /dev/dev -> / symlink */ in vfs_mountroot_shuffle()
430 #define CC_WHITESPACE -1
431 #define CC_NONWHITESPACE -2
434 #define PE_EOF -1
435 #define PE_EOL -2
438 parse_peek(char **conf) in parse_peek() argument
441 return (**conf); in parse_peek()
445 parse_poke(char **conf, int c) in parse_poke() argument
448 **conf = c; in parse_poke()
452 parse_advance(char **conf) in parse_advance() argument
455 (*conf)++; in parse_advance()
459 parse_skipto(char **conf, int mc) in parse_skipto() argument
464 c = parse_peek(conf); in parse_skipto()
482 parse_advance(conf); in parse_skipto()
488 parse_token(char **conf, char **tok) in parse_token() argument
495 error = parse_skipto(conf, CC_NONWHITESPACE); in parse_token()
498 p = *conf; in parse_token()
499 error = parse_skipto(conf, CC_WHITESPACE); in parse_token()
500 len = *conf - p; in parse_token()
519 parse_dir_ask(char **conf) in parse_dir_ask() argument
540 printf("mount -t cd9660 -o ro /dev/cd0 /)\n"); in parse_dir_ask()
563 if (error == -1) in parse_dir_ask()
571 parse_dir_md(char **conf) in parse_dir_md() argument
575 struct md_ioctl *mdio; in parse_dir_md() local
580 fd = -1; in parse_dir_md()
582 error = parse_token(conf, &tok); in parse_dir_md()
587 mdio = malloc(sizeof(*mdio) + len + 1, M_TEMP, M_WAITOK | M_ZERO); in parse_dir_md()
588 path = (void *)(mdio + 1); in parse_dir_md()
603 fd = td->td_retval[0]; in parse_dir_md()
604 mdio->md_version = MDIOVERSION; in parse_dir_md()
605 mdio->md_type = MD_VNODE; in parse_dir_md()
607 if (root_mount_mddev != -1) { in parse_dir_md()
608 mdio->md_unit = root_mount_mddev; in parse_dir_md()
609 (void)kern_ioctl(td, fd, MDIOCDETACH, (void *)mdio); in parse_dir_md()
611 root_mount_mddev = -1; in parse_dir_md()
614 mdio->md_file = (void *)(mdio + 1); in parse_dir_md()
615 mdio->md_options = MD_AUTOUNIT | MD_READONLY; in parse_dir_md()
616 mdio->md_mediasize = sb.st_size; in parse_dir_md()
617 mdio->md_unit = 0; in parse_dir_md()
618 error = kern_ioctl(td, fd, MDIOCATTACH, (void *)mdio); in parse_dir_md()
622 if (mdio->md_unit > 9) { in parse_dir_md()
624 mdio->md_file = NULL; in parse_dir_md()
625 mdio->md_options = 0; in parse_dir_md()
626 mdio->md_mediasize = 0; in parse_dir_md()
627 error = kern_ioctl(td, fd, MDIOCDETACH, (void *)mdio); in parse_dir_md()
633 root_mount_mddev = mdio->md_unit; in parse_dir_md()
634 printf(MD_NAME "%u attached to %s\n", root_mount_mddev, mdio->md_file); in parse_dir_md()
639 free(mdio, M_TEMP); in parse_dir_md()
644 parse_dir_onfail(char **conf) in parse_dir_onfail() argument
649 error = parse_token(conf, &action); in parse_dir_onfail()
671 parse_dir_timeout(char **conf) in parse_dir_timeout() argument
677 error = parse_token(conf, &tok); in parse_dir_timeout()
690 parse_directive(char **conf) in parse_directive() argument
695 error = parse_token(conf, &dir); in parse_directive()
700 error = parse_dir_ask(conf); in parse_directive()
702 error = parse_dir_md(conf); in parse_directive()
704 error = parse_dir_onfail(conf); in parse_directive()
706 error = parse_dir_timeout(conf); in parse_directive()
710 (void)parse_skipto(conf, '\n'); in parse_directive()
734 parse_mount(char **conf) in parse_mount() argument
741 error = parse_token(conf, &tok); in parse_mount()
754 if (root_mount_mddev != -1) { in parse_mount()
762 error = parse_token(conf, &tok); in parse_mount()
785 ma = mount_arg(ma, "fstype", fs, -1); in parse_mount()
786 ma = mount_arg(ma, "fspath", "/", -1); in parse_mount()
787 ma = mount_arg(ma, "from", dev, -1); in parse_mount()
803 timeout -= delay; in parse_mount()
817 /* kernel_mount can return -1 on error. */ in parse_mount()
826 char *conf; in vfs_mountroot_parse() local
829 root_mount_mddev = -1; in vfs_mountroot_parse()
832 conf = sbuf_data(sb); in vfs_mountroot_parse()
837 error = parse_skipto(&conf, CC_NONWHITESPACE); in vfs_mountroot_parse()
839 parse_advance(&conf); in vfs_mountroot_parse()
844 switch (parse_peek(&conf)) { in vfs_mountroot_parse()
846 error = parse_skipto(&conf, '\n'); in vfs_mountroot_parse()
849 error = parse_directive(&conf); in vfs_mountroot_parse()
852 error = parse_mount(&conf); in vfs_mountroot_parse()
853 if (error == -1) { in vfs_mountroot_parse()
863 if (parse_peek(&conf) != '\n') { in vfs_mountroot_parse()
865 (void)parse_skipto(&conf, '\n'); in vfs_mountroot_parse()
879 panic("mountroot: unable to (re-)mount root."); in vfs_mountroot_parse()
947 NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, "/.mount.conf"); in vfs_mountroot_readconf()
955 len = sizeof(buf) - 1; in vfs_mountroot_readconf()
958 UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred, in vfs_mountroot_readconf()
964 buf[len - resid] = 0; in vfs_mountroot_readconf()
966 ofs += len - resid; in vfs_mountroot_readconf()
970 vn_close(nd.ni_vp, FREAD, td->td_ucred, td); in vfs_mountroot_readconf()
998 printf(" %s", h->who); in vfs_mountroot_wait()
1049 timeout -= delay; in vfs_mountroot_wait_if_neccessary()
1100 if (mp->mnt_time > timebase) in vfs_mountroot()
1101 timebase = mp->mnt_time; in vfs_mountroot()
1162 (val_arg != NULL ? -1 : 0)); in parse_mountroot_options()