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/cnode.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * 
    3  *             Coda: an Experimental Distributed File System
    4  *                              Release 3.1
    5  * 
    6  *           Copyright (c) 1987-1998 Carnegie Mellon University
    7  *                          All Rights Reserved
    8  * 
    9  * Permission  to  use, copy, modify and distribute this software and its
   10  * documentation is hereby granted,  provided  that  both  the  copyright
   11  * notice  and  this  permission  notice  appear  in  all  copies  of the
   12  * software, derivative works or  modified  versions,  and  any  portions
   13  * thereof, and that both notices appear in supporting documentation, and
   14  * that credit is given to Carnegie Mellon University  in  all  documents
   15  * and publicity pertaining to direct or indirect use of this code or its
   16  * derivatives.
   17  * 
   18  * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS  KNOWN  TO  HAVE  BUGS,
   19  * SOME  OF  WHICH MAY HAVE SERIOUS CONSEQUENCES.  CARNEGIE MELLON ALLOWS
   20  * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.   CARNEGIE  MELLON
   21  * DISCLAIMS  ANY  LIABILITY  OF  ANY  KIND  FOR  ANY  DAMAGES WHATSOEVER
   22  * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE  OR  OF
   23  * ANY DERIVATIVE WORK.
   24  * 
   25  * Carnegie  Mellon  encourages  users  of  this  software  to return any
   26  * improvements or extensions that  they  make,  and  to  grant  Carnegie
   27  * Mellon the rights to redistribute these changes without encumbrance.
   28  * 
   29  *      @(#) src/sys/coda/cnode.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ 
   30  * $FreeBSD: releng/6.2/sys/coda/cnode.h 143507 2005-03-13 12:09:34Z jeff $
   31  * 
   32  */
   33 
   34 /*-
   35  * Mach Operating System
   36  * Copyright (c) 1990 Carnegie-Mellon University
   37  * Copyright (c) 1989 Carnegie-Mellon University
   38  * All rights reserved.  The CMU software License Agreement specifies
   39  * the terms and conditions for use and redistribution.
   40  */
   41 
   42 /*
   43  * This code was written for the Coda filesystem at Carnegie Mellon University.
   44  * Contributers include David Steere, James Kistler, and M. Satyanarayanan.
   45  */
   46 
   47 #ifndef _CNODE_H_
   48 #define _CNODE_H_
   49 
   50 #include <sys/vnode.h>
   51 #include <sys/lock.h>
   52 #include <machine/clock.h>
   53 
   54 MALLOC_DECLARE(M_CODA);
   55 
   56 /*
   57  * tmp below since we need struct queue
   58  */
   59 #include <coda/coda_kernel.h>
   60 
   61 /*
   62  * Cnode lookup stuff.
   63  * NOTE: CODA_CACHESIZE must be a power of 2 for cfshash to work!
   64  */
   65 #define CODA_CACHESIZE 512
   66 
   67 #define CODA_ALLOC(ptr, cast, size)                                        \
   68 do {                                                                      \
   69     ptr = (cast)malloc((unsigned long) size, M_CODA, M_WAITOK);            \
   70     if (ptr == 0) {                                                       \
   71         panic("kernel malloc returns 0 at %s:%d\n", __FILE__, __LINE__);  \
   72     }                                                                     \
   73 } while (0)
   74 
   75 #define CODA_FREE(ptr, size)  free((ptr), M_CODA)
   76 
   77 /*
   78  * global cache state control
   79  */
   80 extern int coda_nc_use;
   81 
   82 /*
   83  * Used to select debugging statements throughout the cfs code.
   84  */
   85 extern int codadebug;
   86 extern int coda_nc_debug;
   87 extern int coda_printf_delay;
   88 extern int coda_vnop_print_entry;
   89 extern int coda_psdev_print_entry;
   90 extern int coda_vfsop_print_entry;
   91 
   92 #define CODADBGMSK(N)            (1 << N)
   93 #define CODADEBUG(N, STMT)       { if (codadebug & CODADBGMSK(N)) { STMT } }
   94 #define myprintf(args)          \
   95 do {                            \
   96     if (coda_printf_delay)       \
   97         DELAY(coda_printf_delay);\
   98     printf args ;               \
   99 } while (0)
  100 
  101 struct cnode {
  102     struct vnode        *c_vnode;
  103     u_short              c_flags;       /* flags (see below) */
  104     CodaFid              c_fid;         /* file handle */
  105     struct vnode        *c_ovp;         /* open vnode pointer */
  106     u_short              c_ocount;      /* count of openers */
  107     u_short              c_owrite;      /* count of open for write */
  108     struct vattr         c_vattr;       /* attributes */
  109     char                *c_symlink;     /* pointer to symbolic link */
  110     u_short              c_symlen;      /* length of symbolic link */
  111     struct cdev         *c_device;      /* associated vnode device */
  112     ino_t                c_inode;       /* associated vnode inode */
  113     struct cnode        *c_next;        /* links if on NetBSD machine */
  114 };
  115 #define VTOC(vp)        ((struct cnode *)(vp)->v_data)
  116 #define CTOV(cp)        ((struct vnode *)((cp)->c_vnode))
  117 
  118 /* flags */
  119 #define C_VATTR         0x01    /* Validity of vattr in the cnode */
  120 #define C_SYMLINK       0x02    /* Validity of symlink pointer in the Code */
  121 #define C_WANTED        0x08    /* Set if lock wanted */
  122 #define C_LOCKED        0x10    /* Set if lock held */
  123 #define C_UNMOUNTING    0X20    /* Set if unmounting */
  124 #define C_PURGING       0x40    /* Set if purging a fid */
  125 
  126 #define VALID_VATTR(cp)         ((cp->c_flags) & C_VATTR)
  127 #define VALID_SYMLINK(cp)       ((cp->c_flags) & C_SYMLINK)
  128 #define IS_UNMOUNTING(cp)       ((cp)->c_flags & C_UNMOUNTING)
  129 
  130 struct vcomm {
  131         u_long          vc_seq;
  132         struct selinfo  vc_selproc;
  133         struct queue    vc_requests;
  134         struct queue    vc_replys;
  135 };
  136 
  137 #define VC_OPEN(vcp)        ((vcp)->vc_requests.forw != NULL)
  138 #define MARK_VC_CLOSED(vcp) (vcp)->vc_requests.forw = NULL;
  139 #define MARK_VC_OPEN(vcp)    /* MT */
  140 
  141 struct coda_clstat {
  142         int     ncalls;                 /* client requests */
  143         int     nbadcalls;              /* upcall failures */
  144         int     reqs[CODA_NCALLS];      /* count of each request */
  145 };
  146 extern struct coda_clstat coda_clstat;
  147 
  148 /*
  149  * CODA structure to hold mount/filesystem information
  150  */
  151 struct coda_mntinfo {
  152     struct vnode        *mi_rootvp;
  153     struct mount        *mi_vfsp;
  154     struct vcomm         mi_vcomm;
  155     struct cdev         *dev;
  156     int                  mi_started;
  157     LIST_ENTRY(coda_mntinfo) mi_list;
  158 };
  159 struct coda_mntinfo *dev2coda_mntinfo(struct cdev *dev);
  160 
  161 /*
  162  * vfs pointer to mount info
  163  */
  164 #define vftomi(vfsp)    ((struct coda_mntinfo *)(vfsp->mnt_data))
  165 #define CODA_MOUNTED(vfsp)   (vftomi((vfsp)) != (struct coda_mntinfo *)0)
  166 
  167 /*
  168  * vnode pointer to mount info
  169  */
  170 #define vtomi(vp)       ((struct coda_mntinfo *)(vp->v_mount->mnt_data))
  171 
  172 /*
  173  * Used for identifying usage of "Control" object
  174  */
  175 extern struct vnode *coda_ctlvp;
  176 #define IS_CTL_VP(vp)           ((vp) == coda_ctlvp)
  177 #define IS_CTL_NAME(vp, name, l)((l == CODA_CONTROLLEN) \
  178                                  && ((vp) == vtomi((vp))->mi_rootvp)    \
  179                                  && strncmp(name, CODA_CONTROL, l) == 0)
  180 
  181 /* 
  182  * An enum to tell us whether something that will remove a reference
  183  * to a cnode was a downcall or not
  184  */
  185 enum dc_status {
  186     IS_DOWNCALL = 6,
  187     NOT_DOWNCALL = 7
  188 };
  189 
  190 /* cfs_psdev.h */
  191 int coda_call(struct coda_mntinfo *mntinfo, int inSize, int *outSize, caddr_t buffer);
  192 extern int coda_kernel_version;
  193 
  194 /* cfs_subr.h */
  195 int  handleDownCall(int opcode, union outputArgs *out);
  196 void coda_unmounting(struct mount *whoIam);
  197 int  coda_vmflush(struct cnode *cp);
  198 
  199 /* cfs_vnodeops.h */
  200 struct cnode *make_coda_node(CodaFid *fid, struct mount *vfsp, short type);
  201 int coda_vnodeopstats_init(void);
  202 
  203 /* coda_vfsops.h */
  204 struct mount *devtomp(struct cdev *dev);
  205 
  206 /* sigh */
  207 #define CODA_RDWR ((u_long) 31)
  208 
  209 #endif  /* _CNODE_H_ */
  210 

Cache object: 3f307e53d3f1f4bf37f94285569e147c


[ 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.