Skip to content

Commit 02a2aa4

Browse files
steffen-vogel-opalrtstv0g
authored andcommitted
Apply clang-format changes
Signed-off-by: Steffen Vogel <steffen.vogel@opal-rt.com>
1 parent 8da1e68 commit 02a2aa4

300 files changed

Lines changed: 33731 additions & 35782 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

clients/opal/models/send_receive/include/config.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@
88
#ifndef _CONFIG_H_
99
#define _CONFIG_H_
1010

11-
#define PROGNAME "VILLASnode-OPAL-UDP"
12-
#define VERSION "0.7"
11+
#define PROGNAME "VILLASnode-OPAL-UDP"
12+
#define VERSION "0.7"
1313

14-
#define MAX_VALUES 64
14+
#define MAX_VALUES 64
1515

1616
// List of protocols
17-
#define VILLAS 1
18-
#define GTNET_SKT 2
17+
#define VILLAS 1
18+
#define GTNET_SKT 2
1919

2020
// Default protocol
2121
#ifndef PROTOCOL
22-
#define PROTOCOL VILLAS
22+
#define PROTOCOL VILLAS
2323
#endif // PROTOCOL
2424

2525
#endif // _CONFIG_H_

clients/opal/models/send_receive/include/msg_format.h

Lines changed: 38 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10,65 +10,63 @@
1010
#include <stdint.h>
1111

1212
// The current version number for the message format
13-
#define MSG_VERSION 2
13+
#define MSG_VERSION 2
1414

1515
// TODO: Implement more message types
16-
#define MSG_TYPE_DATA 0 // Message contains float values
17-
#define MSG_TYPE_START 1 // Message marks the beginning of a new simulation case
18-
#define MSG_TYPE_STOP 2 // Message marks the end of a simulation case
16+
#define MSG_TYPE_DATA 0 // Message contains float values
17+
#define MSG_TYPE_START 1 // Message marks the beginning of a new simulation case
18+
#define MSG_TYPE_STOP 2 // Message marks the end of a simulation case
1919

2020
// The total size in bytes of a message
21-
#define MSG_LEN(values) (sizeof(struct msg) + MSG_DATA_LEN(values))
21+
#define MSG_LEN(values) (sizeof(struct msg) + MSG_DATA_LEN(values))
2222

2323
// The length of \p values values in bytes
24-
#define MSG_DATA_LEN(values) (sizeof(float) * (values))
24+
#define MSG_DATA_LEN(values) (sizeof(float) * (values))
2525

2626
// The offset to the first data value in a message
27-
#define MSG_DATA_OFFSET(msg) ((char *) (msg) + offsetof(struct msg, data))
27+
#define MSG_DATA_OFFSET(msg) ((char *)(msg) + offsetof(struct msg, data))
2828

2929
// Initialize a message with default values
30-
#define MSG_INIT(len, seq) (struct msg) {\
31-
.version = MSG_VERSION, \
32-
.type = MSG_TYPE_DATA, \
33-
.length = len, \
34-
.sequence = seq, \
35-
.id = 0 \
36-
}
30+
#define MSG_INIT(len, seq) \
31+
(struct msg) { \
32+
.version = MSG_VERSION, .type = MSG_TYPE_DATA, .length = len, \
33+
.sequence = seq, .id = 0 \
34+
}
3735

3836
// The timestamp of a message in struct timespec format
39-
#define MSG_TS(msg) (struct timespec) { \
40-
.tv_sec = (msg)->ts.sec, \
41-
.tv_nsec = (msg)->ts.nsec \
42-
}
37+
#define MSG_TS(msg) \
38+
(struct timespec) { .tv_sec = (msg)->ts.sec, .tv_nsec = (msg)->ts.nsec }
4339

