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/fs/unionfs/union.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  * Copyright (c) 1994 The Regents of the University of California.
    3  * Copyright (c) 1994 Jan-Simon Pendry.
    4  * All rights reserved.
    5  *
    6  * This code is derived from software donated to Berkeley by
    7  * Jan-Simon Pendry.
    8  *
    9  * Redistribution and use in source and binary forms, with or without
   10  * modification, are permitted provided that the following conditions
   11  * are met:
   12  * 1. Redistributions of source code must retain the above copyright
   13  *    notice, this list of conditions and the following disclaimer.
   14  * 2. Redistributions in binary form must reproduce the above copyright
   15  *    notice, this list of conditions and the following disclaimer in the
   16  *    documentation and/or other materials provided with the distribution.
   17  * 3. All advertising materials mentioning features or use of this software
   18  *    must display the following acknowledgement:
   19  *      This product includes software developed by the University of
   20  *      California, Berkeley and its contributors.
   21  * 4. Neither the name of the University nor the names of its contributors
   22  *    may be used to endorse or promote products derived from this software
   23  *    without specific prior written permission.
   24  *
   25  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   26  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   27  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   28  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   29  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   30  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   31  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   32  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   34  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   35  * SUCH DAMAGE.
   36  *
   37  *      @(#)union.h     8.9 (Berkeley) 12/10/94
   38  * $FreeBSD: releng/5.0/sys/fs/unionfs/union.h 105077 2002-10-14 03:20:36Z mckusick $
   39  */
   40 
   41 #define UNMNT_ABOVE     0x0001          /* Target appears above mount point */
   42 #define UNMNT_BELOW     0x0002          /* Target appears below mount point */
   43 #define UNMNT_REPLACE   0x0003          /* Target replaces mount point */
   44 
   45 struct union_mount {
   46         struct vnode    *um_uppervp;    /* UN_ULOCK holds locking state */
   47         struct vnode    *um_lowervp;    /* Left unlocked */
   48         struct ucred    *um_cred;       /* Credentials of user calling mount */
   49         int             um_cmode;       /* cmask from mount process */
   50         int             um_op;          /* Operation mode */
   51 };
   52 
   53 #ifdef _KERNEL
   54 
   55 #ifndef DIAGNOSTIC
   56 #define DIAGNOSTIC
   57 #endif
   58 
   59 /*
   60  * DEFDIRMODE is the mode bits used to create a shadow directory.
   61  */
   62 #define VRWXMODE (VREAD|VWRITE|VEXEC)
   63 #define VRWMODE (VREAD|VWRITE)
   64 #define UN_DIRMODE ((VRWXMODE)|(VRWXMODE>>3)|(VRWXMODE>>6))
   65 #define UN_FILEMODE ((VRWMODE)|(VRWMODE>>3)|(VRWMODE>>6))
   66 
   67 /*
   68  * A cache of vnode references  (hangs off v_data)
   69  */
   70 struct union_node {
   71         LIST_ENTRY(union_node)  un_cache;       /* Hash chain */
   72         struct vnode            *un_vnode;      /* Back pointer */
   73         struct vnode            *un_uppervp;    /* overlaying object */
   74         struct vnode            *un_lowervp;    /* underlying object */
   75         struct vnode            *un_dirvp;      /* Parent dir of uppervp */
   76         struct vnode            *un_pvp;        /* Parent vnode */
   77         char                    *un_path;       /* saved component name */
   78         int                     un_openl;       /* # of opens on lowervp */
   79         int                     un_exclcnt;     /* exclusive count */
   80         unsigned int            un_flags;
   81         struct vnode            **un_dircache;  /* cached union stack */
   82         off_t                   un_uppersz;     /* size of upper object */
   83         off_t                   un_lowersz;     /* size of lower object */
   84 #ifdef DIAGNOSTIC
   85         pid_t                   un_pid;
   86 #endif
   87 };
   88 
   89 /*
   90  * XXX UN_ULOCK -       indicates that the uppervp is locked
   91  *
   92  * UN_CACHED -  node is in the union cache
   93  */
   94 
   95 /*#define UN_ULOCK      0x04*/  /* Upper node is locked */
   96 #define UN_CACHED       0x10    /* In union cache */
   97 
   98 /*
   99  * Hash table locking flags
  100  */
  101 
  102 #define UNVP_WANT       0x01
  103 #define UNVP_LOCKED     0x02
  104 
  105 extern int union_allocvp(struct vnode **, struct mount *,
  106                                 struct vnode *, 
  107                                 struct vnode *, 
  108                                 struct componentname *, struct vnode *,
  109                                 struct vnode *, int);
  110 extern int union_freevp(struct vnode *);
  111 extern struct vnode *union_dircache(struct vnode *, struct thread *);
  112 extern int union_copyup(struct union_node *, int, struct ucred *,
  113                                 struct thread *);
  114 extern int union_dowhiteout(struct union_node *, struct ucred *,
  115                                         struct thread *);
  116 extern int union_mkshadow(struct union_mount *, struct vnode *,
  117                                 struct componentname *, struct vnode **);
  118 extern int union_mkwhiteout(struct union_mount *, struct vnode *,
  119                                 struct componentname *, char *);
  120 extern int union_cn_close(struct vnode *, int, struct ucred *,
  121                                 struct thread *);
  122 extern void union_removed_upper(struct union_node *un);
  123 extern struct vnode *union_lowervp(struct vnode *);
  124 extern void union_newsize(struct vnode *, off_t, off_t);
  125 
  126 extern int (*union_dircheckp)(struct thread *, struct vnode **,
  127                                  struct file *);
  128 
  129 #define MOUNTTOUNIONMOUNT(mp) ((struct union_mount *)((mp)->mnt_data))
  130 #define VTOUNION(vp) ((struct union_node *)(vp)->v_data)
  131 #define UNIONTOV(un) ((un)->un_vnode)
  132 #define LOWERVP(vp) (VTOUNION(vp)->un_lowervp)
  133 #define UPPERVP(vp) (VTOUNION(vp)->un_uppervp)
  134 #define OTHERVP(vp) (UPPERVP(vp) ? UPPERVP(vp) : LOWERVP(vp))
  135 
  136 #define UDEBUG(x)       if (uniondebug) printf x
  137 #define UDEBUG_ENABLED  1
  138 
  139 extern vop_t **union_vnodeop_p;
  140 extern struct vfsops union_vfsops;
  141 extern int uniondebug;
  142 
  143 #endif /* _KERNEL */

Cache object: b0e4d01c06bcc4399b15714b0d1630db


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