Skip to content
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

AllocatedPipe::close(): use Drop & use self #365

Closed
anemoneflower opened this issue Jan 27, 2021 · 0 comments · Fixed by #362
Closed

AllocatedPipe::close(): use Drop & use self #365

anemoneflower opened this issue Jan 27, 2021 · 0 comments · Fixed by #362

Comments

@anemoneflower
Copy link
Collaborator

rv6/kernel-rs/src/pipe.rs

Lines 160 to 168 in 5bbd4f0

// TODO: use `Drop` instead of `close`
// TODO: use `self` instead of `&mut self`
// `&mut self` is used because `Drop` of `File` uses AllocatedPipe inside File.
// https://github.com/kaist-cp/rv6/pull/211#discussion_r491671723
pub unsafe fn close(&mut self, writable: bool) {
if (*self.ptr).close(writable) {
kernel().free(Page::from_usize(self.ptr as *mut Pipe as _));
}
}

anemoneflower added a commit to anemoneflower/rv6-1 that referenced this issue Jan 27, 2021
anemoneflower added a commit to anemoneflower/rv6-1 that referenced this issue Jan 27, 2021
ghost pushed a commit that referenced this issue Jan 29, 2021
362: [Closes #365] Fix TODOs in pipe.rs r=Medowhill a=travis1829

Closes #365 
* #356 에서의 변경사항 중 `Pin` API와 관련없는 내용만 따로 빼서 새롭게 PR을 만들었습니다. (주로 `Pipe`에 대한 변경사항입니다.)
* `Pipe`의 `Drop` trait을 추가했고 `Copy`, `Clone` trait을 없앴습니다.
* 추가로, `Pipe::copy`가 `unsafe`일 필요가 없는 것 같아서 없앴습니다. (혹시 `unsafe`이여야하는 이유가 있다면 말씀해주세요.)
* kernel.rs에 있던 주석을 일부 지웠습니다. (#356 (comment))

Co-authored-by: travis1829 <[email protected]>
ghost pushed a commit that referenced this issue Jan 29, 2021
362: [Closes #365] Fix TODOs in pipe.rs r=Medowhill a=travis1829

Closes #365 
* #356 에서의 변경사항 중 `Pin` API와 관련없는 내용만 따로 빼서 새롭게 PR을 만들었습니다. (주로 `Pipe`에 대한 변경사항입니다.)
* `Pipe`의 `Drop` trait을 추가했고 `Copy`, `Clone` trait을 없앴습니다.
* 추가로, `Pipe::copy`가 `unsafe`일 필요가 없는 것 같아서 없앴습니다. (혹시 `unsafe`이여야하는 이유가 있다면 말씀해주세요.)
* kernel.rs에 있던 주석을 일부 지웠습니다. (#356 (comment))

Co-authored-by: travis1829 <[email protected]>
@ghost ghost closed this as completed in df05e46 Jan 29, 2021
Gabriel4256 pushed a commit to Gabriel4256/rv6 that referenced this issue Sep 8, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant