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)
Mon, May 6, 10:50 PM
Unknown Object (File)
Mon, May 6, 12:10 PM
Unknown Object (File)
Wed, May 1, 7:59 PM
Unknown Object (File)
Tue, Apr 30, 4:12 PM
Unknown Object (File)
Tue, Apr 30, 2:35 PM
Unknown Object (File)
Tue, Apr 30, 2:34 PM
Unknown Object (File)
Tue, Apr 30, 2:34 PM
Unknown Object (File)
Tue, Apr 30, 2: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
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.