Re: [RFC][PATCH - 1/12] NTP cleanup: Move NTP code into ntp.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

> 	This patch moves the generic NTP code from time.c and timer.c into
> ntp.c. It makes most of the NTP variables static providing more
> understandable interfaces like ntp_synced() and ntp_clear(). 
> 	
> Since some of the newly made static variables are used in arch generic
> code, this patch alone will not compile. Thus this patch requires part 2
> of the series which fixes the arch specific uses of the newly static
> variables.
> 
> Any comments or feedback would be greatly appreciated.
> 
> thanks
> -john
> 

> diff --git a/kernel/ntp.c b/kernel/ntp.c
> new file mode 100644
> --- /dev/null
> +++ b/kernel/ntp.c
> @@ -0,0 +1,490 @@
> +/********************************************************************
> +* linux/kernel/ntp.c
> +*
> +* NTP state machine and time scaling code.
> +*
> +* Code moved from kernel/time.c and kernel/timer.c
> +* Please see those files for original copyrights.
> +*
> +* 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.
> +*
> +* Notes:
> +*
> +* Hopefully you should never have to understand or touch
> +* any of the code below. but don't let that keep you from trying!
                         ~~~ should be "," ?

> +* This code is loosely based on David Mills' RFC 1589 and its
> +* updates. Please see the following for more details:
> +*  http://www.eecis.udel.edu/~mills/database/rfc/rfc1589.txt
> +*  http://www.eecis.udel.edu/~mills/database/reports/kern/kernb.pdf
> +*
> +* NOTE:	To simplify the code, we do not implement any of
> +* the PPS code, as the code that uses it never was merged.
> +*                             [email protected]
> +*
> +*********************************************************************/
> +
> +#include <linux/ntp.h>
> +#include <linux/jiffies.h>
> +#include <linux/errno.h>
> +
> +#ifdef CONFIG_TIME_INTERPOLATION
> +void time_interpolator_update(long delta_nsec);
> +#else
> +#define time_interpolator_update(x)

do {} while (0) is safer...

> +	result = time_state;       /* mostly `TIME_OK' */
> +
> +	/* Save for later - semantics of adjtime is to return old value */
> +	save_adjust = time_next_adjust ? time_next_adjust : time_adjust;
> +
> +#if 0	/* STA_CLOCKERR is never set yet */
> +	time_status &= ~STA_CLOCKERR;		/* reset STA_CLOCKERR */
> +#endif

Please remove deleted code completely.

> +/**
> + * ntp_synced - Returns 1 if the NTP status is not UNSYNC
> + *
> + */
> +int ntp_synced(void)
> +{
> +	return !(time_status & STA_UNSYNC);
> +}

Should this be inline in header somewhere?

								Pavel
-- 
teflon -- maybe it is a trademark, but it should not be.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux