- register struct a {
- char *fspec;
- char *freg;
- int ronly;
- } *uap = (struct a *)u.u_ap;
- dev_t dev;
- register struct inode *ip;
- register struct fs *fs;
- register char *cp;
- register struct nameidata *ndp = &u.u_nd;
- u_int len;
-
- u.u_error = getmdev(&dev, uap->fspec);
- if (u.u_error)
- return;
- ndp->ni_nameiop = LOOKUP | NOCACHE | FOLLOW;
- ndp->ni_segflg = UIO_USERSPACE;
- ndp->ni_dirp = (caddr_t)uap->freg;
- ip = namei(ndp);
- if (ip == NULL)
- return;
- if (ip->i_count!=1 || (ip->i_mode&IFMT) != IFDIR) {
- iput(ip);
- u.u_error = EBUSY;
- return;
+ panic("lfs_mountroot"); /* XXX -- implement */
+}
+
+/*
+ * VFS Operations.
+ *
+ * mount system call
+ */
+lfs_mount(mp, path, data, ndp, p)
+ register struct mount *mp;
+ char *path;
+ caddr_t data;
+ struct nameidata *ndp;
+ struct proc *p;
+{
+ struct vnode *devvp;
+ struct ufs_args args;
+ struct ufsmount *ump;
+ register struct lfs *fs; /* LFS */
+ u_int size;
+ int error;
+
+ if (error = copyin(data, (caddr_t)&args, sizeof (struct ufs_args)))
+ return (error);
+
+ /* Until LFS can do NFS right. XXX */
+ if (args.export.ex_flags & MNT_EXPORTED)
+ return (EINVAL);
+
+ /*
+ * If updating, check whether changing from read-only to
+ * read/write; if there is no device name, that's all we do.
+ */
+ if (mp->mnt_flag & MNT_UPDATE) {
+ ump = VFSTOUFS(mp);
+#ifdef NOTLFS /* LFS */
+ fs = ump->um_fs;
+ if (fs->fs_ronly && (mp->mnt_flag & MNT_RDONLY) == 0)
+ fs->fs_ronly = 0;
+#else
+ fs = ump->um_lfs;
+ if (fs->lfs_ronly && (mp->mnt_flag & MNT_RDONLY) == 0)
+ fs->lfs_ronly = 0;
+#endif
+ if (args.fspec == 0) {
+ /*
+ * Process export requests.
+ */
+ return (vfs_export(mp, &ump->um_export, &args.export));
+ }
+ }
+ /*
+ * Not an update, or updating the name: look up the name
+ * and verify that it refers to a sensible block device.
+ */
+ NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, p);
+ if (error = namei(ndp))
+ return (error);
+ devvp = ndp->ni_vp;
+ if (devvp->v_type != VBLK) {
+ vrele(devvp);
+ return (ENOTBLK);
+ }
+ if (major(devvp->v_rdev) >= nblkdev) {
+ vrele(devvp);
+ return (ENXIO);
+ }
+ if ((mp->mnt_flag & MNT_UPDATE) == 0)
+ error = lfs_mountfs(devvp, mp, p); /* LFS */
+ else {
+ if (devvp != ump->um_devvp)
+ error = EINVAL; /* needs translation */
+ else
+ vrele(devvp);