Annotation of kernel/kern/mapfs.h, revision 1.1

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

unix.superglobalmegacorp.com

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