Page MenuHomeFreeBSD

Reduce duplication between MD parts of the Linuxulator
ClosedPublic

Authored by dchagin on May 2 2019, 11:16 AM.

Details

Summary

In order to reduce duplication between MD parts of the Linuxulator
move bits that are MI out into the headers in compat/linux.
For that remove bogus _packed attribute from struct l_sockaddr
and use MI types for struct members.

And continue to move into the linux_common module a code that is
intended for both Linuxulator modules (both instruction set - 32 & 64 bit)
or for external modules like linsysfs or linprocfs.

To avoid header pollution introduce new sys/compat/linux_common.h header.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

dchagin created this revision.May 2 2019, 11:16 AM
emaste added a comment.May 2 2019, 1:02 PM

Overall looks good to me, a few comments inline. Minor comment - ideally we'd commit the verbatim code movement first in one commit followed by the new functionality (e.g. is_lo).

sys/compat/linux/linux.c
230 ↗(On Diff #56948)

make is_eth and is_lo bool?

238 ↗(On Diff #56948)

This line seems a bit awkward and style(9) prefers not using ! (in !strncmp) I think? What about just is_lo = len == 2 && strcmp(lxname, "lo") == 0;

272–280 ↗(On Diff #56948)

Existing code but it seems we'd be better without any assumption Linux and FreeBSD flags are in the same bit, maybe something for a future change?

dchagin updated this revision to Diff 56960.May 2 2019, 2:24 PM
dchagin edited the summary of this revision. (Show Details)

Split the patch into two parts, modifying ifname_linux_to_bsd() will be next

dchagin marked an inline comment as done.May 2 2019, 2:26 PM
dchagin added inline comments.
sys/compat/linux/linux.c
230 ↗(On Diff #56948)

next review

238 ↗(On Diff #56948)

next review

272–280 ↗(On Diff #56948)

yes, I thought about it, I will fix this next

emaste accepted this revision.May 2 2019, 3:23 PM
This revision is now accepted and ready to land.May 2 2019, 3:23 PM
This revision was automatically updated to reflect the committed changes.
dchagin marked an inline comment as done.