Skip to content

Commit c1455ba

Browse files
misc(kernel): cleanup
Signed-off-by: Anhad Singh <[email protected]>
1 parent b69e91b commit c1455ba

File tree

7 files changed

+7
-8
lines changed

7 files changed

+7
-8
lines changed

src/aero_kernel/src/fs/block/gpt.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use super::BlockDevice;
2121
use core::mem::MaybeUninit;
2222

2323
use alloc::boxed::Box;
24-
use alloc::sync::Arc;
2524

2625
const GPT_TABLE_SIGNATURE: u64 = 0x5452_4150_2049_4645;
2726

@@ -121,7 +120,7 @@ pub struct Gpt {
121120
}
122121

123122
impl Gpt {
124-
pub fn new(controller: Arc<BlockDevice>) -> Option<Self> {
123+
pub fn new(controller: &BlockDevice) -> Option<Self> {
125124
// Get the GPT header.
126125
let mut header = Box::<GptTableHeader>::new_uninit();
127126

src/aero_kernel/src/fs/block/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ pub fn launch() -> Result<()> {
398398
}
399399

400400
for block in blocks_copy {
401-
if let Some(gpt) = Gpt::new(block.clone()) {
401+
if let Some(gpt) = Gpt::new(&block) {
402402
log::info!("block: found GPT on {}!", block.name());
403403

404404
for (i, entry) in gpt

src/aero_kernel/src/net/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ fn packet_processor_thread() {
153153
let options = parser.next::<TcpOptions>();
154154
let payload = &parser.payload()[..size];
155155

156-
tcp::on_packet(tcp, options, payload)
156+
tcp::on_packet(tcp, &options, payload)
157157
}
158158
}
159159
}

src/aero_kernel/src/net/tcp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use crate::socket::tcp::TcpSocket;
2525

2626
static HANDLERS: RwLock<BTreeMap<u16, Arc<TcpSocket>>> = RwLock::new(BTreeMap::new());
2727

28-
pub fn on_packet(tcp: &Tcp, options: TcpOptions, payload: &[u8]) {
28+
pub fn on_packet(tcp: &Tcp, options: &TcpOptions, payload: &[u8]) {
2929
let handlers = HANDLERS.read();
3030

3131
if let Some(handler) = handlers.get(&tcp.dest_port()) {

src/aero_kernel/src/socket/tcp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl TcpSocket {
7575
})
7676
}
7777

78-
pub fn on_packet(&self, tcp: &Tcp, options: TcpOptions, payload: &[u8]) {
78+
pub fn on_packet(&self, tcp: &Tcp, options: &TcpOptions, payload: &[u8]) {
7979
if let Some(socket) = self.tcp.lock_irq().as_mut() {
8080
// Ignore any invalid TCP options.
8181
let options = options.iter().filter_map(Result::ok).collect::<Vec<_>>();

src/aero_kernel/src/socket/unix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ impl UnixSocket {
209209
})
210210
}
211211

212-
pub fn connect_pair(a: DirCacheItem, b: DirCacheItem) -> fs::Result<()> {
212+
pub fn connect_pair(a: &DirCacheItem, b: &DirCacheItem) -> fs::Result<()> {
213213
let a = a
214214
.inode()
215215
.downcast_arc::<UnixSocket>()

src/aero_kernel/src/syscall/net.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ pub fn socket_pair(
337337
let a = create_socket(___domain, type_and_flags, protocol)?;
338338
let b = create_socket(___domain, type_and_flags, protocol)?;
339339

340-
UnixSocket::connect_pair(a.clone(), b.clone())?;
340+
UnixSocket::connect_pair(&a, &b)?;
341341

342342
fds[0] = current_task.file_table.open_file(a, sockfd_flags)? as i32;
343343
fds[1] = current_task.file_table.open_file(b, sockfd_flags)? as i32;

0 commit comments

Comments
 (0)