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)
Fri, Nov 8, 5:01 AM
Unknown Object (File)
Wed, Nov 6, 9:15 PM
Unknown Object (File)
Wed, Nov 6, 1:26 PM
Unknown Object (File)
Thu, Oct 31, 5:37 PM
Unknown Object (File)
Thu, Oct 24, 9:31 PM
Unknown Object (File)
Tue, Oct 22, 12:52 AM
Unknown Object (File)
Oct 5 2024, 4:27 PM
Unknown Object (File)
Sep 24 2024, 4:56 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
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.