The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/coda/coda_vfsops.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: coda_vfsops.c,v 1.33.2.1 2004/05/29 09:04:35 tron Exp $        */
    2 
    3 /*
    4  * 
    5  *             Coda: an Experimental Distributed File System
    6  *                              Release 3.1
    7  * 
    8  *           Copyright (c) 1987-1998 Carnegie Mellon University
    9  *                          All Rights Reserved
   10  * 
   11  * Permission  to  use, copy, modify and distribute this software and its
   12  * documentation is hereby granted,  provided  that  both  the  copyright
   13  * notice  and  this  permission  notice  appear  in  all  copies  of the
   14  * software, derivative works or  modified  versions,  and  any  portions
   15  * thereof, and that both notices appear in supporting documentation, and
   16  * that credit is given to Carnegie Mellon University  in  all  documents
   17  * and publicity pertaining to direct or indirect use of this code or its
   18  * derivatives.
   19  * 
   20  * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS  KNOWN  TO  HAVE  BUGS,
   21  * SOME  OF  WHICH MAY HAVE SERIOUS CONSEQUENCES.  CARNEGIE MELLON ALLOWS
   22  * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.   CARNEGIE  MELLON
   23  * DISCLAIMS  ANY  LIABILITY  OF  ANY  KIND  FOR  ANY  DAMAGES WHATSOEVER
   24  * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE  OR  OF
   25  * ANY DERIVATIVE WORK.
   26  * 
   27  * Carnegie  Mellon  encourages  users  of  this  software  to return any
   28  * improvements or extensions that  they  make,  and  to  grant  Carnegie
   29  * Mellon the rights to redistribute these changes without encumbrance.
   30  * 
   31  *      @(#) cfs/coda_vfsops.c,v 1.1.1.1 1998/08/29 21:26:45 rvb Exp $ 
   32  */
   33 
   34 /* 
   35  * Mach Operating System
   36  * Copyright (c) 1989 Carnegie-Mellon University
   37  * All rights reserved.  The CMU software License Agreement specifies
   38  * the terms and conditions for use and redistribution.
   39  */
   40 
   41 /*
   42  * This code was written for the Coda file system at Carnegie Mellon
   43  * University.  Contributers include David Steere, James Kistler, and
   44  * M. Satyanarayanan.  
   45  */
   46 
   47 #include <sys/cdefs.h>
   48 __KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.33.2.1 2004/05/29 09:04:35 tron Exp $");
   49 
   50 #ifdef  _LKM
   51 #define NVCODA 4
   52 #else
   53 #include <vcoda.h>
   54 #endif
   55 
   56 #include <sys/param.h>
   57 #include <sys/systm.h>
   58 #include <sys/sysctl.h>
   59 #include <sys/malloc.h>
   60 #include <sys/conf.h>
   61 #include <sys/namei.h>
   62 #include <sys/mount.h>
   63 #include <sys/proc.h>
   64 #include <sys/select.h>
   65 
   66 #include <coda/coda.h>
   67 #include <coda/cnode.h>
   68 #include <coda/coda_vfsops.h>
   69 #include <coda/coda_venus.h>
   70 #include <coda/coda_subr.h>
   71 #include <coda/coda_opstats.h>
   72 /* for VN_RDEV */
   73 #include <miscfs/specfs/specdev.h>
   74 
   75 MALLOC_DEFINE(M_CODA, "coda", "Coda file system structures and tables");
   76 
   77 int codadebug = 0;
   78 
   79 int coda_vfsop_print_entry = 0;
   80 #define ENTRY if(coda_vfsop_print_entry) myprintf(("Entered %s\n",__func__))
   81 
   82 struct vnode *coda_ctlvp;
   83 struct coda_mntinfo coda_mnttbl[NVCODA]; /* indexed by minor device number */
   84 
   85 /* structure to keep statistics of internally generated/satisfied calls */
   86 
   87 struct coda_op_stats coda_vfsopstats[CODA_VFSOPS_SIZE];
   88 
   89 #define MARK_ENTRY(op) (coda_vfsopstats[op].entries++)
   90 #define MARK_INT_SAT(op) (coda_vfsopstats[op].sat_intrn++)
   91 #define MARK_INT_FAIL(op) (coda_vfsopstats[op].unsat_intrn++)
   92 #define MRAK_INT_GEN(op) (coda_vfsopstats[op].gen_intrn++)
   93 
   94 extern const struct cdevsw vcoda_cdevsw;
   95 extern const struct vnodeopv_desc coda_vnodeop_opv_desc;
   96 
   97 const struct vnodeopv_desc * const coda_vnodeopv_descs[] = {
   98         &coda_vnodeop_opv_desc,
   99         NULL,
  100 };
  101 
  102 struct vfsops coda_vfsops = {
  103     MOUNT_CODA,
  104     coda_mount,
  105     coda_start,
  106     coda_unmount,
  107     coda_root,
  108     coda_quotactl,
  109     coda_nb_statfs,
  110     coda_sync,
  111     coda_vget,
  112     (int (*) (struct mount *, struct fid *, struct vnode ** ))
  113         eopnotsupp,
  114     (int (*) (struct vnode *, struct fid *)) eopnotsupp,
  115     coda_init,
  116     NULL,
  117     coda_done,
  118     NULL,
  119     (int (*)(void)) eopnotsupp,
  120     (int (*)(struct mount *, struct mbuf *, int *, struct ucred **))
  121         eopnotsupp,
  122     coda_vnodeopv_descs,
  123     0
  124 };
  125 
  126 
  127 int
  128 coda_vfsopstats_init(void)
  129 {
  130         int i;
  131         
  132         for (i=0;i<CODA_VFSOPS_SIZE;i++) {
  133                 coda_vfsopstats[i].opcode = i;
  134                 coda_vfsopstats[i].entries = 0;
  135                 coda_vfsopstats[i].sat_intrn = 0;
  136                 coda_vfsopstats[i].unsat_intrn = 0;
  137                 coda_vfsopstats[i].gen_intrn = 0;
  138         }
  139         
  140         return 0;
  141 }
  142 
  143 /*
  144  * cfs mount vfsop
  145  * Set up mount info record and attach it to vfs struct.
  146  */
  147 /*ARGSUSED*/
  148 int
  149 coda_mount(vfsp, path, data, ndp, p)
  150     struct mount *vfsp;         /* Allocated and initialized by mount(2) */
  151     const char *path;           /* path covered: ignored by the fs-layer */
  152     void *data;                 /* Need to define a data type for this in netbsd? */
  153     struct nameidata *ndp;      /* Clobber this to lookup the device name */
  154     struct proc *p;             /* The ever-famous proc pointer */
  155 {
  156     struct vnode *dvp;
  157     struct cnode *cp;
  158     dev_t dev;
  159     struct coda_mntinfo *mi;
  160     struct vnode *rootvp;
  161     const struct cdevsw *cdev;
  162     CodaFid rootfid = INVAL_FID;
  163     CodaFid ctlfid = CTL_FID;
  164     int error;
  165 
  166     if (vfsp->mnt_flag & MNT_GETARGS)
  167         return 0;
  168     ENTRY;
  169 
  170     coda_vfsopstats_init();
  171     coda_vnodeopstats_init();
  172     
  173     MARK_ENTRY(CODA_MOUNT_STATS);
  174     if (CODA_MOUNTED(vfsp)) {
  175         MARK_INT_FAIL(CODA_MOUNT_STATS);
  176         return(EBUSY);
  177     }
  178     
  179     /* Validate mount device.  Similar to getmdev(). */
  180 
  181     NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, data, p);
  182     error = namei(ndp);
  183     dvp = ndp->ni_vp;
  184 
  185     if (error) {
  186         MARK_INT_FAIL(CODA_MOUNT_STATS);
  187         return (error);
  188     }
  189     if (dvp->v_type != VCHR) {
  190         MARK_INT_FAIL(CODA_MOUNT_STATS);
  191         vrele(dvp);
  192         return(ENXIO);
  193     }
  194     dev = dvp->v_specinfo->si_rdev;
  195     vrele(dvp);
  196     cdev = cdevsw_lookup(dev);
  197     if (cdev == NULL) {
  198         MARK_INT_FAIL(CODA_MOUNT_STATS);
  199         return(ENXIO);
  200     }
  201 
  202     /*
  203      * See if the device table matches our expectations.
  204      */
  205     if (cdev != &vcoda_cdevsw)
  206     {
  207         MARK_INT_FAIL(CODA_MOUNT_STATS);
  208         return(ENXIO);
  209     }
  210     
  211     if (minor(dev) >= NVCODA || minor(dev) < 0) {
  212         MARK_INT_FAIL(CODA_MOUNT_STATS);
  213         return(ENXIO);
  214     }
  215     
  216     /*
  217      * Initialize the mount record and link it to the vfs struct
  218      */
  219     mi = &coda_mnttbl[minor(dev)];
  220     
  221     if (!VC_OPEN(&mi->mi_vcomm)) {
  222         MARK_INT_FAIL(CODA_MOUNT_STATS);
  223         return(ENODEV);
  224     }
  225     
  226     /* No initialization (here) of mi_vcomm! */
  227     vfsp->mnt_data = mi;
  228     vfsp->mnt_stat.f_fsid.val[0] = 0;
  229     vfsp->mnt_stat.f_fsid.val[1] = makefstype(MOUNT_CODA);
  230     mi->mi_vfsp = vfsp;
  231     
  232     /*
  233      * Make a root vnode to placate the Vnode interface, but don't
  234      * actually make the CODA_ROOT call to venus until the first call
  235      * to coda_root in case a server is down while venus is starting.
  236      */
  237     cp = make_coda_node(&rootfid, vfsp, VDIR);
  238     rootvp = CTOV(cp);
  239     rootvp->v_flag |= VROOT;
  240         
  241 /*  cp = make_coda_node(&ctlfid, vfsp, VCHR);
  242     The above code seems to cause a loop in the cnode links.
  243     I don't totally understand when it happens, it is caught
  244     when closing down the system.
  245  */
  246     cp = make_coda_node(&ctlfid, 0, VCHR);
  247 
  248     coda_ctlvp = CTOV(cp);
  249 
  250     /* Add vfs and rootvp to chain of vfs hanging off mntinfo */
  251     mi->mi_vfsp = vfsp;
  252     mi->mi_rootvp = rootvp;
  253     
  254     /* set filesystem block size */
  255     vfsp->mnt_stat.f_bsize = 8192;          /* XXX -JJK */
  256 
  257     /* error is currently guaranteed to be zero, but in case some
  258        code changes... */
  259     CODADEBUG(1,
  260              myprintf(("coda_mount returned %d\n",error)););
  261     if (error)
  262         MARK_INT_FAIL(CODA_MOUNT_STATS);
  263     else
  264         MARK_INT_SAT(CODA_MOUNT_STATS);
  265 
  266     return set_statfs_info("/coda", UIO_SYSSPACE, "CODA", UIO_SYSSPACE, vfsp,
  267         p);
  268 }
  269 
  270 int
  271 coda_start(vfsp, flags, p)
  272     struct mount *vfsp;
  273     int flags;
  274     struct proc *p;
  275 {
  276     ENTRY;
  277     vftomi(vfsp)->mi_started = 1;
  278     return (0);
  279 }
  280 
  281 int
  282 coda_unmount(vfsp, mntflags, p)
  283     struct mount *vfsp;
  284     int mntflags;
  285     struct proc *p;
  286 {
  287     struct coda_mntinfo *mi = vftomi(vfsp);
  288     int active, error = 0;
  289     
  290     ENTRY;
  291     MARK_ENTRY(CODA_UMOUNT_STATS);
  292     if (!CODA_MOUNTED(vfsp)) {
  293         MARK_INT_FAIL(CODA_UMOUNT_STATS);
  294         return(EINVAL);
  295     }
  296     
  297     if (mi->mi_vfsp == vfsp) {  /* We found the victim */
  298         if (!IS_UNMOUNTING(VTOC(mi->mi_rootvp)))
  299             return (EBUSY);     /* Venus is still running */
  300 
  301 #ifdef  DEBUG
  302         printf("coda_unmount: ROOT: vp %p, cp %p\n", mi->mi_rootvp, VTOC(mi->mi_rootvp));
  303 #endif
  304         mi->mi_started = 0;
  305 
  306         vrele(mi->mi_rootvp);
  307 
  308         active = coda_kill(vfsp, NOT_DOWNCALL);
  309         mi->mi_rootvp->v_flag &= ~VROOT;
  310         error = vflush(mi->mi_vfsp, NULLVP, FORCECLOSE);
  311         printf("coda_unmount: active = %d, vflush active %d\n", active, error);
  312         error = 0;
  313 
  314         /* I'm going to take this out to allow lookups to go through. I'm
  315          * not sure it's important anyway. -- DCS 2/2/94
  316          */
  317         /* vfsp->VFS_DATA = NULL; */
  318 
  319         /* No more vfsp's to hold onto */
  320         mi->mi_vfsp = NULL;
  321         mi->mi_rootvp = NULL;
  322 
  323         if (error)
  324             MARK_INT_FAIL(CODA_UMOUNT_STATS);
  325         else
  326             MARK_INT_SAT(CODA_UMOUNT_STATS);
  327 
  328         return(error);
  329     }
  330     return (EINVAL);
  331 }
  332 
  333 /*
  334  * find root of cfs
  335  */
  336 int
  337 coda_root(vfsp, vpp)
  338         struct mount *vfsp;
  339         struct vnode **vpp;
  340 {
  341     struct coda_mntinfo *mi = vftomi(vfsp);
  342     int error;
  343     struct proc *p = curproc;    /* XXX - bnoble */
  344     CodaFid VFid;
  345     static const CodaFid invalfid = INVAL_FID;
  346 
  347     ENTRY;
  348     MARK_ENTRY(CODA_ROOT_STATS);
  349     
  350     if (vfsp == mi->mi_vfsp) {
  351         if (memcmp(&VTOC(mi->mi_rootvp)->c_fid, &invalfid, sizeof(CodaFid)))
  352             { /* Found valid root. */
  353                 *vpp = mi->mi_rootvp;
  354                 /* On Mach, this is vref.  On NetBSD, VOP_LOCK */
  355                 vref(*vpp);
  356                 vn_lock(*vpp, LK_EXCLUSIVE);
  357                 MARK_INT_SAT(CODA_ROOT_STATS);
  358                 return(0);
  359             }
  360     }
  361 
  362     error = venus_root(vftomi(vfsp), p->p_cred->pc_ucred, p, &VFid);
  363 
  364     if (!error) {
  365         /*
  366          * Save the new rootfid in the cnode, and rehash the cnode into the
  367          * cnode hash with the new fid key.
  368          */
  369         coda_unsave(VTOC(mi->mi_rootvp));
  370         VTOC(mi->mi_rootvp)->c_fid = VFid;
  371         coda_save(VTOC(mi->mi_rootvp));
  372 
  373         *vpp = mi->mi_rootvp;
  374         vref(*vpp);
  375         vn_lock(*vpp, LK_EXCLUSIVE);
  376         MARK_INT_SAT(CODA_ROOT_STATS);
  377         goto exit;
  378     } else if (error == ENODEV || error == EINTR) {
  379         /* Gross hack here! */
  380         /*
  381          * If Venus fails to respond to the CODA_ROOT call, coda_call returns
  382          * ENODEV. Return the uninitialized root vnode to allow vfs
  383          * operations such as unmount to continue. Without this hack,
  384          * there is no way to do an unmount if Venus dies before a 
  385          * successful CODA_ROOT call is done. All vnode operations 
  386          * will fail.
  387          */
  388         *vpp = mi->mi_rootvp;
  389         vref(*vpp);
  390         vn_lock(*vpp, LK_EXCLUSIVE);
  391         MARK_INT_FAIL(CODA_ROOT_STATS);
  392         error = 0;
  393         goto exit;
  394     } else {
  395         CODADEBUG( CODA_ROOT, myprintf(("error %d in CODA_ROOT\n", error)); );
  396         MARK_INT_FAIL(CODA_ROOT_STATS);
  397                 
  398         goto exit;
  399     }
  400  exit:
  401     return(error);
  402 }
  403 
  404 int
  405 coda_quotactl(vfsp, cmd, uid, arg, p)
  406     struct mount *vfsp;
  407     int cmd;
  408     uid_t uid;
  409     caddr_t arg;
  410     struct proc *p;
  411 {
  412     ENTRY;
  413     return (EOPNOTSUPP);
  414 }
  415      
  416 /*
  417  * Get file system statistics.
  418  */
  419 int
  420 coda_nb_statfs(vfsp, sbp, p)
  421     struct mount *vfsp;
  422     struct statfs *sbp;
  423     struct proc *p;
  424 {
  425     struct coda_statfs fsstat;
  426     int error;
  427 
  428     ENTRY;
  429     MARK_ENTRY(CODA_STATFS_STATS);
  430     if (!CODA_MOUNTED(vfsp)) {
  431 /*      MARK_INT_FAIL(CODA_STATFS_STATS); */
  432         return(EINVAL);
  433     }
  434     
  435     /* XXX - what to do about f_flags, others? --bnoble */
  436     /* Below This is what AFS does
  437         #define NB_SFS_SIZ 0x895440
  438      */
  439     /* Note: Normal fs's have a bsize of 0x400 == 1024 */
  440 
  441     error = venus_statfs(vftomi(vfsp), p->p_cred->pc_ucred, p, &fsstat);
  442 
  443     if (!error) {
  444         sbp->f_type = 0;
  445         sbp->f_bsize = 8192; /* XXX */
  446         sbp->f_iosize = 8192; /* XXX */
  447         sbp->f_blocks = fsstat.f_blocks;
  448         sbp->f_bfree  = fsstat.f_bfree;
  449         sbp->f_bavail = fsstat.f_bavail;
  450         sbp->f_files  = fsstat.f_files;
  451         sbp->f_ffree  = fsstat.f_ffree;
  452         copy_statfs_info(sbp, vfsp);
  453     }
  454 
  455     MARK_INT_SAT(CODA_STATFS_STATS);
  456     return(error);
  457 }
  458 
  459 /*
  460  * Flush any pending I/O.
  461  */
  462 int
  463 coda_sync(vfsp, waitfor, cred, p)
  464     struct mount *vfsp;
  465     int    waitfor;
  466     struct ucred *cred;
  467     struct proc *p;
  468 {
  469     ENTRY;
  470     MARK_ENTRY(CODA_SYNC_STATS);
  471     MARK_INT_SAT(CODA_SYNC_STATS);
  472     return(0);
  473 }
  474 
  475 int
  476 coda_vget(vfsp, ino, vpp)
  477     struct mount *vfsp;
  478     ino_t ino;
  479     struct vnode **vpp;
  480 {
  481     ENTRY;
  482     return (EOPNOTSUPP);
  483 }
  484 
  485 /* 
  486  * fhtovp is now what vget used to be in 4.3-derived systems.  For
  487  * some silly reason, vget is now keyed by a 32 bit ino_t, rather than
  488  * a type-specific fid.  
  489  */
  490 int
  491 coda_fhtovp(vfsp, fhp, nam, vpp, exflagsp, creadanonp)
  492     struct mount *vfsp;    
  493     struct fid *fhp;
  494     struct mbuf *nam;
  495     struct vnode **vpp;
  496     int *exflagsp;
  497     struct ucred **creadanonp;
  498 {
  499     struct cfid *cfid = (struct cfid *)fhp;
  500     struct cnode *cp = 0;
  501     int error;
  502     struct proc *p = curproc; /* XXX -mach */
  503     CodaFid VFid;
  504     int vtype;
  505 
  506     ENTRY;
  507     
  508     MARK_ENTRY(CODA_VGET_STATS);
  509     /* Check for vget of control object. */
  510     if (IS_CTL_FID(&cfid->cfid_fid)) {
  511         *vpp = coda_ctlvp;
  512         vref(coda_ctlvp);
  513         MARK_INT_SAT(CODA_VGET_STATS);
  514         return(0);
  515     }
  516     
  517     error = venus_fhtovp(vftomi(vfsp), &cfid->cfid_fid, p->p_cred->pc_ucred, p, &VFid, &vtype);
  518     
  519     if (error) {
  520         CODADEBUG(CODA_VGET, myprintf(("vget error %d\n",error));)
  521             *vpp = (struct vnode *)0;
  522     } else {
  523         CODADEBUG(CODA_VGET, 
  524                  myprintf(("vget: %s type %d result %d\n",
  525                         coda_f2s(&VFid), vtype, error)); )
  526             
  527         cp = make_coda_node(&VFid, vfsp, vtype);
  528         *vpp = CTOV(cp);
  529     }
  530     return(error);
  531 }
  532 
  533 int
  534 coda_vptofh(vnp, fidp)
  535     struct vnode *vnp;
  536     struct fid   *fidp;
  537 {
  538     ENTRY;
  539     return (EOPNOTSUPP);
  540 }
  541 
  542 void
  543 coda_init(void)
  544 {
  545     ENTRY;
  546 }
  547 
  548 void
  549 coda_done(void)
  550 {
  551     ENTRY;
  552 }
  553 
  554 SYSCTL_SETUP(sysctl_vfs_coda_setup, "sysctl vfs.coda subtree setup")
  555 {
  556         sysctl_createv(clog, 0, NULL, NULL,
  557                        CTLFLAG_PERMANENT,
  558                        CTLTYPE_NODE, "vfs", NULL,
  559                        NULL, 0, NULL, 0,
  560                        CTL_VFS, CTL_EOL);
  561         sysctl_createv(clog, 0, NULL, NULL,
  562                        CTLFLAG_PERMANENT,
  563                        CTLTYPE_NODE, "coda",
  564                        SYSCTL_DESCR("code vfs options"),
  565                        NULL, 0, NULL, 0,
  566                        CTL_VFS, 18, CTL_EOL);
  567         /*
  568          * XXX the "18" above could be dynamic, thereby eliminating
  569          * one more instance of the "number to vfs" mapping problem,
  570          * but "18" is the order as taken from sys/mount.h
  571          */
  572 
  573 /*
  574         sysctl_createv(clog, 0, NULL, NULL,
  575                        CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
  576                        CTLTYPE_INT, "clusterread",
  577                        SYSCTL_DESCR( anyone? ),
  578                        NULL, 0, &doclusterread, 0,
  579                        CTL_VFS, 18, FFS_CLUSTERREAD, CTL_EOL);
  580 */
  581 }
  582 
  583 /*
  584  * To allow for greater ease of use, some vnodes may be orphaned when
  585  * Venus dies.  Certain operations should still be allowed to go
  586  * through, but without propagating orphan-ness.  So this function will
  587  * get a new vnode for the file from the current run of Venus.
  588  */
  589  
  590 int
  591 getNewVnode(vpp)
  592      struct vnode **vpp;
  593 {
  594     struct cfid cfid;
  595     struct coda_mntinfo *mi = vftomi((*vpp)->v_mount);
  596     
  597     ENTRY;
  598 
  599     cfid.cfid_len = (short)sizeof(CodaFid);
  600     cfid.cfid_fid = VTOC(*vpp)->c_fid;  /* Structure assignment. */
  601     /* XXX ? */
  602 
  603     /* We're guessing that if set, the 1st element on the list is a
  604      * valid vnode to use. If not, return ENODEV as venus is dead.
  605      */
  606     if (mi->mi_vfsp == NULL)
  607         return ENODEV;
  608     
  609     return coda_fhtovp(mi->mi_vfsp, (struct fid*)&cfid, NULL, vpp,
  610                       NULL, NULL);
  611 }
  612 
  613 #include <ufs/ufs/quota.h>
  614 #include <ufs/ufs/ufsmount.h>
  615 /* get the mount structure corresponding to a given device.  Assume 
  616  * device corresponds to a UFS. Return NULL if no device is found.
  617  */ 
  618 struct mount *devtomp(dev)
  619     dev_t dev;
  620 {
  621     struct mount *mp, *nmp;
  622     
  623     for (mp = mountlist.cqh_first; mp != (void*)&mountlist; mp = nmp) {
  624         nmp = mp->mnt_list.cqe_next;
  625         if ((!strcmp(mp->mnt_op->vfs_name, MOUNT_UFS)) &&
  626             ((VFSTOUFS(mp))->um_dev == (dev_t) dev)) {
  627             /* mount corresponds to UFS and the device matches one we want */
  628             return(mp); 
  629         }
  630     }
  631     /* mount structure wasn't found */ 
  632     return(NULL); 
  633 }

Cache object: 2bc126b184e543a7f0145af8aaedb93a


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.