1.1 --- a/file.h Thu Apr 01 00:57:43 2021 +0200
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,95 +0,0 @@
1.4 -/*
1.5 - * File access convenience functions and types.
1.6 - *
1.7 - * Copyright (C) 2021 Paul Boddie <paul@boddie.org.uk>
1.8 - *
1.9 - * This program is free software; you can redistribute it and/or
1.10 - * modify it under the terms of the GNU General Public License as
1.11 - * published by the Free Software Foundation; either version 2 of
1.12 - * the License, or (at your option) any later version.
1.13 - *
1.14 - * This program is distributed in the hope that it will be useful,
1.15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.17 - * GNU General Public License for more details.
1.18 - *
1.19 - * You should have received a copy of the GNU General Public License
1.20 - * along with this program; if not, write to the Free Software
1.21 - * Foundation, Inc., 51 Franklin Street, Fifth Floor,
1.22 - * Boston, MA 02110-1301, USA
1.23 - */
1.24 -
1.25 -#include <l4/sys/types.h>
1.26 -
1.27 -#include <systypes/base.h>
1.28 -
1.29 -
1.30 -
1.31 -EXTERN_C_BEGIN
1.32 -
1.33 -/* File access abstraction. */
1.34 -
1.35 -typedef struct
1.36 -{
1.37 - /* File object reference. */
1.38 -
1.39 - l4_cap_idx_t ref;
1.40 -
1.41 - /* Mapped memory accessing a file region. */
1.42 -
1.43 - char *memory;
1.44 -
1.45 - /* File region parameters. */
1.46 -
1.47 - offset_t start_pos, end_pos; /* start and end positions of region */
1.48 - offset_t data_end; /* amount of data in the region */
1.49 -
1.50 - /* Total size of file. */
1.51 -
1.52 - offset_t size;
1.53 -
1.54 -} file_t;
1.55 -
1.56 -
1.57 -
1.58 -/* File operations. */
1.59 -
1.60 -void file_close(file_t *file);
1.61 -long file_open(file_t *file, const char *filename, l4_cap_idx_t server);
1.62 -
1.63 -/* File lifecycle operations. */
1.64 -
1.65 -long file_context(file_t *file, l4_cap_idx_t server);
1.66 -long file_context_open(file_t *file, file_t *context);
1.67 -void file_init(file_t *file);
1.68 -
1.69 -/* File and region operations. */
1.70 -
1.71 -long file_mmap(file_t *file, offset_t position, offset_t length);
1.72 -long file_resize(file_t *file, offset_t size);
1.73 -
1.74 -/* File and region properties. */
1.75 -
1.76 -offset_t file_populated_span(file_t *file);
1.77 -offset_t file_span(file_t *file);
1.78 -
1.79 -/* Convenience functions. */
1.80 -
1.81 -char *file_string_get(file_t *file, offset_t offset);
1.82 -int file_string_set(file_t *file, const char *data, offset_t offset, offset_t *written);
1.83 -
1.84 -
1.85 -
1.86 -/* Pipe operations. */
1.87 -
1.88 -long pipe_open(offset_t size, file_t *reader, file_t *writer, l4_cap_idx_t server);
1.89 -
1.90 -/* Pipe region operations. */
1.91 -
1.92 -long pipe_current(file_t *pipe);
1.93 -long pipe_next(file_t *pipe);
1.94 -long pipe_written(file_t *pipe, offset_t size);
1.95 -
1.96 -EXTERN_C_END
1.97 -
1.98 -// vim: tabstop=2 expandtab shiftwidth=2