| [2f02aa17] | 1 | /*
|
|---|
| [d7f7a4a] | 2 | * SPDX-FileCopyrightText: 2007 Jakub Jermar
|
|---|
| [2f02aa17] | 3 | *
|
|---|
| [d7f7a4a] | 4 | * SPDX-License-Identifier: BSD-3-Clause
|
|---|
| [2f02aa17] | 5 | */
|
|---|
| 6 |
|
|---|
| 7 | /** @addtogroup libc
|
|---|
| 8 | * @{
|
|---|
| 9 | */
|
|---|
| 10 | /** @file
|
|---|
| 11 | */
|
|---|
| 12 |
|
|---|
| [4805495] | 13 | #ifndef _LIBC_VFS_H_
|
|---|
| 14 | #define _LIBC_VFS_H_
|
|---|
| [2f02aa17] | 15 |
|
|---|
| [8d2dd7f2] | 16 | #include <stddef.h>
|
|---|
| 17 | #include <stdint.h>
|
|---|
| [2595dab] | 18 | #include <ipc/vfs.h>
|
|---|
| [15f3c3f] | 19 | #include <ipc/loc.h>
|
|---|
| [10e4cd7] | 20 | #include <adt/list.h>
|
|---|
| [2595dab] | 21 | #include <stdio.h>
|
|---|
| [866e627] | 22 | #include <async.h>
|
|---|
| [23c8acd9] | 23 | #include <offset.h>
|
|---|
| [66366470] | 24 |
|
|---|
| [2bc13887] | 25 | enum vfs_change_state_type {
|
|---|
| 26 | VFS_PASS_HANDLE
|
|---|
| 27 | };
|
|---|
| [17b2aac] | 28 |
|
|---|
| [6e5562a] | 29 | typedef enum {
|
|---|
| 30 | KIND_FILE,
|
|---|
| 31 | KIND_DIRECTORY,
|
|---|
| 32 | } vfs_file_kind_t;
|
|---|
| 33 |
|
|---|
| [39330200] | 34 | typedef struct {
|
|---|
| [23a0368] | 35 | fs_handle_t fs_handle;
|
|---|
| 36 | service_id_t service_id;
|
|---|
| 37 | fs_index_t index;
|
|---|
| 38 | unsigned int lnkcnt;
|
|---|
| 39 | bool is_file;
|
|---|
| 40 | bool is_directory;
|
|---|
| 41 | aoff64_t size;
|
|---|
| 42 | service_id_t service;
|
|---|
| [39330200] | 43 | } vfs_stat_t;
|
|---|
| [23a0368] | 44 |
|
|---|
| [39330200] | 45 | typedef struct {
|
|---|
| [b5b5d84] | 46 | char fs_name[FS_NAME_MAXLEN + 1];
|
|---|
| 47 | uint32_t f_bsize; /* fundamental file system block size */
|
|---|
| 48 | uint64_t f_blocks; /* total data blocks in file system */
|
|---|
| 49 | uint64_t f_bfree; /* free blocks in fs */
|
|---|
| [39330200] | 50 | } vfs_statfs_t;
|
|---|
| [b5b5d84] | 51 |
|
|---|
| [b14d9f9] | 52 | /** List of file system types */
|
|---|
| 53 | typedef struct {
|
|---|
| 54 | char **fstypes;
|
|---|
| 55 | char *buf;
|
|---|
| 56 | size_t size;
|
|---|
| 57 | } vfs_fstypes_t;
|
|---|
| 58 |
|
|---|
| [b7fd2a0] | 59 | extern errno_t vfs_fhandle(FILE *, int *);
|
|---|
| [2595dab] | 60 |
|
|---|
| [3ba431a] | 61 | extern char *vfs_absolutize(const char *, size_t *);
|
|---|
| [b7fd2a0] | 62 | extern errno_t vfs_clone(int, int, bool, int *);
|
|---|
| 63 | extern errno_t vfs_cwd_get(char *path, size_t);
|
|---|
| 64 | extern errno_t vfs_cwd_set(const char *path);
|
|---|
| [866e627] | 65 | extern async_exch_t *vfs_exchange_begin(void);
|
|---|
| 66 | extern void vfs_exchange_end(async_exch_t *);
|
|---|
| [b7fd2a0] | 67 | extern errno_t vfs_fsprobe(const char *, service_id_t, vfs_fs_probe_info_t *);
|
|---|
| 68 | extern errno_t vfs_fstypes(vfs_fstypes_t *);
|
|---|
| [b14d9f9] | 69 | extern void vfs_fstypes_free(vfs_fstypes_t *);
|
|---|
| [b7fd2a0] | 70 | extern errno_t vfs_link(int, const char *, vfs_file_kind_t, int *);
|
|---|
| 71 | extern errno_t vfs_link_path(const char *, vfs_file_kind_t, int *);
|
|---|
| 72 | extern errno_t vfs_lookup(const char *, int, int *);
|
|---|
| 73 | extern errno_t vfs_lookup_open(const char *, int, int, int *);
|
|---|
| 74 | extern errno_t vfs_mount_path(const char *, const char *, const char *,
|
|---|
| [80743a1] | 75 | const char *, unsigned int, unsigned int);
|
|---|
| [b7fd2a0] | 76 | extern errno_t vfs_mount(int, const char *, service_id_t, const char *, unsigned,
|
|---|
| [80743a1] | 77 | unsigned, int *);
|
|---|
| [b7fd2a0] | 78 | extern errno_t vfs_open(int, int);
|
|---|
| 79 | extern errno_t vfs_pass_handle(async_exch_t *, int, async_exch_t *);
|
|---|
| 80 | extern errno_t vfs_put(int);
|
|---|
| 81 | extern errno_t vfs_read(int, aoff64_t *, void *, size_t, size_t *);
|
|---|
| 82 | extern errno_t vfs_read_short(int, aoff64_t, void *, size_t, ssize_t *);
|
|---|
| 83 | extern errno_t vfs_receive_handle(bool, int *);
|
|---|
| 84 | extern errno_t vfs_rename_path(const char *, const char *);
|
|---|
| 85 | extern errno_t vfs_resize(int, aoff64_t);
|
|---|
| [5126f80] | 86 | extern int vfs_root(void);
|
|---|
| [b7fd2a0] | 87 | extern errno_t vfs_root_set(int);
|
|---|
| [39330200] | 88 | extern errno_t vfs_stat(int, vfs_stat_t *);
|
|---|
| 89 | extern errno_t vfs_stat_path(const char *, vfs_stat_t *);
|
|---|
| 90 | extern errno_t vfs_statfs(int, vfs_statfs_t *);
|
|---|
| 91 | extern errno_t vfs_statfs_path(const char *, vfs_statfs_t *);
|
|---|
| [b7fd2a0] | 92 | extern errno_t vfs_sync(int);
|
|---|
| 93 | extern errno_t vfs_unlink(int, const char *, int);
|
|---|
| 94 | extern errno_t vfs_unlink_path(const char *);
|
|---|
| 95 | extern errno_t vfs_unmount(int);
|
|---|
| 96 | extern errno_t vfs_unmount_path(const char *);
|
|---|
| 97 | extern errno_t vfs_walk(int, const char *, int, int *);
|
|---|
| 98 | extern errno_t vfs_write(int, aoff64_t *, const void *, size_t, size_t *);
|
|---|
| 99 | extern errno_t vfs_write_short(int, aoff64_t, const void *, size_t, ssize_t *);
|
|---|
| [354b642] | 100 |
|
|---|
| [2f02aa17] | 101 | #endif
|
|---|
| 102 |
|
|---|
| 103 | /** @}
|
|---|
| 104 | */
|
|---|