config: convert 'ntpshm_segment' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
177a7104d5
commit
4c9c447429
7
config.c
7
config.c
|
@ -96,6 +96,7 @@ struct config_item config_tab[] = {
|
|||
GLOB_ITEM_DBL("first_step_threshold", 0.00002, 0.0, DBL_MAX),
|
||||
GLOB_ITEM_INT("logging_level", LOG_INFO, PRINT_LEVEL_MIN, PRINT_LEVEL_MAX),
|
||||
GLOB_ITEM_INT("max_frequency", 900000000, 0, INT_MAX),
|
||||
GLOB_ITEM_INT("ntpshm_segment", 0, INT_MIN, INT_MAX),
|
||||
GLOB_ITEM_DBL("pi_integral_const", 0.0, 0.0, DBL_MAX),
|
||||
GLOB_ITEM_DBL("pi_integral_exponent", 0.4, -DBL_MAX, DBL_MAX),
|
||||
GLOB_ITEM_DBL("pi_integral_norm_max", 0.3, DBL_MIN, 2.0),
|
||||
|
@ -554,12 +555,6 @@ static enum parser_result parse_global_setting(const char *option,
|
|||
return r;
|
||||
cfg->dds.sanity_freq_limit = val;
|
||||
|
||||
} else if (!strcmp(option, "ntpshm_segment")) {
|
||||
r = get_ranged_int(value, &val, INT_MIN, INT_MAX);
|
||||
if (r != PARSED_OK)
|
||||
return r;
|
||||
*cfg->ntpshm_segment = val;
|
||||
|
||||
} else if (!strcmp(option, "ptp_dst_mac")) {
|
||||
if (MAC_LEN != sscanf(value, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
|
||||
&mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5]))
|
||||
|
|
2
config.h
2
config.h
|
@ -69,8 +69,6 @@ struct config {
|
|||
struct port_defaults pod;
|
||||
enum servo_type clock_servo;
|
||||
|
||||
int *ntpshm_segment;
|
||||
|
||||
unsigned char *ptp_dst_mac;
|
||||
unsigned char *p2p_dst_mac;
|
||||
unsigned char *udp6_scope;
|
||||
|
|
9
ntpshm.c
9
ntpshm.c
|
@ -22,12 +22,11 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/shm.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "print.h"
|
||||
#include "ntpshm.h"
|
||||
#include "servo_private.h"
|
||||
|
||||
#define NS_PER_SEC 1000000000
|
||||
|
||||
/* NTP leap values */
|
||||
#define LEAP_NORMAL 0x0
|
||||
#define LEAP_INSERT 0x1
|
||||
|
@ -36,9 +35,6 @@
|
|||
/* Key of the first SHM segment */
|
||||
#define SHMKEY 0x4e545030
|
||||
|
||||
/* Number of the SHM segment to be used */
|
||||
int ntpshm_segment = 0;
|
||||
|
||||
/* Declaration of the SHM segment from ntp (ntpd/refclock_shm.c) */
|
||||
struct shmTime {
|
||||
int mode; /* 0 - if valid set
|
||||
|
@ -134,9 +130,10 @@ static void ntpshm_leap(struct servo *servo, int leap)
|
|||
s->leap = leap;
|
||||
}
|
||||
|
||||
struct servo *ntpshm_servo_create(void)
|
||||
struct servo *ntpshm_servo_create(struct config *cfg)
|
||||
{
|
||||
struct ntpshm_servo *s;
|
||||
int ntpshm_segment = config_get_int(cfg, NULL, "ntpshm_segment");
|
||||
int shmid;
|
||||
|
||||
s = calloc(1, sizeof(*s));
|
||||
|
|
7
ntpshm.h
7
ntpshm.h
|
@ -21,11 +21,6 @@
|
|||
|
||||
#include "servo.h"
|
||||
|
||||
/**
|
||||
* The number of the SHM segment that will be used by newly created servo
|
||||
*/
|
||||
extern int ntpshm_segment;
|
||||
|
||||
struct servo *ntpshm_servo_create(void);
|
||||
struct servo *ntpshm_servo_create(struct config *cfg);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1227,6 +1227,7 @@ int main(int argc, char *argv[])
|
|||
int c, domain_number = 0, pps_fd = -1;
|
||||
int r, wait_sync = 0;
|
||||
int print_level = LOG_INFO, use_syslog = 1, verbose = 0;
|
||||
int ntpshm_segment;
|
||||
double phc_rate, tmp;
|
||||
struct node node = {
|
||||
.sanity_freq_limit = 200000000,
|
||||
|
@ -1334,6 +1335,8 @@ int main(int argc, char *argv[])
|
|||
case 'M':
|
||||
if (get_arg_val_i(c, optarg, &ntpshm_segment, INT_MIN, INT_MAX))
|
||||
return -1;
|
||||
if (config_set_int(cfg, "ntpshm_segment", ntpshm_segment))
|
||||
return -1;
|
||||
break;
|
||||
case 'u':
|
||||
if (get_arg_val_ui(c, optarg, &node.stats_max_count,
|
||||
|
|
2
ptp4l.c
2
ptp4l.c
|
@ -103,8 +103,6 @@ static struct config cfg_settings = {
|
|||
.transport = TRANS_UDP_IPV4,
|
||||
.clock_servo = CLOCK_SERVO_PI,
|
||||
|
||||
.ntpshm_segment = &ntpshm_segment,
|
||||
|
||||
.ptp_dst_mac = ptp_dst_mac,
|
||||
.p2p_dst_mac = p2p_dst_mac,
|
||||
.udp6_scope = &udp6_scope,
|
||||
|
|
Loading…
Reference in New Issue