提交 b6420ebd 编写于 作者: L Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/doc

Pull documentation updates from Jiri Kosina:
 "Updates to kernel documentation.

  I took this over (hopefully temporarily) from Randy who was not
  willing to maintain it any longer.  This pile mostly is a relay of
  queue that Randy already had in his tree"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/doc:
  Documentation: fix broken v4l-utils URL
  Documentation: update include path for mpssd
  Documentation: correct parameter error for dma_mapping_error
  MAINTAINERS: update location of linux-doc tree
  Documentation: remove networking/.gitignore
  tools: add more endian.h macros
  Make Documenation depend on headers_install
  Docs: this_cpu_ops: remove redundant add forms
  Documentation: disable vdso_test to avoid breakage with old glibc
  Documentation: update vDSO makefile to build portable examples
  Documentation: update .gitignore files
  Documentation: support glibc versions without htole macros
  v4l2-pci-skeleton: Only build if PCI is available
  Documentation: fix misc. warnings
  Documentation: make functions static to avoid prototype warnings
  Documentation: add makefiles for more targets
  Documentation: use subdir-y to avoid unnecessary built-in.o files
filesystems/dnotify_test
laptops/dslm
timers/hpet_example
vm/hugepage-mmap
vm/hugepage-shm
vm/map_hugetlb
...@@ -531,7 +531,7 @@ To map a single region, you do: ...@@ -531,7 +531,7 @@ To map a single region, you do:
size_t size = buffer->len; size_t size = buffer->len;
dma_handle = dma_map_single(dev, addr, size, direction); dma_handle = dma_map_single(dev, addr, size, direction);
if (dma_mapping_error(dma_handle)) { if (dma_mapping_error(dev, dma_handle)) {
/* /*
* reduce current DMA mapping usage, * reduce current DMA mapping usage,
* delay and try again later or * delay and try again later or
...@@ -588,7 +588,7 @@ Specifically: ...@@ -588,7 +588,7 @@ Specifically:
size_t size = buffer->len; size_t size = buffer->len;
dma_handle = dma_map_page(dev, page, offset, size, direction); dma_handle = dma_map_page(dev, page, offset, size, direction);
if (dma_mapping_error(dma_handle)) { if (dma_mapping_error(dev, dma_handle)) {
/* /*
* reduce current DMA mapping usage, * reduce current DMA mapping usage,
* delay and try again later or * delay and try again later or
...@@ -689,7 +689,7 @@ to use the dma_sync_*() interfaces. ...@@ -689,7 +689,7 @@ to use the dma_sync_*() interfaces.
dma_addr_t mapping; dma_addr_t mapping;
mapping = dma_map_single(cp->dev, buffer, len, DMA_FROM_DEVICE); mapping = dma_map_single(cp->dev, buffer, len, DMA_FROM_DEVICE);
if (dma_mapping_error(dma_handle)) { if (dma_mapping_error(cp->dev, dma_handle)) {
/* /*
* reduce current DMA mapping usage, * reduce current DMA mapping usage,
* delay and try again later or * delay and try again later or
......
...@@ -110,7 +110,7 @@ makes no provisions to find these related devices. Some really ...@@ -110,7 +110,7 @@ makes no provisions to find these related devices. Some really
complex devices use the Media Controller (see <xref linkend="media_controller" />) complex devices use the Media Controller (see <xref linkend="media_controller" />)
which can be used for this purpose. But most drivers do not use it, which can be used for this purpose. But most drivers do not use it,
and while some code exists that uses sysfs to discover related devices and while some code exists that uses sysfs to discover related devices
(see libmedia_dev in the <ulink url="http://git.linuxtv.org/v4l-utils/">v4l-utils</ulink> (see libmedia_dev in the <ulink url="http://git.linuxtv.org/cgit.cgi/v4l-utils.git/">v4l-utils</ulink>
git repository), there is no library yet that can provide a single API towards git repository), there is no library yet that can provide a single API towards
both Media Controller-based devices and devices that do not use the Media Controller. both Media Controller-based devices and devices that do not use the Media Controller.
If you want to work on this please write to the linux-media mailing list: &v4l-ml;.</para> If you want to work on this please write to the linux-media mailing list: &v4l-ml;.</para>
......
obj-m := DocBook/ accounting/ auxdisplay/ connector/ \ subdir-y := accounting arm auxdisplay blackfin connector \
filesystems/ filesystems/configfs/ ia64/ laptops/ networking/ \ filesystems filesystems ia64 laptops mic misc-devices \
pcmcia/ spi/ timers/ watchdog/src/ misc-devices/mei/ networking pcmcia prctl ptp spi timers vDSO video4linux \
watchdog
# kbuild trick to avoid linker error. Can be omitted if a module is built.
obj- := dummy.o
# List of programs to build # List of programs to build
hostprogs-y := getdelays hostprogs-y := getdelays
......
subdir-y := SH-Mobile
BIN := vrl4 # List of programs to build
hostprogs-y := vrl4
.PHONY: all # Tell kbuild to always build the programs
all: $(BIN) always := $(hostprogs-y)
.PHONY: clean HOSTCFLAGS_vrl4.o += -I$(objtree)/usr/include -I$(srctree)/tools/include
clean:
rm -f *.o $(BIN)
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include <tools/endian.h>
struct hdr { struct hdr {
uint32_t magic1; uint32_t magic1;
...@@ -77,7 +78,7 @@ struct hdr { ...@@ -77,7 +78,7 @@ struct hdr {
#define ROUND_UP(x) ((x + ALIGN - 1) & ~(ALIGN - 1)) #define ROUND_UP(x) ((x + ALIGN - 1) & ~(ALIGN - 1))
ssize_t do_read(int fd, void *buf, size_t count) static ssize_t do_read(int fd, void *buf, size_t count)
{ {
size_t offset = 0; size_t offset = 0;
ssize_t l; ssize_t l;
...@@ -98,7 +99,7 @@ ssize_t do_read(int fd, void *buf, size_t count) ...@@ -98,7 +99,7 @@ ssize_t do_read(int fd, void *buf, size_t count)
return offset; return offset;
} }
ssize_t do_write(int fd, const void *buf, size_t count) static ssize_t do_write(int fd, const void *buf, size_t count)
{ {
size_t offset = 0; size_t offset = 0;
ssize_t l; ssize_t l;
...@@ -117,7 +118,7 @@ ssize_t do_write(int fd, const void *buf, size_t count) ...@@ -117,7 +118,7 @@ ssize_t do_write(int fd, const void *buf, size_t count)
return offset; return offset;
} }
ssize_t write_zero(int fd, size_t len) static ssize_t write_zero(int fd, size_t len)
{ {
size_t i = len; size_t i = len;
......
# kbuild trick to avoid linker error. Can be omitted if a module is built.
obj- := dummy.o
# List of programs to build # List of programs to build
hostprogs-y := cfag12864b-example hostprogs-y := cfag12864b-example
......
ifneq ($(CONFIG_BLACKFIN),)
obj-m := gptimers-example.o obj-m := gptimers-example.o
endif
all: modules
modules clean:
$(MAKE) -C ../.. SUBDIRS=$(PWD) $@
# kbuild trick to avoid linker error. Can be omitted if a module is built. subdir-y := configfs
obj- := dummy.o
# List of programs to build # List of programs to build
hostprogs-y := dnotify_test hostprogs-y := dnotify_test
......
# kbuild trick to avoid linker error. Can be omitted if a module is built.
obj- := dummy.o
# List of programs to build # List of programs to build
hostprogs-y := aliasing-test hostprogs-y := aliasing-test
......
# kbuild trick to avoid linker error. Can be omitted if a module is built.
obj- := dummy.o
# List of programs to build # List of programs to build
hostprogs-y := dslm hostprogs-y := dslm freefall
# Tell kbuild to always build the programs # Tell kbuild to always build the programs
always := $(hostprogs-y) always := $(hostprogs-y)
# # List of programs to build
# Makefile - Intel MIC User Space Tools. hostprogs-y := mpssd
# Copyright(c) 2013, Intel Corporation.
# mpssd-objs := mpssd.o sysfs.o
# Tell kbuild to always build the programs
always := $(hostprogs-y)
HOSTCFLAGS += -I$(objtree)/usr/include -I$(srctree)/tools/include
ifdef DEBUG ifdef DEBUG
CFLAGS += $(USERWARNFLAGS) -I. -g -Wall -DDEBUG=$(DEBUG) HOSTCFLAGS += -DDEBUG=$(DEBUG)
else
CFLAGS += $(USERWARNFLAGS) -I. -g -Wall
endif endif
mpssd: mpssd.o sysfs.o HOSTLOADLIBES_mpssd := -lpthread
$(CC) $(CFLAGS) -o $@ $^ -lpthread
install: install:
install mpssd /usr/sbin/mpssd install mpssd /usr/sbin/mpssd
install micctrl /usr/sbin/micctrl install micctrl /usr/sbin/micctrl
clean:
rm -f mpssd *.o
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "mpssd.h" #include "mpssd.h"
#include <linux/mic_ioctl.h> #include <linux/mic_ioctl.h>
#include <linux/mic_common.h> #include <linux/mic_common.h>
#include <tools/endian.h>
static void init_mic(struct mic_info *mic); static void init_mic(struct mic_info *mic);
...@@ -1476,9 +1477,9 @@ set_cmdline(struct mic_info *mic) ...@@ -1476,9 +1477,9 @@ set_cmdline(struct mic_info *mic)
len = snprintf(buffer, PATH_MAX, len = snprintf(buffer, PATH_MAX,
"clocksource=tsc highres=off nohz=off "); "clocksource=tsc highres=off nohz=off ");
len += snprintf(buffer + len, PATH_MAX, len += snprintf(buffer + len, PATH_MAX - len,
"cpufreq_on;corec6_off;pc3_off;pc6_off "); "cpufreq_on;corec6_off;pc3_off;pc6_off ");
len += snprintf(buffer + len, PATH_MAX, len += snprintf(buffer + len, PATH_MAX - len,
"ifcfg=static;address,172.31.%d.1;netmask,255.255.255.0", "ifcfg=static;address,172.31.%d.1;netmask,255.255.255.0",
mic->id); mic->id);
......
# kbuild trick to avoid linker error. Can be omitted if a module is built.
obj- := dummy.o
# List of programs to build # List of programs to build
hostprogs-y := mei-amt-version hostprogs-y := mei-amt-version
HOSTCFLAGS_mei-amt-version.o += -I$(objtree)/usr/include HOSTCFLAGS_mei-amt-version.o += -I$(objtree)/usr/include
......
# kbuild trick to avoid linker error. Can be omitted if a module is built. subdir-y := timestamping
obj- := dummy.o
# Tell kbuild to always build the programs
always := $(hostprogs-y)
obj-m := timestamping/
timestamping timestamping
txtimestamp
hwtstamp_config hwtstamp_config
# kbuild trick to avoid linker error. Can be omitted if a module is built.
obj- := dummy.o
# List of programs to build # List of programs to build
hostprogs-y := timestamping hwtstamp_config hostprogs-y := hwtstamp_config timestamping
# Tell kbuild to always build the programs # Tell kbuild to always build the programs
always := $(hostprogs-y) always := $(hostprogs-y)
HOSTCFLAGS_timestamping.o += -I$(objtree)/usr/include HOSTCFLAGS_timestamping.o += -I$(objtree)/usr/include
HOSTCFLAGS_hwtstamp_config.o += -I$(objtree)/usr/include HOSTCFLAGS_hwtstamp_config.o += -I$(objtree)/usr/include
clean:
rm -f timestamping hwtstamp_config
# kbuild trick to avoid linker error. Can be omitted if a module is built.
obj- := dummy.o
# List of programs to build # List of programs to build
hostprogs-y := crc32hash hostprogs-y := crc32hash
......
disable-tsc-ctxt-sw-stress-test
disable-tsc-on-off-stress-test
disable-tsc-test
# List of programs to build
hostprogs-y := disable-tsc-ctxt-sw-stress-test disable-tsc-on-off-stress-test disable-tsc-test
# Tell kbuild to always build the programs
always := $(hostprogs-y)
HOSTCFLAGS_disable-tsc-ctxt-sw-stress-test.o += -I$(objtree)/usr/include
HOSTCFLAGS_disable-tsc-on-off-stress-test.o += -I$(objtree)/usr/include
HOSTCFLAGS_disable-tsc-test.o += -I$(objtree)/usr/include
...@@ -27,19 +27,20 @@ ...@@ -27,19 +27,20 @@
# define PR_TSC_SIGSEGV 2 /* throw a SIGSEGV instead of reading the TSC */ # define PR_TSC_SIGSEGV 2 /* throw a SIGSEGV instead of reading the TSC */
#endif #endif
uint64_t rdtsc() { static uint64_t rdtsc(void)
{
uint32_t lo, hi; uint32_t lo, hi;
/* We cannot use "=A", since this would use %rax on x86_64 */ /* We cannot use "=A", since this would use %rax on x86_64 */
__asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
return (uint64_t)hi << 32 | lo; return (uint64_t)hi << 32 | lo;
} }
void sigsegv_expect(int sig) static void sigsegv_expect(int sig)
{ {
/* */ /* */
} }
void segvtask(void) static void segvtask(void)
{ {
if (prctl(PR_SET_TSC, PR_TSC_SIGSEGV) < 0) if (prctl(PR_SET_TSC, PR_TSC_SIGSEGV) < 0)
{ {
...@@ -54,13 +55,13 @@ void segvtask(void) ...@@ -54,13 +55,13 @@ void segvtask(void)
} }
void sigsegv_fail(int sig) static void sigsegv_fail(int sig)
{ {
fprintf(stderr, "FATAL ERROR, rdtsc() failed while enabled\n"); fprintf(stderr, "FATAL ERROR, rdtsc() failed while enabled\n");
exit(0); exit(0);
} }
void rdtsctask(void) static void rdtsctask(void)
{ {
if (prctl(PR_SET_TSC, PR_TSC_ENABLE) < 0) if (prctl(PR_SET_TSC, PR_TSC_ENABLE) < 0)
{ {
......
...@@ -29,7 +29,8 @@ ...@@ -29,7 +29,8 @@
/* snippet from wikipedia :-) */ /* snippet from wikipedia :-) */
uint64_t rdtsc() { static uint64_t rdtsc(void)
{
uint32_t lo, hi; uint32_t lo, hi;
/* We cannot use "=A", since this would use %rax on x86_64 */ /* We cannot use "=A", since this would use %rax on x86_64 */
__asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
...@@ -38,7 +39,7 @@ return (uint64_t)hi << 32 | lo; ...@@ -38,7 +39,7 @@ return (uint64_t)hi << 32 | lo;
int should_segv = 0; int should_segv = 0;
void sigsegv_cb(int sig) static void sigsegv_cb(int sig)
{ {
if (!should_segv) if (!should_segv)
{ {
...@@ -55,7 +56,7 @@ void sigsegv_cb(int sig) ...@@ -55,7 +56,7 @@ void sigsegv_cb(int sig)
rdtsc(); rdtsc();
} }
void task(void) static void task(void)
{ {
signal(SIGSEGV, sigsegv_cb); signal(SIGSEGV, sigsegv_cb);
alarm(10); alarm(10);
......
...@@ -29,14 +29,15 @@ const char *tsc_names[] = ...@@ -29,14 +29,15 @@ const char *tsc_names[] =
[PR_TSC_SIGSEGV] = "PR_TSC_SIGSEGV", [PR_TSC_SIGSEGV] = "PR_TSC_SIGSEGV",
}; };
uint64_t rdtsc() { static uint64_t rdtsc(void)
{
uint32_t lo, hi; uint32_t lo, hi;
/* We cannot use "=A", since this would use %rax on x86_64 */ /* We cannot use "=A", since this would use %rax on x86_64 */
__asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
return (uint64_t)hi << 32 | lo; return (uint64_t)hi << 32 | lo;
} }
void sigsegv_cb(int sig) static void sigsegv_cb(int sig)
{ {
int tsc_val = 0; int tsc_val = 0;
......
# List of programs to build
hostprogs-y := testptp
# Tell kbuild to always build the programs
always := $(hostprogs-y)
HOSTCFLAGS_testptp.o += -I$(objtree)/usr/include
HOSTLOADLIBES_testptp := -lrt
...@@ -500,11 +500,11 @@ int main(int argc, char *argv[]) ...@@ -500,11 +500,11 @@ int main(int argc, char *argv[])
interval = t2 - t1; interval = t2 - t1;
offset = (t2 + t1) / 2 - tp; offset = (t2 + t1) / 2 - tp;
printf("system time: %" PRId64 ".%u\n", printf("system time: %lld.%u\n",
(pct+2*i)->sec, (pct+2*i)->nsec); (pct+2*i)->sec, (pct+2*i)->nsec);
printf("phc time: %" PRId64 ".%u\n", printf("phc time: %lld.%u\n",
(pct+2*i+1)->sec, (pct+2*i+1)->nsec); (pct+2*i+1)->sec, (pct+2*i+1)->nsec);
printf("system time: %" PRId64 ".%u\n", printf("system time: %lld.%u\n",
(pct+2*i+2)->sec, (pct+2*i+2)->nsec); (pct+2*i+2)->sec, (pct+2*i+2)->nsec);
printf("system/phc clock time offset is %" PRId64 " ns\n" printf("system/phc clock time offset is %" PRId64 " ns\n"
"system clock time delay is %" PRId64 " ns\n", "system clock time delay is %" PRId64 " ns\n",
......
# PTP 1588 clock support - User space test program
#
# Copyright (C) 2010 OMICRON electronics GmbH
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
CC = $(CROSS_COMPILE)gcc
INC = -I$(KBUILD_OUTPUT)/usr/include
CFLAGS = -Wall $(INC)
LDLIBS = -lrt
PROGS = testptp
all: $(PROGS)
testptp: testptp.o
clean:
rm -f testptp.o
distclean: clean
rm -f $(PROGS)
# kbuild trick to avoid linker error. Can be omitted if a module is built.
obj- := dummy.o
# List of programs to build # List of programs to build
hostprogs-y := spidev_test spidev_fdx hostprogs-y := spidev_test spidev_fdx
......
...@@ -41,7 +41,6 @@ The following this_cpu() operations with implied preemption protection ...@@ -41,7 +41,6 @@ The following this_cpu() operations with implied preemption protection
are defined. These operations can be used without worrying about are defined. These operations can be used without worrying about
preemption and interrupts. preemption and interrupts.
this_cpu_add()
this_cpu_read(pcp) this_cpu_read(pcp)
this_cpu_write(pcp, val) this_cpu_write(pcp, val)
this_cpu_add(pcp, val) this_cpu_add(pcp, val)
...@@ -225,7 +224,6 @@ still occur while an operation is in progress and if the interrupt too ...@@ -225,7 +224,6 @@ still occur while an operation is in progress and if the interrupt too
modifies the variable, then RMW actions can not be guaranteed to be modifies the variable, then RMW actions can not be guaranteed to be
safe. safe.
__this_cpu_add()
__this_cpu_read(pcp) __this_cpu_read(pcp)
__this_cpu_write(pcp, val) __this_cpu_write(pcp, val)
__this_cpu_add(pcp, val) __this_cpu_add(pcp, val)
......
# kbuild trick to avoid linker error. Can be omitted if a module is built.
obj- := dummy.o
# List of programs to build # List of programs to build
hostprogs-$(CONFIG_X86) := hpet_example hostprogs-$(CONFIG_X86) := hpet_example
......
vdso_test
vdso_standalone_test_x86
# vdso_test won't build for glibc < 2.16, so disable it
# hostprogs-y := vdso_test
hostprogs-$(CONFIG_X86) := vdso_standalone_test_x86
vdso_standalone_test_x86-objs := vdso_standalone_test_x86.o parse_vdso.o
vdso_test-objs := parse_vdso.o vdso_test.o
# Tell kbuild to always build the programs
always := $(hostprogs-y)
HOSTCFLAGS := -I$(objtree)/usr/include -std=gnu99
HOSTCFLAGS_vdso_standalone_test_x86.o := -fno-asynchronous-unwind-tables -fno-stack-protector
HOSTLOADLIBES_vdso_standalone_test_x86 := -nostdlib
obj-$(CONFIG_VIDEO_PCI_SKELETON) := v4l2-pci-skeleton.o
# kbuild trick to avoid linker error. Can be omitted if a module is built.
obj- := dummy.o
# List of programs to build # List of programs to build
hostprogs-y := watchdog-simple watchdog-test hostprogs-y := watchdog-simple watchdog-test
......
...@@ -3018,6 +3018,7 @@ F: Documentation/ ...@@ -3018,6 +3018,7 @@ F: Documentation/
X: Documentation/ABI/ X: Documentation/ABI/
X: Documentation/devicetree/ X: Documentation/devicetree/
X: Documentation/[a-z][a-z]_[A-Z][A-Z]/ X: Documentation/[a-z][a-z]_[A-Z][A-Z]/
T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/doc.git
DOUBLETALK DRIVER DOUBLETALK DRIVER
M: "James R. Van Zandt" <jrv@vanzandt.mv.com> M: "James R. Van Zandt" <jrv@vanzandt.mv.com>
......
...@@ -1547,6 +1547,8 @@ endif ...@@ -1547,6 +1547,8 @@ endif
$(cmd_crmodverdir) $(cmd_crmodverdir)
$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
$(build)=$(build-dir) $(build)=$(build-dir)
# Make sure the latest headers are built for Documentation
Documentation/: headers_install
%/: prepare scripts FORCE %/: prepare scripts FORCE
$(cmd_crmodverdir) $(cmd_crmodverdir)
$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
......
...@@ -12,4 +12,4 @@ config RC_MAP ...@@ -12,4 +12,4 @@ config RC_MAP
The ir-keytable program, available at v4l-utils package The ir-keytable program, available at v4l-utils package
provide the tool and the same RC maps for load from provide the tool and the same RC maps for load from
userspace. Its available at userspace. Its available at
http://git.linuxtv.org/v4l-utils http://git.linuxtv.org/cgit.cgi/v4l-utils.git/
...@@ -25,6 +25,15 @@ config VIDEO_FIXED_MINOR_RANGES ...@@ -25,6 +25,15 @@ config VIDEO_FIXED_MINOR_RANGES
When in doubt, say N. When in doubt, say N.
config VIDEO_PCI_SKELETON
tristate "Skeleton PCI V4L2 driver"
depends on PCI && BUILD_DOCSRC
depends on VIDEO_V4L2 && VIDEOBUF2_CORE
depends on VIDEOBUF2_MEMOPS && VIDEOBUF2_DMA_CONTIG
---help---
Enable build of the skeleton PCI driver, used as a reference
when developing new drivers.
# Used by drivers that need tuner.ko # Used by drivers that need tuner.ko
config VIDEO_TUNER config VIDEO_TUNER
tristate tristate
......
#ifndef _TOOLS_ENDIAN_H
#define _TOOLS_ENDIAN_H
#include <byteswap.h>
#if __BYTE_ORDER == __LITTLE_ENDIAN
#ifndef htole16
#define htole16(x) (x)
#endif
#ifndef htole32
#define htole32(x) (x)
#endif
#ifndef htole64
#define htole64(x) (x)
#endif
#ifndef le16toh
#define le16toh(x) (x)
#endif
#ifndef le32toh
#define le32toh(x) (x)
#endif
#ifndef le64toh
#define le64toh(x) (x)
#endif
#else /* __BYTE_ORDER */
#ifndef htole16
#define htole16(x) __bswap_16(x)
#endif
#ifndef htole32
#define htole32(x) __bswap_32(x)
#endif
#ifndef htole64
#define htole64(x) __bswap_64(x)
#endif
#ifndef le16toh
#define le16toh(x) __bswap_16(x)
#endif
#ifndef le32toh
#define le32toh(x) __bswap_32(x)
#endif
#ifndef le64toh
#define le64toh(x) __bswap_64(x)
#endif
#endif
#endif /* _TOOLS_ENDIAN_H */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册