/* * The sys call that tells the system about a quota file. */ setquota() { register struct a { char *fblk; char *fname; } *uap = (struct a *)u.u_ap; register struct mount *mp; dev_t dev; #ifndef QUOTA u.u_error = EINVAL; return; #else u.u_error = getmdev(&dev, uap->fblk); if (u.u_error) return; for (mp = mount; mp < &mount[NMOUNT]; mp++) if (mp->m_bufp && mp->m_dev == dev) { if (uap->fname == NULL) closedq(mp); else opendq(mp, (caddr_t)uap->fname); return; } #endif }
smount() { 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 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 | 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) { iput(ip); u.u_error = EBUSY; return; } if ((ip->i_mode&IFMT) != IFDIR) { iput(ip); u.u_error = ENOTDIR; return; } fs = mountfs(dev, uap->ronly, ip); if (fs == 0) return; (void) copyinstr(uap->freg, fs->fs_fsmnt, sizeof(fs->fs_fsmnt)-1, &len); bzero(fs->fs_fsmnt + len, sizeof (fs->fs_fsmnt) - len); }