missing: add onestep sync to missing.h

this patch uses grep to test whether the net_tstamp.h header has
HWTSTAMP_TX_ONESTEP_SYNC flag defined. If it doesn't then we can simply define
it with the correct value. This works because proper drivers should just report
that the value is not allowed if they don't support onestep mode. This is the
cleanest way to ensure that linuxptp will still work on kernels which have not
defined the one step flag, and also works for any distributions which backport
the feature.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
master
Jacob Keller 2013-09-03 17:19:30 -07:00 committed by Richard Cochran
parent 78d3669b06
commit 5bf265e860
2 changed files with 9 additions and 0 deletions

View File

@ -21,6 +21,9 @@ FEAT_CFLAGS :=
ifneq ($(shell grep --no-messages clock_adjtime /usr/include/bits/time.h),)
FEAT_CFLAGS += -D_GNU_SOURCE -DHAVE_CLOCK_ADJTIME
endif
ifneq ($(shell grep --no-messages HWTSTAMP_TX_ONESTEP_SYNC $(KBUILD_OUTPUT)/usr/include/linux/net_tstamp.h),)
FEAT_CFLAGS += -DHAVE_ONESTEP_SYNC
endif
DEBUG =
CC = $(CROSS_COMPILE)gcc

View File

@ -44,6 +44,12 @@
#define FD_TO_CLOCKID(fd) ((~(clockid_t) (fd) << 3) | CLOCKFD)
#define CLOCKID_TO_FD(clk) ((unsigned int) ~((clk) >> 3))
#ifndef HAVE_ONESTEP_SYNC
enum _missing_hwtstamp_tx_types {
HWTSTAMP_TX_ONESTEP_SYNC = 2,
}
#endif
#ifndef HAVE_CLOCK_ADJTIME
static inline int clock_adjtime(clockid_t id, struct timex *tx)
{