rbo.h revision e88f27b3
1e88f27b3Smrg/* 2e88f27b3Smrg * Copyright © 2011 Red Hat 3e88f27b3Smrg * 4e88f27b3Smrg * Permission is hereby granted, free of charge, to any person obtaining a 5e88f27b3Smrg * copy of this software and associated documentation files (the "Software"), 6e88f27b3Smrg * to deal in the Software without restriction, including without limitation 7e88f27b3Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8e88f27b3Smrg * and/or sell copies of the Software, and to permit persons to whom the 9e88f27b3Smrg * Software is furnished to do so, subject to the following conditions: 10e88f27b3Smrg * 11e88f27b3Smrg * The above copyright notice and this permission notice (including the next 12e88f27b3Smrg * paragraph) shall be included in all copies or substantial portions of the 13e88f27b3Smrg * Software. 14e88f27b3Smrg * 15e88f27b3Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16e88f27b3Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17e88f27b3Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18e88f27b3Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19e88f27b3Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20e88f27b3Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21e88f27b3Smrg * IN THE SOFTWARE. 22e88f27b3Smrg * 23e88f27b3Smrg * Authors: 24e88f27b3Smrg * Jerome Glisse <j.glisse@gmail.com> 25e88f27b3Smrg */ 26e88f27b3Smrg#ifndef RBO_H 27e88f27b3Smrg#define RBO_H 28e88f27b3Smrg 29e88f27b3Smrg#include "list.h" 30e88f27b3Smrg 31e88f27b3Smrgstruct rbo { 32e88f27b3Smrg struct list_head list; 33e88f27b3Smrg int fd; 34e88f27b3Smrg unsigned refcount; 35e88f27b3Smrg unsigned mapcount; 36e88f27b3Smrg unsigned handle; 37e88f27b3Smrg unsigned size; 38e88f27b3Smrg unsigned alignment; 39e88f27b3Smrg void *data; 40e88f27b3Smrg}; 41e88f27b3Smrg 42e88f27b3Smrgstruct rbo *rbo(int fd, unsigned handle, unsigned size, 43e88f27b3Smrg unsigned alignment, void *ptr); 44e88f27b3Smrgint rbo_map(struct rbo *bo); 45e88f27b3Smrgvoid rbo_unmap(struct rbo *bo); 46e88f27b3Smrgstruct rbo *rbo_incref(struct rbo *bo); 47e88f27b3Smrgstruct rbo *rbo_decref(struct rbo *bo); 48e88f27b3Smrgint rbo_wait(struct rbo *bo); 49e88f27b3Smrg 50e88f27b3Smrg#endif 51