4440
// This message format is used by all clients
45-
struct msg
46-
{
41+
struct msg {
4742
#if BYTE_ORDER == BIG_ENDIAN
48-
unsigned version: 4; // Specifies the format of the remaining message (see MGS_VERSION)
49-
unsigned type : 2; // Data or control message (see MSG_TYPE_*)
50-
unsigned reserved1 : 2; // Reserved bits
43+
unsigned
44+
version : 4; // Specifies the format of the remaining message (see MGS_VERSION)
45+
unsigned type : 2; // Data or control message (see MSG_TYPE_*)
46+
unsigned reserved1 : 2; // Reserved bits
5147
#elif BYTE_ORDER == LITTLE_ENDIAN
52-
unsigned reserved1 : 2; // Reserved bits
53-
unsigned type : 2; // Data or control message (see MSG_TYPE_*)
54-
unsigned version: 4; // Specifies the format of the remaining message (see MGS_VERSION)
48+
unsigned reserved1 : 2; // Reserved bits
49+
unsigned type : 2; // Data or control message (see MSG_TYPE_*)
50+
unsigned
51+
version : 4; // Specifies the format of the remaining message (see MGS_VERSION)
5552
#else
56-
#error Invalid byte-order
53+
#error Invalid byte-order
5754
#endif // BYTEORDER
5855

59-
uint8_t id; // An id which identifies the source of this sample
60-
uint16_t length; // The number of values in msg::data[]
61-
uint32_t sequence; // The sequence number is incremented by one for consecutive messages
56+
uint8_t id; // An id which identifies the source of this sample
57+
uint16_t length; // The number of values in msg::data[]
58+
uint32_t
59+
sequence; // The sequence number is incremented by one for consecutive messages
6260

63-
// A timestamp per message
64-
struct {
65-
uint32_t sec; // Seconds since 1970-01-01 00:00:00
66-
uint32_t nsec; // Nanoseconds of the current second
67-
} ts;
61+
// A timestamp per message
62+
struct {
63+
uint32_t sec; // Seconds since 1970-01-01 00:00:00
64+
uint32_t nsec; // Nanoseconds of the current second
65+
} ts;
6866

69-
// The message payload
70-
union {
71-
float f; // Floating point values
72-
uint32_t i; // Integer values
73-
} data[];
67+
// The message payload
68+
union {
69+
float f; // Floating point values
70+
uint32_t i; // Integer values
71+
} data[];
7472
} __attribute__((packed));

clients/opal/models/send_receive/include/socket.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
#define RT
1414
#include "OpalGenAsyncParamCtrl.h"
1515

16-
#define UDP_PROTOCOL 1
17-
#define TCP_PROTOCOL 2
16+
#define UDP_PROTOCOL 1
17+
#define TCP_PROTOCOL 2
1818

1919
struct socket {
20-
struct sockaddr_in send_ad; // Send address
21-
struct sockaddr_in recv_ad; // Receive address
22-
int sd; // socket descriptor
20+
struct sockaddr_in send_ad; // Send address
21+
struct sockaddr_in recv_ad; // Receive address
22+
int sd; // socket descriptor
2323
};
2424

2525
int socket_init(struct socket *s, Opal_GenAsyncParam_Ctrl IconCtrlStruct);

clients/opal/models/send_receive/src/compat.c

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,21 @@
99

1010
#include <string.h>
1111

12-
size_t __intel_sse2_strlen(const char *s)
13-
{
14-
return strlen(s);
15-
}
12+
size_t __intel_sse2_strlen(const char *s) { return strlen(s); }
1613

17-
void * _intel_fast_memset(void *b, int c, size_t len)
18-
{
19-
return memset(b, c, len);
14+
void *_intel_fast_memset(void *b, int c, size_t len) {
15+
return memset(b, c, len);
2016
}
2117

22-
void * _intel_fast_memcpy(void *restrict dst, const void *restrict src, size_t n)
23-
{
24-
return memcpy(dst, src, n);
18+
void *_intel_fast_memcpy(void *restrict dst, const void *restrict src,
19+
size_t n) {
20+
return memcpy(dst, src, n);
2521
}
2622

27-
int _intel_fast_memcmp(const void *s1, const void *s2, size_t n)
28-
{
29-
return memcmp(s1, s2, n);
23+
int _intel_fast_memcmp(const void *s1, const void *s2, size_t n) {
24+
return memcmp(s1, s2, n);
3025
}
3126

32-
void * _intel_fast_memmove(void *dest, const void *src, size_t num)
33-
{
34-
return memmove(dest, src, num);
27+
void *_intel_fast_memmove(void *dest, const void *src, size_t num) {
28+
return memmove(dest, src, num);
3529
}

0 commit comments

Comments
 (0)