paul@31 | 1 | /* |
paul@31 | 2 | * File access convenience functions and types. |
paul@31 | 3 | * |
paul@31 | 4 | * Copyright (C) 2021 Paul Boddie <paul@boddie.org.uk> |
paul@31 | 5 | * |
paul@31 | 6 | * This program is free software; you can redistribute it and/or |
paul@31 | 7 | * modify it under the terms of the GNU General Public License as |
paul@31 | 8 | * published by the Free Software Foundation; either version 2 of |
paul@31 | 9 | * the License, or (at your option) any later version. |
paul@31 | 10 | * |
paul@31 | 11 | * This program is distributed in the hope that it will be useful, |
paul@31 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@31 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@31 | 14 | * GNU General Public License for more details. |
paul@31 | 15 | * |
paul@31 | 16 | * You should have received a copy of the GNU General Public License |
paul@31 | 17 | * along with this program; if not, write to the Free Software |
paul@31 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
paul@31 | 19 | * Boston, MA 02110-1301, USA |
paul@31 | 20 | */ |
paul@31 | 21 | |
paul@31 | 22 | #include <l4/sys/types.h> |
paul@31 | 23 | |
paul@31 | 24 | #include <systypes/base.h> |
paul@31 | 25 | |
paul@31 | 26 | |
paul@31 | 27 | |
paul@31 | 28 | typedef struct |
paul@31 | 29 | { |
paul@31 | 30 | l4_cap_idx_t ref; |
paul@31 | 31 | char *memory; |
paul@31 | 32 | offset_t start_pos, end_pos, data_end, size; |
paul@31 | 33 | } file_t; |
paul@31 | 34 | |
paul@31 | 35 | offset_t file_span(file_t *file); |
paul@31 | 36 | void file_init(file_t *file); |
paul@31 | 37 | long file_open(file_t *file, l4_cap_idx_t context_ref); |
paul@31 | 38 | void file_close(file_t *file); |
paul@31 | 39 | long file_mmap(file_t *file, offset_t position, offset_t length); |
paul@31 | 40 | long context_open(file_t *file, l4_cap_idx_t server); |
paul@31 | 41 | |
paul@31 | 42 | // vim: tabstop=2 expandtab shiftwidth=2 |