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

kernel: Implement a syscall proc macro #65

Merged
merged 4 commits into from Apr 19, 2022

Conversation

48cf
Copy link
Collaborator

@48cf 48cf commented Apr 14, 2022

This patch introduces a procedural macro that takes care of validating input buffers and paths automagically for us :^) There is still a bit of clean up to do, but for the most part it does what it's supposed to be doing.

This patch introduces a procedural macro that takes care of validating
input buffers and paths automagically for us :^) There is still a bit
of clean up/bug fixing to do, but for the most part it does what it's
supposed to be doing.
@Andy-Python-Programmer
Copy link
Owner

When you state bug fixing to do, what are those bugs? Also love the automagically work :^)

@48cf
Copy link
Collaborator Author

48cf commented Apr 19, 2022

When you state bug fixing to do, what are those bugs? Also love the automagically work :^)

Oh my bad, it's just that I was in the middle of writing the PR message when I realized what was causing the proc macro to panic when emitting the code for &Path and I fixed it without realizing I left the comment there 😅

Edit: fixed!

* The current code parsed the array by parsing it as a slice and then
getting a reference `N` elements which does *not* make it an array (it
will still be a slice).
* Update the macro to use `validate_array_mut` to validate and construct
the array.
* Remove the length param from ArgType::Array since the
`validate_array_mut` method takes the length as a const generic
param which means that the compiler can automagically get us the length
:^)
* Remove all of the useless diagnostic since now we automagically get
the array length.

Signed-off-by: Andy-Python-Programmer <andypythonappdeveloper@gmail.com>
Signed-off-by: Andy-Python-Programmer <andypythonappdeveloper@gmail.com>
Signed-off-by: Andy-Python-Programmer <andypythonappdeveloper@gmail.com>
@Andy-Python-Programmer Andy-Python-Programmer merged commit 5aec0e1 into master Apr 19, 2022
@Andy-Python-Programmer
Copy link
Owner

Thanks @czapek1337!

@48cf 48cf deleted the syscall-proc-macro branch April 19, 2022 12:45
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 this pull request may close these issues.

None yet

2 participants