[BACK]Return to xfs_node.h CVS log [TXT][DIR] Up to [local] / sys / xfs

Annotation of sys/xfs/xfs_node.h, Revision 1.1.1.1

1.1       nbrk        1: /*
                      2:  * Copyright (c) 1995 - 2002 Kungliga Tekniska Högskolan
                      3:  * (Royal Institute of Technology, Stockholm, Sweden).
                      4:  * All rights reserved.
                      5:  *
                      6:  * Redistribution and use in source and binary forms, with or without
                      7:  * modification, are permitted provided that the following conditions
                      8:  * are met:
                      9:  *
                     10:  * 1. Redistributions of source code must retain the above copyright
                     11:  *    notice, this list of conditions and the following disclaimer.
                     12:  *
                     13:  * 2. Redistributions in binary form must reproduce the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer in the
                     15:  *    documentation and/or other materials provided with the distribution.
                     16:  *
                     17:  * 3. Neither the name of the Institute nor the names of its contributors
                     18:  *    may be used to endorse or promote products derived from this software
                     19:  *    without specific prior written permission.
                     20:  *
                     21:  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
                     22:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     23:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     24:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
                     25:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     26:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     27:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     28:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     29:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     30:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     31:  * SUCH DAMAGE.
                     32:  */
                     33:
                     34: /*     $arla: xfs_node.h,v 1.33 2003/01/25 18:48:28 lha Exp $   */
                     35:
                     36: #ifndef _xfs_xnode_h
                     37: #define _xfs_xnode_h
                     38:
                     39: #include <sys/types.h>
                     40: #include <sys/time.h>
                     41: #ifdef HAVE_KERNEL_LF_ADVLOCK
                     42: #include <sys/lockf.h>
                     43: #endif
                     44:
                     45: #include <xfs/xfs_attr.h>
                     46: #include <xfs/xfs_message.h>
                     47: #include <xfs/xfs_queue.h>
                     48:
                     49: #ifdef __APPLE__
                     50: typedef struct lock__bsd__ xfs_vnode_lock;
                     51: #else
                     52: typedef struct lock xfs_vnode_lock;
                     53: #endif
                     54:
                     55: struct xfs_node {
                     56: #if defined(__NetBSD_Version__) && __NetBSD_Version__ >= 105280000
                     57:     struct genfs_node gnode;
                     58: #endif
                     59:     struct vnode *vn;
                     60:     struct vnode *data;
                     61:     struct vattr attr;
                     62:     uint32_t offset;
                     63:     u_int flags;
                     64:     u_int tokens;
                     65:     xfs_handle handle;
                     66:     xfs_pag_t id[MAXRIGHTS];
                     67:     u_char rights[MAXRIGHTS];
                     68:     u_char anonrights;
                     69: #if defined(HAVE_KERNEL_LOCKMGR) || defined(HAVE_KERNEL_DEBUGLOCKMGR)
                     70:     xfs_vnode_lock lock;
                     71: #else
                     72:     int vnlocks;
                     73: #endif
                     74: #ifdef HAVE_KERNEL_LF_ADVLOCK
                     75:     struct   lockf *lockf;
                     76: #endif
                     77:     struct ucred *rd_cred;
                     78:     struct ucred *wr_cred;
                     79:     NNPQUEUE_ENTRY(xfs_node) nn_hash;
                     80: };
                     81:
                     82: #define XN_HASHSIZE    101
                     83:
                     84: NNPQUEUE_HEAD(nh_node_list, xfs_node);
                     85:
                     86: struct xfs_nodelist_head {
                     87:     struct nh_node_list        nh_nodelist[XN_HASHSIZE];
                     88: };
                     89:
                     90: void   nnfs_init_head(struct xfs_nodelist_head *);
                     91: void   xfs_node_purge(struct xfs_nodelist_head *,
                     92:                         void (*func)(struct xfs_node *));
                     93: struct xfs_node *
                     94:        xfs_node_find(struct xfs_nodelist_head *, xfs_handle *);
                     95: void   xfs_remove_node(struct xfs_nodelist_head *, struct xfs_node *);
                     96: void   xfs_insert(struct xfs_nodelist_head *, struct xfs_node *);
                     97: int    xfs_update_handle(struct xfs_nodelist_head *, xfs_handle *,
                     98:                            xfs_handle *);
                     99:
                    100:
                    101: struct xfs;
                    102:
                    103: int xfs_getnewvnode(struct xfs *xfsp, struct vnode **vpp,
                    104:                      struct xfs_handle *handle);
                    105:
                    106:
                    107: #define DATA_FROM_VNODE(vp) DATA_FROM_XNODE(VNODE_TO_XNODE(vp))
                    108:
                    109: #define DATA_FROM_XNODE(xp) ((xp)->data)
                    110:
                    111: #define XNODE_TO_VNODE(xp) ((xp)->vn)
                    112: #define VNODE_TO_XNODE(vp) ((struct xfs_node *) (vp)->v_data)
                    113:
                    114: #if defined(HAVE_ONE_ARGUMENT_VGET)
                    115: #define xfs_do_vget(vp, lockflag, proc) vget((vp))
                    116: #elif defined(HAVE_TWO_ARGUMENT_VGET)
                    117: #define xfs_do_vget(vp, lockflag, proc) vget((vp), (lockflag))
                    118: #elif defined(HAVE_THREE_ARGUMENT_VGET)
                    119: #define xfs_do_vget(vp, lockflag, proc) vget((vp), (lockflag), (proc))
                    120: #else
                    121: #error what kind of vget
                    122: #endif
                    123:
                    124: #ifndef HAVE_VOP_T
                    125: typedef int vop_t (void *);
                    126: #endif
                    127:
                    128: #ifdef LK_INTERLOCK
                    129: #define HAVE_LK_INTERLOCK
                    130: #else
                    131: #define LK_INTERLOCK 0
                    132: #endif
                    133:
                    134: #ifdef LK_RETRY
                    135: #define HAVE_LK_RETRY
                    136: #else
                    137: #define LK_RETRY 0
                    138: #endif
                    139:
                    140: /*
                    141:  * This is compat code for older vfs that have a
                    142:  * vget that only takes an integer (really boolean) argument
                    143:  * that the returned vnode will be returned locked
                    144:  */
                    145:
                    146: #ifdef LK_EXCLUSIVE
                    147: #define HAVE_LK_EXCLUSIVE 1
                    148: #else
                    149: #define LK_EXCLUSIVE 1
                    150: #endif
                    151:
                    152: #ifdef LK_SHARED
                    153: #define HAVE_LK_SHARED 1
                    154: #else
                    155: #define LK_SHARED 1
                    156: #endif
                    157:
                    158: void   xfs_update_write_cred(struct xfs_node *, struct ucred *);
                    159: void   xfs_update_read_cred(struct xfs_node *, struct ucred *);
                    160:
                    161: #endif                                /* _xfs_xnode_h */

CVSweb