[Git][NTPsec/ntpsec][master] 2 commits: Further nsrrow the interface to the shutdown method.

Eric S. Raymond gitlab at mg.gitlab.com
Tue Nov 21 06:25:41 UTC 2017


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
e370c43f by Eric S. Raymond at 2017-11-21T01:07:14-05:00
Further nsrrow the interface to the shutdown method.

- - - - -
483d2667 by Eric S. Raymond at 2017-11-21T01:23:50-05:00
Seven drivers no longer need a custom shutdown method.

Instead, they use a standard shutdown sequence invoked if there is
no custom hook.

- - - - -


16 changed files:

- include/ntp_refclock.h
- ntpd/ntp_refclock.c
- ntpd/refclock_arbiter.c
- ntpd/refclock_generic.c
- ntpd/refclock_gpsd.c
- ntpd/refclock_hpgps.c
- ntpd/refclock_modem.c
- ntpd/refclock_neoclock.c
- ntpd/refclock_nmea.c
- ntpd/refclock_oncore.c
- ntpd/refclock_pps.c
- ntpd/refclock_shm.c
- ntpd/refclock_spectracom.c
- ntpd/refclock_trimble.c
- ntpd/refclock_truetime.c
- ntpd/refclock_zyfer.c


Changes:

=====================================
include/ntp_refclock.h
=====================================
--- a/include/ntp_refclock.h
+++ b/include/ntp_refclock.h
@@ -160,7 +160,7 @@ struct refclockproc {
 struct refclock {
 	const char *basename;
 	bool (*clock_start)	(int, struct peer *);
-	void (*clock_shutdown)	(int, struct refclockproc *);
+	void (*clock_shutdown)	(struct refclockproc *);
 	void (*clock_poll)	(int, struct peer *);
 	void (*clock_control)	(int, const struct refclockstat *,
 				 struct refclockstat *, struct peer *);


=====================================
ntpd/ntp_refclock.c
=====================================
--- a/ntpd/ntp_refclock.c
+++ b/ntpd/ntp_refclock.c
@@ -237,8 +237,6 @@ refclock_unpeer(
 	struct peer *peer	/* peer structure pointer */
 	)
 {
-	int unit;
-
 	/*
 	 * Wiggle the driver to release its resources, then give back
 	 * the interface structure.
@@ -246,9 +244,15 @@ refclock_unpeer(
 	if (NULL == peer->procptr)
 		return;
 
-	unit = peer->procptr->refclkunit;
+	/* There's a standard sghutdown sequence if user didn't declare one */
 	if (peer->procptr->conf->clock_shutdown)
-		(peer->procptr->conf->clock_shutdown)(unit, peer->procptr);
+		(peer->procptr->conf->clock_shutdown)(peer->procptr);
+	else {
+		if (NULL != peer->procptr->unitptr)
+			free(peer->procptr->unitptr);
+		if (-1 != peer->procptr->io.fd)
+			io_closeclock(&peer->procptr->io);
+	}
 	free(peer->procptr);
 	peer->procptr = NULL;
 }


=====================================
ntpd/refclock_arbiter.c
=====================================
--- a/ntpd/refclock_arbiter.c
+++ b/ntpd/refclock_arbiter.c
@@ -115,7 +115,6 @@ struct arbunit {
  * Function prototypes
  */
 static	bool	arb_start	(int, struct peer *);
-static	void	arb_shutdown	(int, struct refclockproc *);
 static	void	arb_receive	(struct recvbuf *);
 static	void	arb_poll	(int, struct peer *);
 
@@ -125,7 +124,7 @@ static	void	arb_poll	(int, struct peer *);
 struct	refclock refclock_arbiter = {
 	NAME,			/* basename of driver */
 	arb_start,		/* start up driver */
-	arb_shutdown,		/* shut down driver */
+	NULL,			/* shut down driver in standard way */
 	arb_poll,		/* transmit poll message */
 	NULL,			/* not used (old arb_control) */
 	NULL,			/* initialize driver (not used) */
@@ -196,27 +195,6 @@ arb_start(
 
 
 /*
- * arb_shutdown - shut down the clock
- */
-static void
-arb_shutdown(
-	int unit,
-	struct refclockproc *pp
-	)
-{
-	struct arbunit *up;
-
-	UNUSED_ARG(unit);
-
-	up = pp->unitptr;
-	if (-1 != pp->io.fd)
-		io_closeclock(&pp->io);
-	if (NULL != up)
-		free(up);
-}
-
-
-/*
  * arb_receive - receive data from the serial interface
  */
 static void


=====================================
ntpd/refclock_generic.c
=====================================
--- a/ntpd/refclock_generic.c
+++ b/ntpd/refclock_generic.c
@@ -133,7 +133,7 @@
  **/
 
 static	bool	parse_start	(int, struct peer *);
-static	void	parse_shutdown	(int, struct refclockproc *);
+static	void	parse_shutdown	(struct refclockproc *);
 static	void	parse_poll	(int, struct peer *);
 static	void	parse_control	(int, const struct refclockstat *, struct refclockstat *, struct peer *);
 
@@ -2304,7 +2304,6 @@ cparse_statistics(
  */
 static void
 parse_shutdown(
-	int unit,
 	struct refclockproc *pp
 	)
 {
@@ -2321,7 +2320,7 @@ parse_shutdown(
 
 	if (!parse->peer)
 	{
-		msyslog(LOG_INFO, "REFCLOCK: PARSE receiver #%d: INTERNAL ERROR - unit already inactive - `shutdown ignored", unit);
+		msyslog(LOG_INFO, "REFCLOCK: PARSE receiver #%d: INTERNAL ERROR - unit already inactive - `shutdown ignored", pp->refclkunit);
 		return;
 	}
 
@@ -2627,7 +2626,7 @@ parse_start(
                     "REFCLOCK: PARSE receiver #%u: parse_start: tcgetattr(%d, &tio): %m",
                     unit, fd232);
 		/* let our cleaning staff do the work */
-		parse_shutdown(parse->peer->procptr->refclkunit, peer->procptr);
+		parse_shutdown(peer->procptr);
 		return false;
 	}
 	else
@@ -2669,7 +2668,7 @@ parse_start(
 			    " tcset{i,o}speed(&tio, speed): %m",
 			    unit);
 		    /* let our cleaning staff do the work */
-		    parse_shutdown(parse->peer->procptr->refclkunit, peer->procptr);
+		    parse_shutdown(peer->procptr);
 		    return false;
 		}
 
@@ -2740,7 +2739,7 @@ parse_start(
 		      "REFCLOCK: PARSE receiver #%u: parse_start: tcsetattr(%d, &tio): %m",
                       unit, fd232);
 		    /* let our cleaning staff do the work */
-		    parse_shutdown(parse->peer->procptr->refclkunit, peer->procptr);
+		    parse_shutdown(peer->procptr);
 		    return false;
 		}
 	}
@@ -2756,7 +2755,7 @@ parse_start(
 	if (parse->binding == (bind_t *)0)
 		{
 			msyslog(LOG_ERR, "REFCLOCK: PARSE receiver #%d: parse_start: io sub system initialisation failed.", parse->peer->procptr->refclkunit);
-			parse_shutdown(parse->peer->procptr->refclkunit, peer->procptr); /* let our cleaning staff do the work */
+			parse_shutdown(peer->procptr); /* let our cleaning staff do the work */
 			return false;			/* well, ok - special initialisation broke */
 		}
 
@@ -2799,7 +2798,7 @@ parse_start(
 		msyslog(LOG_ERR,
                     "REFCLOCK: PARSE receiver #%u: parse_start: parse_setcs() FAILED.",
                     unit);
-		parse_shutdown(parse->peer->procptr->refclkunit, peer->procptr); /* let our cleaning staff do the work */
+		parse_shutdown(peer->procptr);	/* let our cleaning staff do the work */
 		return false;			/* well, ok - special initialisation broke */
 	}
 
@@ -2811,7 +2810,7 @@ parse_start(
 		msyslog(LOG_ERR,
                     "REFCLOCK: PARSE receiver #%u: parse_start: parse_setfmt() FAILED.",
                     unit);
-		parse_shutdown(parse->peer->procptr->refclkunit, peer->procptr); /* let our cleaning staff do the work */
+		parse_shutdown(peer->procptr);	/* let our cleaning staff do the work */
 		return false;			/* well, ok - special initialisation broke */
 	}
 
@@ -2827,7 +2826,7 @@ parse_start(
 		{
 			if (parse->parse_type->cl_init(parse))
 				{
-					parse_shutdown(parse->peer->procptr->refclkunit, peer->procptr); /* let our cleaning staff do the work */
+					parse_shutdown(peer->procptr); /* let our cleaning staff do the work */
 					return false;		/* well, ok - special initialisation broke */
 				}
 		}
@@ -2839,7 +2838,7 @@ parse_start(
         {
 		msyslog(LOG_ERR,
 			"REFCLOCK: PARSE receiver #%d: parse_start: addclock %s fails (ABORT - clock type requires async io)", parse->peer->procptr->refclkunit, parsedev);
-		parse_shutdown(parse->peer->procptr->refclkunit, peer->procptr); /* let our cleaning staff do the work */
+		parse_shutdown(peer->procptr); /* let our cleaning staff do the work */
 		return false;
 	}
 


=====================================
ntpd/refclock_gpsd.c
=====================================
--- a/ntpd/refclock_gpsd.c
+++ b/ntpd/refclock_gpsd.c
@@ -214,7 +214,7 @@ typedef struct addrinfo     addrinfoT;
 
 static	void	gpsd_init	(void);
 static	bool	gpsd_start	(int, peerT *);
-static	void	gpsd_shutdown	(int, struct refclockproc *);
+static	void	gpsd_shutdown	(struct refclockproc *);
 static	void	gpsd_receive	(struct recvbuf *);
 static	void	gpsd_poll	(int, peerT *);
 static	void	gpsd_control	(int, const struct refclockstat *,
@@ -586,14 +586,11 @@ dev_fail:
 
 static void
 gpsd_shutdown(
-	int     unit,
 	struct refclockproc *pp)
 {
 	gpsd_unitT * const up = (gpsd_unitT *)pp->unitptr;
 	gpsd_unitT ** uscan   = &s_clock_units;
 
-	UNUSED_ARG(unit);
-
 	/* The unit pointer might have been removed already. */
 	if (up == NULL)
 		return;
@@ -623,7 +620,7 @@ gpsd_shutdown(
 	}
 	pp->unitptr = NULL;
 	LOGIF(CLOCKINFO,
-	      (LOG_NOTICE, "%s: shutdown: gpsd_json(%d)", unit));
+	      (LOG_NOTICE, "%s: shutdown: gpsd_json(%d)", pp->refclkunit));
 }
 
 /* ------------------------------------------------------------------ */


=====================================
ntpd/refclock_hpgps.c
=====================================
--- a/ntpd/refclock_hpgps.c
+++ b/ntpd/refclock_hpgps.c
@@ -122,7 +122,6 @@ struct hpgpsunit {
  * Function prototypes
  */
 static	bool	hpgps_start	(int, struct peer *);
-static	void	hpgps_shutdown	(int, struct refclockproc *);
 static	void	hpgps_receive	(struct recvbuf *);
 static	void	hpgps_poll	(int, struct peer *);
 
@@ -132,7 +131,7 @@ static	void	hpgps_poll	(int, struct peer *);
 struct	refclock refclock_hpgps = {
 	NAME,			/* basename of driver */
 	hpgps_start,		/* start up driver */
-	hpgps_shutdown,		/* shut down driver */
+	NULL,			/* shut down driver in the standard way */
 	hpgps_poll,		/* transmit poll message */
 	NULL,			/* not used (old hpgps_control) */
 	NULL,			/* initialize driver */
@@ -218,27 +217,6 @@ hpgps_start(
 
 
 /*
- * hpgps_shutdown - shut down the clock
- */
-static void
-hpgps_shutdown(
-	int unit,
-	struct refclockproc *pp
-	)
-{
-	struct hpgpsunit *up;
-
-	UNUSED_ARG(unit);
-
-	up = pp->unitptr;
-	if (-1 != pp->io.fd)
-		io_closeclock(&pp->io);
-	if (NULL != up)
-		free(up);
-}
-
-
-/*
  * hpgps_receive - receive data from the serial interface
  */
 static void


=====================================
ntpd/refclock_modem.c
=====================================
--- a/ntpd/refclock_modem.c
+++ b/ntpd/refclock_modem.c
@@ -218,7 +218,7 @@ struct modemunit {
  * Function prototypes
  */
 static	bool	modem_start	(int, struct peer *);
-static	void	modem_shutdown	(int, struct refclockproc *);
+static	void	modem_shutdown	(struct refclockproc *);
 static	void	modem_receive	(struct recvbuf *);
 static	void	modem_message	(struct peer *, const char *);
 static	void	modem_timecode	(struct peer *, const char *);
@@ -289,12 +289,9 @@ modem_start(
  */
 static void
 modem_shutdown(
-	int	unit,
 	struct refclockproc *pp
 	)
 {
-	UNUSED_ARG(unit);
-
 	/*
 	 * Warning: do this only when a call is not in progress.
 	 */


=====================================
ntpd/refclock_neoclock.c
=====================================
--- a/ntpd/refclock_neoclock.c
+++ b/ntpd/refclock_neoclock.c
@@ -102,7 +102,7 @@ struct neoclock4x_unit {
 };
 
 static	bool	neoclock4x_start	(int, struct peer *);
-static	void	neoclock4x_shutdown	(int, struct refclockproc *);
+static	void	neoclock4x_shutdown	(struct refclockproc *);
 static	void	neoclock4x_receive	(struct recvbuf *);
 static	void	neoclock4x_poll		(int, struct peer *);
 static	void	neoclock4x_control	(int, const struct refclockstat *, struct refclockstat *, struct peer *);
@@ -333,7 +333,7 @@ neoclock4x_start(int unit,
 }
 
 static void
-neoclock4x_shutdown(int unit,
+neoclock4x_shutdown(
 		   struct refclockproc *pp)
 {
     struct neoclock4x_unit *up;
@@ -352,7 +352,7 @@ neoclock4x_shutdown(int unit,
 		if(ioctl(pp->io.fd, TIOCMGET, (void *)&sl232) == -1)
 		{
 		    msyslog(LOG_CRIT, "REFCLOCK: NeoClock4X(%d): can't query RTS/DTR state: %m",
-			    unit);
+			    pp->refclkunit);
 		}
 #ifdef TIOCM_RTS
 		/* turn on RTS, and DTR for power supply */
@@ -364,7 +364,7 @@ neoclock4x_shutdown(int unit,
 		if(ioctl(pp->io.fd, TIOCMSET, (void *)&sl232) == -1)
 		{
 		    msyslog(LOG_CRIT, "REFCLOCK: NeoClock4X(%d): can't set RTS/DTR to power neoclock4x: %m",
-			    unit);
+			    pp->refclkunit);
 		}
 #endif
 		io_closeclock(&pp->io);
@@ -374,10 +374,10 @@ neoclock4x_shutdown(int unit,
 	}
     }
 
-    msyslog(LOG_ERR, "REFCLOCK: NeoClock4X(%d): shutdown", unit);
+    msyslog(LOG_ERR, "REFCLOCK: NeoClock4X(%d): shutdown", pp->refclkunit);
 
     NLOG(NLOG_CLOCKINFO)
-	msyslog(LOG_INFO, "REFCLOCK: NeoClock4X(%d): receiver shutdown done", unit);
+	msyslog(LOG_INFO, "REFCLOCK: NeoClock4X(%d): receiver shutdown done", pp->refclkunit);
 }
 
 static void


=====================================
ntpd/refclock_nmea.c
=====================================
--- a/ntpd/refclock_nmea.c
+++ b/ntpd/refclock_nmea.c
@@ -272,7 +272,7 @@ typedef struct {
  */
 static	void	nmea_init	(void);
 static	bool	nmea_start	(int, struct peer *);
-static	void	nmea_shutdown	(int, struct refclockproc *);
+static	void	nmea_shutdown	(struct refclockproc *);
 static	void	nmea_receive	(struct recvbuf *);
 static	void	nmea_poll	(int, struct peer *);
 #ifdef HAVE_PPSAPI
@@ -505,14 +505,11 @@ nmea_start(
  */
 static void
 nmea_shutdown(
-	int           unit,
 	struct refclockproc * pp
 	)
 {
 	nmea_unit	    * const up = (nmea_unit *)pp->unitptr;
 
-	UNUSED_ARG(unit);
-
 	if (up != NULL) {
 #ifdef HAVE_PPSAPI
 		if (up->ppsapi_lit)


=====================================
ntpd/refclock_oncore.c
=====================================
--- a/ntpd/refclock_oncore.c
+++ b/ntpd/refclock_oncore.c
@@ -351,7 +351,7 @@ struct instance {
 
 static	bool	oncore_start	      (int, struct peer *);
 static	void	oncore_poll	      (int, struct peer *);
-static	void	oncore_shutdown       (int, struct refclockproc *);
+static	void	oncore_shutdown       (struct refclockproc *);
 static	void	oncore_consume	      (struct instance *);
 static	void	oncore_read_config    (struct instance *);
 static	void	oncore_receive	      (struct recvbuf *);
@@ -764,15 +764,10 @@ oncore_start(
 
 static void
 oncore_shutdown(
-	int unit,
 	struct refclockproc *pp
 	)
 {
-	struct instance *instance;
-
-	UNUSED_ARG(unit);
-
-	instance = pp->unitptr;
+	struct instance *instance = pp->unitptr;
 
 	if (pp->io.fd != -1)
 		io_closeclock(&pp->io);
@@ -812,7 +807,7 @@ oncore_poll(
 		if (instance->timeout == 0) {
 			oncore_log(instance, LOG_ERR,
 			    "Oncore: No response from @@Cj, shutting down driver");
-			oncore_shutdown(unit, peer->procptr);
+			oncore_shutdown(peer->procptr);
 		} else {
 			oncore_sendmsg(instance, oncore_cmd_Cj, sizeof(oncore_cmd_Cj));
 			oncore_log(instance, LOG_WARNING, "Oncore: Resend @@Cj");
@@ -2731,7 +2726,7 @@ oncore_msg_CaFaIa(
 				   "ONCORE: self test failed, shutting down driver");
 
 			refclock_report(instance->peer, CEVNT_FAULT);
-			oncore_shutdown(instance->unit, instance->peer->procptr);
+			oncore_shutdown(instance->peer->procptr);
 			return;
 		}
 
@@ -3291,7 +3286,7 @@ oncore_msg_Sz(
 
 	if (instance && instance->peer) {
 		oncore_log(instance, LOG_ERR, "Oncore: System Failure at Power On");
-		oncore_shutdown(instance->unit, instance->peer->procptr);
+		oncore_shutdown(instance->peer->procptr);
 	}
 }
 


=====================================
ntpd/refclock_pps.c
=====================================
--- a/ntpd/refclock_pps.c
+++ b/ntpd/refclock_pps.c
@@ -92,7 +92,7 @@ struct ppsunit {struct refclock_ppsctl ppsctl; /* PPS context structure pointer 
  * Function prototypes
  */
 static	bool	pps_start	(int, struct peer *);
-static	void	pps_shutdown	(int, struct refclockproc *);
+static	void	pps_shutdown	(struct refclockproc *);
 static	void	pps_poll	(int, struct peer *);
 static	void	pps_timer	(int, struct peer *);
 
@@ -162,18 +162,15 @@ pps_start(
  */
 static void
 pps_shutdown(
-	int unit,		/* unit number (not used) */
 	struct refclockproc *pp	/* refclock structure pointer */
 	)
 {
 	struct ppsunit *up;
 
-	UNUSED_ARG(unit);
-
 	up = pp->unitptr;
+	free(up);
 	if (up->fddev > 0)
 		close(up->fddev);
-	free(up);
 }
 
 /*


=====================================
ntpd/refclock_shm.c
=====================================
--- a/ntpd/refclock_shm.c
+++ b/ntpd/refclock_shm.c
@@ -59,7 +59,7 @@
  * Function prototypes
  */
 static  bool    shm_start       (int unit, struct peer *peer);
-static  void    shm_shutdown    (int unit, struct refclockproc *peer);
+static  void    shm_shutdown    (struct refclockproc *peer);
 static  void    shm_poll        (int unit, struct peer *peer);
 static  void    shm_timer       (int unit, struct peer *peer);
 static	void	shm_clockstats  (int unit, struct peer *peer);
@@ -231,13 +231,11 @@ shm_control(
  */
 static void
 shm_shutdown(
-	int unit,
 	struct refclockproc * pp
 	)
 {
 	struct shmunit *      const up = pp->unitptr;
 
-	UNUSED_ARG(unit);
 	if (NULL == up)
 		return;
 


=====================================
ntpd/refclock_spectracom.c
=====================================
--- a/ntpd/refclock_spectracom.c
+++ b/ntpd/refclock_spectracom.c
@@ -132,9 +132,8 @@ struct spectracomunit {
  * Function prototypes
  */
 static	bool	spectracom_start	(int, struct peer *);
-static	void	spectracom_shutdown	(int, struct refclockproc *);
 static	void	spectracom_receive	(struct recvbuf *);
-static	void	spectracom_poll	(int, struct peer *);
+static	void	spectracom_poll		(int, struct peer *);
 static	void	spectracom_timer	(int, struct peer *);
 #ifdef HAVE_PPSAPI
 static	void	spectracom_control	(int, const struct refclockstat *,
@@ -148,9 +147,9 @@ static	void	spectracom_control	(int, const struct refclockstat *,
  * Transfer vector
  */
 struct	refclock refclock_spectracom = {
-	NAME,			/* basename of driver */
+	NAME,				/* basename of driver */
 	spectracom_start,		/* start up driver */
-	spectracom_shutdown,		/* shut down driver */
+	NULL,				/* shut down driver in standard way */
 	spectracom_poll,		/* transmit poll message */
 	SPECTRACOM_CONTROL,		/* fudge set/change notification */
 	NULL,				/* initialize driver (not used) */
@@ -213,27 +212,6 @@ spectracom_start(
 
 
 /*
- * spectracom_shutdown - shut down the clock
- */
-static void
-spectracom_shutdown(
-	int unit,
-	struct refclockproc *	pp
-	)
-{
-	struct spectracomunit *	up;
-
-	UNUSED_ARG(unit);
-
-	up = pp->unitptr;
-	if (-1 != pp->io.fd)
-		io_closeclock(&pp->io);
-	if (NULL != up)
-		free(up);
-}
-
-
-/*
  * spectracom_receive - receive data from the serial interface
  */
 static void


=====================================
ntpd/refclock_trimble.c
=====================================
--- a/ntpd/refclock_trimble.c
+++ b/ntpd/refclock_trimble.c
@@ -128,7 +128,6 @@ struct trimble_unit {
  * Function prototypes
  */
 static	bool	trimble_start		(int, struct peer *);
-static	void	trimble_shutdown	(int, struct refclockproc *);
 static	void	trimble_poll		(int, struct peer *);
 static	void	trimble_timer		(int, struct peer *);
 static	void 	trimble_io		(struct recvbuf *);
@@ -176,7 +175,7 @@ static const bool tb_disc_in_holdover[TB_DISC_MODES+1] = {
 struct refclock refclock_trimble = {
 	NAME,			/* basename of driver */
 	trimble_start,		/* start up driver */
-	trimble_shutdown,	/* shut down driver */
+	NULL,			/* shut down driver in the standard way */
 	trimble_poll,		/* transmit poll message */
 	NULL,			/* control - not used  */
 	NULL,			/* initialize driver (not used) */
@@ -479,26 +478,6 @@ trimble_start (
 	return true;
 }
 
-/*
- * trimble_shutdown - shut down the clock
- */
-static void
-trimble_shutdown (
-	int unit,
-	struct refclockproc *pp
-	)
-{
-	struct trimble_unit *up;
-
-	UNUSED_ARG(unit);
-
-	up = pp->unitptr;
-	if (-1 != pp->io.fd)
-		io_closeclock(&pp->io);
-	if (NULL != up)
-		free(up);
-}
-
 /* 
  * TSIP_decode - decode the TSIP data packets 
  */


=====================================
ntpd/refclock_truetime.c
=====================================
--- a/ntpd/refclock_truetime.c
+++ b/ntpd/refclock_truetime.c
@@ -124,7 +124,6 @@ struct true_unit {
  * Function prototypes
  */
 static	bool	true_start	(int, struct peer *);
-static	void	true_shutdown	(int, struct refclockproc *);
 static	void	true_receive	(struct recvbuf *);
 static	void	true_poll	(int, struct peer *);
 static	void	true_send	(struct peer *, const char *);
@@ -140,7 +139,7 @@ static	unsigned long	true_sample720	(void);
 struct	refclock refclock_true = {
 	NAME,			/* basename of driver */
 	true_start,		/* start up driver */
-	true_shutdown,		/* shut down driver */
+	NULL,			/* shut down driver in the stabdard way */
 	true_poll,		/* transmit poll message */
 	NULL,			/* not used (old true_control) */
 	NULL,			/* initialize driver (not used) */
@@ -258,27 +257,6 @@ true_start(
 
 
 /*
- * true_shutdown - shut down the clock
- */
-static void
-true_shutdown(
-	int unit,
-	struct refclockproc *pp
-	)
-{
-	struct true_unit *up;
-
-	UNUSED_ARG(unit);
-
-	up = pp->unitptr;
-	if (pp->io.fd != -1)
-		io_closeclock(&pp->io);
-	if (up != NULL)
-		free(up);
-}
-
-
-/*
  * true_receive - receive data from the serial interface on a clock
  */
 static void


=====================================
ntpd/refclock_zyfer.c
=====================================
--- a/ntpd/refclock_zyfer.c
+++ b/ntpd/refclock_zyfer.c
@@ -88,7 +88,6 @@ struct zyferunit {
  * Function prototypes
  */
 static	bool	zyfer_start	(int, struct peer *);
-static	void	zyfer_shutdown	(int, struct refclockproc *);
 static	void	zyfer_receive	(struct recvbuf *);
 static	void	zyfer_poll	(int, struct peer *);
 
@@ -98,7 +97,7 @@ static	void	zyfer_poll	(int, struct peer *);
 struct	refclock refclock_zyfer = {
 	NAME,			/* basename of driver */
 	zyfer_start,		/* start up driver */
-	zyfer_shutdown,		/* shut down driver */
+	NULL,			/* shut down driver in the standard way */
 	zyfer_poll,		/* transmit poll message */
 	NULL,			/* not used (old zyfer_control) */
 	NULL,			/* initialize driver (not used) */
@@ -167,27 +166,6 @@ zyfer_start(
 
 
 /*
- * zyfer_shutdown - shut down the clock
- */
-static void
-zyfer_shutdown(
-	int unit,
-	struct refclockproc *pp
-	)
-{
-	struct zyferunit *up;
-
-	UNUSED_ARG(unit);
-
-	up = pp->unitptr;
-	if (pp->io.fd != -1)
-		io_closeclock(&pp->io);
-	if (up != NULL)
-		free(up);
-}
-
-
-/*
  * zyfer_receive - receive data from the serial interface
  */
 static void



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/6e189d174a449aae8984e95bec3c93865b6a98fb...483d2667b8c3bebd039d230a1c1ba9dcbc8d1cb4

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/6e189d174a449aae8984e95bec3c93865b6a98fb...483d2667b8c3bebd039d230a1c1ba9dcbc8d1cb4
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20171121/e759306d/attachment.html>


More information about the vc mailing list