Page MenuHomeFreeBSD

genoffset: simplify and rewrite in sh
ClosedPublic

Authored by imp on Jul 16 2021, 6:53 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Mar 22, 6:18 AM
Unknown Object (File)
Thu, Mar 21, 7:08 AM
Unknown Object (File)
Mon, Mar 11, 10:09 AM
Unknown Object (File)
Feb 26 2024, 10:09 AM
Unknown Object (File)
Feb 14 2024, 8:14 PM
Unknown Object (File)
Feb 11 2024, 4:11 AM
Unknown Object (File)
Jan 31 2024, 10:41 PM
Unknown Object (File)
Jan 29 2024, 6:16 PM
Subscribers
None

Details

Summary

genoffset used the fully generic ASSYM macro to generate the offsets
needed for the thread_lite structure. However, since these are offsets
into a structure, they will always be necessarily small and positive. As
such, just create a simple character array of the right size and use a
naming convention such that we can recover the field name, structure
name and type. Use nm -t d and sort -n to sort these into order, then
loop over the resutls to generate the thread_lite structure.

Sponsored by: Netflix

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 40502
Build 37391: arc lint + arc unit

Event Timeline

imp requested review of this revision.Jul 16 2021, 6:53 PM
imp created this revision.

Use extended sed regexp and remove now-uneeded cruft

sys/kern/genoffset.sh
40
61

Can drop the braces here, they're not needed in assignments.

63

Do all of these end up on one line?

sys/kern/genoffset.sh
63

Yes. They do. Should I try to fix that?

sys/kern/genoffset.sh
63

I think it'd be nice, at least since you take pains to format the rest of the code.

We could write asserts=${asserts}\n...;" and print $asserts with printf or echo -e.

Did you tried to look at the opinion of shellcheck? Often this linter catches quite amusing issues, also it often allows to simplify.

update based on markj feedback

In D31203#702508, @kib wrote:

Did you tried to look at the opinion of shellcheck? Often this linter catches quite amusing issues, also it often allows to simplify.

I'm not sure how to do that. Is that in arc or sh?

In D31203#705647, @imp wrote:
In D31203#702508, @kib wrote:

Did you tried to look at the opinion of shellcheck? Often this linter catches quite amusing issues, also it often allows to simplify.

I'm not sure how to do that. Is that in arc or sh?

pkg install devel/hs-ShellCheck
shellcheck sys/kern/genoffset.sh

update based on shellcheck feedback

markj added inline comments.
sys/sys/assym.h
56

IMO it would be nicer to use a namespace prefix instead of mangling the name, maybe __assym_offset or something like that.

This revision is now accepted and ready to land.Jul 28 2021, 2:51 PM
sys/sys/assym.h
56

I'm agnostic as to the prefix, so I'll change it.

This revision now requires review to proceed.Jul 28 2021, 4:34 PM
This revision is now accepted and ready to land.Jul 28 2021, 4:52 PM

update to support multiple structures completely.

This revision now requires review to proceed.Jul 28 2021, 5:22 PM
This revision was not accepted when it landed; it landed in state Needs Review.Jul 28 2021, 7:55 PM
This revision was automatically updated to reflect the committed changes.