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
Unknown Object (File)
Sun, Jun 16, 12:14 PM
Unknown Object (File)
Sun, Jun 16, 12:10 PM
Unknown Object (File)
Sun, Jun 16, 12:04 PM
Unknown Object (File)
Sun, Jun 16, 2:43 AM
Unknown Object (File)
Sun, Jun 16, 2:10 AM
Unknown Object (File)
Thu, Jun 13, 7:30 AM
Unknown Object (File)
Wed, Jun 12, 8:14 AM
Unknown Object (File)
Sat, Jun 8, 2:53 AM
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
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.