opnsense-src/sys/sys
Thomas Moestl 90ce56c287 Add the following functions/macros to support byte order conversions and
device drivers for bus system with other endinesses than the CPU (using
interfaces compatible to NetBSD):

- bwap16() and bswap32(). These have optimized implementations on some
  architectures; for those that don't, there exist generic implementations.
- macros to convert from a certain byte order to host byte order and vice
  versa, using a naming scheme like le16toh(), htole16().
  These are implemented using the bswap functions.
- stream bus space access functions, which do not perform a byte order
  conversion (while the normal access functions would if the bus endianess
  differs from the CPU endianess).

htons(), htonl(), ntohs() and ntohl() are implemented using the new
functions above for kernel usage. None of the above interfaces is currently
exported to user land.

Make use of the new functions in a few places where local implementations
of the same functionality existed.

Reviewed by:	mike, bde
Tested on alpha by:	mike
2002-02-27 17:16:18 +00:00
..
_lock.h - Move the definition of LOCK_DEBUG back to sys/lock.h from sys/_lock.h. 2001-10-19 19:28:18 +00:00
_mutex.h Modify the critical section API as follows: 2001-12-18 00:27:18 +00:00
_posix.h Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL" 1999-12-29 04:46:21 +00:00
_sigset.h Use struct __ucontext in prototypes and associated functions instead of 2002-02-17 17:40:34 +00:00
_timespec.h Synchronize with some of my local changes. To quote: 2001-01-23 04:40:54 +00:00
aac_ioctl.h Bring the aac driver *much* closer to style(9). 2001-09-05 20:43:02 +00:00
acct.h KSE Milestone 2 2001-09-12 08:38:13 +00:00
acl.h Remove bogus _POSIX_ACL_PATH_MAX definition. 2002-01-22 21:33:12 +00:00
agpio.h Fix an off-by-bit error in the AGP_MODE_[GS]ET_RATE() macros. 2001-11-21 08:40:23 +00:00
aio.h o Add missing synchronization (splnet()/splx()) in aio_free_entry(). 2002-01-06 21:03:39 +00:00
assym.h Use "nm | awk ..." instead of genassym(1) to generate symbol value headers. 2000-06-02 09:27:48 +00:00
ata.h Add Søren's email address. 2001-11-04 11:19:33 +00:00
bio.h GC: BIO_ORDERED, various infrastructure dealing with BIO_ORDERED. 2002-02-22 09:26:35 +00:00
bitstring.h Cleanup of bitstring.h: 2000-10-09 12:34:51 +00:00
blist.h $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
buf.h Replace bowrite() with BUF_WRITE in ufs. 2002-02-22 09:03:00 +00:00
bus.h Add a generic __BUS_ACCESSOR macro to construct ivar accessor functions, 2001-12-21 21:45:09 +00:00
bus_dma.h - Moved the bus_dma declarations from bus_{at386,pc98}.h into bus_dma.h. 2001-10-06 16:27:21 +00:00
bus_private.h Style(9) 2001-09-05 01:06:28 +00:00
callout.h style(9) the structure definitions. 2001-09-05 01:22:14 +00:00
capability.h Update copyrights to include Thomas Moestl. 2001-11-05 15:36:24 +00:00
ccdvar.h Fix some signed/unsigned integer confusion, and add bounds checking of 2001-09-10 11:28:07 +00:00
cdefs.h Back out rev 1.48. The problem is with a bogus __attribute__ in stdio.h. 2001-12-04 01:29:54 +00:00
cdio.h style(9) the structure definitions. 2001-09-05 01:22:14 +00:00
cdrio.h Add entries to allow setting the CD type on cue sheets 2001-12-04 21:40:41 +00:00
chio.h Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL" 1999-12-29 04:46:21 +00:00
clist.h Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL" 1999-12-29 04:46:21 +00:00
condvar.h KSE Milestone 2 2001-09-12 08:38:13 +00:00
conf.h Add revoke_and_destroy_dev(), to be used by devices which decide when 2002-02-16 17:35:05 +00:00
cons.h Add new boot flag to i386 boot: -p. 2001-12-10 20:02:22 +00:00
consio.h Refine cursor type/shape control escape sequences and 2001-08-02 08:30:40 +00:00
copyright.h Welcome 2002. Happy new year. 2002-01-01 09:20:52 +00:00
ctype.h Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL" 1999-12-29 04:46:21 +00:00
dataacq.h Add $FreeBSD$ 2000-05-01 20:32:07 +00:00
device_port.h Add PC-Card/ISA SCSI host adpater drivers from NetBSD/pc98 2000-10-23 12:55:51 +00:00
devicestat.h Export the head structure for the device statistics STAILQ in 2001-08-04 18:02:47 +00:00
digiio.h Add DIGIIO_SETALTPIN and DIGIIO_GETALTPIN ioctl values 2001-06-20 14:51:58 +00:00
dir.h $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
dirent.h Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL" 1999-12-29 04:46:21 +00:00
disk.h Add disk_enumerate() for finding names of disks. Vinum and libh will 2000-06-15 20:30:53 +00:00
disklabel.h Uninlined most of the bloated inline functions in <sys/disklabel.h>. Some 2002-01-17 18:33:18 +00:00
diskmbr.h Uninlined most of the bloated inline functions in <sys/disklabel.h>. Some 2002-01-17 18:33:18 +00:00
diskpc98.h Uninlined most of the bloated inline functions in <sys/disklabel.h>. Some 2002-01-17 18:33:18 +00:00
diskslice.h style(9) the structure definitions. 2001-09-05 01:22:14 +00:00
dkstat.h Redeclare cp_time. It's no longer static, and linprocfs needs it. 2000-09-07 16:38:04 +00:00
dmap.h Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL" 1999-12-29 04:46:21 +00:00
domain.h Hopefully improve control message passing over Unix domain sockets. 2001-10-04 13:11:48 +00:00
dvdio.h #endif /* comment */ 2001-09-10 01:23:39 +00:00
elf32.h $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
elf64.h $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
elf_common.h Catch up with common usage: 2001-09-08 22:59:30 +00:00
elf_generic.h $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
errno.h Tiny style change. Whitespace only change. 2002-01-22 10:44:40 +00:00
event.h Make AIO a loadable module. 2001-12-29 07:13:47 +00:00
eventhandler.h KSE Milestone 2 2001-09-12 08:38:13 +00:00
eventvar.h Simplify kqueue API slightly. 2000-07-18 19:31:52 +00:00
exec.h Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL" 1999-12-29 04:46:21 +00:00
extattr.h Part I: Update extended attribute API and ABI: 2002-02-10 04:43:22 +00:00
fbio.h Add some definitions. Their actual support will be added 2001-08-02 11:17:38 +00:00
fcntl.h SMP Lock struct file, filedesc and the global file list. 2002-01-13 11:58:06 +00:00
fdcio.h Long promised major enhancement set for the floppy disk driver: 2001-12-15 19:09:04 +00:00
file.h Fix namespace pollution introduced in previous commit. 2002-02-23 21:14:43 +00:00
filedesc.h Lock struct pgrp, session and sigio. 2002-02-23 11:12:57 +00:00
filio.h Commit the kernel part of our DVD support. Nothing much to say really, 1999-12-07 22:25:28 +00:00
fnv_hash.h Use the same API as the example code. 2001-03-20 02:10:18 +00:00
gmon.h Reserved one of the spare fields in struct gmon to record the history 2002-02-21 05:52:49 +00:00
iconv.h Update to C99, s/__FUNCTION__/__func__/. 2001-12-10 05:58:28 +00:00
imgact.h Return a more meaningful errno when the length of the interpreter 2001-11-28 03:26:58 +00:00
imgact_aout.h Add the following functions/macros to support byte order conversions and 2002-02-27 17:16:18 +00:00
imgact_elf.h KSE Milestone 2 2001-09-12 08:38:13 +00:00
inflate.h Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL" 1999-12-29 04:46:21 +00:00
interrupt.h Change the preemption code for software interrupt thread schedules and 2002-01-05 08:47:13 +00:00
ioccom.h Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL" 1999-12-29 04:46:21 +00:00
ioctl.h Hide GCCisms in the non-GCC case. 2002-02-26 07:44:03 +00:00
ioctl_bt848.h Fix typo in comments 2000-10-31 14:30:29 +00:00
ioctl_compat.h $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
ioctl_meteor.h Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL" 1999-12-29 04:46:21 +00:00
ipc.h Eliminate semexit_hook using at_exit(9) and rm_at_exit(9). 2001-12-30 18:55:09 +00:00
jail.h Make getcredhostname() take a buffer and the buffer's size 2002-02-27 16:43:20 +00:00
joystick.h Switch over to using the generic joy driver 1999-12-05 20:02:19 +00:00
kbio.h Implement keyboard paste 2001-03-11 22:51:05 +00:00
kernel.h Add a new sysinit SI_SUB_DEVFS. Devfs hooks into the kernel at SI_ORDER_FIRST, 2002-01-09 04:58:49 +00:00
kobj.h Fix typos: initalise -> initialise. 2001-02-08 20:28:57 +00:00
kse.h Add the first shot at minimum KSE interface definitions. 2002-02-19 02:12:36 +00:00
kthread.h KSE Milestone 2 2001-09-12 08:38:13 +00:00
ktr.h Fix two typos, TR6() and ITR6() need to use CTR6(), not CTR5(). 2001-12-14 22:28:58 +00:00
ktrace.h Limit size of passed in data for utrace function. 2001-01-06 09:34:20 +00:00
libkern.h Add a 'strvalid()' call to libkern. Given a character pointer, and 2002-02-18 00:37:03 +00:00
linedisc.h Add revoke_and_destroy_dev(), to be used by devices which decide when 2002-02-16 17:35:05 +00:00
link_aout.h style(9) the structure definitions. 2001-09-05 01:36:46 +00:00
link_elf.h style(9) the structure definitions. 2001-09-05 01:36:46 +00:00
linker.h Fix a number of misspellings of "dependency" and "dependencies" in 2001-11-16 21:08:40 +00:00
linker_set.h With this commit, I hereby pronounce gensetdefs past its use-by date. 2001-06-13 10:58:39 +00:00
lock.h Change the preemption code for software interrupt thread schedules and 2002-01-05 08:47:13 +00:00
lockf.h Wrap around MALLOC_DECLARE() invocation with #ifdef. 2001-05-03 08:57:26 +00:00
lockmgr.h Fix a BUF_TIMELOCK race against BUF_LOCK and fix a deadlock in vget() 2001-12-20 22:42:27 +00:00
malloc.h - Remove asleep(), await(), and M_ASLEEP. 2001-08-10 06:37:05 +00:00
mbuf.h Get rid of the twisted MFREE() macro entirely. 2002-02-05 02:00:56 +00:00
mchain.h Add the following functions/macros to support byte order conversions and 2002-02-27 17:16:18 +00:00
md4.h Import kernel part of SMB/CIFS requester. 2001-04-10 07:59:06 +00:00
md5.h Add a new entrypoint to the hashes in libmd: 2001-03-17 10:00:50 +00:00
mdioctl.h Actually make use of the md_version field of 'struct mdio'. In order 2001-12-20 06:38:21 +00:00
memrange.h Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL" 1999-12-29 04:46:21 +00:00
mman.h Add INHERIT_XXX defines for minherit() system call. 2001-08-24 19:48:07 +00:00
module.h Use protected variables names in prototypes visible to the userland as 2001-09-09 14:57:17 +00:00
mount.h Define a new mount flag "MNT_JAILDEVFS" 2001-11-05 10:33:45 +00:00
mouse.h Spelling police: extention -> extension in a comment. 2001-07-05 08:52:40 +00:00
msg.h Move the MSG* and SEM* options to opt_sysvipc.h 2000-05-01 13:33:56 +00:00
msgbuf.h style(9) the structure definitions. 2001-09-05 01:22:14 +00:00
mtio.h Fix a typo in a comment field. 2002-01-21 11:10:32 +00:00
mutex.h Add kern_giant_ucred to instrument Giant around ucred related operations 2002-02-18 17:51:47 +00:00
namei.h namei.h: move "struct componentname" definition outside "struct nameidata", 2001-09-28 00:05:11 +00:00
nlist_aout.h $Id$ -> $FreeBSD$ 1999-08-27 23:45:13 +00:00
param.h Add the following functions/macros to support byte order conversions and 2002-02-27 17:16:18 +00:00
pciio.h style(9) the structure definitions. 2001-09-05 01:22:14 +00:00
pcpu.h revert last commit temporarily due to whining on the lists. 2002-02-26 20:33:41 +00:00
pioctl.h Add the as-yet-unused S_ALLSTOPS which I forgot in previous commit. 2001-11-02 23:15:13 +00:00
pipe.h First rev at making pipe(2) pipe's MPsafe. 2002-02-27 07:35:59 +00:00
poll.h Fix select on fifos. 2002-01-14 22:03:48 +00:00
posix4.h KSE Milestone 2 2001-09-12 08:38:13 +00:00
power.h Some fix for the recent apm module changes. 2001-11-01 16:34:07 +00:00
priority.h style(9) the structure definitions. 2001-09-05 01:22:14 +00:00
proc.h Lock struct pgrp, session and sigio. 2002-02-23 11:12:57 +00:00
procfs.h Use explicit sizes for the prpsinfo command length string so that 2001-08-16 08:35:51 +00:00
protosw.h KSE Milestone 2 2001-09-12 08:38:13 +00:00
ptio.h $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
ptrace.h Declare struct uio so consumers don't have to #include <sys/uio.h> unless 2001-11-03 03:17:16 +00:00
queue.h Correct a comment that should have been updated in rev 1.43, when 2001-12-11 11:49:58 +00:00
random.h Provide the infrastructure for sysadmins to select the broad class 2001-02-18 17:40:47 +00:00
reboot.h Add new boot flag to i386 boot: -p. 2001-12-10 20:02:22 +00:00
regression.h o Include file to provide prototypes for regression testing-specific 2001-05-26 15:37:25 +00:00
resource.h KSE Milestone 2 2001-09-12 08:38:13 +00:00
resourcevar.h remove trailing semi-colons from macro definitions. 2002-02-27 02:02:13 +00:00
rman.h Add a rman_reserve_resource_bound() function that takes an additional 2001-12-21 21:40:55 +00:00
rtprio.h In a threaded world, differnt priorirites become properties of 2002-02-11 20:37:54 +00:00
runq.h KSE Milestone 2 2001-09-12 08:38:13 +00:00
sbuf.h Replace spaces after #defines with tabs; this makes all #defines 2002-01-09 07:29:28 +00:00
select.h Do not recursively include <sys/selinfo.h> from <sys/select.h>; all in-tree 2001-01-20 03:11:47 +00:00
selinfo.h Fix a whitespace style nit. 2001-09-27 20:33:15 +00:00
sem.h Fix SysV Semaphore Handling. 2001-10-11 08:15:14 +00:00
sema.h Added used includes. <sys/_lock.h> is a prerequisite for <sys/_mutex.h>, 2001-10-10 10:26:07 +00:00
semaphore.h Track libc_r addition of semaphores implementation. 2000-01-20 07:55:42 +00:00
shm.h Introduce [IPC|SHM]_[INFO|STAT] to shmctl to make 2001-10-28 09:29:10 +00:00
signal.h Use struct __ucontext in prototypes and associated functions instead of 2002-02-17 17:40:34 +00:00
signalvar.h Use struct __ucontext in prototypes and associated functions instead of 2002-02-17 17:40:34 +00:00
smp.h Make smp_started volatile in sys/smp.h and remove the volatile 2001-10-31 09:03:05 +00:00
snoop.h Move the kernel stuff out of snoop.h. It was only there because some 2001-07-25 14:47:56 +00:00
socket.h Zero functional difference; make some integer constants unsigned, as 2002-02-03 11:36:59 +00:00
socketvar.h Add parens around macro args. 2002-01-13 23:51:47 +00:00
sockio.h Style consistency fix for MAC ioctls added previously. 2002-02-10 16:55:35 +00:00
soundcard.h Correct the URL to the Hacker's Guide to Voxware. 2001-08-21 07:39:47 +00:00
stat.h Resurrect one of the easiest changes from my big include files roll-up 2002-02-15 22:15:39 +00:00
stdint.h o Add new header <sys/stdint.h>. 2001-11-02 18:05:43 +00:00
sx.h Create a mutex pool API for short term leaf mutexes. 2001-11-13 21:55:13 +00:00
syscall.h Add stub syscalls and definitions for KSE calls. 2002-02-19 02:40:31 +00:00
syscall.mk Add stub syscalls and definitions for KSE calls. 2002-02-19 02:40:31 +00:00
sysctl.h Add code to export and print the description associated to sysctl 2001-12-16 02:55:41 +00:00
sysent.h Make AIO a loadable module. 2001-12-29 07:13:47 +00:00
syslimits.h After one too many PRs on the subject, bite the bullet and define IOV_MAX 2001-06-18 20:24:54 +00:00
syslog.h syslog.h fails to compile with -Wwrite-strings 2001-05-21 17:32:47 +00:00
sysproto.h Add stub syscalls and definitions for KSE calls. 2002-02-19 02:40:31 +00:00
systm.h Move the declaration of panic() from sys/param.h back to sys/systm.h. 2002-02-11 02:13:18 +00:00
taskqueue.h Revert the reindentation of struct task's definition from rev 1.4. 2001-10-28 16:19:34 +00:00
termios.h Add B921600 (yes, some serial ports can do this, but generic sio not support 2001-06-20 03:26:41 +00:00
time.h Fix world breakage (compiling libstdc++): 2002-02-08 03:55:37 +00:00
timeb.h Add missing declaration of ftime. 2001-12-03 15:07:54 +00:00
timepps.h Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL" 1999-12-29 04:46:21 +00:00
timers.h $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
times.h Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL" 1999-12-29 04:46:21 +00:00
timespec.h This file declares `struct timespec' so that we can have a single, 2001-01-23 04:44:04 +00:00
timetc.h Add a generation number to timecounters and spin if it changes under 2002-02-24 20:04:07 +00:00
timex.h Update to the 2001-04-02 version of the nanokernel code from Dave Mills. 2001-04-16 13:05:05 +00:00
tty.h Fixed style bugs (indentation errors, missing punctuation, and unsorting) 2001-10-04 07:25:16 +00:00
ttychars.h $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
ttycom.h Remove the TABLDISC line discipline number, it's not in the tree 2000-01-29 16:47:35 +00:00
ttydefaults.h Kernel support for erase2 character. 2000-11-28 20:03:23 +00:00
ttydev.h Add B921600 (yes, some serial ports can do this, but generic sio not support 2001-06-20 03:26:41 +00:00
types.h Rather than include namespace pollution in <grp.h> in order to declare 2002-02-26 19:43:03 +00:00
ucontext.h Add getcontext, setcontext, makecontext, and swapcontext prototypes 2002-01-10 02:44:30 +00:00
ucred.h Introduce a version field to `struct xucred' in place of one of the 2002-02-27 04:45:37 +00:00
uio.h Remove extraneous semicolon. 2001-10-04 10:39:56 +00:00
un.h Hopefully improve control message passing over Unix domain sockets. 2001-10-04 13:11:48 +00:00
unistd.h Make RFPPWAIT a kernel-only flag. Programs desiring this feature should 2001-12-19 00:55:13 +00:00
unpcb.h style(9) the structure definitions. 2001-09-05 01:22:14 +00:00
user.h Update comments regarding the transient nature of k_kproc and u_md 2001-10-11 08:15:16 +00:00
utsname.h Round 1 of Brucification inspired changes. 2001-03-24 08:37:56 +00:00
vmmeter.h Add mibs to hold the number of forks since boot. New mibs are: 2001-01-23 14:32:01 +00:00
vnioctl.h Fix a bug in the block number calculation for VN disks with a sector 1999-09-17 05:34:00 +00:00
vnode.h Make v_addpollinfo() visible and non-inline. 2002-02-18 16:18:02 +00:00
wait.h Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL" 1999-12-29 04:46:21 +00:00
xrpuio.h $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00