-
Notifications
You must be signed in to change notification settings - Fork 104
Support directory deletion #210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Support directory deletion #210
Conversation
ae73f2f to
cf1eca0
Compare
src/volume_mgr.rs
Outdated
| .iter() | ||
| .find(|dir_info| { | ||
| // Subdirectory is already open. | ||
| dir_info.cluster == dir_entry.cluster |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that if the directory you are deleting is already open, you shouldn't be able to delete it because it would leave a dangling entry.
src/volume_mgr.rs
Outdated
| let dir_idx = data.get_dir_by_id(directory)?; | ||
| let dir_info = &data.open_dirs[dir_idx]; | ||
| let volume_idx = data.get_volume_by_id(dir_info.raw_volume)?; | ||
| let parent_dir_info = data.open_dirs[dir_idx].clone(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't recall needing to clone an entry for an open directory before (unless I'm forgetting about it). What's the reason for the clone as opposed to borrowing the entry, or referring to it by index? This is probably fine, it just gave me pause as I read it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only needed if we want to allow deletion of currently open directories, because I'm creating a new DirectoryInfo in a block and making it a borrow would require using some of the lifetime extension tricks, while the struct looked tiny enough that cloning seemed cleaner to do.
|
Rebasing after #211 is merged should fix CI. |
cf1eca0 to
93bb5e5
Compare
Fix #186.
The changes to the
Errorenum would be a breaking change. The new variant can either be only added, leaving behind a variant that will never be constructed or replaced.