On 2/11/2020 6:03 AM, Richard Cochran wrote:
> Signed-off-by: Richard Cochran <richardcoch...@gmail.com>
> ---
> clock.c | 21 +++++++++++----------
> config.c | 12 +++++++-----
> makefile | 10 +++++-----
> nsm.c | 9 +++++----
> pmc_common.c | 2 +-
> port.c | 19 +++++++++++--------
> port_private.h | 2 +-
> udp.c | 2 +-
> udp6.c | 2 +-
> uds.c | 8 ++++----
> 10 files changed, 47 insertions(+), 40 deletions(-)
<snip>
> diff --git a/config.c b/config.c
> index 65afa70..c30f6bc 100644
> --- a/config.c
> +++ b/config.c
> @@ -775,15 +775,15 @@ int config_read(const char *name, struct config *cfg)
> if (parse_setting_line(line, &option, &value)) {
> fprintf(stderr, "could not parse line %d in %s
> section\n",
> line_num, current_section == GLOBAL_SECTION ?
> - "global" : current_port->name);
> + "global" : interface_name(current_port));
> goto parse_error;
> }
>
> check_deprecated_options(&option);
>
> parser_res = parse_item(cfg, 0, current_section ==
> GLOBAL_SECTION ?
> - NULL : current_port->name, option,
> value);
> -
> + NULL : interface_name(current_port),
> + option, value);
> switch (parser_res) {
> case PARSED_OK:
> break;
> @@ -791,7 +791,7 @@ int config_read(const char *name, struct config *cfg)
> fprintf(stderr, "unknown option %s at line %d in %s
> section\n",
> option, line_num,
> current_section == GLOBAL_SECTION ? "global" :
> - current_port->name);
> + interface_name(current_port));
> goto parse_error;
> case BAD_VALUE:
> fprintf(stderr, "%s is a bad value for option %s at
> line %d\n",
> @@ -820,10 +820,12 @@ parse_error:
> struct interface *config_create_interface(const char *name, struct config
> *cfg)
> {
> struct interface *iface;
> + const char *ifname;
>
> /* only create each interface once (by name) */
> STAILQ_FOREACH(iface, &cfg->interfaces, list) {
> - if (0 == strncmp(name, iface->name, MAX_IFNAME_SIZE))
> + ifname = interface_name(iface);
> + if (0 == strncmp(name, ifname, MAX_IFNAME_SIZE))
> return iface;
> }
>
We use the new interface_name() in config.c meaning that all users of
config.o must link to interface.o now...
> diff --git a/makefile b/makefile
> index e1e0e99..e1dd3fa 100644
> --- a/makefile
> +++ b/makefile
> @@ -57,13 +57,13 @@ all: $(PRG)
>
> ptp4l: $(OBJ)
>
> -nsm: config.o $(FILTERS) hash.o msg.o nsm.o phc.o print.o \
> +nsm: config.o $(FILTERS) hash.o interface.o msg.o nsm.o phc.o print.o \
> rtnl.o sk.o $(TRANSP) tlv.o tsproc.o util.o version.o
>
> -pmc: config.o hash.o msg.o phc.o pmc.o pmc_common.o print.o sk.o tlv.o \
> - $(TRANSP) util.o version.o
> +pmc: config.o hash.o interface.o msg.o phc.o pmc.o pmc_common.o print.o sk.o
> \
> + tlv.o $(TRANSP) util.o version.o
>
> -phc2sys: clockadj.o clockcheck.o config.o hash.o msg.o \
> +phc2sys: clockadj.o clockcheck.o config.o hash.o interface.o msg.o \
> phc.o phc2sys.o pmc_common.o print.o $(SERVOS) sk.o stats.o \
> sysoff.o tlv.o $(TRANSP) util.o version.o
>
> @@ -71,7 +71,7 @@ hwstamp_ctl: hwstamp_ctl.o version.o
>
> phc_ctl: phc_ctl.o phc.o sk.o util.o clockadj.o sysoff.o print.o version.o
>
> -snmp4lptp: config.o hash.o msg.o phc.o pmc_common.o print.o sk.o \
> +snmp4lptp: config.o hash.o interface.o msg.o phc.o pmc_common.o print.o sk.o
> \
> snmp4lptp.o tlv.o $(TRANSP) util.o
> $(CC) $^ $(LDFLAGS) $(LOADLIBES) $(LDLIBS) $(snmplib) -o $@
>
Considering the interface logic used to be in config.h and all of the
modified programs load from config does it make sense to add $(CONFIG)
that selects both config.o and interface.o? I mean config.o now requires
interface.o....
Hmm. On the one hand it sort of doesn't make that much sense because
interface stuff is distinct from configs?
Is there a way to generate the network of how interconnected the various
object files are?
Thanks,
Jake
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel