ptp4l: change interface name into static array

In order to support future settings which allow for the configuration of
per-port data, this patch modifies the interface name to be a static array
instead of a pointer.

-v2
* Minor edit for merge with previous patch

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
master
Jacob Keller 2012-08-20 10:56:40 -07:00 committed by Richard Cochran
parent 5a0b6c3cd3
commit 31865b2589
2 changed files with 3 additions and 2 deletions

View File

@ -25,10 +25,11 @@
#include "transport.h" #include "transport.h"
#define MAX_PORTS 8 #define MAX_PORTS 8
#define MAX_IFNAME_SIZE 16
/** Defines a network interface, with PTP options. */ /** Defines a network interface, with PTP options. */
struct interface { struct interface {
char *name; char name[MAX_IFNAME_SIZE + 1];
enum delay_mechanism dm; enum delay_mechanism dm;
enum transport_type transport; enum transport_type transport;
}; };

View File

@ -152,7 +152,7 @@ int main(int argc, char *argv[])
break; break;
case 'i': case 'i':
if (*nports < MAX_PORTS) { if (*nports < MAX_PORTS) {
iface[*nports].name = optarg; strncpy(iface[*nports].name, optarg, MAX_IFNAME_SIZE);
iface[*nports].dm = *dm; iface[*nports].dm = *dm;
iface[*nports].transport = *transport; iface[*nports].transport = *transport;
(*nports)++; (*nports)++;