Page MenuHomeFreeBSD

Reduce duplication between MD parts of the Linuxulator
ClosedPublic

Authored by dchagin on May 2 2019, 11:16 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 2, 11:44 PM
Unknown Object (File)
Wed, Oct 30, 12:19 PM
Unknown Object (File)
Oct 8 2024, 1:41 PM
Unknown Object (File)
Oct 8 2024, 1:41 PM
Unknown Object (File)
Oct 8 2024, 1:40 PM
Unknown Object (File)
Oct 8 2024, 1:40 PM
Unknown Object (File)
Oct 8 2024, 1:10 PM
Unknown Object (File)
Sep 27 2024, 5:49 AM
Subscribers

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 - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

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 edited the summary of this revision. (Show Details)

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

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

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.