Re: [Linuxptp-devel] [PATCH RFC 07/30] Convert call sites to the proper method for getting interface names.

2020-03-05 Thread Jacob Keller
On 3/4/2020 8:59 AM, Richard Cochran wrote:
> On Tue, Feb 18, 2020 at 11:38:43AM -0800, Jacob Keller wrote:
>>
>> Is there a way to generate the network of how interconnected the various
>> object files are?
> 
> The .d files have the includes.  I once wrote a script to turn the .d
> files into a dotty graph.  But I guess the utility is low.
> 
> Thanks,
> Richard
> 

Right.

Thanks,
Jake


___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


Re: [Linuxptp-devel] [PATCH RFC 07/30] Convert call sites to the proper method for getting interface names.

2020-03-04 Thread Richard Cochran
On Tue, Feb 18, 2020 at 11:38:43AM -0800, Jacob Keller wrote:
> 
> Is there a way to generate the network of how interconnected the various
> object files are?

The .d files have the includes.  I once wrote a script to turn the .d
files into a dotty graph.  But I guess the utility is low.

Thanks,
Richard


___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


Re: [Linuxptp-devel] [PATCH RFC 07/30] Convert call sites to the proper method for getting interface names.

2020-02-18 Thread Jacob Keller



On 2/11/2020 6:03 AM, Richard Cochran wrote:
> Signed-off-by: Richard Cochran 
> ---
>  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(-)



> 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, , )) {
>   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();
>  
>   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, >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


[Linuxptp-devel] [PATCH RFC 07/30] Convert call sites to the proper method for getting interface names.

2020-02-11 Thread Richard Cochran
Signed-off-by: Richard Cochran 
---
 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(-)

diff --git a/clock.c b/clock.c
index 9f4207d..7d13b3b 100644
--- a/clock.c
+++ b/clock.c
@@ -849,7 +849,7 @@ int clock_required_modes(struct clock *c)
 static void ensure_ts_label(struct interface *iface)
 {
if (iface->ts_label[0] == '\0')
-   strncpy(iface->ts_label, iface->name, MAX_IFNAME_SIZE);
+   strncpy(iface->ts_label, interface_name(iface), 
MAX_IFNAME_SIZE);
 }
 
 struct clock *clock_create(enum clock_type type, struct config *config,
@@ -960,13 +960,13 @@ struct clock *clock_create(enum clock_type type, struct 
config *config,
c->timestamping = timestamping;
required_modes = clock_required_modes(c);
STAILQ_FOREACH(iface, >interfaces, list) {
-   rtnl_get_ts_device(iface->name, iface->ts_label);
+   rtnl_get_ts_device(interface_name(iface), iface->ts_label);
ensure_ts_label(iface);
sk_get_ts_info(iface->ts_label, >ts_info);
if (iface->ts_info.valid &&
((iface->ts_info.so_timestamping & required_modes) != 
required_modes)) {
-   pr_err("interface '%s' does not support "
-  "requested timestamping mode", iface->name);
+   pr_err("interface '%s' does not support requested 
timestamping mode",
+  interface_name(iface));
return NULL;
}
}
@@ -996,7 +996,7 @@ struct clock *clock_create(enum clock_type type, struct 
config *config,
if (strcmp(config_get_string(config, NULL, "clockIdentity"),
   "00..00") == 0) {
if (generate_clock_identity(>dds.clockIdentity,
-   iface->name)) {
+   interface_name(iface))) {
pr_err("failed to generate a clock identity");
return NULL;
}
@@ -1011,19 +1011,20 @@ struct clock *clock_create(enum clock_type type, struct 
config *config,
/* Configure the UDS. */
snprintf(udsif->name, sizeof(udsif->name), "%s",
 config_get_string(config, NULL, "uds_address"));
-   if (config_set_section_int(config, udsif->name,
+   if (config_set_section_int(config, interface_name(udsif),
   "announceReceiptTimeout", 0)) {
return NULL;
}
-   if (config_set_section_int(config, udsif->name,
+   if (config_set_section_int(config, interface_name(udsif),
"delay_mechanism", DM_AUTO)) {
return NULL;
}
-   if (config_set_section_int(config, udsif->name,
+   if (config_set_section_int(config, interface_name(udsif),
"network_transport", TRANS_UDS)) {
return NULL;
}
-   if (config_set_section_int(config, udsif->name, "delay_filter_length", 
1)) {
+   if (config_set_section_int(config, interface_name(udsif),
+  "delay_filter_length", 1)) {
return NULL;
}
 
@@ -1147,7 +1148,7 @@ struct clock *clock_create(enum clock_type type, struct 
config *config,
/* Create the ports. */
STAILQ_FOREACH(iface, >interfaces, list) {
if (clock_add_port(c, phc_device, phc_index, timestamping, 
iface)) {
-   pr_err("failed to open port %s", iface->name);
+   pr_err("failed to open port %s", interface_name(iface));
return NULL;
}
}
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, , )) {
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();
 
parser_res = parse_item(cfg, 0, current_section == 
GLOBAL_SECTION ?
-   NULL : current_port->name, option, 
value);
-
+   NULL : interface_name(current_port),
+   option, value);