-
Notifications
You must be signed in to change notification settings - Fork 13
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
[check for #426] Use AsBytes for copy_in, read_kernel #460
Conversation
@@ -185,7 +186,11 @@ pub struct InodeGuard<'a> { | |||
pub inode: &'a Inode, | |||
} | |||
|
|||
#[derive(Default)] | |||
// It needs repr(C) for deriving zerocopy::AsBytes trait. | |||
// DIRSIZ should match conditions for AsBytes. |
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.
DIRSIZ
가 많이 커질 일은 없겠지만 그래도 AsBytes
의 조건을 만족해야하기 때문에 명시했습니다.
@@ -185,7 +186,11 @@ pub struct InodeGuard<'a> { | |||
pub inode: &'a Inode, | |||
} | |||
|
|||
#[derive(Default)] | |||
// It needs repr(C) for deriving zerocopy::AsBytes trait. |
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.
AsBytes
를 derive
한 다른 타입들은 이미 repr(C)
였기 때문에 AsBytes
를 위해 repr(C)
를 추가한 Dirent
에만 이 코멘트를 추가했습니다.
@@ -30,6 +30,7 @@ array-macro = "2.0.0" | |||
static_assertions = "1.1.0" | |||
itertools = { version = "0.10.0", default-features = false } | |||
pin-project = "1" | |||
zerocopy = { version = "0.3.0", default-features = false } |
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.
최신 버전은 0.4.0
이지만 documentation은 0.3.0
까지만 되어 있어서 0.3.0
을 사용했습니다.
/// # Safety | ||
/// | ||
/// `T` can be safely `transmute`d to `[u8; size_of::<T>()]`. | ||
pub unsafe fn read_kernel<T>(&mut self, dst: &mut T, off: u32) -> Result<(), ()> { | ||
/// https://docs.rs/zerocopy/0.3.0/zerocopy/trait.AsBytes.html |
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.
unsafe
가 없어졌어도 Safety 코멘트를 남겨야 할 것 같아서 두었습니다. 대신 이걸 사용한 곳에서는 제거했습니다.
copy_in
도 마찬가지입니다.
현재 확인한 바로는 |
issue #426 의 의미를 파악하기 위한 draft pr 입니다.