10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*11888SPavel.Filipensky@Sun.COM * Common Development and Distribution License (the "License"). 6*11888SPavel.Filipensky@Sun.COM * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*11888SPavel.Filipensky@Sun.COM * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 270Sstevel@tonic-gate /* All Rights Reserved */ 280Sstevel@tonic-gate 290Sstevel@tonic-gate /* 300Sstevel@tonic-gate * University Copyright- Copyright (c) 1982, 1986, 1988 310Sstevel@tonic-gate * The Regents of the University of California 320Sstevel@tonic-gate * All Rights Reserved 330Sstevel@tonic-gate * 340Sstevel@tonic-gate * University Acknowledgment- Portions of this document are derived from 350Sstevel@tonic-gate * software developed by the University of California, Berkeley, and its 360Sstevel@tonic-gate * contributors. 370Sstevel@tonic-gate */ 380Sstevel@tonic-gate 390Sstevel@tonic-gate #ifndef _VM_PVN_H 400Sstevel@tonic-gate #define _VM_PVN_H 410Sstevel@tonic-gate 420Sstevel@tonic-gate #include <sys/buf.h> 430Sstevel@tonic-gate #include <vm/seg.h> 440Sstevel@tonic-gate 450Sstevel@tonic-gate #ifdef __cplusplus 460Sstevel@tonic-gate extern "C" { 470Sstevel@tonic-gate #endif 480Sstevel@tonic-gate 490Sstevel@tonic-gate #ifdef _KERNEL 500Sstevel@tonic-gate 510Sstevel@tonic-gate /* 520Sstevel@tonic-gate * VM - paged vnode. 530Sstevel@tonic-gate * 540Sstevel@tonic-gate * The VM system manages memory as a cache of paged vnodes. 550Sstevel@tonic-gate * This file desribes the interfaces to common subroutines 560Sstevel@tonic-gate * used to help implement the VM/file system routines. 570Sstevel@tonic-gate */ 580Sstevel@tonic-gate 590Sstevel@tonic-gate struct page *pvn_read_kluster(struct vnode *vp, u_offset_t off, 600Sstevel@tonic-gate struct seg *seg, caddr_t addr, u_offset_t *offp, 610Sstevel@tonic-gate size_t *lenp, u_offset_t vp_off, size_t vp_len, 620Sstevel@tonic-gate int isra); 630Sstevel@tonic-gate struct page *pvn_write_kluster(struct vnode *vp, struct page *pp, 640Sstevel@tonic-gate u_offset_t *offp, size_t *lenp, u_offset_t vp_off, 650Sstevel@tonic-gate size_t vp_len, int flags); 660Sstevel@tonic-gate void pvn_read_done(struct page *plist, int flags); 670Sstevel@tonic-gate void pvn_write_done(struct page *plist, int flags); 680Sstevel@tonic-gate void pvn_io_done(struct page *plist); 690Sstevel@tonic-gate int pvn_vplist_dirty(struct vnode *vp, u_offset_t off, 700Sstevel@tonic-gate int (*putapage)(vnode_t *, struct page *, u_offset_t *, 710Sstevel@tonic-gate size_t *, int, cred_t *), 720Sstevel@tonic-gate int flags, struct cred *cred); 73*11888SPavel.Filipensky@Sun.COM void pvn_vplist_setdirty(vnode_t *vp, int (*page_check)(page_t *)); 740Sstevel@tonic-gate int pvn_getdirty(struct page *pp, int flags); 750Sstevel@tonic-gate void pvn_vpzero(struct vnode *vp, u_offset_t vplen, size_t zbytes); 760Sstevel@tonic-gate int pvn_getpages( 770Sstevel@tonic-gate int (*getpage)(vnode_t *, u_offset_t, size_t, uint_t *, 780Sstevel@tonic-gate struct page *[], size_t, struct seg *, 790Sstevel@tonic-gate caddr_t, enum seg_rw, cred_t *), 800Sstevel@tonic-gate struct vnode *vp, u_offset_t off, size_t len, 810Sstevel@tonic-gate uint_t *protp, struct page **pl, size_t plsz, 820Sstevel@tonic-gate struct seg *seg, caddr_t addr, enum seg_rw rw, 830Sstevel@tonic-gate struct cred *cred); 840Sstevel@tonic-gate void pvn_plist_init(struct page *pp, struct page **pl, size_t plsz, 850Sstevel@tonic-gate u_offset_t off, size_t io_len, enum seg_rw rw); 860Sstevel@tonic-gate void pvn_init(void); 870Sstevel@tonic-gate 880Sstevel@tonic-gate /* 89*11888SPavel.Filipensky@Sun.COM * The value is put in p_hash to identify marker pages. It is safe to 90*11888SPavel.Filipensky@Sun.COM * test p_hash ==(!=) PVN_VPLIST_HASH_TAG even without holding p_selock. 91*11888SPavel.Filipensky@Sun.COM */ 92*11888SPavel.Filipensky@Sun.COM #define PVN_VPLIST_HASH_TAG ((page_t *)-1) 93*11888SPavel.Filipensky@Sun.COM 94*11888SPavel.Filipensky@Sun.COM /* 950Sstevel@tonic-gate * When requesting pages from the getpage routines, pvn_getpages will 960Sstevel@tonic-gate * allocate space to return PVN_GETPAGE_NUM pages which map PVN_GETPAGE_SZ 970Sstevel@tonic-gate * worth of bytes. These numbers are chosen to be the minimum of the max's 980Sstevel@tonic-gate * given in terms of bytes and pages. 990Sstevel@tonic-gate */ 1000Sstevel@tonic-gate #define PVN_MAX_GETPAGE_SZ 0x10000 /* getpage size limit */ 1010Sstevel@tonic-gate #define PVN_MAX_GETPAGE_NUM 0x8 /* getpage page limit */ 1020Sstevel@tonic-gate 1030Sstevel@tonic-gate #if PVN_MAX_GETPAGE_SZ > PVN_MAX_GETPAGE_NUM * PAGESIZE 1040Sstevel@tonic-gate 1050Sstevel@tonic-gate #define PVN_GETPAGE_SZ ptob(PVN_MAX_GETPAGE_NUM) 1060Sstevel@tonic-gate #define PVN_GETPAGE_NUM PVN_MAX_GETPAGE_NUM 1070Sstevel@tonic-gate 1080Sstevel@tonic-gate #else 1090Sstevel@tonic-gate 1100Sstevel@tonic-gate #define PVN_GETPAGE_SZ PVN_MAX_GETPAGE_SZ 1110Sstevel@tonic-gate #define PVN_GETPAGE_NUM btop(PVN_MAX_GETPAGE_SZ) 1120Sstevel@tonic-gate 1130Sstevel@tonic-gate #endif 1140Sstevel@tonic-gate 1150Sstevel@tonic-gate #endif /* _KERNEL */ 1160Sstevel@tonic-gate 1170Sstevel@tonic-gate #ifdef __cplusplus 1180Sstevel@tonic-gate } 1190Sstevel@tonic-gate #endif 1200Sstevel@tonic-gate 1210Sstevel@tonic-gate #endif /* _VM_PVN_H */ 122