Commit 019e2f89 authored by Alessandro Rubini's avatar Alessandro Rubini

Merge branch 'libc-cleanup'

This patch-set removes most of the awful pp_ libc replacements (like
pp_memcpy) that I used in the initial ptp-proposal project.  I now
think using standard names is better and easier. The build for all
architectures has no conflicts with this approah (all commits build).
parents 43adf9c4 78c4e80a
......@@ -14,6 +14,7 @@ OBJ-libarch := $A/bare-startup.o \
$A/bare-timer.o \
$A/bare-io.o \
$A/syscalls.o \
lib/libc-functions.o \
lib/div64.o
$(LIBARCH): $(OBJ-libarch)
......
/*
* Alessandro Rubini for CERN, 2011 -- GNU LGPL v2.1 or later
*/
#include <string.h>
/*
* These are the functions provided by the various bare files
*/
......@@ -14,11 +14,6 @@ extern int bare_send_packet(struct pp_instance *ppi, void *pkt, int len,
extern void bare_main_loop(struct pp_instance *ppi);
/* basics */
extern void *memset(void *s, int c, int count);
extern char *strcpy(char *dest, const char *src);
extern void *memcpy(void *dest, const void *src, int count);
/* syscalls */
struct bare_sockaddr;
......
......@@ -9,26 +9,7 @@ const Integer32 PP_ADJ_FREQ_MAX = 512000;
void pp_puts(const char *s)
{
sys_write(0, s, pp_strnlen(s, 300));
}
int pp_strnlen(const char *s, int maxlen)
{
int len = 0;
while (*(s++))
len++;
return len;
}
void *pp_memcpy(void *dest, const void *src, int count)
{
/* from u-boot-1.1.2 */
char *tmp = (char *) dest, *s = (char *) src;
while (count--)
*tmp++ = *s++;
return dest;
sys_write(0, s, strnlen(s, 300));
}
void bare_get_tstamp(TimeInternal *t)
......@@ -65,45 +46,6 @@ int32_t bare_set_tstamp(TimeInternal *t)
return tv.tv_sec - tv_orig.tv_sec;
}
int pp_memcmp(const void *cs, const void *ct, int count)
{
/* from u-boot-1.1.2 */
const unsigned char *su1, *su2;
int res = 0;
for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
if ((res = *su1 - *su2) != 0)
break;
return res;
}
void *pp_memset(void *s, int c, int count)
{
/* from u-boot-1.1.2 */
char *xs = (char *) s;
while (count--)
*xs++ = c;
return s;
}
/* What follows has no prefix because it's only used by arch code */
char *strcpy(char *dest, const char *src)
{
/* from u-boot-1.1.2 */
char *tmp = dest;
while ((*dest++ = *src++) != '\0')
/* nothing */;
return tmp;
}
void *memset(void *s, int c, int count)
__attribute__((alias("pp_memset")));
void *memcpy(void *dest, const void *src, int count)
__attribute__((alias("pp_memcpy")));
int bare_adj_freq(Integer32 adj)
{
struct bare_timex t;
......
......@@ -15,6 +15,7 @@ OBJ-libarch := $A/bare-startup.o \
$A/bare-io.o \
$A/syscall.o \
$A/syscalls.o \
lib/libc-functions.o \
lib/div64.o
$(LIBARCH): $(OBJ-libarch)
......
......@@ -9,26 +9,7 @@ const Integer32 PP_ADJ_FREQ_MAX = 512000;
void pp_puts(const char *s)
{
sys_write(0, s, pp_strnlen(s, 300));
}
int pp_strnlen(const char *s, int maxlen)
{
int len = 0;
while (*(s++))
len++;
return len;
}
void *pp_memcpy(void *dest, const void *src, int count)
{
/* from u-boot-1.1.2 */
char *tmp = (char *) dest, *s = (char *) src;
while (count--)
*tmp++ = *s++;
return dest;
sys_write(0, s, strnlen(s, 300));
}
void bare_get_tstamp(TimeInternal *t)
......@@ -65,45 +46,6 @@ int32_t bare_set_tstamp(TimeInternal *t)
return tv.tv_sec - tv_orig.tv_sec;
}
int pp_memcmp(const void *cs, const void *ct, int count)
{
/* from u-boot-1.1.2 */
const unsigned char *su1, *su2;
int res = 0;
for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
if ((res = *su1 - *su2) != 0)
break;
return res;
}
void *pp_memset(void *s, int c, int count)
{
/* from u-boot-1.1.2 */
char *xs = (char *) s;
while (count--)
*xs++ = c;
return s;
}
/* What follows has no prefix because it's only used by arch code */
char *strcpy(char *dest, const char *src)
{
/* from u-boot-1.1.2 */
char *tmp = dest;
while ((*dest++ = *src++) != '\0')
/* nothing */;
return tmp;
}
void *memset(void *s, int c, int count)
__attribute__((alias("pp_memset")));
void *memcpy(void *dest, const void *src, int count)
__attribute__((alias("pp_memcpy")));
int bare_adj_freq(Integer32 adj)
{
struct bare_timex t;
......
/*
* Alessandro Rubini for CERN, 2011 -- GNU LGPL v2.1 or later
*/
#include <string.h>
/*
* These are the functions provided by the various bare files
......@@ -14,11 +15,6 @@ extern int bare_send_packet(struct pp_instance *ppi, void *pkt, int len,
extern void bare_main_loop(struct pp_instance *ppi);
/* basics */
extern void *memset(void *s, int c, int count);
extern char *strcpy(char *dest, const char *src);
extern void *memcpy(void *dest, const void *src, int count);
/* syscalls */
struct bare_sockaddr;
......
......@@ -25,21 +25,11 @@ void posix_puts(const char *s)
fputs(s, stdout);
}
int posix_strnlen(const char *s, int maxlen)
{
return strnlen(s, maxlen);
}
void *posix_memcpy(void *d, const void *s, int count)
{
return memcpy(d, s, count);
}
int posix_memcmp(const void *s1, const void *s2, int count)
{
return memcmp(s1, s2, count);
}
void *posix_memset(void *s, int c, int count)
{
return memset(s, c, count);
......@@ -89,18 +79,6 @@ int posix_adj_freq(Integer32 adj)
void pp_puts(const char *s)
__attribute__((alias("posix_puts")));
int pp_strnlen(const char *s, int maxlen)
__attribute__((alias("posix_strnlen")));
void *pp_memcpy(void *d, const void *s, int count)
__attribute__((alias("posix_memcpy")));
int pp_memcmp(const void *s1, const void *s2, int count)
__attribute__((alias("posix_memcmp")));
void *pp_memset(void *s, int c, int count)
__attribute__((alias("posix_memset")));
void pp_get_tstamp(TimeInternal *t)
__attribute__((alias("posix_get_tstamp")));
......
......@@ -305,7 +305,7 @@ int posix_open_ch(struct pp_instance *ppi, char *ifname, int chtype)
}
/* Init General multicast IP address */
pp_memcpy(addr_str, PP_DEFAULT_DOMAIN_ADDRESS, INET_ADDRSTRLEN);
memcpy(addr_str, PP_DEFAULT_DOMAIN_ADDRESS, INET_ADDRSTRLEN);
if (!inet_aton(addr_str, &net_addr)) {
pp_diag_error_str2(ppi, "inet_aton\n", strerror(errno));
......
......@@ -13,25 +13,6 @@ void pp_puts(const char *s)
uart_write_string(s);
}
int pp_strnlen(const char *s, int maxlen)
{
int len = 0;
while (*(s++))
len++;
return len;
}
void *pp_memcpy(void *dest, const void *src, int count)
{
/* from u-boot-1.1.2 */
char *tmp = (char *) dest, *s = (char *) src;
while (count--)
*tmp++ = *s++;
return dest;
}
void pp_get_tstamp(TimeInternal *t) //uint32_t *sptr)
{
uint64_t sec;
......@@ -41,58 +22,6 @@ void pp_get_tstamp(TimeInternal *t) //uint32_t *sptr)
t->nanoseconds = (int32_t)nsec;
}
/* What follows has no prefix because it's only used by arch code */
char *strcpy(char *dest, const char *src)
{
/* from u-boot-1.1.2 */
char *tmp = dest;
while ((*dest++ = *src++) != '\0')
/* nothing */;
return tmp;
}
void *pp_memset(void *s, int c, int count)
{
return memset(s, c, count);
}
void *memset(void *s, int c, int count)
{
/* from u-boot-1.1.2 */
char *xs = (char *) s;
while (count--)
*xs++ = c;
return s;
}
void *memcpy(void *dest, const void *src, int count)
{
/* from u-boot-1.1.2 */
char *tmp = (char *) dest, *s = (char *) src;
while (count--)
*tmp++ = *s++;
return dest;
}
int pp_memcmp(const void *s1, const void *s2, int count)
{
unsigned char *u1 = (unsigned char*) s1;
unsigned char *u2 = (unsigned char*) s2;
while (count-- != 0)
{
if (*u1 != *u2)
return (*u1 < *u2) ? -1 : +1;
u1++;
u2++;
}
return 0;
}
int32_t spec_set_tstamp(TimeInternal *t)
{
shw_pps_gen_set_time(t->seconds, t->nanoseconds);
......@@ -109,9 +38,5 @@ int spec_adj_freq(Integer32 adj)
int pp_adj_freq(Integer32 adj)
__attribute__((alias("spec_adj_freq")));
int32_t pp_set_tstamp(TimeInternal *t)
__attribute__((alias("spec_set_tstamp")));
char *pp_strcpy(char *dest, const char *src)
__attribute__((alias("strcpy")));
......@@ -73,11 +73,6 @@ extern int halexp_get_port_state(hexp_port_state_t *state,
/* End halexp_port_state */
/* basics */
extern void *memset(void *s, int c, int count);
extern char *strcpy(char *dest, const char *src);
extern void *memcpy(void *dest, const void *src, int count);
/* syscall-lookalike */
extern int spec_time(void);
extern void spec_udelay(int usecs);
......
......@@ -281,7 +281,7 @@ static char *string(char *buf, char *s, int field_width, int precision, int flag
if (s == 0)
s = "<NULL>";
len = pp_strnlen(s, precision);
len = strnlen(s, precision);
if (!(flags & LEFT))
while (len < field_width--)
......
......@@ -4,14 +4,9 @@
#ifndef __PPSI_LIB_H__
#define __PPSI_LIB_H__
#include <stdint.h>
#include <string.h>
/* We base on puts and a few more functions: each arch must have it */
extern void pp_puts(const char *s);
extern int pp_strnlen(const char *s, int maxlen);
extern char *pp_strcpy(char *dest, const char *src);
extern void *pp_memcpy(void *d, const void *s, int count);
extern int pp_memcmp(const void *s1, const void *s2, int count);
extern void *pp_memset(void *s, int c, int count);
extern uint32_t __div64_32(uint64_t *n, uint32_t base);
......
/*
* Alessandro Rubini for CERN, 2011 -- GPL 2 or later (it includes u-boot code)
* (FIXME: turn to LGPL by using uclibc or equivalent -- avoid rewriting :)
*/
#include <ppsi/lib.h>
size_t strnlen(const char *s, size_t maxlen)
{
int len = 0;
while (*(s++))
len++;
return len;
}
void *memcpy(void *dest, const void *src, size_t count)
{
/* from u-boot-1.1.2 */
char *tmp = (char *) dest, *s = (char *) src;
while (count--)
*tmp++ = *s++;
return dest;
}
int memcmp(const void *cs, const void *ct, size_t count)
{
/* from u-boot-1.1.2 */
const unsigned char *su1, *su2;
int res = 0;
for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
if ((res = *su1 - *su2) != 0)
break;
return res;
}
void *memset(void *s, int c, size_t count)
{
/* from u-boot-1.1.2 */
char *xs = (char *) s;
while (count--)
*xs++ = c;
return s;
}
char *strcpy(char *dest, const char *src)
{
/* from u-boot-1.1.2 */
char *tmp = dest;
while ((*dest++ = *src++) != '\0')
/* nothing */;
return tmp;
}
......@@ -26,13 +26,13 @@ void m1(struct pp_instance *ppi)
DSCUR(ppi)->meanPathDelay.seconds = 0;
/* Parent data set */
pp_memcpy(DSPAR(ppi)->parentPortIdentity.clockIdentity,
memcpy(DSPAR(ppi)->parentPortIdentity.clockIdentity,
DSDEF(ppi)->clockIdentity, PP_CLOCK_IDENTITY_LENGTH);
DSPAR(ppi)->parentPortIdentity.portNumber = 0;
DSPAR(ppi)->parentStats = PP_DEFAULT_PARENTS_STATS;
DSPAR(ppi)->observedParentClockPhaseChangeRate = 0;
DSPAR(ppi)->observedParentOffsetScaledLogVariance = 0;
pp_memcpy(DSPAR(ppi)->grandmasterIdentity, DSDEF(ppi)->clockIdentity,
memcpy(DSPAR(ppi)->grandmasterIdentity, DSDEF(ppi)->clockIdentity,
PP_CLOCK_IDENTITY_LENGTH);
DSPAR(ppi)->grandmasterClockQuality.clockAccuracy =
DSDEF(ppi)->clockQuality.clockAccuracy;
......@@ -55,13 +55,13 @@ void s1(struct pp_instance *ppi, MsgHeader *hdr, MsgAnnounce *ann)
DSCUR(ppi)->stepsRemoved = ann->stepsRemoved + 1;
/* Parent DS */
pp_memcpy(DSPAR(ppi)->parentPortIdentity.clockIdentity,
memcpy(DSPAR(ppi)->parentPortIdentity.clockIdentity,
hdr->sourcePortIdentity.clockIdentity,
PP_CLOCK_IDENTITY_LENGTH);
DSPAR(ppi)->parentPortIdentity.portNumber =
hdr->sourcePortIdentity.portNumber;
pp_memcpy(DSPAR(ppi)->grandmasterIdentity,
memcpy(DSPAR(ppi)->grandmasterIdentity,
ann->grandmasterIdentity, PP_CLOCK_IDENTITY_LENGTH);
DSPAR(ppi)->grandmasterClockQuality.clockAccuracy =
......@@ -103,7 +103,7 @@ void s1(struct pp_instance *ppi, MsgHeader *hdr, MsgAnnounce *ann)
void copy_d0( struct pp_instance *ppi, MsgHeader *hdr, MsgAnnounce *ann)
{
ann->grandmasterPriority1 = DSDEF(ppi)->priority1;
pp_memcpy(ann->grandmasterIdentity, DSDEF(ppi)->clockIdentity,
memcpy(ann->grandmasterIdentity, DSDEF(ppi)->clockIdentity,
PP_CLOCK_IDENTITY_LENGTH);
ann->grandmasterClockQuality.clockClass =
DSDEF(ppi)->clockQuality.clockClass;
......@@ -113,7 +113,7 @@ void copy_d0( struct pp_instance *ppi, MsgHeader *hdr, MsgAnnounce *ann)
DSDEF(ppi)->clockQuality.offsetScaledLogVariance;
ann->grandmasterPriority2 = DSDEF(ppi)->priority2;
ann->stepsRemoved = 0;
pp_memcpy(hdr->sourcePortIdentity.clockIdentity,
memcpy(hdr->sourcePortIdentity.clockIdentity,
DSDEF(ppi)->clockIdentity, PP_CLOCK_IDENTITY_LENGTH);
}
......@@ -132,7 +132,7 @@ Integer8 bmc_dataset_cmp(struct pp_instance *ppi,
PP_VPRINTF("BMC: in bmc_dataset_cmp\n");
/* Identity comparison */
if (!pp_memcmp(ann_a->grandmasterIdentity,
if (!memcmp(ann_a->grandmasterIdentity,
ann_b->grandmasterIdentity, PP_CLOCK_IDENTITY_LENGTH)) {
/* Algorithm part2 Fig 28 */
......@@ -147,7 +147,7 @@ Integer8 bmc_dataset_cmp(struct pp_instance *ppi,
ppci = DSPAR(ppi)->parentPortIdentity.clockIdentity;
if (ann_a->stepsRemoved > ann_b->stepsRemoved) {
if (!pp_memcmp(
if (!memcmp(
hdr_a->sourcePortIdentity.clockIdentity,
ppci,
PP_CLOCK_IDENTITY_LENGTH)) {
......@@ -157,7 +157,7 @@ Integer8 bmc_dataset_cmp(struct pp_instance *ppi,
return 1;
} else if (ann_b->stepsRemoved > ann_a->stepsRemoved) {
if (!pp_memcmp(
if (!memcmp(
hdr_b->sourcePortIdentity.clockIdentity,
ppci,
PP_CLOCK_IDENTITY_LENGTH)) {
......@@ -167,13 +167,13 @@ Integer8 bmc_dataset_cmp(struct pp_instance *ppi,
return -1;
}
} else { /* steps removed A == steps removed B */
if (!pp_memcmp(
if (!memcmp(
hdr_a->sourcePortIdentity.clockIdentity,
hdr_b->sourcePortIdentity.clockIdentity,
PP_CLOCK_IDENTITY_LENGTH)) {
PP_PRINTF("Sender=Receiver: Error -2");
return 0;
} else if ((pp_memcmp(
} else if ((memcmp(
hdr_a->sourcePortIdentity.clockIdentity,
hdr_b->sourcePortIdentity.clockIdentity,
PP_CLOCK_IDENTITY_LENGTH)) < 0)
......@@ -190,7 +190,7 @@ Integer8 bmc_dataset_cmp(struct pp_instance *ppi,
if (ann_a->grandmasterClockQuality.clockAccuracy == ann_b->grandmasterClockQuality.clockAccuracy) {
if (ann_a->grandmasterClockQuality.offsetScaledLogVariance == ann_b->grandmasterClockQuality.offsetScaledLogVariance) {
if (ann_a->grandmasterPriority2 == ann_b->grandmasterPriority2) {
comp = pp_memcmp(ann_a->grandmasterIdentity, ann_b->grandmasterIdentity, PP_CLOCK_IDENTITY_LENGTH);
comp = memcmp(ann_a->grandmasterIdentity, ann_b->grandmasterIdentity, PP_CLOCK_IDENTITY_LENGTH);
if (comp < 0)
return -1;
else if (comp > 0)
......@@ -199,7 +199,7 @@ Integer8 bmc_dataset_cmp(struct pp_instance *ppi,
return 0;
} else {
/* Priority2 are not identical */
comp = pp_memcmp(&ann_a->grandmasterPriority2, &ann_b->grandmasterPriority2, 1);
comp = memcmp(&ann_a->grandmasterPriority2, &ann_b->grandmasterPriority2, 1);
if (comp < 0)
return -1;
else if (comp > 0)
......@@ -209,7 +209,7 @@ Integer8 bmc_dataset_cmp(struct pp_instance *ppi,
}
} else {
/* offsetScaledLogVariance are not identical */
comp = pp_memcmp(&ann_a->grandmasterClockQuality.clockClass, &ann_b->grandmasterClockQuality.clockClass, 1);
comp = memcmp(&ann_a->grandmasterClockQuality.clockClass, &ann_b->grandmasterClockQuality.clockClass, 1);
if (comp < 0)
return -1;
else if (comp > 0)
......@@ -219,7 +219,7 @@ Integer8 bmc_dataset_cmp(struct pp_instance *ppi,
}
} else { /* Accuracy are not identitcal */
comp = pp_memcmp(&ann_a->grandmasterClockQuality.clockAccuracy, &ann_b->grandmasterClockQuality.clockAccuracy, 1);
comp = memcmp(&ann_a->grandmasterClockQuality.clockAccuracy, &ann_b->grandmasterClockQuality.clockAccuracy, 1);
if (comp < 0)
return -1;
else if (comp > 0)
......@@ -228,7 +228,7 @@ Integer8 bmc_dataset_cmp(struct pp_instance *ppi,
return 0;
}
} else { /* ClockClass are not identical */
comp = pp_memcmp(&ann_a->grandmasterClockQuality.clockClass, &ann_b->grandmasterClockQuality.clockClass, 1);
comp = memcmp(&ann_a->grandmasterClockQuality.clockClass, &ann_b->grandmasterClockQuality.clockClass, 1);
if (comp < 0)
return -1;
else if (comp > 0)
......@@ -237,7 +237,7 @@ Integer8 bmc_dataset_cmp(struct pp_instance *ppi,
return 0;
}
} else { /* Priority1 are not identical */
comp = pp_memcmp(&ann_a->grandmasterPriority1, &ann_b->grandmasterPriority1, 1);
comp = memcmp(&ann_a->grandmasterPriority1, &ann_b->grandmasterPriority1, 1);
if (comp < 0)
return -1;
else if (comp > 0)
......
......@@ -97,7 +97,7 @@ void st_com_add_foreign(struct pp_instance *ppi, unsigned char *buf)
/* Check if foreign master is already known */
for (i = 0; i < ppi->number_foreign_records; i++) {
if (!pp_memcmp(hdr->sourcePortIdentity.clockIdentity,
if (!memcmp(hdr->sourcePortIdentity.clockIdentity,
ppi->frgn_master[j].port_identity.
clockIdentity,
PP_CLOCK_IDENTITY_LENGTH) &&
......@@ -132,7 +132,7 @@ void st_com_add_foreign(struct pp_instance *ppi, unsigned char *buf)
j = ppi->foreign_record_i;
/* Copy new foreign master data set from announce message */
pp_memcpy(ppi->frgn_master[j].port_identity.clockIdentity,
memcpy(ppi->frgn_master[j].port_identity.clockIdentity,
hdr->sourcePortIdentity.clockIdentity,
PP_CLOCK_IDENTITY_LENGTH);
ppi->frgn_master[j].port_identity.portNumber =
......
......@@ -90,13 +90,13 @@ void msg_unpack_header(struct pp_instance *ppi, void *buf)
hdr->messageLength = htons(*(UInteger16 *) (buf + 2));
hdr->domainNumber = (*(UInteger8 *) (buf + 4));
pp_memcpy(hdr->flagField, (buf + 6), PP_FLAG_FIELD_LENGTH);
memcpy(hdr->flagField, (buf + 6), PP_FLAG_FIELD_LENGTH);
pp_memcpy(&hdr->correctionfield.msb, (buf + 8), 4);
pp_memcpy(&hdr->correctionfield.lsb, (buf + 12), 4);
memcpy(&hdr->correctionfield.msb, (buf + 8), 4);
memcpy(&hdr->correctionfield.lsb, (buf + 12), 4);
hdr->correctionfield.msb = htonl(hdr->correctionfield.msb);
hdr->correctionfield.lsb = htonl(hdr->correctionfield.lsb);
pp_memcpy(hdr->sourcePortIdentity.clockIdentity, (buf + 20),
memcpy(hdr->sourcePortIdentity.clockIdentity, (buf + 20),
PP_CLOCK_IDENTITY_LENGTH);
hdr->sourcePortIdentity.portNumber =
htons(*(UInteger16 *) (buf + 28));
......@@ -106,14 +106,14 @@ void msg_unpack_header(struct pp_instance *ppi, void *buf)
if (DSPOR(ppi)->portIdentity.portNumber ==
ppi->msg_tmp_header.sourcePortIdentity.portNumber
&& !pp_memcmp(ppi->msg_tmp_header.sourcePortIdentity.clockIdentity,
&& !memcmp(ppi->msg_tmp_header.sourcePortIdentity.clockIdentity,
DSPOR(ppi)->portIdentity.clockIdentity,
PP_CLOCK_IDENTITY_LENGTH))
ppi->is_from_self = 1;
else
ppi->is_from_self = 0;
if (!pp_memcmp(DSPAR(ppi)->parentPortIdentity.clockIdentity,
if (!memcmp(DSPAR(ppi)->parentPortIdentity.clockIdentity,
hdr->sourcePortIdentity.clockIdentity,
PP_CLOCK_IDENTITY_LENGTH) &&
(DSPAR(ppi)->parentPortIdentity.portNumber ==
......@@ -141,8 +141,8 @@ void msg_pack_header(struct pp_instance *ppi, void *buf)
if (DSDEF(ppi)->twoStepFlag)
*(UInteger8 *) (buf + 6) = PP_TWO_STEP_FLAG;
pp_memset((buf + 8), 0, 8);
pp_memcpy((buf + 20), DSPOR(ppi)->portIdentity.clockIdentity,
memset((buf + 8), 0, 8);
memcpy((buf + 20), DSPOR(ppi)->portIdentity.clockIdentity,
PP_CLOCK_IDENTITY_LENGTH);
*(UInteger16 *) (buf + 28) =
htons(DSPOR(ppi)->portIdentity.portNumber);
......@@ -152,7 +152,7 @@ void msg_pack_header(struct pp_instance *ppi, void *buf)
void *msg_copy_header(MsgHeader *dest, MsgHeader *src)
{
return pp_memcpy(dest, src, sizeof(MsgHeader));
return memcpy(dest, src, sizeof(MsgHeader));
}
......@@ -175,7 +175,7 @@ void msg_pack_sync(struct pp_instance *ppi, Timestamp *orig_tstamp)
/* Table 23 */
*(Integer8 *) (buf + 33) = DSPOR(ppi)->logSyncInterval;
pp_memset((buf + 8), 0, 8);
memset((buf + 8), 0, 8);
/* Sync message */
*(UInteger16 *) (buf + 34) = htons(orig_tstamp->secondsField.msb);
......@@ -216,7 +216,7 @@ int msg_pack_announce(struct pp_instance *ppi)
*(Integer8 *) (buf + 33) = DSPOR(ppi)->logAnnounceInterval;
/* Announce message */
pp_memset((buf + 34), 0, 10);
memset((buf + 34), 0, 10);
*(Integer16 *) (buf + 44) = htons(DSPRO(ppi)->currentUtcOffset);
*(UInteger8 *) (buf + 47) = DSPAR(ppi)->grandmasterPriority1;
*(UInteger8 *) (buf + 48) = DSDEF(ppi)->clockQuality.clockClass;
......@@ -224,7 +224,7 @@ int msg_pack_announce(struct pp_instance *ppi)
*(UInteger16 *) (buf + 50) =
htons(DSDEF(ppi)->clockQuality.offsetScaledLogVariance);
*(UInteger8 *) (buf + 52) = DSPAR(ppi)->grandmasterPriority2;
pp_memcpy((buf + 53), DSPAR(ppi)->grandmasterIdentity,
memcpy((buf + 53), DSPAR(ppi)->grandmasterIdentity,
PP_CLOCK_IDENTITY_LENGTH);
*(UInteger16 *) (buf + 61) = htons(DSCUR(ppi)->stepsRemoved);
*(Enumeration8 *) (buf + 63) = DSPRO(ppi)->timeSource;
......@@ -257,7 +257,7 @@ void msg_unpack_announce(void *buf, MsgAnnounce *ann)
ann->grandmasterClockQuality.offsetScaledLogVariance =
htons(*(UInteger16 *) (buf + 50));
ann->grandmasterPriority2 = *(UInteger8 *) (buf + 52);
pp_memcpy(ann->grandmasterIdentity, (buf + 53),
memcpy(ann->grandmasterIdentity, (buf + 53),
PP_CLOCK_IDENTITY_LENGTH);
ann->stepsRemoved = htons(*(UInteger16 *) (buf + 61));
ann->timeSource = *(Enumeration8 *) (buf + 63);
......@@ -340,14 +340,14 @@ void msg_pack_pdelay_req(struct pp_instance *ppi, Timestamp *orig_tstamp)
*(Integer8 *) (buf + 33) = 0x7F;
/* Table 24 */
pp_memset((buf + 8), 0, 8);
memset((buf + 8), 0, 8);
/* Pdelay_req message */
*(UInteger16 *) (buf + 34) = htons(orig_tstamp->secondsField.msb);
*(UInteger32 *) (buf + 36) = htonl(orig_tstamp->secondsField.lsb);
*(UInteger32 *) (buf + 40) = htonl(orig_tstamp->nanosecondsField);
pp_memset((buf + 44), 0, 10);
memset((buf + 44), 0, 10);
/* RAZ reserved octets */
}
......@@ -372,7 +372,7 @@ void msg_pack_delay_req(struct pp_instance *ppi, Timestamp *orig_tstamp)
*(Integer8 *) (buf + 33) = 0x7F;
/* Table 24 */
pp_memset((buf + 8), 0, 8);
memset((buf + 8), 0, 8);
/* Pdelay_req message */
*(UInteger16 *) (buf + 34) = htons(orig_tstamp->secondsField.msb);
......@@ -396,7 +396,7 @@ void msg_pack_delay_resp(struct pp_instance *ppi,
/* Table 19 */
*(UInteger16 *) (buf + 2) = htons(PP_DELAY_RESP_LENGTH);
*(UInteger8 *) (buf + 4) = hdr->domainNumber;
pp_memset((buf + 8), 0, 8);
memset((buf + 8), 0, 8);
/* Copy correctionField of delayReqMessage */
*(Integer32 *) (buf + 8) = htonl(hdr->correctionfield.msb);
......@@ -416,7 +416,7 @@ void msg_pack_delay_resp(struct pp_instance *ppi,
htons(rcv_tstamp->secondsField.msb);
*(UInteger32 *) (buf + 36) = htonl(rcv_tstamp->secondsField.lsb);
*(UInteger32 *) (buf + 40) = htonl(rcv_tstamp->nanosecondsField);
pp_memcpy((buf + 44), hdr->sourcePortIdentity.clockIdentity,
memcpy((buf + 44), hdr->sourcePortIdentity.clockIdentity,
PP_CLOCK_IDENTITY_LENGTH);
*(UInteger16 *) (buf + 52) =
htons(hdr->sourcePortIdentity.portNumber);
......@@ -437,7 +437,7 @@ void msg_pack_pdelay_resp(struct pp_instance *ppi, MsgHeader *hdr,
/* Table 19 */
*(UInteger16 *) (buf + 2) = htons(PP_PDELAY_RESP_LENGTH);
*(UInteger8 *) (buf + 4) = hdr->domainNumber;
pp_memset((buf + 8), 0, 8);
memset((buf + 8), 0, 8);
*(UInteger16 *) (buf + 30) = htons(hdr->sequenceId);
......@@ -450,7 +450,7 @@ void msg_pack_pdelay_resp(struct pp_instance *ppi, MsgHeader *hdr,
*(UInteger16 *) (buf + 34) = htons(req_rec_tstamp->secondsField.msb);
*(UInteger32 *) (buf + 36) = htonl(req_rec_tstamp->secondsField.lsb);
*(UInteger32 *) (buf + 40) = htonl(req_rec_tstamp->nanosecondsField);
pp_memcpy((buf + 44), hdr->sourcePortIdentity.clockIdentity,
memcpy((buf + 44), hdr->sourcePortIdentity.clockIdentity,
PP_CLOCK_IDENTITY_LENGTH);
*(UInteger16 *) (buf + 52) =
htons(hdr->sourcePortIdentity.portNumber);
......@@ -498,7 +498,7 @@ void msg_unpack_delay_resp(void *buf, MsgDelayResp *resp)
htonl(*(UInteger32 *) (buf + 36));
resp->receiveTimestamp.nanosecondsField =
htonl(*(UInteger32 *) (buf + 40));
pp_memcpy(resp->requestingPortIdentity.clockIdentity,
memcpy(resp->requestingPortIdentity.clockIdentity,
(buf + 44), PP_CLOCK_IDENTITY_LENGTH);
resp->requestingPortIdentity.portNumber =
htons(*(UInteger16 *) (buf + 52));
......@@ -519,7 +519,7 @@ void msg_unpack_pdelay_resp(void *buf, MsgPDelayResp *presp)
htonl(*(UInteger32 *) (buf + 36));
presp->requestReceiptTimestamp.nanosecondsField =
htonl(*(UInteger32 *) (buf + 40));
pp_memcpy(presp->requestingPortIdentity.clockIdentity,
memcpy(presp->requestingPortIdentity.clockIdentity,
(buf + 44), PP_CLOCK_IDENTITY_LENGTH);
presp->requestingPortIdentity.portNumber =
htons(*(UInteger16 *) (buf + 52));
......@@ -566,7 +566,7 @@ void msg_pack_pdelay_resp_followup(struct pp_instance *ppi,
htonl(resp_orig_tstamp->secondsField.lsb);
*(UInteger32 *) (buf + 40) =
htonl(resp_orig_tstamp->nanosecondsField);
pp_memcpy((buf + 44), hdr->sourcePortIdentity.clockIdentity,
memcpy((buf + 44), hdr->sourcePortIdentity.clockIdentity,
PP_CLOCK_IDENTITY_LENGTH);
*(UInteger16 *) (buf + 52) =
htons(hdr->sourcePortIdentity.portNumber);
......@@ -582,7 +582,7 @@ void msg_unpack_pdelay_resp_followup(void *buf,
htonl(*(UInteger32 *) (buf + 36));
presp_follow->responseOriginTimestamp.nanosecondsField =
htonl(*(UInteger32 *) (buf + 40));
pp_memcpy(presp_follow->requestingPortIdentity.clockIdentity,
memcpy(presp_follow->requestingPortIdentity.clockIdentity,
(buf + 44), PP_CLOCK_IDENTITY_LENGTH);
presp_follow->requestingPortIdentity.portNumber =
htons(*(UInteger16 *) (buf + 52));
......
......@@ -45,7 +45,7 @@ int pp_initializing(struct pp_instance *ppi, unsigned char *pkt, int plen)
id[7] = mac[5];
DSDEF(ppi)->numberPorts = 1;
pp_memcpy(&DSDEF(ppi)->clockQuality, &OPTS(ppi)->clock_quality,
memcpy(&DSDEF(ppi)->clockQuality, &OPTS(ppi)->clock_quality,
sizeof(ClockQuality));
DSDEF(ppi)->priority1 = OPTS(ppi)->prio1;
DSDEF(ppi)->priority2 = OPTS(ppi)->prio2;
......@@ -55,7 +55,7 @@ int pp_initializing(struct pp_instance *ppi, unsigned char *pkt, int plen)
ppi->defaultDS->clockQuality.clockClass = 255;
/* Initialize port data set */
pp_memcpy(ppi->portDS->portIdentity.clockIdentity,
memcpy(ppi->portDS->portIdentity.clockIdentity,
ppi->defaultDS->clockIdentity, PP_CLOCK_IDENTITY_LENGTH);
DSPOR(ppi)->portIdentity.portNumber = 1;
DSPOR(ppi)->logMinDelayReqInterval = PP_DEFAULT_DELAYREQ_INTERVAL;
......
......@@ -113,7 +113,7 @@ int pp_master(struct pp_instance *ppi, unsigned char *pkt, int plen)
if (!((ppi->sent_seq_id[PPM_PDELAY_REQ] ==
hdr->sequenceId)
&& (!pp_memcmp(DSPOR(ppi)->portIdentity.clockIdentity,
&& (!memcmp(DSPOR(ppi)->portIdentity.clockIdentity,
ppi->msg_tmp.presp.requestingPortIdentity.
clockIdentity,
PP_CLOCK_IDENTITY_LENGTH))
......
......@@ -89,7 +89,7 @@ int pp_slave(struct pp_instance *ppi, unsigned char *pkt, int plen)
msg_unpack_delay_resp(pkt, &ppi->msg_tmp.resp);
if ((pp_memcmp(DSPOR(ppi)->portIdentity.clockIdentity,
if ((memcmp(DSPOR(ppi)->portIdentity.clockIdentity,
ppi->msg_tmp.resp.requestingPortIdentity.clockIdentity,
PP_CLOCK_IDENTITY_LENGTH) == 0) &&
((ppi->sent_seq_id[PPM_DELAY_REQ] - 1) ==
......@@ -155,7 +155,7 @@ int pp_slave(struct pp_instance *ppi, unsigned char *pkt, int plen)
if (!((ppi->sent_seq_id[PPM_PDELAY_REQ] ==
hdr->sequenceId)
&& (!pp_memcmp(DSPOR(ppi)->portIdentity.clockIdentity,
&& (!memcmp(DSPOR(ppi)->portIdentity.clockIdentity,
ppi->msg_tmp.presp.requestingPortIdentity.
clockIdentity, PP_CLOCK_IDENTITY_LENGTH))
&& (DSPOR(ppi)->portIdentity.portNumber ==
......
......@@ -127,7 +127,7 @@ int msg_pack_wrsig(struct pp_instance *ppi, Enumeration16 wr_msg_id)
*(UInteger8*)(buf+32) = 0x05; //Table 23 -> all other
/* target portIdentity */
pp_memcpy((buf+34),DSPAR(ppi)->parentPortIdentity.clockIdentity,
memcpy((buf+34),DSPAR(ppi)->parentPortIdentity.clockIdentity,
PP_CLOCK_IDENTITY_LENGTH);
put_be16(buf + 42,DSPAR(ppi)->parentPortIdentity.portNumber);
......@@ -190,7 +190,7 @@ void msg_unpack_wrsig(struct pp_instance *ppi, void *buf,
UInteger16 tlv_versionNumber;
Enumeration16 wr_msg_id;
pp_memcpy(wrsig_msg->targetPortIdentity.clockIdentity,(buf+34),
memcpy(wrsig_msg->targetPortIdentity.clockIdentity,(buf+34),
PP_CLOCK_IDENTITY_LENGTH);
wrsig_msg->targetPortIdentity.portNumber = (UInteger16)get_be16(buf+42);
......
......@@ -206,8 +206,7 @@ int wr_servo_init(struct pp_instance *ppi)
clock->netPath.ifaceName, 16);//fixme
*/
pp_strcpy(cur_servo_state.slave_servo_state,
"Uninitialized");
strcpy(cur_servo_state.slave_servo_state, "Uninitialized");
servo_state_valid = 1;
cur_servo_state.valid = 1;
......@@ -372,8 +371,7 @@ int wr_servo_update(struct pp_instance *ppi)
if(ts_offset_hw.seconds != 0)
{
pp_strcpy(cur_servo_state.slave_servo_state,
"SYNC_SEC");
strcpy(cur_servo_state.slave_servo_state, "SYNC_SEC");
wr_adjust_counters(ts_offset_hw.seconds, 0);
wr_adjust_phase(0);
......@@ -385,7 +383,7 @@ int wr_servo_update(struct pp_instance *ppi)
break;
case WR_SYNC_NSEC:
pp_strcpy(cur_servo_state.slave_servo_state, "SYNC_NSEC");
strcpy(cur_servo_state.slave_servo_state, "SYNC_NSEC");
if(ts_offset_hw.nanoseconds != 0)
{
......@@ -399,7 +397,7 @@ int wr_servo_update(struct pp_instance *ppi)
break;
case WR_SYNC_PHASE:
pp_strcpy(cur_servo_state.slave_servo_state, "SYNC_PHASE");
strcpy(cur_servo_state.slave_servo_state, "SYNC_PHASE");
s->cur_setpoint = ts_offset_hw.phase + ts_offset_hw.nanoseconds * 1000;
wr_adjust_phase(s->cur_setpoint);
......@@ -429,7 +427,7 @@ int wr_servo_update(struct pp_instance *ppi)
}
case WR_TRACK_PHASE:
pp_strcpy(cur_servo_state.slave_servo_state, "TRACK_PHASE");
strcpy(cur_servo_state.slave_servo_state, "TRACK_PHASE");
cur_servo_state.cur_setpoint = s->cur_setpoint;
cur_servo_state.cur_skew = s->delta_ms - s->delta_ms_prev;
......
......@@ -25,13 +25,13 @@ void m1(struct pp_instance *ppi)
DSCUR(ppi)->meanPathDelay.seconds = 0;
/* Parent data set */
pp_memcpy(DSPAR(ppi)->parentPortIdentity.clockIdentity,
memcpy(DSPAR(ppi)->parentPortIdentity.clockIdentity,
DSDEF(ppi)->clockIdentity, PP_CLOCK_IDENTITY_LENGTH);
DSPAR(ppi)->parentPortIdentity.portNumber = 0;
DSPAR(ppi)->parentStats = PP_DEFAULT_PARENTS_STATS;
DSPAR(ppi)->observedParentClockPhaseChangeRate = 0;
DSPAR(ppi)->observedParentOffsetScaledLogVariance = 0;
pp_memcpy(DSPAR(ppi)->grandmasterIdentity, DSDEF(ppi)->clockIdentity,
memcpy(DSPAR(ppi)->grandmasterIdentity, DSDEF(ppi)->clockIdentity,
PP_CLOCK_IDENTITY_LENGTH);
DSPAR(ppi)->grandmasterClockQuality.clockAccuracy =
DSDEF(ppi)->clockQuality.clockAccuracy;
......@@ -54,13 +54,13 @@ void s1(struct pp_instance *ppi, MsgHeader *hdr, MsgAnnounce *ann)
DSCUR(ppi)->stepsRemoved = ann->stepsRemoved + 1;
/* Parent DS */
pp_memcpy(DSPAR(ppi)->parentPortIdentity.clockIdentity,
memcpy(DSPAR(ppi)->parentPortIdentity.clockIdentity,
hdr->sourcePortIdentity.clockIdentity,
PP_CLOCK_IDENTITY_LENGTH);
DSPAR(ppi)->parentPortIdentity.portNumber =
hdr->sourcePortIdentity.portNumber;
pp_memcpy(DSPAR(ppi)->grandmasterIdentity,
memcpy(DSPAR(ppi)->grandmasterIdentity,
ann->grandmasterIdentity, PP_CLOCK_IDENTITY_LENGTH);
DSPAR(ppi)->grandmasterClockQuality.clockAccuracy =
......@@ -91,7 +91,7 @@ void s1(struct pp_instance *ppi, MsgHeader *hdr, MsgAnnounce *ann)
void copy_d0( struct pp_instance *ppi, MsgHeader *hdr, MsgAnnounce *ann)
{
ann->grandmasterPriority1 = DSDEF(ppi)->priority1;
pp_memcpy(ann->grandmasterIdentity, DSDEF(ppi)->clockIdentity,
memcpy(ann->grandmasterIdentity, DSDEF(ppi)->clockIdentity,
PP_CLOCK_IDENTITY_LENGTH);
ann->grandmasterClockQuality.clockClass =
DSDEF(ppi)->clockQuality.clockClass;
......@@ -101,7 +101,7 @@ void copy_d0( struct pp_instance *ppi, MsgHeader *hdr, MsgAnnounce *ann)
DSDEF(ppi)->clockQuality.offsetScaledLogVariance;
ann->grandmasterPriority2 = DSDEF(ppi)->priority2;
ann->stepsRemoved = 0;
pp_memcpy(hdr->sourcePortIdentity.clockIdentity,
memcpy(hdr->sourcePortIdentity.clockIdentity,
DSDEF(ppi)->clockIdentity, PP_CLOCK_IDENTITY_LENGTH);
}
......@@ -120,7 +120,7 @@ Integer8 bmc_dataset_cmp(struct pp_instance *ppi,
PP_VPRINTF("BMC: in bmc_dataset_cmp\n");
/* Identity comparison */
if (!pp_memcmp(ann_a->grandmasterIdentity,
if (!memcmp(ann_a->grandmasterIdentity,
ann_b->grandmasterIdentity, PP_CLOCK_IDENTITY_LENGTH)) {
/* Algorithm part2 Fig 28 */
......@@ -135,7 +135,7 @@ Integer8 bmc_dataset_cmp(struct pp_instance *ppi,
ppci = DSPAR(ppi)->parentPortIdentity.clockIdentity;
if (ann_a->stepsRemoved > ann_b->stepsRemoved) {
if (!pp_memcmp(
if (!memcmp(
hdr_a->sourcePortIdentity.clockIdentity,
ppci,
PP_CLOCK_IDENTITY_LENGTH)) {
......@@ -145,7 +145,7 @@ Integer8 bmc_dataset_cmp(struct pp_instance *ppi,
return 1;
} else if (ann_b->stepsRemoved > ann_a->stepsRemoved) {
if (!pp_memcmp(
if (!memcmp(
hdr_b->sourcePortIdentity.clockIdentity,
ppci,
PP_CLOCK_IDENTITY_LENGTH)) {
......@@ -155,13 +155,13 @@ Integer8 bmc_dataset_cmp(struct pp_instance *ppi,
return -1;
}
} else { /* steps removed A == steps removed B */
if (!pp_memcmp(
if (!memcmp(
hdr_a->sourcePortIdentity.clockIdentity,
hdr_b->sourcePortIdentity.clockIdentity,
PP_CLOCK_IDENTITY_LENGTH)) {
PP_PRINTF("Sender=Receiver: Error -2");
return 0;
} else if ((pp_memcmp(
} else if ((memcmp(
hdr_a->sourcePortIdentity.clockIdentity,
hdr_b->sourcePortIdentity.clockIdentity,
PP_CLOCK_IDENTITY_LENGTH)) < 0)
......@@ -178,7 +178,7 @@ Integer8 bmc_dataset_cmp(struct pp_instance *ppi,
if (ann_a->grandmasterClockQuality.clockAccuracy == ann_b->grandmasterClockQuality.clockAccuracy) {
if (ann_a->grandmasterClockQuality.offsetScaledLogVariance == ann_b->grandmasterClockQuality.offsetScaledLogVariance) {
if (ann_a->grandmasterPriority2 == ann_b->grandmasterPriority2) {
comp = pp_memcmp(ann_a->grandmasterIdentity, ann_b->grandmasterIdentity, PP_CLOCK_IDENTITY_LENGTH);
comp = memcmp(ann_a->grandmasterIdentity, ann_b->grandmasterIdentity, PP_CLOCK_IDENTITY_LENGTH);
if (comp < 0)
return -1;
else if (comp > 0)
......@@ -187,7 +187,7 @@ Integer8 bmc_dataset_cmp(struct pp_instance *ppi,
return 0;
} else {
/* Priority2 are not identical */
comp = pp_memcmp(&ann_a->grandmasterPriority2, &ann_b->grandmasterPriority2, 1);
comp = memcmp(&ann_a->grandmasterPriority2, &ann_b->grandmasterPriority2, 1);
if (comp < 0)
return -1;
else if (comp > 0)
......@@ -197,7 +197,7 @@ Integer8 bmc_dataset_cmp(struct pp_instance *ppi,
}
} else {
/* offsetScaledLogVariance are not identical */
comp = pp_memcmp(&ann_a->grandmasterClockQuality.clockClass, &ann_b->grandmasterClockQuality.clockClass, 1);
comp = memcmp(&ann_a->grandmasterClockQuality.clockClass, &ann_b->grandmasterClockQuality.clockClass, 1);
if (comp < 0)
return -1;
else if (comp > 0)
......@@ -207,7 +207,7 @@ Integer8 bmc_dataset_cmp(struct pp_instance *ppi,
}
} else { /* Accuracy are not identitcal */
comp = pp_memcmp(&ann_a->grandmasterClockQuality.clockAccuracy, &ann_b->grandmasterClockQuality.clockAccuracy, 1);
comp = memcmp(&ann_a->grandmasterClockQuality.clockAccuracy, &ann_b->grandmasterClockQuality.clockAccuracy, 1);
if (comp < 0)
return -1;
else if (comp > 0)
......@@ -216,7 +216,7 @@ Integer8 bmc_dataset_cmp(struct pp_instance *ppi,
return 0;
}
} else { /* ClockClass are not identical */
comp = pp_memcmp(&ann_a->grandmasterClockQuality.clockClass, &ann_b->grandmasterClockQuality.clockClass, 1);
comp = memcmp(&ann_a->grandmasterClockQuality.clockClass, &ann_b->grandmasterClockQuality.clockClass, 1);
if (comp < 0)
return -1;
else if (comp > 0)
......@@ -225,7 +225,7 @@ Integer8 bmc_dataset_cmp(struct pp_instance *ppi,
return 0;
}
} else { /* Priority1 are not identical */
comp = pp_memcmp(&ann_a->grandmasterPriority1, &ann_b->grandmasterPriority1, 1);
comp = memcmp(&ann_a->grandmasterPriority1, &ann_b->grandmasterPriority1, 1);
if (comp < 0)
return -1;
else if (comp > 0)
......
......@@ -88,7 +88,7 @@ void st_com_add_foreign(struct pp_instance *ppi, unsigned char *buf)
/* Check if foreign master is already known */
for (i = 0; i < ppi->number_foreign_records; i++) {
if (!pp_memcmp(hdr->sourcePortIdentity.clockIdentity,
if (!memcmp(hdr->sourcePortIdentity.clockIdentity,
ppi->frgn_master[j].port_identity.
clockIdentity,
PP_CLOCK_IDENTITY_LENGTH) &&
......@@ -123,7 +123,7 @@ void st_com_add_foreign(struct pp_instance *ppi, unsigned char *buf)
j = ppi->foreign_record_i;
/* Copy new foreign master data set from announce message */
pp_memcpy(ppi->frgn_master[j].port_identity.clockIdentity,
memcpy(ppi->frgn_master[j].port_identity.clockIdentity,
hdr->sourcePortIdentity.clockIdentity,
PP_CLOCK_IDENTITY_LENGTH);
ppi->frgn_master[j].port_identity.portNumber =
......
......@@ -87,13 +87,13 @@ void msg_unpack_header(struct pp_instance *ppi, void *buf)
hdr->messageLength = htons(*(UInteger16 *) (buf + 2));
hdr->domainNumber = (*(UInteger8 *) (buf + 4));
pp_memcpy(hdr->flagField, (buf + 6), PP_FLAG_FIELD_LENGTH);
memcpy(hdr->flagField, (buf + 6), PP_FLAG_FIELD_LENGTH);
pp_memcpy(&hdr->correctionfield.msb, (buf + 8), 4);
pp_memcpy(&hdr->correctionfield.lsb, (buf + 12), 4);
memcpy(&hdr->correctionfield.msb, (buf + 8), 4);
memcpy(&hdr->correctionfield.lsb, (buf + 12), 4);
hdr->correctionfield.msb = htonl(hdr->correctionfield.msb);
hdr->correctionfield.lsb = htonl(hdr->correctionfield.lsb);
pp_memcpy(hdr->sourcePortIdentity.clockIdentity, (buf + 20),
memcpy(hdr->sourcePortIdentity.clockIdentity, (buf + 20),
PP_CLOCK_IDENTITY_LENGTH);
hdr->sourcePortIdentity.portNumber =
htons(*(UInteger16 *) (buf + 28));
......@@ -103,14 +103,14 @@ void msg_unpack_header(struct pp_instance *ppi, void *buf)
if (DSPOR(ppi)->portIdentity.portNumber ==
ppi->msg_tmp_header.sourcePortIdentity.portNumber
&& !pp_memcmp(ppi->msg_tmp_header.sourcePortIdentity.clockIdentity,
&& !memcmp(ppi->msg_tmp_header.sourcePortIdentity.clockIdentity,
DSPOR(ppi)->portIdentity.clockIdentity,
PP_CLOCK_IDENTITY_LENGTH))
ppi->is_from_self = 1;
else
ppi->is_from_self = 0;
if (!pp_memcmp(DSPAR(ppi)->parentPortIdentity.clockIdentity,
if (!memcmp(DSPAR(ppi)->parentPortIdentity.clockIdentity,
hdr->sourcePortIdentity.clockIdentity,
PP_CLOCK_IDENTITY_LENGTH) &&
(DSPAR(ppi)->parentPortIdentity.portNumber ==
......@@ -138,8 +138,8 @@ void msg_pack_header(struct pp_instance *ppi, void *buf)
if (DSDEF(ppi)->twoStepFlag)
*(UInteger8 *) (buf + 6) = PP_TWO_STEP_FLAG;
pp_memset((buf + 8), 0, 8);
pp_memcpy((buf + 20), DSPOR(ppi)->portIdentity.clockIdentity,
memset((buf + 8), 0, 8);
memcpy((buf + 20), DSPOR(ppi)->portIdentity.clockIdentity,
PP_CLOCK_IDENTITY_LENGTH);
*(UInteger16 *) (buf + 28) =
htons(DSPOR(ppi)->portIdentity.portNumber);
......@@ -149,7 +149,7 @@ void msg_pack_header(struct pp_instance *ppi, void *buf)
void *msg_copy_header(MsgHeader *dest, MsgHeader *src)
{
return pp_memcpy(dest, src, sizeof(MsgHeader));
return memcpy(dest, src, sizeof(MsgHeader));
}
......@@ -172,7 +172,7 @@ void msg_pack_sync(struct pp_instance *ppi, Timestamp *orig_tstamp)
/* Table 23 */
*(Integer8 *) (buf + 33) = DSPOR(ppi)->logSyncInterval;
pp_memset((buf + 8), 0, 8);
memset((buf + 8), 0, 8);
/* Sync message */
*(UInteger16 *) (buf + 34) = htons(orig_tstamp->secondsField.msb);
......@@ -213,7 +213,7 @@ int msg_pack_announce(struct pp_instance *ppi)
*(Integer8 *) (buf + 33) = DSPOR(ppi)->logAnnounceInterval;
/* Announce message */
pp_memset((buf + 34), 0, 10);
memset((buf + 34), 0, 10);
*(Integer16 *) (buf + 44) = htons(DSPRO(ppi)->currentUtcOffset);
*(UInteger8 *) (buf + 47) = DSPAR(ppi)->grandmasterPriority1;
*(UInteger8 *) (buf + 48) = DSDEF(ppi)->clockQuality.clockClass;
......@@ -221,7 +221,7 @@ int msg_pack_announce(struct pp_instance *ppi)
*(UInteger16 *) (buf + 50) =
htons(DSDEF(ppi)->clockQuality.offsetScaledLogVariance);
*(UInteger8 *) (buf + 52) = DSPAR(ppi)->grandmasterPriority2;
pp_memcpy((buf + 53), DSPAR(ppi)->grandmasterIdentity,
memcpy((buf + 53), DSPAR(ppi)->grandmasterIdentity,
PP_CLOCK_IDENTITY_LENGTH);
*(UInteger16 *) (buf + 61) = htons(DSCUR(ppi)->stepsRemoved);
*(Enumeration8 *) (buf + 63) = DSPRO(ppi)->timeSource;
......@@ -247,7 +247,7 @@ void msg_unpack_announce(void *buf, MsgAnnounce *ann)
ann->grandmasterClockQuality.offsetScaledLogVariance =
htons(*(UInteger16 *) (buf + 50));
ann->grandmasterPriority2 = *(UInteger8 *) (buf + 52);
pp_memcpy(ann->grandmasterIdentity, (buf + 53),
memcpy(ann->grandmasterIdentity, (buf + 53),
PP_CLOCK_IDENTITY_LENGTH);
ann->stepsRemoved = htons(*(UInteger16 *) (buf + 61));
ann->timeSource = *(Enumeration8 *) (buf + 63);
......@@ -324,14 +324,14 @@ void msg_pack_pdelay_req(struct pp_instance *ppi, Timestamp *orig_tstamp)
*(Integer8 *) (buf + 33) = 0x7F;
/* Table 24 */
pp_memset((buf + 8), 0, 8);
memset((buf + 8), 0, 8);
/* Pdelay_req message */
*(UInteger16 *) (buf + 34) = htons(orig_tstamp->secondsField.msb);
*(UInteger32 *) (buf + 36) = htonl(orig_tstamp->secondsField.lsb);
*(UInteger32 *) (buf + 40) = htonl(orig_tstamp->nanosecondsField);
pp_memset((buf + 44), 0, 10);
memset((buf + 44), 0, 10);
/* RAZ reserved octets */
}
......@@ -356,7 +356,7 @@ void msg_pack_delay_req(struct pp_instance *ppi, Timestamp *orig_tstamp)
*(Integer8 *) (buf + 33) = 0x7F;
/* Table 24 */
pp_memset((buf + 8), 0, 8);
memset((buf + 8), 0, 8);
/* Pdelay_req message */
*(UInteger16 *) (buf + 34) = htons(orig_tstamp->secondsField.msb);
......@@ -380,7 +380,7 @@ void msg_pack_delay_resp(struct pp_instance *ppi,
/* Table 19 */
*(UInteger16 *) (buf + 2) = htons(PP_DELAY_RESP_LENGTH);
*(UInteger8 *) (buf + 4) = hdr->domainNumber;
pp_memset((buf + 8), 0, 8);
memset((buf + 8), 0, 8);
/* Copy correctionField of delayReqMessage */
*(Integer32 *) (buf + 8) = htonl(hdr->correctionfield.msb);
......@@ -400,7 +400,7 @@ void msg_pack_delay_resp(struct pp_instance *ppi,
htons(rcv_tstamp->secondsField.msb);
*(UInteger32 *) (buf + 36) = htonl(rcv_tstamp->secondsField.lsb);
*(UInteger32 *) (buf + 40) = htonl(rcv_tstamp->nanosecondsField);
pp_memcpy((buf + 44), hdr->sourcePortIdentity.clockIdentity,
memcpy((buf + 44), hdr->sourcePortIdentity.clockIdentity,
PP_CLOCK_IDENTITY_LENGTH);
*(UInteger16 *) (buf + 52) =
htons(hdr->sourcePortIdentity.portNumber);
......@@ -421,7 +421,7 @@ void msg_pack_pdelay_resp(struct pp_instance *ppi, MsgHeader *hdr,
/* Table 19 */
*(UInteger16 *) (buf + 2) = htons(PP_PDELAY_RESP_LENGTH);
*(UInteger8 *) (buf + 4) = hdr->domainNumber;
pp_memset((buf + 8), 0, 8);
memset((buf + 8), 0, 8);
*(UInteger16 *) (buf + 30) = htons(hdr->sequenceId);
......@@ -434,7 +434,7 @@ void msg_pack_pdelay_resp(struct pp_instance *ppi, MsgHeader *hdr,
*(UInteger16 *) (buf + 34) = htons(req_rec_tstamp->secondsField.msb);
*(UInteger32 *) (buf + 36) = htonl(req_rec_tstamp->secondsField.lsb);
*(UInteger32 *) (buf + 40) = htonl(req_rec_tstamp->nanosecondsField);
pp_memcpy((buf + 44), hdr->sourcePortIdentity.clockIdentity,
memcpy((buf + 44), hdr->sourcePortIdentity.clockIdentity,
PP_CLOCK_IDENTITY_LENGTH);
*(UInteger16 *) (buf + 52) =
htons(hdr->sourcePortIdentity.portNumber);
......@@ -482,7 +482,7 @@ void msg_unpack_delay_resp(void *buf, MsgDelayResp *resp)
htonl(*(UInteger32 *) (buf + 36));
resp->receiveTimestamp.nanosecondsField =
htonl(*(UInteger32 *) (buf + 40));
pp_memcpy(resp->requestingPortIdentity.clockIdentity,
memcpy(resp->requestingPortIdentity.clockIdentity,
(buf + 44), PP_CLOCK_IDENTITY_LENGTH);
resp->requestingPortIdentity.portNumber =
htons(*(UInteger16 *) (buf + 52));
......@@ -503,7 +503,7 @@ void msg_unpack_pdelay_resp(void *buf, MsgPDelayResp *presp)
htonl(*(UInteger32 *) (buf + 36));
presp->requestReceiptTimestamp.nanosecondsField =
htonl(*(UInteger32 *) (buf + 40));
pp_memcpy(presp->requestingPortIdentity.clockIdentity,
memcpy(presp->requestingPortIdentity.clockIdentity,
(buf + 44), PP_CLOCK_IDENTITY_LENGTH);
presp->requestingPortIdentity.portNumber =
htons(*(UInteger16 *) (buf + 52));
......@@ -550,7 +550,7 @@ void msg_pack_pdelay_resp_followup(struct pp_instance *ppi,
htonl(resp_orig_tstamp->secondsField.lsb);
*(UInteger32 *) (buf + 40) =
htonl(resp_orig_tstamp->nanosecondsField);
pp_memcpy((buf + 44), hdr->sourcePortIdentity.clockIdentity,
memcpy((buf + 44), hdr->sourcePortIdentity.clockIdentity,
PP_CLOCK_IDENTITY_LENGTH);
*(UInteger16 *) (buf + 52) =
htons(hdr->sourcePortIdentity.portNumber);
......@@ -566,7 +566,7 @@ void msg_unpack_pdelay_resp_followup(void *buf,
htonl(*(UInteger32 *) (buf + 36));
presp_follow->responseOriginTimestamp.nanosecondsField =
htonl(*(UInteger32 *) (buf + 40));
pp_memcpy(presp_follow->requestingPortIdentity.clockIdentity,
memcpy(presp_follow->requestingPortIdentity.clockIdentity,
(buf + 44), PP_CLOCK_IDENTITY_LENGTH);
presp_follow->requestingPortIdentity.portNumber =
htons(*(UInteger16 *) (buf + 52));
......
......@@ -40,7 +40,7 @@ int pp_initializing(struct pp_instance *ppi, unsigned char *pkt, int plen)
id[7] = mac[5];
DSDEF(ppi)->numberPorts = 1;
pp_memcpy(&DSDEF(ppi)->clockQuality, &OPTS(ppi)->clock_quality,
memcpy(&DSDEF(ppi)->clockQuality, &OPTS(ppi)->clock_quality,
sizeof(ClockQuality));
DSDEF(ppi)->priority1 = OPTS(ppi)->prio1;
DSDEF(ppi)->priority2 = OPTS(ppi)->prio2;
......@@ -50,7 +50,7 @@ int pp_initializing(struct pp_instance *ppi, unsigned char *pkt, int plen)
ppi->defaultDS->clockQuality.clockClass = 255;
/* Initialize port data set */
pp_memcpy(ppi->portDS->portIdentity.clockIdentity,
memcpy(ppi->portDS->portIdentity.clockIdentity,
ppi->defaultDS->clockIdentity, PP_CLOCK_IDENTITY_LENGTH);
DSPOR(ppi)->portIdentity.portNumber = 1;
DSPOR(ppi)->logMinDelayReqInterval = PP_DEFAULT_DELAYREQ_INTERVAL;
......
......@@ -103,7 +103,7 @@ int pp_master(struct pp_instance *ppi, unsigned char *pkt, int plen)
if (!((ppi->sent_seq_id[PPM_PDELAY_REQ] ==
hdr->sequenceId)
&& (!pp_memcmp(DSPOR(ppi)->portIdentity.clockIdentity,
&& (!memcmp(DSPOR(ppi)->portIdentity.clockIdentity,
ppi->msg_tmp.presp.requestingPortIdentity.
clockIdentity,
PP_CLOCK_IDENTITY_LENGTH))
......
......@@ -87,7 +87,7 @@ int pp_slave(struct pp_instance *ppi, unsigned char *pkt, int plen)
msg_unpack_delay_resp(pkt, &ppi->msg_tmp.resp);
if ((pp_memcmp(DSPOR(ppi)->portIdentity.clockIdentity,
if ((memcmp(DSPOR(ppi)->portIdentity.clockIdentity,
ppi->msg_tmp.resp.requestingPortIdentity.clockIdentity,
PP_CLOCK_IDENTITY_LENGTH) == 0) &&
((ppi->sent_seq_id[PPM_DELAY_REQ] - 1) ==
......@@ -143,7 +143,7 @@ int pp_slave(struct pp_instance *ppi, unsigned char *pkt, int plen)
if (!((ppi->sent_seq_id[PPM_PDELAY_REQ] ==
hdr->sequenceId)
&& (!pp_memcmp(DSPOR(ppi)->portIdentity.clockIdentity,
&& (!memcmp(DSPOR(ppi)->portIdentity.clockIdentity,
ppi->msg_tmp.presp.requestingPortIdentity.
clockIdentity, PP_CLOCK_IDENTITY_LENGTH))
&& (DSPOR(ppi)->portIdentity.portNumber ==
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment