Skip to content

Commit

Permalink
WIP: remove conflict with linux uuid_t type
Browse files Browse the repository at this point in the history
Since this change [1] compilation of vrouter module will fail with
message that uuid_t is already defined.

[1]
torvalds/linux@f9727a1

Partial-Bug: #1633387
Change-Id: If82ad77cd6f41a343879e234143b2cc535900a33
(cherry picked from commit 80002037bb5a7f7411a081ccbb4137589e21470c)
  • Loading branch information
haripk committed Apr 18, 2018
1 parent 50ada6f commit 9ac5d23
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions library/c/protocol/thrift_binary_protocol.c
Expand Up @@ -281,7 +281,7 @@ thrift_binary_protocol_write_ipaddr (ThriftProtocol *protocol,
}

int32_t
thrift_binary_protocol_write_uuid_t (ThriftProtocol *protocol, const uuid_t value,
thrift_binary_protocol_write_uuid_t (ThriftProtocol *protocol, const ct_uuid_t value,
int *error)
{
if (thrift_transport_write (protocol->transport,
Expand Down Expand Up @@ -647,7 +647,7 @@ thrift_binary_protocol_read_ipaddr (ThriftProtocol *protocol, ipaddr_t *value,
}

int32_t
thrift_binary_protocol_read_uuid_t (ThriftProtocol *protocol, uuid_t *value,
thrift_binary_protocol_read_uuid_t (ThriftProtocol *protocol, ct_uuid_t *value,
int *error)
{
int32_t ret;
Expand Down
2 changes: 1 addition & 1 deletion library/c/protocol/thrift_protocol.c
Expand Up @@ -103,7 +103,7 @@ thrift_protocol_skip (ThriftProtocol *protocol, ThriftType type, int *error)
}
case T_UUID:
{
uuid_t uuid;
ct_uuid_t uuid;
return thrift_protocol_read_uuid_t (protocol, &uuid, error);
}
case T_STRUCT:
Expand Down
8 changes: 4 additions & 4 deletions library/c/protocol/thrift_protocol.h
Expand Up @@ -128,7 +128,7 @@ struct _ThriftProtocol
const u_int32_t len, int *error);
int32_t (*write_xml) (struct _ThriftProtocol *protocol, const char *str,
int *error);
int32_t (*write_uuid_t) (struct _ThriftProtocol *protocol, const uuid_t value,
int32_t (*write_uuid_t) (struct _ThriftProtocol *protocol, const ct_uuid_t value,
int *error);

int32_t (*read_sandesh_begin) (struct _ThriftProtocol *protocol, char **name,
Expand Down Expand Up @@ -161,7 +161,7 @@ struct _ThriftProtocol
int32_t (*read_binary) (struct _ThriftProtocol *protocol, void **buf,
u_int32_t *len, int *error);
int32_t (*read_xml) (struct _ThriftProtocol *protocol, char **str, int *error);
int32_t (*read_uuid_t) (struct _ThriftProtocol *protocol, uuid_t *value, int *error);
int32_t (*read_uuid_t) (struct _ThriftProtocol *protocol, ct_uuid_t *value, int *error);
};
typedef struct _ThriftProtocol ThriftProtocol;

Expand Down Expand Up @@ -341,7 +341,7 @@ static inline int32_t thrift_protocol_write_xml (ThriftProtocol *protocol,
}

static inline int32_t thrift_protocol_write_uuid_t (ThriftProtocol *protocol,
const uuid_t value,
const ct_uuid_t value,
int *error)
{
return protocol->write_uuid_t (protocol, value, error);
Expand Down Expand Up @@ -505,7 +505,7 @@ static inline int32_t thrift_protocol_read_xml (ThriftProtocol *protocol,
}

static inline int32_t thrift_protocol_read_uuid_t (ThriftProtocol *protocol,
uuid_t *value, int *error)
ct_uuid_t *value, int *error)
{
return protocol->read_uuid_t (protocol, value, error);
}
Expand Down
2 changes: 1 addition & 1 deletion library/c/sandesh.h
Expand Up @@ -73,7 +73,7 @@ extern int vrouter_dbg;
#define os_log(level, format, arg...) syslog(level, format, ##arg)
#endif /* __KERNEL__ */

typedef unsigned char uuid_t[16];
typedef unsigned char ct_uuid_t[16];

typedef struct ipaddr_s {
uint8_t iptype; // AF_INET or AF_INET6
Expand Down
14 changes: 7 additions & 7 deletions library/c/test/sandesh_c_test.cc
Expand Up @@ -55,7 +55,7 @@ static uint32_t inner_f(4294967295u);
static uint64_t inner_g(18446744073709551615ull);
static std::string inner_h("abc");
static uint32_t inner_i(4294967295u);
static uuid_t inner_j = {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
static ct_uuid_t inner_j = {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f};
static std::string inner_k("20.1.1.2");
static std::string inner_l("2001:abce::4");
Expand Down Expand Up @@ -93,7 +93,7 @@ static void ValidateAbcInner(abc_inner *inner) {
EXPECT_STREQ(inner->inner_h, inner_h.c_str());
EXPECT_EQ(inner->inner_i, inner_i);
EXPECT_EQ(0, memcmp(inner->inner_j,
inner_j, sizeof(uuid_t)));
inner_j, sizeof(ct_uuid_t)));
ipaddr_t inner_k_v4;
inner_k_v4.iptype = AF_INET;
int success(inet_pton(AF_INET, inner_k.c_str(), &inner_k_v4.ipv4));
Expand Down Expand Up @@ -135,7 +135,7 @@ static void CompareAbcInner(abc_inner *actual, abc_inner *expected) {
EXPECT_STREQ(actual->inner_h, expected->inner_h);
EXPECT_EQ(actual->inner_i, expected->inner_i);
EXPECT_EQ(0, memcmp(actual->inner_j,
expected->inner_j, sizeof(uuid_t)));
expected->inner_j, sizeof(ct_uuid_t)));
EXPECT_EQ(actual->inner_k.iptype, expected->inner_k.iptype);
EXPECT_EQ(0, memcmp(&actual->inner_k.ipv4,
&expected->inner_k.ipv4, 4));
Expand Down Expand Up @@ -496,7 +496,7 @@ abc_sandesh_process (void *pabc) {
void
buffer_test_process (void *ptr) {
int i;
uuid_t uuid_value =
ct_uuid_t uuid_value =
{0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f};
BufferTest *psandesh = (BufferTest *)ptr;
Expand All @@ -507,18 +507,18 @@ buffer_test_process (void *ptr) {
for (i = 0; i < 5; i++) {
EXPECT_EQ(psandesh->listElem1[i], i);
EXPECT_EQ(psandesh->listElem2[i], i);
uuid_t uuid_temp =
ct_uuid_t uuid_temp =
{0x00+i,0x00+i,0x01+i,0x01+i,0x02+i,0x02+i,0x03+i,0x03+i,
0x04+i,0x04+i,0x05+i,0x05+i,0x06+i,0x06+i,0x07+i,0x07+i};
EXPECT_EQ(0, memcmp(psandesh->listElem3[i],
uuid_temp, sizeof(uuid_t)));
uuid_temp, sizeof(ct_uuid_t)));
}
EXPECT_EQ(psandesh->u16Elem1, 65535);
EXPECT_EQ(psandesh->u32Elem1, 4294967295u);
EXPECT_EQ(psandesh->u64Elem1, 18446744073709551615ull);
EXPECT_STREQ(psandesh->xmlElem1, "xmlElem1");
EXPECT_EQ(psandesh->ipv4Elem1, 4294967295u);
EXPECT_EQ(0, memcmp(psandesh->uuidElem1, uuid_value, sizeof(uuid_t)));
EXPECT_EQ(0, memcmp(psandesh->uuidElem1, uuid_value, sizeof(ct_uuid_t)));
ipaddr_t ipaddr1;
inet_pton(AF_INET, "11.11.11.3", &ipaddr1.ipv4);
EXPECT_EQ(psandesh->ipaddrElem1.iptype, AF_INET);
Expand Down
2 changes: 1 addition & 1 deletion library/c/test/sandesh_c_test.sandesh
Expand Up @@ -24,7 +24,7 @@ struct abc_inner {
7:u64 inner_g;
8:xml inner_h;
9:ipv4 inner_i;
10:uuid_t inner_j;
10:ct_uuid_t inner_j;
11:ipaddr inner_k;
12:ipaddr inner_l;
13:string inner_m;
Expand Down

0 comments on commit 9ac5d23

Please sign in to comment.