On Mon, Jan 4, 2021 at 4:28 AM Richard Cochran <richardcoch...@gmail.com> wrote: > Why not refactor them all to use a helper function? The new function could be called port2str(struct port *p) and live in port.c.
>See cid2str() in util.c as an example. This sounds good to me. However, cid2str() uses static storage and there are several log messages that log information about multiple ports. Is it acceptable to assume that authors will not inadvertantly use this new function twice in a single setting, and will instead construct the port format string by hand? Alternatively, I could add the 'debug' prefix of a port ("port 12 (eth8)") to the port struct as a separately allocated string. This would be more foolproof, and might end in single-port scenarios being a lower amount of runtime memory used than a statically allocated array that needs to cover large names. Or, I could also implement port variants of the log functions that takes the port pointer as a parameter and prefixes the port debug info. Let me know, I'm happy to change the patch as needed. -cliff _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel