Skip to content

Commit

Permalink
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: Ibe72effc72a7579b00f7d147d9fb814b4c7ee7a3
  • Loading branch information
Jeya ganesh babu J committed Oct 10, 2018
1 parent c6f4180 commit cd779c5
Show file tree
Hide file tree
Showing 17 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion compiler/generate/t_c_generator.cc
Expand Up @@ -633,7 +633,7 @@ string t_c_generator::base_type_name(t_base_type *type) {
case t_base_type::TYPE_IPADDR:
return "ipaddr_t";
case t_base_type::TYPE_UUID:
return "uuid_t";
return "ct_uuid_t";
default:
throw "compiler error: no C base type name for base type "
+ t_base_type::t_base_name (tbase);
Expand Down
4 changes: 2 additions & 2 deletions compiler/main.cc
Expand Up @@ -824,7 +824,7 @@ void validate_const_rec(std::string name, t_type* type, t_const_value* value) {
break;
case t_base_type::TYPE_UUID:
if (value->get_type() != t_const_value::CV_STRING) {
throw "type error: const \"" + name + "\" was declared as uuid_t";
throw "type error: const \"" + name + "\" was declared as ct_uuid_t";
}
break;
case t_base_type::TYPE_IPADDR:
Expand Down Expand Up @@ -1388,7 +1388,7 @@ int main(int argc, char** argv) {
g_type_ipv4 = new t_base_type("ipv4", t_base_type::TYPE_IPV4);
g_type_ipaddr = new t_base_type("ipaddr", t_base_type::TYPE_IPADDR);
g_type_xml = new t_base_type("xml", t_base_type::TYPE_XML);
g_type_uuid_t = new t_base_type("uuid_t", t_base_type::TYPE_UUID);
g_type_uuid_t = new t_base_type("ct_uuid_t", t_base_type::TYPE_UUID);
g_type_static_const_string = new t_base_type("static const string", t_base_type::TYPE_STATIC_CONST_STRING);
g_type_sandesh_system = new t_base_type("system", t_base_type::TYPE_SANDESH_SYSTEM);
g_type_sandesh_request = new t_base_type("request", t_base_type::TYPE_SANDESH_REQUEST);
Expand Down
2 changes: 1 addition & 1 deletion compiler/parse/t_base_type.h
Expand Up @@ -232,7 +232,7 @@ class t_base_type : public t_type {
case TYPE_IPV4 : return "ipv4"; break;
case TYPE_IPADDR : return "ipaddr"; break;
case TYPE_XML : return "xml"; break;
case TYPE_UUID : return "uuid_t"; break;
case TYPE_UUID : return "ct_uuid_t"; break;
case TYPE_STATIC_CONST_STRING :
return "static const string"; break;
case TYPE_SANDESH_SYSTEM : return "system"; break;
Expand Down
2 changes: 1 addition & 1 deletion compiler/sandeshl.ll
Expand Up @@ -160,7 +160,7 @@ format_str (%([1-9]$)?([+-]?[ -#0])?([1-9]+)?(\.[1-9]+)?(hh|h|l|ll|L|z|j|t)?(
"string" { return tok_string; }
"binary" { return tok_binary; }
"xml" { return tok_xml; }
"uuid_t" { return tok_uuid_t; }
"ct_uuid_t" { return tok_uuid_t; }
"slist" { return tok_slist; }
"senum" { return tok_senum; }
"map" { return tok_map; }
Expand Down
4 changes: 2 additions & 2 deletions library/c/protocol/thrift_binary_protocol.c
Expand Up @@ -284,7 +284,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 @@ -650,7 +650,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 @@ -106,7 +106,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 @@ -131,7 +131,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 @@ -164,7 +164,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 @@ -344,7 +344,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 @@ -508,7 +508,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
4 changes: 2 additions & 2 deletions library/common/test/sandesh_buffer_test.sandesh
Expand Up @@ -19,8 +19,8 @@ buffer sandesh BufferTest {
8: u64 u64Elem1;
9: xml xmlElem1;
10: ipv4 ipv4Elem1;
11: uuid_t uuidElem1;
12: list<uuid_t> listElem3;
11: ct_uuid_t uuidElem1;
12: list<ct_uuid_t> listElem3;
13: ipaddr ipaddrElem1;
14: list<ipaddr> listElem4;
}
Expand Down
4 changes: 2 additions & 2 deletions library/cpp/test/sandesh_http_test.sandesh
Expand Up @@ -25,7 +25,7 @@ response sandesh SandeshHttpTestResp {
3: string teststring1;
4: string teststring2;
5: ipaddr testIpaddr1;
6: uuid_t testUuid1;
6: ct_uuid_t testUuid1;
}

request sandesh SandeshHttpTestRequest {
Expand All @@ -34,5 +34,5 @@ request sandesh SandeshHttpTestRequest {
3: string teststring1;
4: string teststring2;
5: ipaddr testIpaddr1;
6: uuid_t testUuid1;
6: ct_uuid_t testUuid1;
}
6 changes: 3 additions & 3 deletions library/cpp/test/sandesh_rw_test.sandesh
Expand Up @@ -27,9 +27,9 @@ struct SandeshStructTest {
12: xml xmlTest2;
13: xml xmlTest3;
14: ipv4 ipv4Test;
15: uuid_t uuidTest;
16: list<uuid_t> uuidListTest;
17: uuid_t uuidDefaultTest = "00010203-0405-0607-0423-023434265323";
15: ct_uuid_t uuidTest;
16: list<ct_uuid_t> uuidListTest;
17: ct_uuid_t uuidDefaultTest = "00010203-0405-0607-0423-023434265323";
18: ipaddr ipaddrv4Test
19: ipaddr ipaddrv6Test
20: list<ipaddr> ipaddrListTest
Expand Down
6 changes: 3 additions & 3 deletions library/cpp/test/sandesh_send_queue_test.sandesh
Expand Up @@ -27,9 +27,9 @@ struct SandeshStructTest {
12: xml xmlTest2;
13: xml xmlTest3;
14: ipv4 ipv4Test;
15: uuid_t uuidTest;
16: list<uuid_t> uuidListTest;
17: uuid_t uuidDefaultTest = "00010203-0405-0607-0423-023434265323";
15: ct_uuid_t uuidTest;
16: list<ct_uuid_t> uuidListTest;
17: ct_uuid_t uuidDefaultTest = "00010203-0405-0607-0423-023434265323";
}

response sandesh SandeshResponseTest {
Expand Down
8 changes: 4 additions & 4 deletions library/python/pysandesh/test/encode_decode_test.sandesh
Expand Up @@ -25,7 +25,7 @@ systemlog sandesh BasicTypesTest {
14: xml xml_3;
15: xml xml_4;
16: ipv4 ipv4_1;
17: uuid_t uuid_1;
17: ct_uuid_t uuid_1;
18: ipaddr ipaddr_1;
19: ipaddr ipaddr_2;
}
Expand All @@ -43,8 +43,8 @@ struct StructBasicTypes {
10: xml xml_3;
11: xml xml_4;
12: ipv4 ipv4_1;
13: uuid_t uuid_1;
14: uuid_t uuid_2 = "00010203-0405-0607-0423-023434265323";
13: ct_uuid_t uuid_1;
14: ct_uuid_t uuid_2 = "00010203-0405-0607-0423-023434265323";
}

objectlog sandesh StructTest {
Expand All @@ -56,7 +56,7 @@ struct StructContainerTypes {
1: list<i32> li32_1;
2: list<string> lstring_1;
3: list<StructBasicTypes> lbst_1;
4: list<uuid_t> luuid_1;
4: list<ct_uuid_t> luuid_1;
5: list<ipaddr> lipaddr_1;
}

Expand Down
2 changes: 1 addition & 1 deletion library/python/pysandesh/test/msg_test.sandesh
Expand Up @@ -12,7 +12,7 @@ systemlog sandesh SystemLogTest {
1: "Async Test";
2: list<i32> list1;
3: map<i32, string> map1;
4: uuid_t uuid1;
4: ct_uuid_t uuid1;
}

struct StructObject {
Expand Down
2 changes: 1 addition & 1 deletion library/python/pysandesh/test/sandesh_http_test.sandesh
Expand Up @@ -11,6 +11,6 @@ request sandesh SandeshHttpRequest {
1: i32 testID;
2: string teststring1;
3: string teststring2;
4: uuid_t testUuid1;
4: ct_uuid_t testUuid1;
5: ipaddr testIpaddr1;
}

0 comments on commit cd779c5

Please sign in to comment.