| 937 | } |
| 938 | |
| 939 | static int |
| 940 | vfs_mountroot_readconf(struct thread *td, struct sbuf *sb) |
| 941 | { |
| 942 | static char buf[128]; |
| 943 | struct nameidata nd; |
| 944 | off_t ofs; |
| 945 | ssize_t resid; |
| 946 | int error, flags, len; |
| 947 | |
| 948 | NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, "/.mount.conf", td); |
| 949 | flags = FREAD; |
| 950 | error = vn_open(&nd, &flags, 0, NULL); |
| 951 | if (error) |
| 952 | return (error); |
| 953 | |
| 954 | NDFREE(&nd, NDF_ONLY_PNBUF); |
| 955 | ofs = 0; |
| 956 | len = sizeof(buf) - 1; |
| 957 | while (1) { |
| 958 | error = vn_rdwr(UIO_READ, nd.ni_vp, buf, len, ofs, |
| 959 | UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred, |
| 960 | NOCRED, &resid, td); |
| 961 | if (error) |
| 962 | break; |
| 963 | if (resid == len) |
| 964 | break; |
| 965 | buf[len - resid] = 0; |
| 966 | sbuf_printf(sb, "%s", buf); |
| 967 | ofs += len - resid; |
| 968 | } |
| 969 | |
| 970 | VOP_UNLOCK(nd.ni_vp); |
| 971 | vn_close(nd.ni_vp, FREAD, td->td_ucred, td); |
| 972 | return (error); |
| 973 | } |
| 974 | |
| 975 | static void |
| 976 | vfs_mountroot_wait(void) |
no test coverage detected