Skip to content

Commit 00084f5

Browse files
committed
Merge branch 'dev' into main
2 parents a5c4f32 + 87743ba commit 00084f5

File tree

4 files changed

+1
-17
lines changed

4 files changed

+1
-17
lines changed

os/src/fs/inode.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use alloc::vec::Vec;
1010
use spin::Mutex;
1111
use super::File;
1212
use crate::mm::UserBuffer;
13-
use core::any::Any;
1413

1514
pub struct OSInode {
1615
readable: bool,
@@ -157,5 +156,4 @@ impl File for OSInode {
157156
}
158157
total_write_size
159158
}
160-
fn as_any_ref(&self) -> &dyn Any { self }
161159
}

os/src/fs/mod.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,12 @@ mod stdio;
33
mod inode;
44

55
use crate::mm::UserBuffer;
6-
use core::any::Any;
76

8-
pub trait File : Any + Send + Sync {
7+
pub trait File : Send + Sync {
98
fn readable(&self) -> bool;
109
fn writable(&self) -> bool;
1110
fn read(&self, buf: UserBuffer) -> usize;
1211
fn write(&self, buf: UserBuffer) -> usize;
13-
fn as_any_ref(&self) -> &dyn Any;
14-
}
15-
16-
impl dyn File {
17-
#[allow(unused)]
18-
pub fn downcast_ref<T: File>(&self) -> Option<&T> {
19-
self.as_any_ref().downcast_ref::<T>()
20-
}
2112
}
2213

2314
pub use pipe::{Pipe, make_pipe};

os/src/fs/pipe.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use crate::mm::{
55
UserBuffer,
66
};
77
use crate::task::suspend_current_and_run_next;
8-
use core::any::Any;
98

109
pub struct Pipe {
1110
readable: bool,
@@ -165,5 +164,4 @@ impl File for Pipe {
165164
}
166165
}
167166
}
168-
fn as_any_ref(&self) -> &dyn Any { self }
169167
}

os/src/fs/stdio.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use super::File;
22
use crate::mm::{UserBuffer};
33
use crate::sbi::console_getchar;
44
use crate::task::suspend_current_and_run_next;
5-
use core::any::Any;
65

76
pub struct Stdin;
87

@@ -31,7 +30,6 @@ impl File for Stdin {
3130
fn write(&self, _user_buf: UserBuffer) -> usize {
3231
panic!("Cannot write to stdin!");
3332
}
34-
fn as_any_ref(&self) -> &dyn Any { self }
3533
}
3634

3735
impl File for Stdout {
@@ -46,5 +44,4 @@ impl File for Stdout {
4644
}
4745
user_buf.len()
4846
}
49-
fn as_any_ref(&self) -> &dyn Any { self }
5047
}

0 commit comments

Comments
 (0)