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/union/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 /*      $NetBSD: union.h,v 1.15 2006/05/14 21:31:52 elad Exp $  */
    2 
    3 /*
    4  * Copyright (c) 1994 The Regents of the University of California.
    5  * All rights reserved.
    6  *
    7  * This code is derived from software donated to Berkeley by
    8  * Jan-Simon Pendry.
    9  *
   10  * Redistribution and use in source and binary forms, with or without
   11  * modification, are permitted provided that the following conditions
   12  * are met:
   13  * 1. Redistributions of source code must retain the above copyright
   14  *    notice, this list of conditions and the following disclaimer.
   15  * 2. Redistributions in binary form must reproduce the above copyright
   16  *    notice, this list of conditions and the following disclaimer in the
   17  *    documentation and/or other materials provided with the distribution.
   18  * 3. Neither the name of the University nor the names of its contributors
   19  *    may be used to endorse or promote products derived from this software
   20  *    without specific prior written permission.
   21  *
   22  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   25  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   32  * SUCH DAMAGE.
   33  *
   34  *      @(#)union.h     8.9 (Berkeley) 12/10/94
   35  */
   36 
   37 /*
   38  * Copyright (c) 1994 Jan-Simon Pendry.
   39  * All rights reserved.
   40  *
   41  * This code is derived from software donated to Berkeley by
   42  * Jan-Simon Pendry.
   43  *
   44  * Redistribution and use in source and binary forms, with or without
   45  * modification, are permitted provided that the following conditions
   46  * are met:
   47  * 1. Redistributions of source code must retain the above copyright
   48  *    notice, this list of conditions and the following disclaimer.
   49  * 2. Redistributions in binary form must reproduce the above copyright
   50  *    notice, this list of conditions and the following disclaimer in the
   51  *    documentation and/or other materials provided with the distribution.
   52  * 3. All advertising materials mentioning features or use of this software
   53  *    must display the following acknowledgement:
   54  *      This product includes software developed by the University of
   55  *      California, Berkeley and its contributors.
   56  * 4. Neither the name of the University nor the names of its contributors
   57  *    may be used to endorse or promote products derived from this software
   58  *    without specific prior written permission.
   59  *
   60  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   61  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   62  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   63  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   64  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   65  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   66  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   67  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   68  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   69  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   70  * SUCH DAMAGE.
   71  *
   72  *      @(#)union.h     8.9 (Berkeley) 12/10/94
   73  */
   74 
   75 #ifndef _MISCFS_UNION_H_
   76 #define _MISCFS_UNION_H_
   77 
   78 struct union_args {
   79         char            *target;        /* Target of loopback  */
   80         int             mntflags;       /* Options on the mount */
   81 };
   82 
   83 #define UNMNT_ABOVE     0x0001          /* Target appears below mount point */
   84 #define UNMNT_BELOW     0x0002          /* Target appears below mount point */
   85 #define UNMNT_REPLACE   0x0003          /* Target replaces mount point */
   86 #define UNMNT_OPMASK    0x0003
   87 
   88 #define UNMNT_BITS "\177\2" \
   89     "b\00above\0b\01below\0b\02replace\0"
   90 
   91 #ifdef _KERNEL
   92 
   93 struct union_mount {
   94         struct vnode    *um_uppervp;
   95         struct vnode    *um_lowervp;
   96         kauth_cred_t    um_cred;        /* Credentials of user calling mount */
   97         int             um_cmode;       /* cmask from mount process */
   98         int             um_op;          /* Operation mode */
   99 };
  100 
  101 /*
  102  * DEFDIRMODE is the mode bits used to create a shadow directory.
  103  */
  104 #define UN_DIRMODE      (S_IRWXU|S_IRWXG|S_IRWXO)
  105 #define UN_FILEMODE     (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
  106 
  107 /*
  108  * A cache of vnode references
  109  */
  110 struct union_node {
  111         LIST_ENTRY(union_node)  un_cache;       /* Hash chain */
  112         struct vnode            *un_vnode;      /* Back pointer */
  113         struct vnode            *un_uppervp;    /* overlaying object */
  114         struct vnode            *un_lowervp;    /* underlying object */
  115         struct vnode            *un_dirvp;      /* Parent dir of uppervp */
  116         struct vnode            *un_pvp;        /* Parent vnode */
  117         char                    *un_path;       /* saved component name */
  118         int                     un_hash;        /* saved un_path hash value */
  119         int                     un_openl;       /* # of opens on lowervp */
  120         unsigned int            un_flags;
  121         struct vnode            **un_dircache;  /* cached union stack */
  122         off_t                   un_uppersz;     /* size of upper object */
  123         off_t                   un_lowersz;     /* size of lower object */
  124         pid_t                   un_pid;         /* DIAGNOSTIC only */
  125 };
  126 
  127 #define UN_WANTED       0x01
  128 #define UN_LOCKED       0x02
  129 #define UN_ULOCK        0x04            /* Upper node is locked */
  130 #define UN_KLOCK        0x08            /* Keep upper node locked on vput */
  131 #define UN_CACHED       0x10            /* In union cache */
  132 #define UN_DRAINING     0x20            /* upper node lock is draining */
  133 #define UN_DRAINED      0x40            /* upper node lock is drained */
  134 
  135 extern int union_allocvp(struct vnode **, struct mount *,
  136                                 struct vnode *, struct vnode *,
  137                                 struct componentname *, struct vnode *,
  138                                 struct vnode *, int);
  139 extern int union_copyfile(struct vnode *, struct vnode *, kauth_cred_t,
  140     struct lwp *);
  141 extern int union_copyup(struct union_node *, int, kauth_cred_t,
  142     struct lwp *);
  143 extern void union_diruncache(struct union_node *);
  144 extern int union_dowhiteout(struct union_node *, kauth_cred_t,
  145     struct lwp *);
  146 extern int union_mkshadow(struct union_mount *, struct vnode *,
  147     struct componentname *, struct vnode **);
  148 extern int union_mkwhiteout(struct union_mount *, struct vnode *,
  149     struct componentname *, char *);
  150 extern int union_vn_create(struct vnode **, struct union_node *,
  151     struct lwp *);
  152 extern int union_cn_close(struct vnode *, int, kauth_cred_t,
  153     struct lwp *);
  154 extern void union_removed_upper(struct union_node *un);
  155 extern struct vnode *union_lowervp(struct vnode *);
  156 extern void union_newlower(struct union_node *, struct vnode *);
  157 extern void union_newupper(struct union_node *, struct vnode *);
  158 extern void union_newsize(struct vnode *, off_t, off_t);
  159 int union_readdirhook(struct vnode **, struct file *, struct lwp *);
  160 
  161 #define MOUNTTOUNIONMOUNT(mp) ((struct union_mount *)((mp)->mnt_data))
  162 #define VTOUNION(vp) ((struct union_node *)(vp)->v_data)
  163 #define UNIONTOV(un) ((un)->un_vnode)
  164 #define LOWERVP(vp) (VTOUNION(vp)->un_lowervp)
  165 #define UPPERVP(vp) (VTOUNION(vp)->un_uppervp)
  166 #define OTHERVP(vp) (UPPERVP(vp) ? UPPERVP(vp) : LOWERVP(vp))
  167 
  168 extern int (**union_vnodeop_p)(void *);
  169 
  170 void union_init(void);
  171 void union_done(void);
  172 int union_freevp(struct vnode *);
  173 
  174 #ifdef SYSCTL_SETUP_PROTO
  175 SYSCTL_SETUP_PROTO(sysctl_vfs_union_setup);
  176 #endif /* SYSCTL_SETUP_PROTO */
  177 #endif /* _KERNEL */
  178 #endif /* _MISCFS_UNION_H_ */

Cache object: e975f255d2717e805c4684e13cfd478b


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