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  * Copyright (c) 2005, 2006 Masanori Ozawa <ozawa@ongs.co.jp>, ONGS Inc.
    5  * Copyright (c) 2006 Daichi Goto <daichi@freebsd.org>
    6  * All rights reserved.
    7  *
    8  * This code is derived from software donated to Berkeley by
    9  * Jan-Simon Pendry.
   10  *
   11  * Redistribution and use in source and binary forms, with or without
   12  * modification, are permitted provided that the following conditions
   13  * are met:
   14  * 1. Redistributions of source code must retain the above copyright
   15  *    notice, this list of conditions and the following disclaimer.
   16  * 2. Redistributions in binary form must reproduce the above copyright
   17  *    notice, this list of conditions and the following disclaimer in the
   18  *    documentation and/or other materials provided with the distribution.
   19  * 4. Neither the name of the University nor the names of its contributors
   20  *    may be used to endorse or promote products derived from this software
   21  *    without specific prior written permission.
   22  *
   23  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   33  * SUCH DAMAGE.
   34  *
   35  *      @(#)union.h     8.9 (Berkeley) 12/10/94
   36  * $FreeBSD$
   37  */
   38 
   39 #ifdef _KERNEL
   40 
   41 /* copy method of attr from lower to upper */
   42 typedef enum _unionfs_copymode {
   43         UNIONFS_TRADITIONAL = 0,
   44         UNIONFS_TRANSPARENT,
   45         UNIONFS_MASQUERADE
   46 } unionfs_copymode;
   47 
   48 /* whiteout policy of upper layer */
   49 typedef enum _unionfs_whitemode {
   50        UNIONFS_WHITE_ALWAYS = 0,
   51        UNIONFS_WHITE_WHENNEEDED
   52 } unionfs_whitemode;
   53 
   54 struct unionfs_mount {
   55         struct vnode   *um_lowervp;     /* VREFed once */
   56         struct vnode   *um_uppervp;     /* VREFed once */
   57         struct vnode   *um_rootvp;      /* ROOT vnode */
   58         unionfs_copymode um_copymode;
   59         unionfs_whitemode um_whitemode;
   60         uid_t           um_uid;
   61         gid_t           um_gid;
   62         u_short         um_udir;
   63         u_short         um_ufile;
   64 };
   65 
   66 /* unionfs status list */
   67 struct unionfs_node_status {
   68         LIST_ENTRY(unionfs_node_status) uns_list;       /* Status list */
   69         lwpid_t         uns_tid;                /* current thread id */
   70         int             uns_node_flag;          /* uns flag */
   71         int             uns_lower_opencnt;      /* open count of lower */
   72         int             uns_upper_opencnt;      /* open count of upper */
   73         int             uns_lower_openmode;     /* open mode of lower */
   74         int             uns_lower_fdidx;        /* open fdidx of lower */
   75         int             uns_readdir_status;     /* read status of readdir */
   76 };
   77 
   78 /* union node status flags */
   79 #define UNS_OPENL_4_READDIR     0x01    /* open lower layer for readdir */
   80 
   81 /* A cache of vnode references */
   82 struct unionfs_node {
   83         struct vnode   *un_lowervp;             /* lower side vnode */
   84         struct vnode   *un_uppervp;             /* upper side vnode */
   85         struct vnode   *un_dvp;                 /* parent unionfs vnode */
   86         struct vnode   *un_vnode;               /* Back pointer */
   87         LIST_HEAD(, unionfs_node_status) un_unshead;  /* unionfs status head */
   88         char           *un_path;                /* path */
   89         int             un_flag;                /* unionfs node flag */
   90 };
   91 
   92 /*
   93  * unionfs node flags
   94  * It needs the vnode with exclusive lock, when changing the un_flag variable.
   95  */
   96 #define UNIONFS_OPENEXTL        0x01    /* openextattr (lower) */
   97 #define UNIONFS_OPENEXTU        0x02    /* openextattr (upper) */
   98 
   99 #define MOUNTTOUNIONFSMOUNT(mp) ((struct unionfs_mount *)((mp)->mnt_data))
  100 #define VTOUNIONFS(vp) ((struct unionfs_node *)(vp)->v_data)
  101 #define UNIONFSTOV(xp) ((xp)->un_vnode)
  102 
  103 int unionfs_init(struct vfsconf *vfsp);
  104 int unionfs_uninit(struct vfsconf *vfsp);
  105 int unionfs_nodeget(struct mount *mp, struct vnode *uppervp, struct vnode *lowervp, struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, struct thread *td);
  106 void unionfs_noderem(struct vnode *vp, struct thread *td);
  107 void unionfs_get_node_status(struct unionfs_node *unp, struct thread *td, struct unionfs_node_status **unspp);
  108 void unionfs_tryrem_node_status(struct unionfs_node *unp, struct thread *td, struct unionfs_node_status *unsp);
  109 
  110 int unionfs_check_rmdir(struct vnode *vp, struct ucred *cred, struct thread *td);
  111 int unionfs_copyfile(struct unionfs_node *unp, int docopy, struct ucred *cred, struct thread *td);
  112 void unionfs_create_uppervattr_core(struct unionfs_mount *ump, struct vattr *lva, struct vattr *uva, struct thread *td);
  113 int unionfs_create_uppervattr(struct unionfs_mount *ump, struct vnode *lvp, struct vattr *uva, struct ucred *cred, struct thread *td);
  114 int unionfs_mkshadowdir(struct unionfs_mount *ump, struct vnode *duvp, struct unionfs_node *unp, struct componentname *cnp, struct thread *td);
  115 int unionfs_mkwhiteout(struct vnode *dvp, struct componentname *cnp, struct thread *td, char *path);
  116 int unionfs_relookup_for_create(struct vnode *dvp, struct componentname *cnp, struct thread *td);
  117 int unionfs_relookup_for_delete(struct vnode *dvp, struct componentname *cnp, struct thread *td);
  118 int unionfs_relookup_for_rename(struct vnode *dvp, struct componentname *cnp, struct thread *td);
  119 
  120 #ifdef DIAGNOSTIC
  121 struct vnode   *unionfs_checklowervp(struct vnode *vp, char *fil, int lno);
  122 struct vnode   *unionfs_checkuppervp(struct vnode *vp, char *fil, int lno);
  123 #define UNIONFSVPTOLOWERVP(vp) unionfs_checklowervp((vp), __FILE__, __LINE__)
  124 #define UNIONFSVPTOUPPERVP(vp) unionfs_checkuppervp((vp), __FILE__, __LINE__)
  125 #else
  126 #define UNIONFSVPTOLOWERVP(vp) (VTOUNIONFS(vp)->un_lowervp)
  127 #define UNIONFSVPTOUPPERVP(vp) (VTOUNIONFS(vp)->un_uppervp)
  128 #endif
  129 
  130 extern struct vop_vector unionfs_vnodeops;
  131 
  132 #ifdef MALLOC_DECLARE
  133 MALLOC_DECLARE(M_UNIONFSNODE);
  134 MALLOC_DECLARE(M_UNIONFSPATH);
  135 #endif
  136 
  137 #ifdef UNIONFS_DEBUG
  138 #define UNIONFSDEBUG(format, args...) printf(format ,## args)
  139 #else
  140 #define UNIONFSDEBUG(format, args...)
  141 #endif                          /* UNIONFS_DEBUG */
  142 
  143 #endif                          /* _KERNEL */

Cache object: e9033a9f2a69b4eb03ef3e7e56eca800


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