Annotation of XNU/bsd/kern/mapfs.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      6:  * The contents of this file constitute Original Code as defined in and
                      7:  * are subject to the Apple Public Source License Version 1.1 (the
                      8:  * "License").  You may not use this file except in compliance with the
                      9:  * License.  Please obtain a copy of the License at
                     10:  * http://www.apple.com/publicsource and read it before using this file.
                     11:  * 
                     12:  * This Original Code and all software distributed under the License are
                     13:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     14:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     15:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     16:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     17:  * License for the specific language governing rights and limitations
                     18:  * under the License.
                     19:  * 
                     20:  * @APPLE_LICENSE_HEADER_END@
                     21:  */
                     22: /* 
                     23:  * Mach Operating System
                     24:  * Copyright (c) 1987 Carnegie-Mellon University
                     25:  * All rights reserved.  The CMU software License Agreement specifies
                     26:  * the terms and conditions for use and redistribution.
                     27:  */
                     28: /*
                     29:  * HISTORY
                     30:  *  3-Aug-90  Doug Mitchell at NeXT
                     31:  *     Added prototypes for exported functions.
                     32:  *
                     33:  * 18-Feb-90  Gregg Kellogg (gk) at NeXT
                     34:  *     Merged in with Mach 2.5 stuff.
                     35:  *
                     36:  *  9-Mar-88  John Seamons (jks) at NeXT
                     37:  *     Allocate vm_info structures from a zone.
                     38:  *
                     39:  * 11-Jun-87  William Bolosky (bolosky) at Carnegie-Mellon University
                     40:  *     Changed pager_id to pager.
                     41:  *
                     42:  * 30-Apr-87  Avadis Tevanian (avie) at Carnegie-Mellon University
                     43:  *     Created.
                     44:  */
                     45: /*
                     46:  *     File:   mapfs.h
                     47:  *     Author: Avadis Tevanian, Jr.
                     48:  *     Copyright (C) 1987, Avadis Tevanian, Jr.
                     49:  *
                     50:  *     Header file for mapped file system support.
                     51:  *
                     52:  */ 
                     53: 
                     54: #ifndef        _KERN_MAPFS_H_
                     55: #define        _KERN_MAPFS_H_
                     56: 
                     57: #include <vm/vnode_pager.h>
                     58: #include <kern/queue.h>
                     59: #include <sys/types.h>
                     60: #include <sys/vnode.h>
                     61: 
                     62: #include <sys/lock.h>
                     63: /*
                     64:  *     Associated with each mapped file is information about its
                     65:  *     corresponding VM window.  This information is kept in the following
                     66:  *     vm_info structure.
                     67:  */
                     68: struct vm_info {
                     69:        vnode_pager_t   pager;          /*  pager */
                     70:        short           map_count;      /* number of times mapped */
                     71:        short           use_count;      /* number of times in use */
                     72:        vm_offset_t     va;             /* mapped virtual address */
                     73:        vm_size_t       size;           /* mapped size */
                     74:        vm_offset_t     offset;         /* offset into file at va */
                     75:        vm_size_t       vnode_size;     /* vnode size (not reflected in ip) */
                     76:        void *          lock;           /* lock for changing window */
                     77:        void *          object;         /* object [for KERNEL flushing] */
                     78:        queue_chain_t   lru_links;      /* lru queue links */
                     79:        struct ucred    *cred;          /* vnode credentials */
                     80:        int             error;          /* holds error codes */
                     81:        u_int   queued:1,       /* on lru queue? */
                     82:                        dirty:1,        /* range needs flushing? */
                     83:                        close_flush:1,  /* flush on close */
                     84:                        invalidate:1,   /* is mapping invalid? */
                     85:                        busy:1,                 /* are we busy conducting an uiomove */
                     86:                        delayed_fsync:1,/* need to do a push after the uiomove completes */
                     87:                        filesize:1,             /* want size as reflected in ip */
                     88:                        mapped:1,               /* mapped into KERNEL VM? */
                     89:                        dying:1;                /* vm_info being freed */
                     90:        vm_size_t       dirtysize;      /* unwritten data so far */
                     91:        vm_offset_t     dirtyoffset;    /* unwritten data so far */
                     92: };
                     93: 
                     94: #define VM_INFO_NULL   ((struct vm_info *) 0)
                     95: 
                     96: extern struct zone     *vm_info_zone;
                     97: 
                     98: /*
                     99:  * exported primitives for loadable file systems.
                    100:  */
                    101: int vm_info_init __P((struct vnode *));
                    102: void vm_info_free  __P((struct vnode *));
                    103: 
                    104: #define ISMAPPABLEFILE(vp)     \
                    105:        (((vp)->v_type == VREG) && ((vp)->v_vm_info))
                    106: 
                    107: #define ISMAPPEDFILE(vp)       \
                    108:        (((vp)->v_type == VREG) &&      \
                    109:        ((vp)->v_vm_info) && ((vp)->v_vm_info->mapped))
                    110: 
                    111: #define NOTMAPPEDFILE(vp)      \
                    112:        (((vp)->v_type == VREG) &&      \
                    113:        (((vp)->v_vm_info) && !((vp)->v_vm_info->mapped)))
                    114: 
                    115: #define ISMAPFILEFLUSH(vp)     \
                    116:        (((vp)->v_type == VREG) &&      \
                    117:        ((vp)->v_vm_info) && ((vp)->v_vm_info->mapped) && \
                    118:        ((vp)->v_vm_info->dirty))
                    119: 
                    120: 
                    121: 
                    122: #endif /* _KERN_MAPFS_H_ */
                    123: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.