Date: Fri, 03 Dec 2004 22:22:56 +0100 From: "Poul-Henning Kamp" <phk@phk.freebsd.dk> To: arch@freebsd.org Subject: [HEADSUP] omount/nmount migration and rootfs mounting Message-ID: <26127.1102108976@critter.freebsd.dk>
next in thread | raw e-mail | index | archive | help
Ok, here is the big picture: All filesystems get a ->vfs_mount() which does the job. Filesystems which have a ->vfs_omount() looses it and gets a ->vfs_cmount() instead which after pulling compat args in calls the nmount() stuff. Here is my prototype for ffs: +static int +ffs_cmount(char *path, void *data, int flags, struct thread *td) +{ + struct ufs_args args; + struct iovec v[10]; + int error; + + if (data == NULL) + return (EINVAL); + error = copyin(data, &args, sizeof args); + if (error) + return (error); + + v[0].iov_base = "fstype"; + v[0].iov_len = strlen(v[0].iov_base) + 1; + v[1].iov_base = "ufs"; + v[1].iov_len = strlen(v[1].iov_base) + 1; + + v[2].iov_base = "fspath"; + v[2].iov_len = strlen(v[2].iov_base) + 1; + v[3].iov_base = path; + v[3].iov_len = strlen(v[3].iov_base) + 1; + + v[4].iov_base = "from"; + v[4].iov_len = strlen(v[4].iov_base) + 1; + v[5].iov_base = args.fspec; + v[5].iov_len = strlen(v[5].iov_base) + 1; + + v[6].iov_base = "export"; + v[6].iov_len = strlen(v[6].iov_base) + 1; + v[7].iov_base = &args.export; + v[7].iov_len = sizeof(args.export); + + v[8].iov_base = NULL; + v[8].iov_len = 0; + + error = kernel_mount(v, 8, flags); + + return (error); +} Root mounting will happen the following way: create a mountpoint. devfs->vfs_mount() on it. set rootdir for proc0 create symlink: /dev -> / Mount real root filesystem as / using normal ->vfs_mount() method. (filesystem contains no magic for this) Surgically move the devfs mount from / to /dev in the new rootfs. Keep an eye on p4:phk_bufwork, it works for ffs and nfs already. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?26127.1102108976>