rsh: add rcp, remote copy program
This commit is contained in:
@@ -250,7 +250,7 @@ impl<T: GenericRxDescriptor> GenericRxRing<T> {
|
||||
) -> Result<usize, Error> {
|
||||
let mut inner = self.inner.lock();
|
||||
|
||||
while head.map_or(true, |tail| tail != inner.rd) {
|
||||
while head.is_none_or(|tail| tail != inner.rd) {
|
||||
let index = inner.rd % self.capacity;
|
||||
|
||||
inner.entries.cache_flush_element(index, false);
|
||||
|
||||
@@ -312,7 +312,8 @@ impl IoContext {
|
||||
let (dst_node, dst_name) = if let Ok(node) = self.find(dst_at.clone(), dst, false) {
|
||||
// There is a node with the destination name, but it's not a directory
|
||||
if !node.is_directory() {
|
||||
return Err(Error::AlreadyExists);
|
||||
node.parent().unlink_child(&node)?;
|
||||
// return Err(Error::AlreadyExists);
|
||||
}
|
||||
|
||||
// mv /a/b /c if /c exists -> move /a/b into /c with filename b
|
||||
@@ -321,7 +322,7 @@ impl IoContext {
|
||||
// Otherwise try looking up a parent
|
||||
let node = self.find(dst_at, dst_parent, true)?;
|
||||
if !node.is_directory() {
|
||||
return Err(Error::NotADirectory);
|
||||
node.parent().unlink_child(&node)?;
|
||||
}
|
||||
|
||||
// mv /a/b /c/d if /c/d doesn't exist -> move /a/b into /c with filename d
|
||||
|
||||
Reference in New Issue
Block a user