blob: b632241aec791d57aaa18df4427538c635a2cb6d [file] [log] [blame]
Jens Axboe132159a2011-09-30 15:01:32 -06001#include <stdio.h>
2#include <stdlib.h>
3#include <unistd.h>
4#include <limits.h>
5#include <errno.h>
6#include <fcntl.h>
7#include <sys/poll.h>
8#include <sys/types.h>
9#include <sys/stat.h>
10#include <sys/wait.h>
11#include <sys/mman.h>
12#include <netinet/in.h>
13#include <arpa/inet.h>
14#include <netdb.h>
15
16#include "fio.h"
17#include "server.h"
18#include "crc/crc32.h"
Jens Axboeb66570d2011-10-01 11:11:35 -060019#include "flist.h"
Jens Axboe132159a2011-09-30 15:01:32 -060020
Jens Axboeb66570d2011-10-01 11:11:35 -060021struct fio_client {
22 struct flist_head list;
23 struct sockaddr_in addr;
24 char *hostname;
25 int fd;
Jens Axboe81179ee2011-10-04 12:42:06 +020026
27 int state;
28
29 uint16_t argc;
30 char **argv;
31};
32
33enum {
Jens Axboe5c2857f2011-10-04 13:14:32 +020034 Client_created = 0,
Jens Axboe81179ee2011-10-04 12:42:06 +020035 Client_connected = 1,
36 Client_started = 2,
37 Client_stopped = 3,
Jens Axboe5c2857f2011-10-04 13:14:32 +020038 Client_exited = 4,
Jens Axboeb66570d2011-10-01 11:11:35 -060039};
40
41static FLIST_HEAD(client_list);
Jens Axboeb66570d2011-10-01 11:11:35 -060042
Jens Axboe0b8f30a2011-10-04 10:31:53 +020043static int handle_client(struct fio_client *client, int one);
44
Jens Axboeb66570d2011-10-01 11:11:35 -060045static struct fio_client *find_client_by_fd(int fd)
46{
47 struct fio_client *client;
48 struct flist_head *entry;
49
50 flist_for_each(entry, &client_list) {
51 client = flist_entry(entry, struct fio_client, list);
52
53 if (client->fd == fd)
54 return client;
55 }
56
57 return NULL;
58}
59
60static struct fio_client *find_client_by_name(const char *name)
61{
62 struct fio_client *client;
63 struct flist_head *entry;
64
65 flist_for_each(entry, &client_list) {
66 client = flist_entry(entry, struct fio_client, list);
67
68 if (!strcmp(name, client->hostname))
69 return client;
70 }
71
72 return NULL;
73}
74
75static void remove_client(struct fio_client *client)
76{
Jens Axboe46c48f12011-10-01 12:50:51 -060077 dprint(FD_NET, "removed client <%s>\n", client->hostname);
Jens Axboeb66570d2011-10-01 11:11:35 -060078 flist_del(&client->list);
79 nr_clients--;
Jens Axboe81179ee2011-10-04 12:42:06 +020080
Jens Axboeb66570d2011-10-01 11:11:35 -060081 free(client->hostname);
Jens Axboe81179ee2011-10-04 12:42:06 +020082 if (client->argv)
83 free(client->argv);
84
Jens Axboeb66570d2011-10-01 11:11:35 -060085 free(client);
86}
Jens Axboe132159a2011-09-30 15:01:32 -060087
Jens Axboe81179ee2011-10-04 12:42:06 +020088static void __fio_client_add_cmd_option(struct fio_client *client,
89 const char *opt)
90{
91 client->argc++;
92 client->argv = realloc(client->argv, sizeof(char *) * client->argc);
93 client->argv[client->argc - 1] = strdup(opt);
94}
95
96void fio_client_add_cmd_option(const char *hostname, const char *opt)
97{
98 struct fio_client *client;
99
100 if (!hostname || !opt)
101 return;
102
103 client = find_client_by_name(hostname);
104 if (!client) {
105 log_err("fio: unknown client %s\n", hostname);
106 return;
107 }
108
109 __fio_client_add_cmd_option(client, opt);
110}
111
Jens Axboea37f69b2011-10-01 12:24:21 -0600112void fio_client_add(const char *hostname)
Jens Axboe132159a2011-09-30 15:01:32 -0600113{
Jens Axboeb66570d2011-10-01 11:11:35 -0600114 struct fio_client *client;
Jens Axboe132159a2011-09-30 15:01:32 -0600115
Jens Axboe46c48f12011-10-01 12:50:51 -0600116 dprint(FD_NET, "added client <%s>\n", hostname);
Jens Axboeb66570d2011-10-01 11:11:35 -0600117 client = malloc(sizeof(*client));
Jens Axboea37f69b2011-10-01 12:24:21 -0600118 memset(client, 0, sizeof(*client));
Jens Axboe81179ee2011-10-04 12:42:06 +0200119
Jens Axboea37f69b2011-10-01 12:24:21 -0600120 client->hostname = strdup(hostname);
121 client->fd = -1;
Jens Axboe81179ee2011-10-04 12:42:06 +0200122
123 __fio_client_add_cmd_option(client, "fio");
124
Jens Axboea37f69b2011-10-01 12:24:21 -0600125 flist_add(&client->list, &client_list);
126 nr_clients++;
127}
128
129static int fio_client_connect(struct fio_client *client)
130{
131 int fd;
Jens Axboe132159a2011-09-30 15:01:32 -0600132
Jens Axboe46c48f12011-10-01 12:50:51 -0600133 dprint(FD_NET, "connect to host %s\n", client->hostname);
134
Jens Axboeb66570d2011-10-01 11:11:35 -0600135 memset(&client->addr, 0, sizeof(client->addr));
136 client->addr.sin_family = AF_INET;
137 client->addr.sin_port = htons(fio_net_port);
138
Jens Axboea37f69b2011-10-01 12:24:21 -0600139 if (inet_aton(client->hostname, &client->addr.sin_addr) != 1) {
Jens Axboe132159a2011-09-30 15:01:32 -0600140 struct hostent *hent;
141
Jens Axboea37f69b2011-10-01 12:24:21 -0600142 hent = gethostbyname(client->hostname);
Jens Axboe132159a2011-09-30 15:01:32 -0600143 if (!hent) {
144 log_err("fio: gethostbyname: %s\n", strerror(errno));
145 return 1;
146 }
147
Jens Axboeb66570d2011-10-01 11:11:35 -0600148 memcpy(&client->addr.sin_addr, hent->h_addr, 4);
Jens Axboe132159a2011-09-30 15:01:32 -0600149 }
150
151 fd = socket(AF_INET, SOCK_STREAM, 0);
152 if (fd < 0) {
153 log_err("fio: socket: %s\n", strerror(errno));
154 return 1;
155 }
156
Jens Axboeb66570d2011-10-01 11:11:35 -0600157 if (connect(fd, (struct sockaddr *) &client->addr, sizeof(client->addr)) < 0) {
Jens Axboe132159a2011-09-30 15:01:32 -0600158 log_err("fio: connect: %s\n", strerror(errno));
Jens Axboecdf54d82011-10-04 08:31:40 +0200159 log_err("fio: failed to connect to %s\n", client->hostname);
Jens Axboe132159a2011-09-30 15:01:32 -0600160 return 1;
161 }
162
Jens Axboeb66570d2011-10-01 11:11:35 -0600163 client->fd = fd;
Jens Axboe81179ee2011-10-04 12:42:06 +0200164 client->state = Client_connected;
Jens Axboe132159a2011-09-30 15:01:32 -0600165 return 0;
166}
167
Jens Axboecc0df002011-10-03 20:53:32 +0200168void fio_clients_terminate(void)
169{
170 struct flist_head *entry;
171 struct fio_client *client;
172
173 flist_for_each(entry, &client_list) {
174 client = flist_entry(entry, struct fio_client, list);
175
176 fio_net_send_simple_cmd(client->fd, FIO_NET_CMD_QUIT, 0);
177 }
178}
179
180static void sig_int(int sig)
181{
182 fio_clients_terminate();
183}
184
185static void client_signal_handler(void)
186{
187 struct sigaction act;
188
189 memset(&act, 0, sizeof(act));
190 act.sa_handler = sig_int;
191 act.sa_flags = SA_RESTART;
192 sigaction(SIGINT, &act, NULL);
193
194 memset(&act, 0, sizeof(act));
195 act.sa_handler = sig_int;
196 act.sa_flags = SA_RESTART;
197 sigaction(SIGTERM, &act, NULL);
198}
199
Jens Axboe0b8f30a2011-10-04 10:31:53 +0200200static void probe_client(struct fio_client *client)
201{
202 fio_net_send_simple_cmd(client->fd, FIO_NET_CMD_PROBE, 0);
203 handle_client(client, 1);
204}
205
Jens Axboe81179ee2011-10-04 12:42:06 +0200206static int send_client_cmd_line(struct fio_client *client)
207{
208 struct cmd_line_pdu *pdu;
209 int i, ret;
210
211 pdu = malloc(sizeof(*pdu));
212 for (i = 0; i < client->argc; i++)
213 strcpy((char *) pdu->argv[i], client->argv[i]);
214
215 pdu->argc = cpu_to_le16(client->argc);
216 ret = fio_net_send_cmd(client->fd, FIO_NET_CMD_JOBLINE, pdu, sizeof(*pdu));
217 free(pdu);
218 return ret;
219}
220
Jens Axboea37f69b2011-10-01 12:24:21 -0600221int fio_clients_connect(void)
222{
223 struct fio_client *client;
224 struct flist_head *entry, *tmp;
225 int ret;
226
Jens Axboecc0df002011-10-03 20:53:32 +0200227 client_signal_handler();
228
Jens Axboea37f69b2011-10-01 12:24:21 -0600229 flist_for_each_safe(entry, tmp, &client_list) {
230 client = flist_entry(entry, struct fio_client, list);
231
232 ret = fio_client_connect(client);
Jens Axboe0b8f30a2011-10-04 10:31:53 +0200233 if (ret) {
Jens Axboea37f69b2011-10-01 12:24:21 -0600234 remove_client(client);
Jens Axboe0b8f30a2011-10-04 10:31:53 +0200235 continue;
236 }
237
238 probe_client(client);
Jens Axboe81179ee2011-10-04 12:42:06 +0200239
240 if (client->argc > 1)
241 send_client_cmd_line(client);
Jens Axboea37f69b2011-10-01 12:24:21 -0600242 }
243
244 return !nr_clients;
245}
246
Jens Axboe132159a2011-09-30 15:01:32 -0600247/*
248 * Send file contents to server backend. We could use sendfile(), but to remain
249 * more portable lets just read/write the darn thing.
250 */
Jens Axboea37f69b2011-10-01 12:24:21 -0600251static int fio_client_send_ini(struct fio_client *client, const char *filename)
Jens Axboe132159a2011-09-30 15:01:32 -0600252{
253 struct stat sb;
254 char *p, *buf;
255 off_t len;
256 int fd, ret;
257
Jens Axboe46c48f12011-10-01 12:50:51 -0600258 dprint(FD_NET, "send ini %s to %s\n", filename, client->hostname);
259
Jens Axboe132159a2011-09-30 15:01:32 -0600260 fd = open(filename, O_RDONLY);
261 if (fd < 0) {
262 log_err("fio: job file open: %s\n", strerror(errno));
263 return 1;
264 }
265
266 if (fstat(fd, &sb) < 0) {
267 log_err("fio: job file stat: %s\n", strerror(errno));
268 return 1;
269 }
270
271 buf = malloc(sb.st_size);
272
273 len = sb.st_size;
274 p = buf;
275 do {
276 ret = read(fd, p, len);
277 if (ret > 0) {
278 len -= ret;
279 if (!len)
280 break;
281 p += ret;
282 continue;
283 } else if (!ret)
284 break;
285 else if (errno == EAGAIN || errno == EINTR)
286 continue;
287 } while (1);
288
Jens Axboe0b8f30a2011-10-04 10:31:53 +0200289 if (len) {
290 log_err("fio: failed reading job file %s\n", filename);
291 return 1;
292 }
293
Jens Axboe81179ee2011-10-04 12:42:06 +0200294 ret = fio_net_send_cmd(client->fd, FIO_NET_CMD_JOB, buf, sb.st_size);
Jens Axboe132159a2011-09-30 15:01:32 -0600295 free(buf);
296 return ret;
297}
Jens Axboe37db14f2011-09-30 17:00:42 -0600298
Jens Axboea37f69b2011-10-01 12:24:21 -0600299int fio_clients_send_ini(const char *filename)
300{
301 struct fio_client *client;
302 struct flist_head *entry, *tmp;
303
304 flist_for_each_safe(entry, tmp, &client_list) {
305 client = flist_entry(entry, struct fio_client, list);
306
307 if (fio_client_send_ini(client, filename))
308 remove_client(client);
309 }
310
311 return !nr_clients;
312}
313
Jens Axboea64e88d2011-10-03 14:20:01 +0200314static void convert_io_stat(struct io_stat *dst, struct io_stat *src)
315{
316 dst->max_val = le64_to_cpu(src->max_val);
317 dst->min_val = le64_to_cpu(src->min_val);
318 dst->samples = le64_to_cpu(src->samples);
319 /* FIXME */
Jens Axboeddcc0b62011-10-03 14:45:27 +0200320 dst->mean = __le64_to_cpu(src->mean);
321 dst->S = __le64_to_cpu(src->S);
Jens Axboea64e88d2011-10-03 14:20:01 +0200322}
323
324static void convert_ts(struct thread_stat *dst, struct thread_stat *src)
325{
326 int i, j;
327
328 dst->error = le32_to_cpu(src->error);
329 dst->groupid = le32_to_cpu(src->groupid);
330 dst->pid = le32_to_cpu(src->pid);
331 dst->members = le32_to_cpu(src->members);
332
333 for (i = 0; i < 2; i++) {
334 convert_io_stat(&dst->clat_stat[i], &src->clat_stat[i]);
335 convert_io_stat(&dst->slat_stat[i], &src->slat_stat[i]);
336 convert_io_stat(&dst->lat_stat[i], &src->lat_stat[i]);
337 convert_io_stat(&dst->bw_stat[i], &src->bw_stat[i]);
338 }
339
340 dst->usr_time = le64_to_cpu(src->usr_time);
341 dst->sys_time = le64_to_cpu(src->sys_time);
342 dst->ctx = le64_to_cpu(src->ctx);
343 dst->minf = le64_to_cpu(src->minf);
344 dst->majf = le64_to_cpu(src->majf);
345 dst->clat_percentiles = le64_to_cpu(src->clat_percentiles);
346 dst->percentile_list = NULL;
347
348 for (i = 0; i < FIO_IO_U_MAP_NR; i++) {
349 dst->io_u_map[i] = le32_to_cpu(src->io_u_map[i]);
350 dst->io_u_submit[i] = le32_to_cpu(src->io_u_submit[i]);
351 dst->io_u_complete[i] = le32_to_cpu(src->io_u_complete[i]);
352 }
353
354 for (i = 0; i < FIO_IO_U_LAT_U_NR; i++) {
355 dst->io_u_lat_u[i] = le32_to_cpu(src->io_u_lat_u[i]);
356 dst->io_u_lat_m[i] = le32_to_cpu(src->io_u_lat_m[i]);
357 }
358
359 for (i = 0; i < 2; i++)
360 for (j = 0; j < FIO_IO_U_PLAT_NR; j++)
361 dst->io_u_plat[i][j] = le32_to_cpu(src->io_u_plat[i][j]);
362
363 for (i = 0; i < 3; i++) {
364 dst->total_io_u[i] = le64_to_cpu(src->total_io_u[i]);
Jens Axboe93eee042011-10-03 21:08:48 +0200365 dst->short_io_u[i] = le64_to_cpu(src->short_io_u[i]);
Jens Axboea64e88d2011-10-03 14:20:01 +0200366 }
367
368 dst->total_submit = le64_to_cpu(src->total_submit);
369 dst->total_complete = le64_to_cpu(src->total_complete);
370
371 for (i = 0; i < 2; i++) {
372 dst->io_bytes[i] = le64_to_cpu(src->io_bytes[i]);
373 dst->runtime[i] = le64_to_cpu(src->runtime[i]);
374 }
375
376 dst->total_run_time = le64_to_cpu(src->total_run_time);
377 dst->continue_on_error = le16_to_cpu(src->continue_on_error);
378 dst->total_err_count = le64_to_cpu(src->total_err_count);
Jens Axboeddcc0b62011-10-03 14:45:27 +0200379 dst->first_error = le32_to_cpu(src->first_error);
380 dst->kb_base = le32_to_cpu(src->kb_base);
Jens Axboea64e88d2011-10-03 14:20:01 +0200381}
382
383static void convert_gs(struct group_run_stats *dst, struct group_run_stats *src)
384{
385 int i;
386
387 for (i = 0; i < 2; i++) {
388 dst->max_run[i] = le64_to_cpu(src->max_run[i]);
389 dst->min_run[i] = le64_to_cpu(src->min_run[i]);
390 dst->max_bw[i] = le64_to_cpu(src->max_bw[i]);
391 dst->min_bw[i] = le64_to_cpu(src->min_bw[i]);
392 dst->io_kb[i] = le64_to_cpu(src->io_kb[i]);
393 dst->agg[i] = le64_to_cpu(src->agg[i]);
394 }
395
396 dst->kb_base = le32_to_cpu(src->kb_base);
397 dst->groupid = le32_to_cpu(src->groupid);
398}
399
400static void handle_ts(struct fio_net_cmd *cmd)
401{
402 struct cmd_ts_pdu *p = (struct cmd_ts_pdu *) cmd->payload;
403
404 convert_ts(&p->ts, &p->ts);
405 convert_gs(&p->rs, &p->rs);
406
407 show_thread_status(&p->ts, &p->rs);
408}
409
410static void handle_gs(struct fio_net_cmd *cmd)
411{
412 struct group_run_stats *gs = (struct group_run_stats *) cmd->payload;
413
414 convert_gs(gs, gs);
415 show_group_stats(gs);
416}
417
Jens Axboecf451d12011-10-03 16:48:30 +0200418static void handle_eta(struct fio_net_cmd *cmd)
419{
420 struct jobs_eta *je = (struct jobs_eta *) cmd->payload;
421 int i;
422
423 je->nr_running = le32_to_cpu(je->nr_running);
424 je->nr_ramp = le32_to_cpu(je->nr_ramp);
425 je->nr_pending = le32_to_cpu(je->nr_pending);
426 je->files_open = le32_to_cpu(je->files_open);
427 je->m_rate = le32_to_cpu(je->m_rate);
428 je->t_rate = le32_to_cpu(je->t_rate);
429 je->m_iops = le32_to_cpu(je->m_iops);
430 je->t_iops = le32_to_cpu(je->t_iops);
431
432 for (i = 0; i < 2; i++) {
433 je->rate[i] = le32_to_cpu(je->rate[i]);
434 je->iops[i] = le32_to_cpu(je->iops[i]);
435 }
436
437 je->elapsed_sec = le32_to_cpu(je->nr_running);
438 je->eta_sec = le64_to_cpu(je->eta_sec);
439
440 display_thread_status(je);
441}
442
Jens Axboe2e03b4b2011-10-04 09:00:40 +0200443static void handle_probe(struct fio_net_cmd *cmd)
444{
445 struct cmd_probe_pdu *probe = (struct cmd_probe_pdu *) cmd->payload;
446
Jens Axboe0b8f30a2011-10-04 10:31:53 +0200447 log_info("Probe: hostname=%s, fio ver %u.%u.%u\n", probe->hostname,
448 probe->fio_major, probe->fio_minor, probe->fio_patch);
Jens Axboe2e03b4b2011-10-04 09:00:40 +0200449}
450
Jens Axboe0b8f30a2011-10-04 10:31:53 +0200451static int handle_client(struct fio_client *client, int one)
Jens Axboe37db14f2011-09-30 17:00:42 -0600452{
453 struct fio_net_cmd *cmd;
Jens Axboea450e492011-10-03 14:24:03 +0200454 int done = 0;
Jens Axboe37db14f2011-09-30 17:00:42 -0600455
Jens Axboe70e0c312011-10-04 09:18:30 +0200456 while ((cmd = fio_net_recv_cmd(client->fd, 1)) != NULL) {
Jens Axboe46c48f12011-10-01 12:50:51 -0600457 dprint(FD_NET, "%s: got cmd op %d\n", client->hostname,
458 cmd->opcode);
459
Jens Axboea64e88d2011-10-03 14:20:01 +0200460 switch (cmd->opcode) {
Jens Axboea64e88d2011-10-03 14:20:01 +0200461 case FIO_NET_CMD_QUIT:
Jens Axboeb66570d2011-10-01 11:11:35 -0600462 remove_client(client);
Jens Axboe437377e2011-10-01 08:31:30 -0600463 free(cmd);
Jens Axboea450e492011-10-03 14:24:03 +0200464 done = 1;
Jens Axboe437377e2011-10-01 08:31:30 -0600465 break;
Jens Axboea64e88d2011-10-03 14:20:01 +0200466 case FIO_NET_CMD_TEXT:
Jens Axboe0b8f30a2011-10-04 10:31:53 +0200467 fprintf(f_out, "Client <%s>: ", client->hostname);
468 fwrite(cmd->payload, cmd->pdu_len, 1, f_out);
469 fflush(f_out);
Jens Axboe37db14f2011-09-30 17:00:42 -0600470 free(cmd);
Jens Axboea64e88d2011-10-03 14:20:01 +0200471 break;
472 case FIO_NET_CMD_TS:
473 handle_ts(cmd);
474 free(cmd);
475 break;
476 case FIO_NET_CMD_GS:
477 handle_gs(cmd);
478 free(cmd);
479 break;
Jens Axboecf451d12011-10-03 16:48:30 +0200480 case FIO_NET_CMD_ETA:
481 handle_eta(cmd);
482 free(cmd);
483 break;
Jens Axboe2e03b4b2011-10-04 09:00:40 +0200484 case FIO_NET_CMD_PROBE:
485 handle_probe(cmd);
486 free(cmd);
487 break;
Jens Axboe81179ee2011-10-04 12:42:06 +0200488 case FIO_NET_CMD_START:
489 client->state = Client_started;
490 free(cmd);
491 break;
492 case FIO_NET_CMD_STOP:
493 client->state = Client_stopped;
494 free(cmd);
495 break;
Jens Axboea64e88d2011-10-03 14:20:01 +0200496 default:
497 log_err("fio: unknown client op: %d\n", cmd->opcode);
498 free(cmd);
499 break;
Jens Axboe37db14f2011-09-30 17:00:42 -0600500 }
Jens Axboea450e492011-10-03 14:24:03 +0200501
Jens Axboe0b8f30a2011-10-04 10:31:53 +0200502 if (done || one)
Jens Axboea450e492011-10-03 14:24:03 +0200503 break;
Jens Axboe37db14f2011-09-30 17:00:42 -0600504 }
505
506 return 0;
507}
Jens Axboeb66570d2011-10-01 11:11:35 -0600508
509int fio_handle_clients(void)
510{
511 struct fio_client *client;
512 struct flist_head *entry;
513 struct pollfd *pfds;
Jens Axboe82a4be12011-10-01 12:40:32 -0600514 int i, ret = 0;
Jens Axboeb66570d2011-10-01 11:11:35 -0600515
516 pfds = malloc(nr_clients * sizeof(struct pollfd));
517
Jens Axboeb66570d2011-10-01 11:11:35 -0600518 while (!exit_backend && nr_clients) {
Jens Axboe82a4be12011-10-01 12:40:32 -0600519 i = 0;
520 flist_for_each(entry, &client_list) {
521 client = flist_entry(entry, struct fio_client, list);
522
523 pfds[i].fd = client->fd;
524 pfds[i].events = POLLIN;
525 i++;
526 }
527
528 assert(i == nr_clients);
529
Jens Axboe5c2857f2011-10-04 13:14:32 +0200530 do {
531 ret = poll(pfds, nr_clients, 100);
532 if (ret < 0) {
533 if (errno == EINTR)
534 continue;
535 log_err("fio: poll clients: %s\n", strerror(errno));
536 break;
537 } else if (!ret)
Jens Axboeb66570d2011-10-01 11:11:35 -0600538 continue;
Jens Axboe5c2857f2011-10-04 13:14:32 +0200539 } while (ret <= 0);
Jens Axboeb66570d2011-10-01 11:11:35 -0600540
541 for (i = 0; i < nr_clients; i++) {
542 if (!(pfds[i].revents & POLLIN))
543 continue;
544
545 client = find_client_by_fd(pfds[i].fd);
546 if (!client) {
547 log_err("fio: unknown client\n");
548 continue;
549 }
Jens Axboe0b8f30a2011-10-04 10:31:53 +0200550 handle_client(client, 0);
Jens Axboeb66570d2011-10-01 11:11:35 -0600551 }
552 }
553
554 free(pfds);
Jens Axboeb66570d2011-10-01 11:11:35 -0600555 return 0;
556}