Skip to content

Commit

Permalink
require Inode instead of Directory for list_dir
Browse files Browse the repository at this point in the history
  • Loading branch information
tsatke committed Oct 27, 2023
1 parent 2fc94a1 commit 5eba56d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ext2/src/dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::error::Error;
use crate::superblock::RequiredFeatures;
use crate::{
bytefield, bytefield_field_read, bytefield_field_write, check_is_implemented, Directory,
Ext2Fs, Inode, InodeAddress,
Ext2Fs, Inode, InodeAddress, Type,
};
use alloc::vec;
use alloc::vec::Vec;
Expand All @@ -15,7 +15,9 @@ where
T: BlockDevice,
{
// TODO: make this return some Result<impl Iterator<Item=DirEntry>, Error>
pub fn list_dir(&self, dir: &Directory) -> Result<Vec<DirEntry>, Error> {
pub fn list_dir(&self, dir: &Inode) -> Result<Vec<DirEntry>, Error> {
debug_assert_eq!(dir.typ(), Type::Directory);

let mut entries = Vec::new();
let block_size = self.superblock.block_size() as usize;
let dir_entries_have_type = self
Expand Down

0 comments on commit 5eba56d

Please sign in to comment.