| 821 | #undef ERRMSGL |
| 822 | |
| 823 | static int |
| 824 | vfs_mountroot_parse(struct sbuf *sb, struct mount *mpdevfs) |
| 825 | { |
| 826 | struct mount *mp; |
| 827 | char *conf; |
| 828 | int error; |
| 829 | |
| 830 | root_mount_mddev = -1; |
| 831 | |
| 832 | retry: |
| 833 | conf = sbuf_data(sb); |
| 834 | mp = TAILQ_NEXT(mpdevfs, mnt_list); |
| 835 | error = (mp == NULL) ? 0 : EDOOFUS; |
| 836 | root_mount_onfail = A_CONTINUE; |
| 837 | while (mp == NULL) { |
| 838 | error = parse_skipto(&conf, CC_NONWHITESPACE); |
| 839 | if (error == PE_EOL) { |
| 840 | parse_advance(&conf); |
| 841 | continue; |
| 842 | } |
| 843 | if (error < 0) |
| 844 | break; |
| 845 | switch (parse_peek(&conf)) { |
| 846 | case '#': |
| 847 | error = parse_skipto(&conf, '\n'); |
| 848 | break; |
| 849 | case '.': |
| 850 | error = parse_directive(&conf); |
| 851 | break; |
| 852 | default: |
| 853 | error = parse_mount(&conf); |
| 854 | if (error == -1) { |
| 855 | printf("mountroot: invalid file system " |
| 856 | "specification.\n"); |
| 857 | error = 0; |
| 858 | } |
| 859 | break; |
| 860 | } |
| 861 | if (error < 0) |
| 862 | break; |
| 863 | /* Ignore any trailing garbage on the line. */ |
| 864 | if (parse_peek(&conf) != '\n') { |
| 865 | printf("mountroot: advancing to next directive...\n"); |
| 866 | (void)parse_skipto(&conf, '\n'); |
| 867 | } |
| 868 | mp = TAILQ_NEXT(mpdevfs, mnt_list); |
| 869 | } |
| 870 | if (mp != NULL) |
| 871 | return (0); |
| 872 | |
| 873 | /* |
| 874 | * We failed to mount (a new) root. |
| 875 | */ |
| 876 | switch (root_mount_onfail) { |
| 877 | case A_CONTINUE: |
| 878 | break; |
| 879 | case A_PANIC: |
| 880 | panic("mountroot: unable to (re-)mount root."); |
no test coverage detected