MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vfs_mountroot_parse

Function vfs_mountroot_parse

freebsd/kern/vfs_mountroot.c:823–890  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

821#undef ERRMSGL
822
823static int
824vfs_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
832retry:
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.");

Callers 1

vfs_mountrootFunction · 0.85

Calls 9

sbuf_dataFunction · 0.85
parse_skiptoFunction · 0.85
parse_advanceFunction · 0.85
parse_peekFunction · 0.85
parse_directiveFunction · 0.85
parse_mountFunction · 0.85
kern_rebootFunction · 0.85
printfFunction · 0.70
panicFunction · 0.70

Tested by

no test coverage detected