Annotation of kernel/vm/vm_pager.c, 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:  *     File:   vm/vm_pager.c
        !            33:  *     Author: Avadis Tevanian, Jr., Michael Wayne Young
        !            34:  *
        !            35:  *     Copyright (C) 1986, Avadis Tevanian, Jr., Michael Wayne Young
        !            36:  *     Copyright (C) 1985, Avadis Tevanian, Jr., Michael Wayne Young
        !            37:  *
        !            38:  *     Paging space routine stubs.  Emulates a matchmaker-like interface
        !            39:  *     for builtin pagers.
        !            40:  */
        !            41: 
        !            42: #import <mach/kern_return.h>
        !            43: #import <vm/vm_pager.h>
        !            44: #import <vm/vm_page.h>
        !            45: #import <mach/vm_prot.h>
        !            46: #import <mach/boolean.h>
        !            47: #import <vm/vnode_pager.h>
        !            48: 
        !            49: #import <vm/pmap.h>
        !            50: 
        !            51: /*
        !            52:  *     Important note:
        !            53:  *             All of these routines gain a reference to the
        !            54:  *             object (first argument) as part of the automatic
        !            55:  *             argument conversion. Explicit deallocation is necessary.
        !            56:  */
        !            57: 
        !            58: extern
        !            59: boolean_t      vm_page_zero_fill();
        !            60: 
        !            61: pager_return_t vm_pager_get(pager, m, error)
        !            62:        vm_pager_t      pager;
        !            63:        vm_page_t       m;
        !            64:        int             *error;
        !            65: {
        !            66:        if (pager == vm_pager_null) {
        !            67:                (void) vm_page_zero_fill(m);
        !            68:                return(PAGER_SUCCESS);
        !            69:        }
        !            70:        if (pager->is_device)
        !            71:                panic("vm_pager_get device");
        !            72:        return(vnode_pagein(m, error));
        !            73: }
        !            74: 
        !            75: pager_return_t vm_pager_put(pager, m)
        !            76:        vm_pager_t      pager;
        !            77:        vm_page_t       m;
        !            78: {
        !            79:        if (pager == vm_pager_null)
        !            80:                panic("vm_pager_put: null pager");
        !            81:        if (pager->is_device)
        !            82:            panic("vm_pager_put device");
        !            83:        return(vnode_pageout(m));
        !            84: }
        !            85: 
        !            86: void vm_pager_deallocate(pager)
        !            87:        vm_pager_t      pager;
        !            88: {
        !            89:        if (pager == vm_pager_null)
        !            90:                panic("vm_pager_deallocate: null pager");
        !            91:        if (pager->is_device)
        !            92:                panic("vm_pager_deallocate device");
        !            93:        vnode_dealloc(pager);
        !            94: }
        !            95: 
        !            96: vm_pager_t vm_pager_allocate(size)
        !            97:        vm_size_t       size;
        !            98: {
        !            99:        return((vm_pager_t)vnode_alloc(size));
        !           100: }
        !           101: 
        !           102: boolean_t vm_pager_has_page(pager, offset)
        !           103:        vm_pager_t      pager;
        !           104:        vm_offset_t     offset;
        !           105: {
        !           106:        if ((pager == vm_pager_null) || pager->is_device)
        !           107:                panic("vm_pager_has_page");
        !           108:        return(vnode_has_page(pager,offset));
        !           109: }

unix.superglobalmegacorp.com

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