Skip to content

Commit

Permalink
Revert "WIP: remove conflict with linux uuid_t type"
Browse files Browse the repository at this point in the history
This commit has to be reverted and reworked. It did not take in to
account all references of uuid_t type.

Partial-Bug: #1633387

This reverts commit 70d93eb.

Change-Id: I4f0e2f8a79e9163ba887007affc93aaa03f8b14b
  • Loading branch information
michalskalski committed Apr 23, 2018
1 parent 70d93eb commit e7c95d7
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions sandesh/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 ct_uuid_t value,
thrift_binary_protocol_write_uuid_t (ThriftProtocol *protocol, const 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, ct_uuid_t *value,
thrift_binary_protocol_read_uuid_t (ThriftProtocol *protocol, uuid_t *value,
int *error)
{
int32_t ret;
Expand Down
2 changes: 1 addition & 1 deletion sandesh/library/c/protocol/thrift_protocol.c
Expand Up @@ -106,7 +106,7 @@ thrift_protocol_skip (ThriftProtocol *protocol, ThriftType type, int *error)
}
case T_UUID:
{
ct_uuid_t uuid;
uuid_t uuid;
return thrift_protocol_read_uuid_t (protocol, &uuid, error);
}
case T_STRUCT:
Expand Down
8 changes: 4 additions & 4 deletions sandesh/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 ct_uuid_t value,
int32_t (*write_uuid_t) (struct _ThriftProtocol *protocol, const 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, ct_uuid_t *value, int *error);
int32_t (*read_uuid_t) (struct _ThriftProtocol *protocol, 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 ct_uuid_t value,
const 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,
ct_uuid_t *value, int *error)
uuid_t *value, int *error)
{
return protocol->read_uuid_t (protocol, value, error);
}
Expand Down
2 changes: 1 addition & 1 deletion sandesh/library/c/sandesh.h
Expand Up @@ -125,7 +125,7 @@ typedef UINT32 uint32_t, u_int32_t;
typedef UINT64 uint64_t, u_int64_t;
#endif

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

typedef struct ipaddr_s {
uint8_t iptype; // AF_INET or AF_INET6
Expand Down
14 changes: 7 additions & 7 deletions sandesh/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 ct_uuid_t inner_j = {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
static 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(ct_uuid_t)));
inner_j, sizeof(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(ct_uuid_t)));
expected->inner_j, sizeof(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;
ct_uuid_t uuid_value =
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);
ct_uuid_t uuid_temp =
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(ct_uuid_t)));
uuid_temp, sizeof(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(ct_uuid_t)));
EXPECT_EQ(0, memcmp(psandesh->uuidElem1, uuid_value, sizeof(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 sandesh/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:ct_uuid_t inner_j;
10:uuid_t inner_j;
11:ipaddr inner_k;
12:ipaddr inner_l;
13:string inner_m;
Expand Down

0 comments on commit e7c95d7

Please sign in to comment.