L4Re/departure

libfsclient/include/fsclient/client.h

144:9c62ddc654a7
2021-07-24 Paul Boddie Introduced filesystem objects, separated file paging functionality from openers, and made the ext2 file opener configurable for specific users, each opener being created via the ext2 filesystem object. Changed the file opening mechanism so that openers are called from the file paging functionality where new file accessors and mappers need to be created. A file opening interface has been defined to establish the functionality provided by each opener to implement its part of the mechanism. Introduced filesystem-related functions to the client and file libraries, also changing functions with overridable capability details to accept the actual capability index instead of the name of the capability in the environment. Changed the libext2fs interfacing to work with the updated client library.
     1 /*     2  * Filesystem client functions.     3  *     4  * Copyright (C) 2018, 2019, 2020, 2021 Paul Boddie <paul@boddie.org.uk>     5  *     6  * This program is free software; you can redistribute it and/or     7  * modify it under the terms of the GNU General Public License as     8  * published by the Free Software Foundation; either version 2 of     9  * the License, or (at your option) any later version.    10  *    11  * This program is distributed in the hope that it will be useful,    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    14  * GNU General Public License for more details.    15  *    16  * You should have received a copy of the GNU General Public License    17  * along with this program; if not, write to the Free Software    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor,    19  * Boston, MA  02110-1301, USA    20  */    21     22 #pragma once    23     24 #include <fsclient/file.h>    25     26     27     28 EXTERN_C_BEGIN    29     30 /* Filesystem access operations. */    31     32 l4_cap_idx_t client_open_for_user(sys_uid_t uid, sys_gid_t gid, sys_mode_t umask);    33 l4_cap_idx_t client_open_for_user_using(sys_uid_t uid, sys_gid_t gid, sys_mode_t umask, l4_cap_idx_t server);    34     35 /* Opening and closing operations. */    36     37 void client_close(file_t *file);    38 file_t *client_open(const char *name, flags_t flags);    39 file_t *client_open_using(const char *name, flags_t flags, l4_cap_idx_t server);    40     41 long client_pipe(file_t **reader, file_t **writer);    42 long client_pipe_using(file_t **reader, file_t **writer, l4_cap_idx_t server);    43     44 /* File and region operations. */    45     46 long client_flush(file_t *file);    47 void *client_mmap(file_t *file, offset_t position, offset_t length);    48     49 /* Pipe region operations. */    50     51 long client_current_region(file_t *file);    52 long client_next_region(file_t *file);    53     54 /* File data operations. */    55     56 offset_t client_read(file_t *file, void *buf, offset_t count);    57 offset_t client_write(file_t *file, const void *buf, offset_t count);    58     59 /* File navigation operations. */    60     61 offset_t client_seek(file_t *file, offset_t offset, int whence);    62 long client_tell(file_t *file);    63     64 /* Notification operations. */    65     66 long client_set_blocking(file_t *file, notify_flags_t flags);    67 long client_subscribe(file_t *file, notify_flags_t flags);    68 long client_unsubscribe(file_t *file);    69 long client_wait_file(file_t *file);    70 long client_wait_files(file_t **file);    71     72 EXTERN_C_END    73     74 // vim: tabstop=2 expandtab shiftwidth=2