17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*f8bbc571SPavel Filipensky * Common Development and Distribution License (the "License"). 6*f8bbc571SPavel Filipensky * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*f8bbc571SPavel Filipensky * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 277c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate /* 307c478bd9Sstevel@tonic-gate * University Copyright- Copyright (c) 1982, 1986, 1988 317c478bd9Sstevel@tonic-gate * The Regents of the University of California 327c478bd9Sstevel@tonic-gate * All Rights Reserved 337c478bd9Sstevel@tonic-gate * 347c478bd9Sstevel@tonic-gate * University Acknowledgment- Portions of this document are derived from 357c478bd9Sstevel@tonic-gate * software developed by the University of California, Berkeley, and its 367c478bd9Sstevel@tonic-gate * contributors. 377c478bd9Sstevel@tonic-gate */ 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate #ifndef _VM_PVN_H 407c478bd9Sstevel@tonic-gate #define _VM_PVN_H 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate #include <sys/buf.h> 437c478bd9Sstevel@tonic-gate #include <vm/seg.h> 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate #ifdef __cplusplus 467c478bd9Sstevel@tonic-gate extern "C" { 477c478bd9Sstevel@tonic-gate #endif 487c478bd9Sstevel@tonic-gate 497c478bd9Sstevel@tonic-gate #ifdef _KERNEL 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gate /* 527c478bd9Sstevel@tonic-gate * VM - paged vnode. 537c478bd9Sstevel@tonic-gate * 547c478bd9Sstevel@tonic-gate * The VM system manages memory as a cache of paged vnodes. 557c478bd9Sstevel@tonic-gate * This file desribes the interfaces to common subroutines 567c478bd9Sstevel@tonic-gate * used to help implement the VM/file system routines. 577c478bd9Sstevel@tonic-gate */ 587c478bd9Sstevel@tonic-gate 597c478bd9Sstevel@tonic-gate struct page *pvn_read_kluster(struct vnode *vp, u_offset_t off, 607c478bd9Sstevel@tonic-gate struct seg *seg, caddr_t addr, u_offset_t *offp, 617c478bd9Sstevel@tonic-gate size_t *lenp, u_offset_t vp_off, size_t vp_len, 627c478bd9Sstevel@tonic-gate int isra); 637c478bd9Sstevel@tonic-gate struct page *pvn_write_kluster(struct vnode *vp, struct page *pp, 647c478bd9Sstevel@tonic-gate u_offset_t *offp, size_t *lenp, u_offset_t vp_off, 657c478bd9Sstevel@tonic-gate size_t vp_len, int flags); 667c478bd9Sstevel@tonic-gate void pvn_read_done(struct page *plist, int flags); 677c478bd9Sstevel@tonic-gate void pvn_write_done(struct page *plist, int flags); 687c478bd9Sstevel@tonic-gate void pvn_io_done(struct page *plist); 697c478bd9Sstevel@tonic-gate int pvn_vplist_dirty(struct vnode *vp, u_offset_t off, 707c478bd9Sstevel@tonic-gate int (*putapage)(vnode_t *, struct page *, u_offset_t *, 717c478bd9Sstevel@tonic-gate size_t *, int, cred_t *), 727c478bd9Sstevel@tonic-gate int flags, struct cred *cred); 73*f8bbc571SPavel Filipensky void pvn_vplist_setdirty(vnode_t *vp, int (*page_check)(page_t *)); 747c478bd9Sstevel@tonic-gate int pvn_getdirty(struct page *pp, int flags); 757c478bd9Sstevel@tonic-gate void pvn_vpzero(struct vnode *vp, u_offset_t vplen, size_t zbytes); 767c478bd9Sstevel@tonic-gate int pvn_getpages( 777c478bd9Sstevel@tonic-gate int (*getpage)(vnode_t *, u_offset_t, size_t, uint_t *, 787c478bd9Sstevel@tonic-gate struct page *[], size_t, struct seg *, 797c478bd9Sstevel@tonic-gate caddr_t, enum seg_rw, cred_t *), 807c478bd9Sstevel@tonic-gate struct vnode *vp, u_offset_t off, size_t len, 817c478bd9Sstevel@tonic-gate uint_t *protp, struct page **pl, size_t plsz, 827c478bd9Sstevel@tonic-gate struct seg *seg, caddr_t addr, enum seg_rw rw, 837c478bd9Sstevel@tonic-gate struct cred *cred); 847c478bd9Sstevel@tonic-gate void pvn_plist_init(struct page *pp, struct page **pl, size_t plsz, 857c478bd9Sstevel@tonic-gate u_offset_t off, size_t io_len, enum seg_rw rw); 867c478bd9Sstevel@tonic-gate void pvn_init(void); 877c478bd9Sstevel@tonic-gate 887c478bd9Sstevel@tonic-gate /* 89*f8bbc571SPavel Filipensky * The value is put in p_hash to identify marker pages. It is safe to 90*f8bbc571SPavel Filipensky * test p_hash ==(!=) PVN_VPLIST_HASH_TAG even without holding p_selock. 91*f8bbc571SPavel Filipensky */ 92*f8bbc571SPavel Filipensky #define PVN_VPLIST_HASH_TAG ((page_t *)-1) 93*f8bbc571SPavel Filipensky 94*f8bbc571SPavel Filipensky /* 957c478bd9Sstevel@tonic-gate * When requesting pages from the getpage routines, pvn_getpages will 967c478bd9Sstevel@tonic-gate * allocate space to return PVN_GETPAGE_NUM pages which map PVN_GETPAGE_SZ 977c478bd9Sstevel@tonic-gate * worth of bytes. These numbers are chosen to be the minimum of the max's 987c478bd9Sstevel@tonic-gate * given in terms of bytes and pages. 997c478bd9Sstevel@tonic-gate */ 1007c478bd9Sstevel@tonic-gate #define PVN_MAX_GETPAGE_SZ 0x10000 /* getpage size limit */ 1017c478bd9Sstevel@tonic-gate #define PVN_MAX_GETPAGE_NUM 0x8 /* getpage page limit */ 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate #if PVN_MAX_GETPAGE_SZ > PVN_MAX_GETPAGE_NUM * PAGESIZE 1047c478bd9Sstevel@tonic-gate 1057c478bd9Sstevel@tonic-gate #define PVN_GETPAGE_SZ ptob(PVN_MAX_GETPAGE_NUM) 1067c478bd9Sstevel@tonic-gate #define PVN_GETPAGE_NUM PVN_MAX_GETPAGE_NUM 1077c478bd9Sstevel@tonic-gate 1087c478bd9Sstevel@tonic-gate #else 1097c478bd9Sstevel@tonic-gate 1107c478bd9Sstevel@tonic-gate #define PVN_GETPAGE_SZ PVN_MAX_GETPAGE_SZ 1117c478bd9Sstevel@tonic-gate #define PVN_GETPAGE_NUM btop(PVN_MAX_GETPAGE_SZ) 1127c478bd9Sstevel@tonic-gate 1137c478bd9Sstevel@tonic-gate #endif 1147c478bd9Sstevel@tonic-gate 1157c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 1167c478bd9Sstevel@tonic-gate 1177c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1187c478bd9Sstevel@tonic-gate } 1197c478bd9Sstevel@tonic-gate #endif 1207c478bd9Sstevel@tonic-gate 1217c478bd9Sstevel@tonic-gate #endif /* _VM_PVN_H */ 122