Annotation of researchv10no/sys/os/mount.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * code related to mounting and unmounting filesystems
                      3:  */
                      4: #include "sys/param.h"
                      5: #include "sys/user.h"
                      6: #include "sys/inode.h"
                      7: #include "sys/file.h"
                      8: #include "sys/conf.h"
                      9: 
                     10: /*
                     11:  * sys fmount
                     12:  * call the filesystem-specific mount routine with
                     13:  *     the inode of the device to be mounted
                     14:  *     the inode of the mount point, still locked
                     15:  *     the flag argument
                     16:  */
                     17: 
                     18: fmount()
                     19: {
                     20:        register struct a {
                     21:                int fstype;
                     22:                int fd;
                     23:                char *name;
                     24:                int flag;
                     25:        } *uap = (struct a *)u.u_ap;
                     26:        struct file *fp;
                     27:        struct inode *ip;
                     28: 
                     29:        if (uap->fstype < 0 || uap->fstype >= nfstyp
                     30:        ||  fstypsw[uap->fstype] == NULL) {
                     31:                u.u_error = EINVAL;
                     32:                return;
                     33:        }
                     34:        if ((fp = getf(uap->fd)) == NULL) {
                     35:                u.u_error = EBADF;
                     36:                return;
                     37:        }
                     38:        if ((ip = namei(uap->name, SEGUDATA, &nilargnamei, 1)) == NULL)
                     39:                return;
                     40:        (*fstypsw[uap->fstype]->t_mount)(fp->f_inode, ip, uap->flag, 1, uap->fstype);
                     41:        iput(ip);
                     42: }
                     43: 
                     44: /*
                     45:  * sys funmount
                     46:  * call the fs-particular unmount routine with
                     47:  * the inode of the mount point
                     48:  */
                     49: 
                     50: funmount()
                     51: {
                     52:        struct a {
                     53:                char *name;
                     54:        } *uap = (struct a *)u.u_ap;
                     55:        struct inode *ip, *mip;
                     56: 
                     57:        if ((ip = namei(uap->name, SEGUDATA, &nilargnamei, 1)) == NULL)
                     58:                return;
                     59:        if ((mip = ip->i_mpoint) == NULL
                     60:        ||  mip->i_mroot != ip) {       /* sanity, also catches root */
                     61:                iput(ip);
                     62:                u.u_error = EINVAL;
                     63:                return;
                     64:        }
                     65:        iput(ip);       /* bag this? */
                     66:        (*fstypsw[ip->i_fstyp]->t_mount)((struct inode *)NULL, mip, 0, 0, ip->i_fstyp);
                     67: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.