1129198Scognet/*- 2129198Scognet * Copyright (c) 2003 Alan L. Cox <alc@cs.rice.edu> 3129198Scognet * All rights reserved. 4129198Scognet * 5129198Scognet * Redistribution and use in source and binary forms, with or without 6129198Scognet * modification, are permitted provided that the following conditions 7129198Scognet * are met: 8129198Scognet * 1. Redistributions of source code must retain the above copyright 9129198Scognet * notice, this list of conditions and the following disclaimer. 10129198Scognet * 2. Redistributions in binary form must reproduce the above copyright 11129198Scognet * notice, this list of conditions and the following disclaimer in the 12129198Scognet * documentation and/or other materials provided with the distribution. 13129198Scognet * 14129198Scognet * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15129198Scognet * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16129198Scognet * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17129198Scognet * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18129198Scognet * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19129198Scognet * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20129198Scognet * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21129198Scognet * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22129198Scognet * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23129198Scognet * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24129198Scognet * SUCH DAMAGE. 25129198Scognet * 26129198Scognet * $FreeBSD$ 27129198Scognet */ 28129198Scognet 29129198Scognet#ifndef _MACHINE_SF_BUF_H_ 30129198Scognet#define _MACHINE_SF_BUF_H_ 31129198Scognet 32266175Sian#include <sys/queue.h> 33129198Scognet 34129198Scognetstruct vm_page; 35129198Scognet 36129198Scognetstruct sf_buf { 37129198Scognet LIST_ENTRY(sf_buf) list_entry; /* list of buffers */ 38129198Scognet TAILQ_ENTRY(sf_buf) free_entry; /* list of buffers */ 39129198Scognet struct vm_page *m; /* currently mapped page */ 40129198Scognet vm_offset_t kva; /* va of mapping */ 41129198Scognet int ref_count; /* usage of this mapping */ 42129198Scognet}; 43129198Scognet 44129198Scognetstatic __inline vm_offset_t 45129198Scognetsf_buf_kva(struct sf_buf *sf) 46129198Scognet{ 47129198Scognet 48129198Scognet return (sf->kva); 49129198Scognet} 50129198Scognet 51129198Scognetstatic __inline struct vm_page * 52129198Scognetsf_buf_page(struct sf_buf *sf) 53129198Scognet{ 54129198Scognet 55129198Scognet return (sf->m); 56129198Scognet} 57129198Scognet 58255352Sglebiusstruct sf_buf * sf_buf_alloc(struct vm_page *m, int flags); 59255352Sglebiusvoid sf_buf_free(struct sf_buf *sf); 60255352Sglebius 61129198Scognet#endif /* !_MACHINE_SF_BUF_H_ */ 62