Page MenuHomeFreeBSD

byteswap.h: Add a glibc/linux compatible byteswap.h
ClosedPublic

Authored by imp on Sep 21 2021, 1:08 PM.
Tags
None
Referenced Files
F106213418: D32051.diff
Fri, Dec 27, 7:12 AM
Unknown Object (File)
Nov 21 2024, 2:16 PM
Unknown Object (File)
Nov 21 2024, 2:16 PM
Unknown Object (File)
Nov 21 2024, 2:16 PM
Unknown Object (File)
Nov 21 2024, 2:16 PM
Unknown Object (File)
Nov 21 2024, 2:16 PM
Unknown Object (File)
Nov 21 2024, 2:15 PM
Unknown Object (File)
Nov 21 2024, 1:34 PM
Subscribers
None

Details

Summary

For endian.h to work instead of sys/endian.h, some software needs
byteswap.h available. It must define {,}byteswap_{16,32,64}.
Included sys/_endian.h to get an appropriate
byteswap16, etc
and defines the new macros in terms of them. Enhance _endian.h
to allow it to be included from here too.

Sponsored by: Netflix

Diff Detail

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

Event Timeline

imp requested review of this revision.Sep 21 2021, 1:08 PM
imp created this revision.

regen after sys/_endian.h update

(PR258544 endian.h exp-run)

Yes, this is paired with the endian.h changes because you need both to not @#^#@& some ports.

include/byteswap.h
18
19
21

Used? Or present under /usr/include?

include/byteswap.h
19

(I included @markj's helpful comma as well)

21

I suspect used. I would perhaps say "included" instead of used?

Update comments from review suggestiosn, and hopefully some additional verbosity
to disambiguate other possible readings not flagged in earlier reviews.

markj added inline comments.
include/byteswap.h
20

Not 100% sure this is what you meant.

This revision is now accepted and ready to land.May 4 2022, 2:25 PM
include/byteswap.h
20

Yes. <sys/_endian.h> provides all the traditional BSD/FreeBSD <sys/endian.h> interfaces, except the ones that interfere or are incompatible with glibc <endian.h>. Those bits are in either <endian.h>/<byteswap.h> or <sys/endian.h>. I struggled with how to convey that 'top level description' and would love any feedback you have. I like your change though.