-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Refactor makesyscalls.lua #1362
Conversation
Adding @jrtc27 and @arichardson since I can't do that in the reviewers setting.... Note to reviewers: This is my GSoC student's libification of makesyscalls.lua. At this stage, it's a drop in replacement. I'll work with my student on the reviews / commits aspect of the review. I'm looking for reviews on the final product. It should be 'no diffs' or nearly so (I think there's extra comments in a few places still, but I've not checked this final version). I'll also focus initially on the no-diff aspect, and hope the other reviewers have time to review this as to structure, lua goodness, etc. It specifically doesn't have anything relating to reducing the number of files we have to check in as we can generate them on the fly now since (a) make is better able to handle that (b) machines are faster than in the 90s and (c) dependency madness has receeded since the 90s for many (but not all) of these files. These issues will be worked out (and the details and extent litigated) in phase 2. Also, lsg was my first, half-completed attempt at this. He finished it off and got it to this point. Yea! |
Yes. Thank you Warner! I'm excited to get this where it needs to be. I'll appreciate any time and effort spent. There are bits and pieces that are still being iterated on, but the guts are there. Files are being generated (mostly) similar. -Tyler |
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 quite hard to review in any kind of meaningful way. There needs to be some sort of overview of the structure in a README.md as well as the commit message.
What I'll want to do before a merge is to take something closer to final and bring it over to CheriBSD so I can apply our local diffs and see how that works in practice.
Some comments:
- Despite all the indentation commits (that need to be squashed), indentation is wildly inconsistent even within files.
- This is missing some commits to makesyscalls.lua (FREEBSD14 is the canary, but everything since the original split needs a review and merge).
- If there are any differences in generated output they need to be very well documented. The desired number is zero.
- The code might benefit from some subdirectories to differentiate code that generates specific files from library code.
- There should probably be three total commits: add new code, switch what the Makefile uses, remove old code.
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.
Initial pass with some feedback; apologies for largely being a ghost this term. I'll try to scrape some time together in the next week or so to do a more thorough review.
sys/tools/syscalls/bsdio.lua
Outdated
-- in. | ||
-- Useful when a file has multiple stages of generation. | ||
function bsdio:store(str, level) | ||
level = level or 1 -- default to level one if not provided |
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.
Let's just consolidate the comment on this line up with that above the function. Maybe:
Can also specify which order (level) to store in, which defaults to one if not provided.
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.
There are other comments that could use a similar suggestion. I've changed those to match this suggestion (and this one). Please inform me if you see anything else.
d62a646
to
4af7106
Compare
4af7106
to
8c96194
Compare
It would be good to first address luacheck's suggestions:
|
I've noticed 2 real differences so far (the other differences are comments or sorting deltas): We have There may be other issues as well. |
77a16d0
to
ded238c
Compare
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 like the code reorganization. Much improved!
My main gripe: pick an indent style and use it consistently. I personally prefer a tabbed style following our C practices, but 4-spaces would be fine.
sys/tools/syscalls/config.lua
Outdated
ptr_intptr_t_cast = "intptr_t", | ||
obsol = {}, | ||
unimpl = {}, | ||
capabilities_conf = "capabilities.conf", |
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.
Support for capabilities.conf should be dropped as the last consumer went away with be67ea4. It should provably not be removed as part of the refactor, but done on one side or the other.
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 was unsure of this. We'll be able to easily approach this after the refactor, in a separate PR. This is an easy change to make.
if t:validate(t.num - 1) then | ||
table.insert(self.syscalls, t) | ||
else | ||
util.abort(1, "Skipped system call at number " .. t.num) | ||
end |
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.
more spaces. There are several more instances in this file and presumably others, but I'm going to stop commenting here.
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.
In regards to spaces that should be tabs. I've changed all of them to tabs--but programmatically. If I catch any (which I haven't) I will continue to change. This should be done.
sys/tools/syscalls/core/syscall.lua
Outdated
-- reseved system calls. this function deals with both knowing that the specific | ||
-- ones are more copy and so we should just return the object we just made w/o | ||
-- an extra 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'm not sure what this sentence is trying to say.
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've reworded. Please let me know if it is still unclear.
This has been followed up on. All luacheck suggestions are addressed. Thanks for the suggestion! This will be the precedent moving forward. |
Great!! I agree with this sentiment. I will be following your preference. I did not catch that (also the source of why there's differences, as code from makesyscalls.lua followed FreeBSD C practices). It's going to be something I do as I correct the diffs, so it probably won't be changed right away, but it should follow a consistent indentation when it's ready. |
3aed7c8
to
d45f7ff
Compare
c360d4e
to
0ad7862
Compare
Comment aligning was inconsistent and required a ton of book-keeping Replaced comment aligning with just a single tab out Part of refactor of makesyscalls.lua See [Refactor makesyscalls.lua freebsd#1362](freebsd#1362)
Comment aligning was inconsistent and required a ton of book-keeping. Replaced comment aligning with a simpler, single tab out. Part of refactor of makesyscalls.lua. See Refactor makesyscalls.lua freebsd#1362: freebsd#1362
Comment aligning was inconsistent and required a ton of book-keeping. Replaced comment aligning with a simpler, single tab out. Part of refactor of makesyscalls.lua. See Refactor makesyscalls.lua: freebsd#1362.
Comment aligning was inconsistent and required a ton of book-keeping. Replaced comment aligning with a simple, single tab out. See Refactor makesyscalls.lua freebsd#1362.
Comment aligning was inconsistent and required a ton of book-keeping. Replaced comment aligning with a simple, single tab out. See Refactor makesyscalls.lua freebsd#1362. Signed-off-by: agge3 <[email protected]>
Comment aligning was inconsistent and required a ton of book-keeping. Replaced comment aligning with a simple, single tab out. See Refactor makesyscalls.lua freebsd#1362. Signed-off-by: agge3 <[email protected]>
Comment aligning was inconsistent and required a ton of book-keeping. Replaced comment aligning with a simple, single tab out. See Refactor makesyscalls.lua freebsd#1362. Signed-off-by: agge3 <[email protected]>
72cc0fc
to
c9c0ec2
Compare
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've updated my branch with a bunch of whitespace fixes and a few fixups of my prior commits. Except for the extra file generation bits the commits on my branch can be seen as reviews in commit form and squashed directly into your commit without credit. The other two add enough content that a Co-authored-by: credit might be nice if squashed.
https://github.com/brooksdavis/freebsd/tree/refactor-makesyscalls.lua
* main.lua replicates the functionality of makesyscalls.lua * Individual files are generated by their associated module * Modules can be called as standalone scripts to generate a specific file * Data and procedures are performed by objects instead of procedual code * Bitmasks are replaced by declarative types * Temporary files are no longer produced, writing is stored in memory * Comments provide explanation to functions and semantics Google Summer of Code 2024 Final Work Product Sponsored by: Google (GSoC 24) Co-authored-by: Warner Losh <[email protected]> Co-authored-by: Brooks Davis <[email protected]> Pull Request: freebsd#1362
I've added a proposed rebasing and squashing of the new code with follow on commits to connect the new code at https://github.com/brooksdavis/freebsd/tree/refactor-makesyscalls.lua-rebased. Happy to take any feedback about the organization or contents. If it looks good, I'll plan to push to FreeBSD once the current stabilization week ends. |
cdb0e81
to
018b136
Compare
Sorry I didn't follow-up more properly on your previous work. Last week, and this week, are very busy for me. I'll be less busy after this week. This is great!!! Thank you for your help on the final stretch! I appreciate the work!! I'm glad you are pleased with the library. I'm happy to contribute and I really value the effort you've put into this. I've merged 505d596 from that branch to be part of this commit. On my part, I've went through everything thoroughly. All changes are minor or non-invasive. Some final changes that I'd like to add (currently squashed into this commit):
Additionally, I noticed that "converstion" in On the weekend (before next week), I'm hoping to go through again. But I'm happy with this being my final input. In terms of this PR, would you like me to pull your commits over, or would you prefer I leave it how it is? |
068622b
to
b52a459
Compare
I've rebased my branch with your changes (including the typo fix squashed into the main commit). I also fixed the typo upstream to reduce diffs in generated files. I've added commits removing capabilities.conf and I'm happy to do another update Monday if you want to take another pass through the code over the weekend. It's probably somewhat easier if you don't incorporate my changes, but if there are any you want to take as part of the main commit, go ahead. |
Great. Sounds good! Yes, I'll take another pass over the weekend. I'll report any changes I have (if any at all), so everything's ready for Monday. In that case, that will be a bit easier. That's probably what I'll opt for. |
5c3a81f
to
8931f15
Compare
* main.lua replicates the functionality of makesyscalls.lua * Individual files are generated by their associated module * Modules can be called as standalone scripts to generate a specific file * Data and procedures are performed by objects instead of procedual code * Bitmasks are replaced by declarative types * Temporary files are no longer produced, writing is stored in memory * Comments provide explanation to functions and semantics Google Summer of Code 2024 Final Work Product Sponsored by: Google (GSoC 24) Co-authored-by: Warner Losh <[email protected]> Co-authored-by: Kyle Evans <[email protected]> Co-authored-by: Brooks Davis <[email protected]> Signed-off-by: agge3 <[email protected]>
8931f15
to
1529735
Compare
Okay, great! I've went through everything thoroughly again. Final changes I have are:
I've regression tested locally to confirm everything's working as it should. If you're ready to commit, I don't see more areas I would like to address before that. I've opted for keeping the PR as the singular commit that is mine. I appreciate the help and that makes the most sense. It is a lot easier, so thanks! Thank you for the thorough review! I'd like to stay in the loop and continue to maintain (and iterate, if necessary) areas revolving around this library. I'd like to consider myself knowledgeable in the library and would be excited to continue.
|
* main.lua replicates the functionality of makesyscalls.lua * Individual files are generated by their associated module * Modules can be called as standalone scripts to generate a specific file * Data and procedures are performed by objects instead of procedual code * Bitmasks are replaced by declarative types * Temporary files are no longer produced, writing is stored in memory * Comments provide explanation to functions and semantics Google Summer of Code 2024 Final Work Product Sponsored by: Google (GSoC 24) Co-authored-by: Warner Losh <[email protected]> Co-authored-by: Kyle Evans <[email protected]> Co-authored-by: Brooks Davis <[email protected]> Pull Request: freebsd#1362 Signed-off-by: agge3 <[email protected]>
* main.lua replicates the functionality of makesyscalls.lua * Individual files are generated by their associated module * Modules can be called as standalone scripts to generate a specific file * Data and procedures are performed by objects instead of procedual code * Bitmasks are replaced by declarative types * Temporary files are no longer produced, writing is stored in memory * Comments provide explanation to functions and semantics Google Summer of Code 2024 Final Work Product Sponsored by: Google (GSoC 24) Pull Request: freebsd#1362 Signed-off-by: agge3 <[email protected]> Co-authored-by: Warner Losh <[email protected]> Co-authored-by: Kyle Evans <[email protected]> Co-authored-by: Brooks Davis <[email protected]>
* main.lua replicates the functionality of makesyscalls.lua * Individual files are generated by their associated module * Modules can be called as standalone scripts to generate a specific file * Data and procedures are performed by objects instead of procedual code * Bitmasks are replaced by declarative types * Temporary files are no longer produced, writing is stored in memory * Comments provide explanation to functions and semantics Google Summer of Code 2024 Final Work Product Co-authored-by: Warner Losh <[email protected]> Co-authored-by: Kyle Evans <[email protected]> Co-authored-by: Brooks Davis <[email protected]> Sponsored by: Google (GSoC 24) Pull Request: freebsd#1362 Signed-off-by: agge3 <[email protected]>
* main.lua replicates the functionality of makesyscalls.lua * Individual files are generated by their associated module * Modules can be called as standalone scripts to generate a specific file * Data and procedures are performed by objects instead of procedual code * Bitmasks are replaced by declarative types * Temporary files are no longer produced, writing is stored in memory * Comments provide explanation to functions and semantics Google Summer of Code 2024 Final Work Product Co-authored-by: Warner Losh <[email protected]> Co-authored-by: Kyle Evans <[email protected]> Co-authored-by: Brooks Davis <[email protected]> Sponsored by: Google (GSoC 24) Pull Request: freebsd#1362 Signed-off-by: agge3 <[email protected]>
Merged as commit 9ded074 |
* main.lua replicates the functionality of makesyscalls.lua * Individual files are generated by their associated module * Modules can be called as standalone scripts to generate a specific file * Data and procedures are performed by objects instead of procedual code * Bitmasks are replaced by declarative types * Temporary files are no longer produced, writing is stored in memory * Comments provide explanation to functions and semantics Google Summer of Code 2024 Final Work Product Co-authored-by: Warner Losh <[email protected]> Co-authored-by: Kyle Evans <[email protected]> Co-authored-by: Brooks Davis <[email protected]> Sponsored by: Google (GSoC 24) Pull Request: #1362 Signed-off-by: agge3 <[email protected]>
* main.lua replicates the functionality of makesyscalls.lua * Individual files are generated by their associated module * Modules can be called as standalone scripts to generate a specific file * Data and procedures are performed by objects instead of procedual code * Bitmasks are replaced by declarative types * Temporary files are no longer produced, writing is stored in memory * Comments provide explanation to functions and semantics Google Summer of Code 2024 Final Work Product Co-authored-by: Warner Losh <[email protected]> Co-authored-by: Kyle Evans <[email protected]> Co-authored-by: Brooks Davis <[email protected]> Sponsored by: Google (GSoC 24) Pull Request: freebsd/freebsd-src#1362 Signed-off-by: agge3 <[email protected]> (cherry picked from commit 9ded074e875c29cb92d5f643801990d7bb23cca4)
* main.lua replicates the functionality of makesyscalls.lua * Individual files are generated by their associated module * Modules can be called as standalone scripts to generate a specific file * Data and procedures are performed by objects instead of procedual code * Bitmasks are replaced by declarative types * Temporary files are no longer produced, writing is stored in memory * Comments provide explanation to functions and semantics Google Summer of Code 2024 Final Work Product Co-authored-by: Warner Losh <[email protected]> Co-authored-by: Kyle Evans <[email protected]> Co-authored-by: Brooks Davis <[email protected]> Sponsored by: Google (GSoC 24) Pull Request: freebsd/freebsd-src#1362 Signed-off-by: agge3 <[email protected]> (cherry picked from commit 9ded074e875c29cb92d5f643801990d7bb23cca4)
Refactor of makesyscalls.lua to be a library
Drop-in replacement to makesyscalls.lua
Google Summer of Code 2024 Final Work Product
Project description: Refactor Syscall Creation Script
Mentors: Warner Losh (bsdimp), Kyle Evans (kevans)
Sponsored by: Google (GSoC 2024)