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/bsd/sys/ubc.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) 1999, 2000-2002 Apple Computer, Inc. All rights reserved.
    3  *
    4  * @APPLE_LICENSE_HEADER_START@
    5  * 
    6  * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
    7  * 
    8  * This file contains Original Code and/or Modifications of Original Code
    9  * as defined in and that are subject to the Apple Public Source License
   10  * Version 2.0 (the 'License'). You may not use this file except in
   11  * compliance with the License. Please obtain a copy of the License at
   12  * http://www.opensource.apple.com/apsl/ and read it before using this
   13  * file.
   14  * 
   15  * The Original Code and all software distributed under the License are
   16  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
   17  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
   18  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
   19  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
   20  * Please see the License for the specific language governing rights and
   21  * limitations under the License.
   22  * 
   23  * @APPLE_LICENSE_HEADER_END@
   24  */
   25 /* 
   26  *      File:   ubc.h
   27  *      Author: Umesh Vaishampayan [umeshv@apple.com]
   28  *              05-Aug-1999     umeshv  Created.
   29  *
   30  *      Header file for Unified Buffer Cache.
   31  *
   32  */ 
   33 
   34 #ifndef _SYS_UBC_H_
   35 #define _SYS_UBC_H_
   36 
   37 #include <sys/appleapiopts.h>
   38 #include <sys/types.h>
   39 #include <sys/ucred.h>
   40 #include <sys/vnode.h>
   41 
   42 #include <sys/cdefs.h>
   43 
   44 #include <mach/memory_object_types.h>
   45 
   46 #define UBC_INFO_NULL   ((struct ubc_info *) 0)
   47 #define UBC_NOINFO              ((struct ubc_info *)0xDEADD1ED)
   48 
   49 #ifdef __APPLE_API_PRIVATE
   50 extern struct zone      *ubc_info_zone;
   51 
   52 /*
   53  *      The following data structure keeps the information to associate
   54  *      a vnode to the correspondig VM objects.
   55  */
   56 
   57 struct ubc_info {
   58         memory_object_t                 ui_pager;       /* pager */
   59         memory_object_control_t ui_control;     /* VM control for the pager */
   60         long                                    ui_flags;       /* flags */
   61         struct vnode                    *ui_vnode;      /* The vnode for this ubc_info */
   62         struct ucred                    *ui_ucred;      /* holds credentials for NFS paging */
   63         int                                             ui_refcount;/* ref count on the ubc_info */
   64         off_t                                   ui_size;        /* file size for the vnode */
   65         long                                    ui_mapped;      /* is it currently mapped */
   66         void                                    *ui_owner;      /* for recursive ubc_busy */
   67 };
   68 
   69 /* Defines for ui_flags */
   70 #define UI_NONE                 0x00000000              /* none */
   71 #define UI_HASPAGER             0x00000001              /* has a pager associated */
   72 #define UI_INITED               0x00000002              /* newly initialized vnode */
   73 #define UI_HASOBJREF    0x00000004              /* hold a reference on object */
   74 #define UI_WASMAPPED    0x00000008              /* vnode was mapped */
   75 #define UI_DONTCACHE    0x00000010              /* do not cache object */
   76 #define UI_BUSY                 0x00000020              /* for VM synchronization */
   77 #define UI_WANTED               0x00000040              /* for VM synchronization */
   78 
   79 #endif /* __APPLE_API_PRIVATE */
   80 
   81 #ifdef __APPLE_API_EVOLVING
   82 /*
   83  * exported primitives for loadable file systems.
   84  */
   85 
   86 __BEGIN_DECLS
   87 int     ubc_info_init __P((struct vnode *));
   88 void    ubc_info_deallocate  __P((struct ubc_info *));
   89 int     ubc_setsize __P((struct vnode *, off_t));
   90 off_t   ubc_getsize __P((struct vnode *));
   91 int     ubc_uncache __P((struct vnode *));
   92 int     ubc_umount __P((struct mount *));
   93 void    ubc_unmountall __P(());
   94 int     ubc_setcred __P((struct vnode *, struct proc *));
   95 struct ucred *ubc_getcred __P((struct vnode *));
   96 memory_object_t ubc_getpager __P((struct vnode *));
   97 memory_object_control_t ubc_getobject __P((struct vnode *, int));
   98 int ubc_setpager __P((struct vnode *, memory_object_t));
   99 int ubc_setflags __P((struct vnode *, int));
  100 int ubc_clearflags __P((struct vnode *, int));
  101 int ubc_issetflags __P((struct vnode *, int));
  102 off_t ubc_blktooff __P((struct vnode *, daddr_t));
  103 daddr_t ubc_offtoblk __P((struct vnode *, off_t));
  104 int ubc_clean __P((struct vnode *, int));
  105 int     ubc_pushdirty __P((struct vnode *));
  106 int     ubc_pushdirty_range __P((struct vnode *, off_t, off_t));
  107 int ubc_hold __P((struct vnode *));
  108 void ubc_rele __P((struct vnode *));
  109 void ubc_map __P((struct vnode *));
  110 int     ubc_destroy_named __P((struct vnode *));
  111 int     ubc_release_named __P((struct vnode *));
  112 int     ubc_invalidate __P((struct vnode *, off_t, size_t));
  113 int     ubc_isinuse __P((struct vnode *, int));
  114 
  115 int     ubc_page_op __P((struct vnode *, off_t, int, ppnum_t *, int *));
  116 
  117 /* cluster IO routines */
  118 int     cluster_read __P((struct vnode *, struct uio *, off_t, int, int));
  119 int     advisory_read __P((struct vnode *, off_t, off_t, int, int));
  120 int     cluster_write __P((struct vnode *, struct uio*, off_t, off_t,
  121                 off_t, off_t,  int, int));
  122 int     cluster_push __P((struct vnode *));
  123 int     cluster_release __P((struct vnode *));
  124 int     cluster_pageout __P((struct vnode *, upl_t, vm_offset_t, off_t, int,
  125                 off_t, int, int));
  126 int     cluster_pagein __P((struct vnode *, upl_t, vm_offset_t, off_t, int,
  127                 off_t, int, int));
  128 int     cluster_bp __P((struct buf *));
  129 int     cluster_copy_upl_data __P((struct uio *, upl_t, int, int));
  130 int     cluster_copy_ubc_data __P((struct vnode *, struct uio *, int *, int));
  131 
  132 /* UPL routines */
  133 int     ubc_create_upl __P((struct vnode *, off_t, long, upl_t *,
  134                 upl_page_info_t **, int));
  135 int ubc_upl_map __P((upl_t, vm_offset_t *));
  136 int ubc_upl_unmap __P((upl_t));
  137 int ubc_upl_commit __P((upl_t));
  138 int ubc_upl_commit_range __P((upl_t, vm_offset_t, vm_size_t, int));
  139 int ubc_upl_abort __P((upl_t, int));
  140 int ubc_upl_abort_range __P((upl_t, vm_offset_t, vm_size_t, int));
  141 upl_page_info_t *ubc_upl_pageinfo __P((upl_t));
  142 __END_DECLS
  143 
  144 #define UBCINFOMISSING(vp) \
  145         ((vp) && ((vp)->v_type == VREG) && ((vp)->v_ubcinfo == UBC_INFO_NULL))
  146 
  147 #define UBCINFORECLAIMED(vp) \
  148         ((vp) && ((vp)->v_type == VREG) && ((vp)->v_ubcinfo == UBC_NOINFO))
  149 
  150 #define UBCINFOEXISTS(vp) \
  151         ((vp) && ((vp)->v_type == VREG) && \
  152                 ((vp)->v_ubcinfo) && ((vp)->v_ubcinfo != UBC_NOINFO))
  153 
  154 #define UBCISVALID(vp) \
  155         ((vp) && ((vp)->v_type == VREG) && !((vp)->v_flag & VSYSTEM))
  156 
  157 #define UBCINVALID(vp) \
  158         (((vp) == NULL) || ((vp) && ((vp)->v_type != VREG))     \
  159                 || ((vp) && ((vp)->v_flag & VSYSTEM)))
  160 
  161 #define UBCINFOCHECK(fun, vp)  \
  162         if ((vp) && ((vp)->v_type == VREG) &&   \
  163                         (((vp)->v_ubcinfo == UBC_INFO_NULL)     \
  164                         || ((vp)->v_ubcinfo == UBC_NOINFO))) \
  165                 panic("%s: lost ubc_info", (fun));
  166 
  167 /* Flags for ubc_getobject() */
  168 #define UBC_FLAGS_NONE          0x0000
  169 #define UBC_HOLDOBJECT          0x0001
  170 #define UBC_FOR_PAGEOUT         0x0002
  171 
  172 #endif /* __APPLE_API_EVOLVING */
  173 
  174 #endif  /* _SYS_UBC_H_ */
  175 

Cache object: f7b5ec3cadbfe286459a63b879d7d07a


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