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-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 /*
    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$
   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 file system at Carnegie Mellon University.
   44  * Contributers include David Steere, James Kistler, and M. Satyanarayanan.
   45  */
   46 
   47 /* 
   48  * HISTORY
   49  * $Log: cnode.h,v $
   50  * Revision 1.5  1998/11/11 20:32:20  rvb
   51  * coda_lookup now passes up an extra flag.  But old veni will
   52  * be ok; new veni will check /dev/cfs0 to make sure that a new
   53  * kernel is running.
   54  * Also, a bug in vc_nb_close iff CODA_SIGNAL's were seen has been
   55  * fixed.
   56  *
   57  * Revision 1.4  1998/09/13 13:57:59  rvb
   58  * Finish conversion of cfs -> coda
   59  *
   60  * Revision 1.3  1998/09/11 18:50:17  rvb
   61  * All the references to cfs, in symbols, structs, and strings
   62  * have been changed to coda.  (Same for CFS.)
   63  *
   64  * Revision 1.2  1998/09/02 19:09:53  rvb
   65  * Pass2 complete
   66  *
   67  * Revision 1.1.1.1  1998/08/29 21:14:52  rvb
   68  * Very Preliminary Coda
   69  *
   70  * Revision 1.10  1998/08/28 18:12:25  rvb
   71  * Now it also works on FreeBSD -current.  This code will be
   72  * committed to the FreeBSD -current and NetBSD -current
   73  * trees.  It will then be tailored to the particular platform
   74  * by flushing conditional code.
   75  *
   76  * Revision 1.9  1998/08/18 17:05:24  rvb
   77  * Don't use __RCSID now
   78  *
   79  * Revision 1.8  1998/08/18 16:31:49  rvb
   80  * Sync the code for NetBSD -current; test on 1.3 later
   81  *
   82  * Revision 1.7  98/02/24  22:22:53  rvb
   83  * Fixes up mainly to flush iopen and friends
   84  * 
   85  * Revision 1.6  98/01/31  20:53:19  rvb
   86  * First version that works on FreeBSD 2.2.5
   87  * 
   88  * Revision 1.5  98/01/23  11:53:51  rvb
   89  * Bring RVB_CODA1_1 to HEAD
   90  * 
   91  * Revision 1.4.2.5  98/01/23  11:21:14  rvb
   92  * Sync with 2.2.5
   93  * 
   94  * Revision 1.4.2.4  98/01/22  13:03:38  rvb
   95  * Had Breaken ls .
   96  * 
   97  * Revision 1.4.2.3  97/12/19  14:26:09  rvb
   98  * session id
   99  * 
  100  * Revision 1.4.2.2  97/12/16  12:40:24  rvb
  101  * Sync with 1.3
  102  * 
  103  * Revision 1.4.2.1  97/12/06  17:41:28  rvb
  104  * Sync with peters coda.h
  105  * 
  106  * Revision 1.4  97/12/05  10:39:30  rvb
  107  * Read CHANGES
  108  * 
  109  * Revision 1.3.18.2  97/11/12  12:09:45  rvb
  110  * reorg pass1
  111  * 
  112  * Revision 1.3.18.1  97/10/29  16:06:31  rvb
  113  * Kill DYING
  114  * 
  115  * Revision 1.3  1996/12/12 22:11:03  bnoble
  116  * Fixed the "downcall invokes venus operation" deadlock in all known cases. 
  117  *  There may be more.
  118  *
  119  * Revision 1.2  1996/01/02 16:57:26  bnoble
  120  * Added support for Coda MiniCache and raw inode calls (final commit)
  121  *
  122  * Revision 1.1.2.1  1995/12/20 01:57:53  bnoble
  123  * Added CODA-specific files
  124  *
  125  * Revision 3.1.1.1  1995/03/04  19:08:23  bnoble
  126  * Branch for NetBSD port revisions
  127  *
  128  * Revision 3.1  1995/03/04  19:08:23  bnoble
  129  * Bump to major revision 3 to prepare for NetBSD port
  130  *
  131  * Revision 2.2  1994/12/06  13:39:18  dcs
  132  * Add a flag value to indicate a cnode was orphaned, e.g. the venus
  133  * that created it has exited. This will allow one to restart venus
  134  * even though some process may be cd'd into /coda.
  135  *
  136  * Revision 2.1  94/07/21  16:25:33  satya
  137  * Conversion to C++ 3.0; start of Coda Release 2.0
  138  * 
  139  * Revision 1.2.7.1  94/06/16  11:26:02  raiff
  140  * Branch for release beta-16Jun1994_39118
  141  * 
  142  * Revision 1.2  92/10/27  17:58:41  lily
  143  * merge kernel/latest and alpha/src/cfs
  144  * 
  145  * Revision 2.3  92/09/30  14:16:53  mja
  146  *      Picked up fixed #ifdef _KERNEL. Also...
  147  * 
  148  *      Substituted rvb's history blurb so that we agree with Mach 2.5 sources.
  149  *      [91/02/09            jjk]
  150  * 
  151  *      Added contributors blurb.
  152  *      [90/12/13            jjk]
  153  * 
  154  * Revision 2.2  90/07/05  11:27:24  mrt
  155  *      Created for the Coda File System.
  156  *      [90/05/23            dcs]
  157  * 
  158  * Revision 1.4  90/05/31  17:02:16  dcs
  159  * Prepare for merge with facilities kernel.
  160  * 
  161  * 
  162  * 
  163  */
  164 
  165 #ifndef _CNODE_H_
  166 #define _CNODE_H_
  167 
  168 #include <sys/vnode.h>
  169 #include <sys/lock.h>
  170 #include <machine/clock.h>
  171 
  172 MALLOC_DECLARE(M_CODA);
  173 
  174 /*
  175  * tmp below since we need struct queue
  176  */
  177 #include <coda/coda_kernel.h>
  178 
  179 /*
  180  * Cnode lookup stuff.
  181  * NOTE: CODA_CACHESIZE must be a power of 2 for cfshash to work!
  182  */
  183 #define CODA_CACHESIZE 512
  184 
  185 #define CODA_ALLOC(ptr, cast, size)                                        \
  186 do {                                                                      \
  187     ptr = (cast)malloc((unsigned long) size, M_CODA, M_WAITOK);            \
  188     if (ptr == 0) {                                                       \
  189         panic("kernel malloc returns 0 at %s:%d\n", __FILE__, __LINE__);  \
  190     }                                                                     \
  191 } while (0)
  192 
  193 #define CODA_FREE(ptr, size)  free((ptr), M_CODA)
  194 
  195 /*
  196  * global cache state control
  197  */
  198 extern int coda_nc_use;
  199 
  200 /*
  201  * Used to select debugging statements throughout the cfs code.
  202  */
  203 extern int codadebug;
  204 extern int coda_nc_debug;
  205 extern int coda_printf_delay;
  206 extern int coda_vnop_print_entry;
  207 extern int coda_psdev_print_entry;
  208 extern int coda_vfsop_print_entry;
  209 
  210 #define CODADBGMSK(N)            (1 << N)
  211 #define CODADEBUG(N, STMT)       { if (codadebug & CODADBGMSK(N)) { STMT } }
  212 #define myprintf(args)          \
  213 do {                            \
  214     if (coda_printf_delay)       \
  215         DELAY(coda_printf_delay);\
  216     printf args ;               \
  217 } while (0)
  218 
  219 struct cnode {
  220     struct vnode        *c_vnode;
  221     u_short              c_flags;       /* flags (see below) */
  222     ViceFid              c_fid;         /* file handle */
  223     struct lock          c_lock;        /* new lock protocol */
  224     struct vnode        *c_ovp;         /* open vnode pointer */
  225     u_short              c_ocount;      /* count of openers */
  226     u_short              c_owrite;      /* count of open for write */
  227     struct vattr         c_vattr;       /* attributes */
  228     char                *c_symlink;     /* pointer to symbolic link */
  229     u_short              c_symlen;      /* length of symbolic link */
  230     dev_t                c_device;      /* associated vnode device */
  231     ino_t                c_inode;       /* associated vnode inode */
  232     struct cnode        *c_next;        /* links if on NetBSD machine */
  233 };
  234 #define VTOC(vp)        ((struct cnode *)(vp)->v_data)
  235 #define CTOV(cp)        ((struct vnode *)((cp)->c_vnode))
  236 
  237 /* flags */
  238 #define C_VATTR         0x01    /* Validity of vattr in the cnode */
  239 #define C_SYMLINK       0x02    /* Validity of symlink pointer in the Code */
  240 #define C_WANTED        0x08    /* Set if lock wanted */
  241 #define C_LOCKED        0x10    /* Set if lock held */
  242 #define C_UNMOUNTING    0X20    /* Set if unmounting */
  243 #define C_PURGING       0x40    /* Set if purging a fid */
  244 
  245 #define VALID_VATTR(cp)         ((cp->c_flags) & C_VATTR)
  246 #define VALID_SYMLINK(cp)       ((cp->c_flags) & C_SYMLINK)
  247 #define IS_UNMOUNTING(cp)       ((cp)->c_flags & C_UNMOUNTING)
  248 
  249 struct vcomm {
  250         u_long          vc_seq;
  251         struct selinfo  vc_selproc;
  252         struct queue    vc_requests;
  253         struct queue    vc_replys;
  254 };
  255 
  256 #define VC_OPEN(vcp)        ((vcp)->vc_requests.forw != NULL)
  257 #define MARK_VC_CLOSED(vcp) (vcp)->vc_requests.forw = NULL;
  258 #define MARK_VC_OPEN(vcp)    /* MT */
  259 
  260 struct coda_clstat {
  261         int     ncalls;                 /* client requests */
  262         int     nbadcalls;              /* upcall failures */
  263         int     reqs[CODA_NCALLS];      /* count of each request */
  264 };
  265 extern struct coda_clstat coda_clstat;
  266 
  267 /*
  268  * CODA structure to hold mount/file system information
  269  */
  270 struct coda_mntinfo {
  271     struct vnode        *mi_rootvp;
  272     struct mount        *mi_vfsp;
  273     struct vcomm         mi_vcomm;
  274 };
  275 extern struct coda_mntinfo coda_mnttbl[]; /* indexed by minor device number */
  276 
  277 /*
  278  * vfs pointer to mount info
  279  */
  280 #define vftomi(vfsp)    ((struct coda_mntinfo *)(vfsp->mnt_data))
  281 #define CODA_MOUNTED(vfsp)   (vftomi((vfsp)) != (struct coda_mntinfo *)0)
  282 
  283 /*
  284  * vnode pointer to mount info
  285  */
  286 #define vtomi(vp)       ((struct coda_mntinfo *)(vp->v_mount->mnt_data))
  287 
  288 /*
  289  * Used for identifying usage of "Control" object
  290  */
  291 extern struct vnode *coda_ctlvp;
  292 #define IS_CTL_VP(vp)           ((vp) == coda_ctlvp)
  293 #define IS_CTL_NAME(vp, name, l)((l == CODA_CONTROLLEN) \
  294                                  && ((vp) == vtomi((vp))->mi_rootvp)    \
  295                                  && strncmp(name, CODA_CONTROL, l) == 0)
  296 
  297 /* 
  298  * An enum to tell us whether something that will remove a reference
  299  * to a cnode was a downcall or not
  300  */
  301 enum dc_status {
  302     IS_DOWNCALL = 6,
  303     NOT_DOWNCALL = 7
  304 };
  305 
  306 /* cfs_psdev.h */
  307 extern int coda_call(struct coda_mntinfo *mntinfo, int inSize, int *outSize, caddr_t buffer);
  308 extern int coda_kernel_version;
  309 
  310 /* cfs_subr.h */
  311 extern int  handleDownCall(int opcode, union outputArgs *out);
  312 extern void coda_unmounting(struct mount *whoIam);
  313 extern int  coda_vmflush(struct cnode *cp);
  314 
  315 /* cfs_vnodeops.h */
  316 extern struct cnode *make_coda_node(ViceFid *fid, struct mount *vfsp, short type);
  317 extern int coda_vnodeopstats_init(void);
  318 
  319 /* coda_vfsops.h */
  320 extern struct mount *devtomp(dev_t dev);
  321 
  322 /* sigh */
  323 #define CODA_RDWR ((u_long) 31)
  324 
  325 #endif  /* _CNODE_H_ */
  326 

Cache object: dbe9d5531a57a51794792c894707828f


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