1From 3d091efa09478d0330be686184ae4793764504e7 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 11 Apr 2017 14:22:23 -0700
4Subject: [PATCH 2/2] replace non-standard uint with unsigned int
5
6make it portable on musl
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10Upstream-Status: Pending
11
12 demos/benchmark/client_tipc.c       | 34 +++++++++++++++++-----------------
13 demos/benchmark/common_tipc.h       |  2 +-
14 demos/benchmark/server_tipc.c       | 10 +++++-----
15 demos/inventory_sim/inventory_sim.c | 12 ++++++------
16 4 files changed, 29 insertions(+), 29 deletions(-)
17
18diff --git a/demos/benchmark/client_tipc.c b/demos/benchmark/client_tipc.c
19index 5d889ee..d913e42 100644
20--- a/demos/benchmark/client_tipc.c
21+++ b/demos/benchmark/client_tipc.c
22@@ -65,7 +65,7 @@ static const struct sockaddr_tipc master_clnt_addr = {
23
24 static int master_clnt_sd;
25 static int master_srv_sd;
26-static uint client_id;
27+static unsigned int client_id;
28 static unsigned char *buf = NULL;
29 static int non_blk = 0;
30 static int select_ip(struct srv_info *sinfo, char *name);
31@@ -79,7 +79,7 @@ struct master_client_cmd {
32 	__u32 bounce;
33 };
34
35-static void master_to_client(uint cmd, uint msglen, uint msgcnt, uint bounce)
36+static void master_to_client(unsigned int cmd, unsigned int msglen, unsigned int msgcnt, unsigned int bounce)
37 {
38 	struct master_client_cmd c;
39
40@@ -93,7 +93,7 @@ static void master_to_client(uint cmd, uint msglen, uint msgcnt, uint bounce)
41 		die("Unable to send cmd %u to clients\n", cmd);
42 }
43
44-static void client_from_master(uint *cmd, uint *msglen, uint *msgcnt, uint *bounce)
45+static void client_from_master(unsigned int *cmd, unsigned int *msglen, unsigned int *msgcnt, unsigned int *bounce)
46 {
47 	struct master_client_cmd c;
48
49@@ -114,7 +114,7 @@ struct client_master_cmd {
50 	__u32 cmd;
51 };
52
53-static void client_to_master(uint cmd)
54+static void client_to_master(unsigned int cmd)
55 {
56 	struct client_master_cmd c;
57
58@@ -125,7 +125,7 @@ static void client_to_master(uint cmd)
59 		die("Client: Unable to send msg to master\n");
60 }
61
62-static void master_from_client(uint *cmd)
63+static void master_from_client(unsigned int *cmd)
64 {
65 	struct client_master_cmd c;
66
67@@ -137,7 +137,7 @@ static void master_from_client(uint *cmd)
68 	*cmd = ntohl(c.cmd);
69 }
70
71-static void master_to_srv(uint cmd, uint msglen, uint msgcnt, uint echo)
72+static void master_to_srv(unsigned int cmd, unsigned int msglen, unsigned int msgcnt, unsigned int echo)
73 {
74 	struct master_srv_cmd c;
75
76@@ -151,7 +151,7 @@ static void master_to_srv(uint cmd, uint msglen, uint msgcnt, uint echo)
77 		die("Unable to send cmd %u to servers\n", cmd);
78 }
79
80-static void master_from_srv(uint *cmd, struct srv_info *sinfo, __u32 *tipc_addr)
81+static void master_from_srv(unsigned int *cmd, struct srv_info *sinfo, __u32 *tipc_addr)
82 {
83 	struct srv_to_master_cmd c;
84
85@@ -290,7 +290,7 @@ static void client_main(unsigned int clnt_id, ushort tcp_port, int tcp_addr)
86 {
87 	int peer_sd, efd = 0;
88 	int imp = clnt_id % 4;
89-	uint cmd, msglen, msgcnt, echo;
90+	unsigned int cmd, msglen, msgcnt, echo;
91 	struct epoll_event event, revents;
92 	struct sockaddr_in tcp_dest;
93 	int rc;
94@@ -400,22 +400,22 @@ static void client_main(unsigned int clnt_id, ushort tcp_port, int tcp_addr)
95 int main(int argc, char *argv[], char *dummy[])
96 {
97 	int c;
98-	uint cmd;
99-	uint latency_transf = DEFAULT_LAT_MSGS;
100-	uint thruput_transf = DEFAULT_THRU_MSGS;
101-	uint req_clients = DEFAULT_CLIENTS;
102-	uint first_msglen = DEFAULT_MSGLEN;
103-	uint last_msglen = TIPC_MAX_USER_MSG_SIZE;
104+	unsigned int cmd;
105+	unsigned int latency_transf = DEFAULT_LAT_MSGS;
106+	unsigned int thruput_transf = DEFAULT_THRU_MSGS;
107+	unsigned int req_clients = DEFAULT_CLIENTS;
108+	unsigned int first_msglen = DEFAULT_MSGLEN;
109+	unsigned int last_msglen = TIPC_MAX_USER_MSG_SIZE;
110 	unsigned long long msglen;
111 	unsigned long long num_clients;
112 	struct timeval start_time;
113 	unsigned long long elapsed;
114 	unsigned long long msgcnt;
115 	unsigned long long iter;
116-	uint clnt_id;
117-	uint conn_typ = TIPC_CONN;
118+	unsigned int clnt_id;
119+	unsigned int conn_typ = TIPC_CONN;
120 	ushort tcp_port = 0;
121-	uint tcp_addr = 0;
122+	unsigned int tcp_addr = 0;
123 	struct srv_info sinfo;
124 	__u32 peer_tipc_addr;
125 	char ifname[16] = {0,};
126diff --git a/demos/benchmark/common_tipc.h b/demos/benchmark/common_tipc.h
127index 1765ba1..47947e0 100644
128--- a/demos/benchmark/common_tipc.h
129+++ b/demos/benchmark/common_tipc.h
130@@ -256,7 +256,7 @@ static void get_ip_list(struct srv_info *sinfo, char *ifname)
131 	}
132 }
133
134-static uint own_node(void)
135+static unsigned int own_node(void)
136 {
137 	struct sockaddr_tipc addr;
138 	socklen_t sz = sizeof(addr);
139diff --git a/demos/benchmark/server_tipc.c b/demos/benchmark/server_tipc.c
140index 9d0e2be..3cd82b7 100644
141--- a/demos/benchmark/server_tipc.c
142+++ b/demos/benchmark/server_tipc.c
143@@ -45,7 +45,7 @@ static int wait_for_connection(int listener_sd);
144 static void echo_messages(int peer_sd, int master_sd, int srv_id);
145 static __u32 own_node_addr;
146
147-static void srv_to_master(uint cmd, struct srv_info *sinfo)
148+static void srv_to_master(unsigned int cmd, struct srv_info *sinfo)
149 {
150 	struct srv_to_master_cmd c;
151
152@@ -62,7 +62,7 @@ static void srv_to_master(uint cmd, struct srv_info *sinfo)
153 		die("Server: unable to send info to master\n");
154 }
155
156-static void srv_from_master(uint *cmd, uint* msglen, uint *msgcnt, uint *echo)
157+static void srv_from_master(unsigned int *cmd, unsigned int* msglen, unsigned int *msgcnt, unsigned int *echo)
158 {
159 	struct master_srv_cmd c;
160
161@@ -84,8 +84,8 @@ int main(int argc, char *argv[], char *dummy[])
162 {
163 	ushort tcp_port = 4711;
164 	struct srv_info sinfo;
165-	uint cmd;
166-	uint max_msglen;
167+	unsigned int cmd;
168+	unsigned int max_msglen;
169 	struct sockaddr_in srv_addr;
170 	int lstn_sd, peer_sd;
171 	int srv_id = 0, srv_cnt = 0;;
172@@ -221,7 +221,7 @@ static int wait_for_connection(int lstn_sd)
173
174 static void echo_messages(int peer_sd, int master_sd, int srv_id)
175 {
176-	uint cmd, msglen, msgcnt, echo, rcvd = 0;
177+	unsigned int cmd, msglen, msgcnt, echo, rcvd = 0;
178
179 	do {
180 		/* Get msg length and number to expect, and ack: */
181diff --git a/demos/inventory_sim/inventory_sim.c b/demos/inventory_sim/inventory_sim.c
182index 22c33d1..9bf5443 100644
183--- a/demos/inventory_sim/inventory_sim.c
184+++ b/demos/inventory_sim/inventory_sim.c
185@@ -940,9 +940,9 @@ int simItem(int itemID, int lagTime, int speed)
186 	char outMsg[MSG_SIZE_MAX];
187 	char *marker;
188 	int msgSize;
189-	uint zone;
190-	uint cluster;
191-	uint node;
192+	unsigned int zone;
193+	unsigned int cluster;
194+	unsigned int node;
195 	char itemName[NAME_SIZE];
196 	int haveItem;
197 	int res;
198@@ -1134,9 +1134,9 @@ int simCust(int itemID, int lagTime, int waitTime, int speed, int taskID)
199 	char msg[MSG_SIZE_MAX];
200 	char *marker;
201 	int msgSize;
202-	uint zone;
203-	uint cluster;
204-	uint node;
205+	unsigned int zone;
206+	unsigned int cluster;
207+	unsigned int node;
208 	char custName[NAME_SIZE];
209 	int transactionID;
210 	int needItem;
211--
2122.12.2
213
214