When compiling with gcc8 and -O2, the clever compiler complains:
interface.c: In function ‘interface_ensure_tslabel’:
interface.c:38:3: error: ‘strncpy’ output may be truncated copying 108 bytes from a string of length 108 [-Werror=stringop-truncation]
Even though this is a false positive, this patch silences the warning
by using memcpy instead of strncpy.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Now that a complete functional API is in place, there is no need to expose
the inner workings of the network interface data type. This patch converts
it into an opaque type while leaving the list marker visible to users
through a simple form of "friendly exposition".
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
In order to eventually hide the implementation details of the interface,
users will need to be able to create and destroy instances thereof. This
patch adds the needed methods.
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
The ts_label field of the interface is set in different ways by different
callers. In order to prevent users from open coding the logic that sets
the label, this patch adds an appropriate method.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
The name field of the interface is set in different ways by different
callers. In order to prevent users from open coding the logic that sets
the name, this patch adds an appropriate method.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
In many cases, the time stamping label will be the same as the name of
the interface. In order to prevent users from open coding the logic that
initializes the label from the interface name, this patch add an
appropriate method.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
In order to prevent users from open coding this logic, this patch
provides a method that populates the time stamping information from
the interface label.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Many of the users only require a read only reference to the time
stamping label of the interface. This patch adds an appropriate
method.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Many of the users only require a read only reference to the interface name.
This patch adds an appropriate method.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>