diff options
| author | Sean Anderson <[email protected]> | 2022-03-22 16:59:20 -0400 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2022-04-01 15:03:13 -0400 |
| commit | f676b45151c33986501e5f8f9bcc64f4a9511089 (patch) | |
| tree | 7a893e7f077239f473c820069f054d25ec1d6d37 /include | |
| parent | 8e1c9fe243a31a0b0a40a80cc20fc3c06246d675 (diff) | |
fs: Add semihosting filesystem
This adds a filesystem which is backed by the host's filesystem. It is
modeled off of sandboxfs, which has very similar aims. Semihosting
doesn't support listing directories (except with SYS_SYSTEM), so neither
do we. it's possible to optimize a bit for the common case of reading a
whole file by omitting a call to smh_seek, but this is left as a future
optimization.
Signed-off-by: Sean Anderson <[email protected]>
Diffstat (limited to 'include')
| -rw-r--r-- | include/fs.h | 1 | ||||
| -rw-r--r-- | include/semihostingfs.h | 21 |
2 files changed, 22 insertions, 0 deletions
diff --git a/include/fs.h b/include/fs.h index b607b0028dc..e2beba36b98 100644 --- a/include/fs.h +++ b/include/fs.h @@ -18,6 +18,7 @@ struct cmd_tbl; #define FS_TYPE_BTRFS 5 #define FS_TYPE_SQUASHFS 6 #define FS_TYPE_EROFS 7 +#define FS_TYPE_SEMIHOSTING 8 struct blk_desc; diff --git a/include/semihostingfs.h b/include/semihostingfs.h new file mode 100644 index 00000000000..25ebdbbeff3 --- /dev/null +++ b/include/semihostingfs.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (C) 2022, Sean Anderson <[email protected]> + * Copyright (c) 2012, Google Inc. + */ + +#ifndef __SEMIHOSTING_FS__ +#define __SEMIHOSTING_FS__ + +struct blk_desc; +struct disk_partition; + +int smh_fs_set_blk_dev(struct blk_desc *rbdd, struct disk_partition *info); +void smh_fs_close(void); +int smh_fs_size(const char *filename, loff_t *size); +int smh_fs_read(const char *filename, void *buf, loff_t offset, loff_t len, + loff_t *actread); +int smh_fs_write(const char *filename, void *buf, loff_t offset, + loff_t len, loff_t *actwrite); + +#endif |
