Richard Cochran
2015-08-12 19:45:16 UTC
Changes in V2:
- API is much simpler to use
- numerous details in the implementation have been improved
- half dozen legacy options converted
The config code was simplistic at first and has grown many warts over
time. The pointers to global variables are rather gross, and it is
hard to add new options, especially port specific ones. The number of
configuration options is sure to grow larger over time.
This series addresses the issues by implementing a hash table based
implementation. Adding a new option is as simple as placing the item
into the config_tab[] table (one line), and then calling
var=config_get_TYPE() at the usage site.
This series add one new option and converts six legacy options. Many
if not all of the remaining legacy options can be converted to the new
system. Once this is done, the config code will be much more compact
and maintainable. In addition, the phc2sys and pmc programs will also
be able to use a configuration file.
Patches 1-4 and 12 provide changes allowing passing of the configuration.
Patch 5 and 6 add a simple hash table.
Patch 7 adds the bulk of the new implementation.
Patch 8 lets the UDP transport use the new TTL option.
Patches 9-11 and 14-16 convert some legacy options.
Patch 13 adds a way to "lock" options from the command line.
Review and comments are most welcome.
Thanks,
Richard
Richard Cochran (16):
clock: store the configuration in the clock data structure.
clock: add a method to obtain the configuration.
pmc: require a configuration for creating a PMC instance.
transport: store the configuration in the transport data structure.
Introduce a simple hash table implementation.
config: Add a hash table into the data structure.
config: introduce a new API for reading configuration settings.
udp: configure the socket with the TTL option.
config: convert the 'assume_two_step' option to the new scheme.
config: convert 'tx_timestamp_timeout' to the new scheme.
config: convert the 'check_fup_sync' option to the new scheme.
servo: store the configuration in the servo data structure.
config: add methods to set values taken from the command line.
config: convert the 'step_threshold' option to the new scheme.
config: convert the 'first_step_threshold' option to the new scheme.
config: convert the 'max_frequency' option to the new scheme.
clock.c | 18 ++-
clock.h | 15 ++-
config.c | 353 +++++++++++++++++++++++++++++++++++++++++++++-------
config.h | 28 +++--
hash.c | 113 +++++++++++++++++
hash.h | 59 +++++++++
makefile | 12 +-
phc2sys.c | 31 +++--
pmc.c | 7 +-
pmc_common.c | 9 +-
pmc_common.h | 8 +-
port.c | 2 +-
ptp4l.c | 21 ++--
servo.c | 16 ++-
servo.h | 27 +---
transport.c | 7 +-
transport.h | 6 +-
transport_private.h | 1 +
udp.c | 15 ++-
19 files changed, 619 insertions(+), 129 deletions(-)
create mode 100644 hash.c
create mode 100644 hash.h
- API is much simpler to use
- numerous details in the implementation have been improved
- half dozen legacy options converted
The config code was simplistic at first and has grown many warts over
time. The pointers to global variables are rather gross, and it is
hard to add new options, especially port specific ones. The number of
configuration options is sure to grow larger over time.
This series addresses the issues by implementing a hash table based
implementation. Adding a new option is as simple as placing the item
into the config_tab[] table (one line), and then calling
var=config_get_TYPE() at the usage site.
This series add one new option and converts six legacy options. Many
if not all of the remaining legacy options can be converted to the new
system. Once this is done, the config code will be much more compact
and maintainable. In addition, the phc2sys and pmc programs will also
be able to use a configuration file.
Patches 1-4 and 12 provide changes allowing passing of the configuration.
Patch 5 and 6 add a simple hash table.
Patch 7 adds the bulk of the new implementation.
Patch 8 lets the UDP transport use the new TTL option.
Patches 9-11 and 14-16 convert some legacy options.
Patch 13 adds a way to "lock" options from the command line.
Review and comments are most welcome.
Thanks,
Richard
Richard Cochran (16):
clock: store the configuration in the clock data structure.
clock: add a method to obtain the configuration.
pmc: require a configuration for creating a PMC instance.
transport: store the configuration in the transport data structure.
Introduce a simple hash table implementation.
config: Add a hash table into the data structure.
config: introduce a new API for reading configuration settings.
udp: configure the socket with the TTL option.
config: convert the 'assume_two_step' option to the new scheme.
config: convert 'tx_timestamp_timeout' to the new scheme.
config: convert the 'check_fup_sync' option to the new scheme.
servo: store the configuration in the servo data structure.
config: add methods to set values taken from the command line.
config: convert the 'step_threshold' option to the new scheme.
config: convert the 'first_step_threshold' option to the new scheme.
config: convert the 'max_frequency' option to the new scheme.
clock.c | 18 ++-
clock.h | 15 ++-
config.c | 353 +++++++++++++++++++++++++++++++++++++++++++++-------
config.h | 28 +++--
hash.c | 113 +++++++++++++++++
hash.h | 59 +++++++++
makefile | 12 +-
phc2sys.c | 31 +++--
pmc.c | 7 +-
pmc_common.c | 9 +-
pmc_common.h | 8 +-
port.c | 2 +-
ptp4l.c | 21 ++--
servo.c | 16 ++-
servo.h | 27 +---
transport.c | 7 +-
transport.h | 6 +-
transport_private.h | 1 +
udp.c | 15 ++-
19 files changed, 619 insertions(+), 129 deletions(-)
create mode 100644 hash.c
create mode 100644 hash.h
--
2.1.4
------------------------------------------------------------------------------
2.1.4
------------------------------------------------------------------------------