Merge branch 'main' of github.com:betrusted-io/xous-core into main

This commit is contained in:
bunnie 2022-07-06 04:55:38 +08:00
commit 620b9c2e56
3 changed files with 24 additions and 11 deletions

View file

@ -182,6 +182,18 @@ perform the Xous firmware upgrade. This requires running manual update commands,
- context switches that revert to a prior app screen are restored from a stashed bitmap instead of a full redraw. This
prevents old menus, contexts, and defacements from "piling up" when an app is blocked due to an exceptional condition
being raised (such as the PDDB requesting a full basis unlock to generate the FSCB)
- PDDB support in libstd
- Directories are implemented as dicts in the flat namespace
- The `:` separator is used between path components
- A path that begins with a `:` specifies a basis. That is, the path `example` specifies a dict in the Union basis, while the path `:.System:example` specifies a dict `example` in the basis `.System`.
- A path that is only `:` specifies `all bases`, and is used to list the open bases
- The path `::` specifies the "default basis", which is the most recently-opened one
- Because the path delimiter is `:`, this cannot be used as a string in filenames
- Note, however, that the underlying API allows for `:` in filenames, which will confuse the libstd API
- It is possible for a "file" and a "directory" with the same name to exist in the same "directory". In this case, the entity will return `true` for both `.is_file()` and `.is_directory()`. In practice this doesn't matter, since there are different calls for working with files and directories.
- When deleting a file, it is immediately deleted and all open file handles on the system are now invalid. This is in contrast to other platforms where open file handles still work, or where a file that is open cannot be deleted.
- It is not yet possible to create or delete bases using this API.
- Libstd support for PDDB is not possible with hosted mode. File operations will write to your local filesystem.
## Roadmap to 1.0

View file

@ -336,7 +336,6 @@ pub(crate) fn open_key(
crate::PddbRetcode::AccessDenied
})?;
let mut writer = backing
.writer(*b"KyOR")
.ok_or(crate::PddbRetcode::InternalError)?;
@ -542,7 +541,7 @@ pub(crate) fn delete_key(
mem: &mut xous::MemoryMessage,
pddb_os: &mut PddbOs,
basis_cache: &mut BasisCache,
fds: &mut Vec<Option<crate::FileHandle>>,
all_fds: &mut std::collections::HashMap<Option<xous::PID>, Vec<Option<FileHandle>>>,
) -> Result<(), crate::PddbRetcode> {
// Convert the memory to a Senres buffer
let backing = senres::Message::from_mut_slice(mem.buf.as_slice_mut())
@ -580,14 +579,16 @@ pub(crate) fn delete_key(
Err(crate::PddbRetcode::UnexpectedEof)
})?;
// Mark the entries as deleted in all remaining file handles
for fd in fds
.iter_mut()
.filter(|f| f.is_some())
.map(|f| f.as_mut().unwrap())
{
if fd.basis == basis && fd.key == key && fd.dict == dict {
fd.deleted = true;
// Mark the entry as deleted in all remaining file handles in the entire system
for fds in all_fds.values_mut() {
for fd in fds
.iter_mut()
.filter(|f| f.is_some())
.map(|f| f.as_mut().unwrap())
{
if fd.basis == basis && fd.key == key && fd.dict == dict {
fd.deleted = true;
}
}
}

View file

@ -1045,7 +1045,7 @@ fn wrapped_main() -> ! {
Opcode::DeleteKeyStd => {
if let Some(mem) = msg.body.memory_message_mut() {
mem.offset = None;
if let Err(err) = libstd::delete_key(mem, &mut pddb_os, &mut basis_cache, fd_mapping.entry(msg.sender.pid()).or_default()) {
if let Err(err) = libstd::delete_key(mem, &mut pddb_os, &mut basis_cache, &mut fd_mapping) {
mem.offset = xous::MemoryAddress::new(err as usize);
}
}