chiark / gitweb /
udevadm: control - use getopt_long()
[elogind.git] / udev / udevtrigger.c
1 /*
2  * Copyright (C) 2004-2006 Kay Sievers <kay@vrfy.org>
3  * Copyright (C) 2006 Hannes Reinecke <hare@suse.de>
4  *
5  *      This program is free software; you can redistribute it and/or modify it
6  *      under the terms of the GNU General Public License as published by the
7  *      Free Software Foundation version 2 of the License.
8  * 
9  *      This program is distributed in the hope that it will be useful, but
10  *      WITHOUT ANY WARRANTY; without even the implied warranty of
11  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  *      General Public License for more details.
13  * 
14  *      You should have received a copy of the GNU General Public License along
15  *      with this program; if not, write to the Free Software Foundation, Inc.,
16  *      51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17  *
18  */
19
20 #include <stdlib.h>
21 #include <stddef.h>
22 #include <string.h>
23 #include <stdio.h>
24 #include <unistd.h>
25 #include <getopt.h>
26 #include <errno.h>
27 #include <dirent.h>
28 #include <fcntl.h>
29 #include <syslog.h>
30 #include <fnmatch.h>
31 #include <sys/stat.h>
32 #include <sys/types.h>
33 #include <sys/socket.h>
34 #include <sys/un.h>
35
36 #include "udev.h"
37 #include "udevd.h"
38 #include "udev_rules.h"
39
40 static int verbose;
41 static int dry_run;
42 LIST_HEAD(device_list);
43 LIST_HEAD(filter_subsystem_match_list);
44 LIST_HEAD(filter_subsystem_nomatch_list);
45 LIST_HEAD(filter_attr_match_list);
46 LIST_HEAD(filter_attr_nomatch_list);
47 static int sock = -1;
48 static struct sockaddr_un saddr;
49 static socklen_t saddrlen;
50
51 /* devices that should run last cause of their dependencies */
52 static int delay_device(const char *devpath)
53 {
54         static const char *delay_device_list[] = {
55                 "*/md*",
56                 "*/dm-*",
57                 NULL
58         };
59         int i;
60
61         for (i = 0; delay_device_list[i] != NULL; i++)
62                 if (fnmatch(delay_device_list[i], devpath, 0) == 0)
63                         return 1;
64         return 0;
65 }
66
67 static int device_list_insert(const char *path)
68 {
69         char filename[PATH_SIZE];
70         char devpath[PATH_SIZE];
71         struct stat statbuf;
72
73         dbg("add '%s'\n" , path);
74
75         /* we only have a device, if we have an uevent file */
76         strlcpy(filename, path, sizeof(filename));
77         strlcat(filename, "/uevent", sizeof(filename));
78         if (stat(filename, &statbuf) < 0)
79                 return -1;
80         if (!(statbuf.st_mode & S_IWUSR))
81                 return -1;
82
83         strlcpy(devpath, &path[strlen(sysfs_path)], sizeof(devpath));
84
85         /* resolve possible link to real target */
86         if (lstat(path, &statbuf) < 0)
87                 return -1;
88         if (S_ISLNK(statbuf.st_mode))
89                 if (sysfs_resolve_link(devpath, sizeof(devpath)) != 0)
90                         return -1;
91
92         name_list_add(&device_list, devpath, 1);
93         return 0;
94 }
95
96 static void trigger_uevent(const char *devpath, const char *action)
97 {
98         char filename[PATH_SIZE];
99         int fd;
100
101         strlcpy(filename, sysfs_path, sizeof(filename));
102         strlcat(filename, devpath, sizeof(filename));
103         strlcat(filename, "/uevent", sizeof(filename));
104
105         if (verbose)
106                 printf("%s\n", devpath);
107
108         if (dry_run)
109                 return;
110
111         fd = open(filename, O_WRONLY);
112         if (fd < 0) {
113                 dbg("error on opening %s: %s\n", filename, strerror(errno));
114                 return;
115         }
116
117         if (write(fd, action, strlen(action)) < 0)
118                 info("error writing '%s' to '%s': %s\n", action, filename, strerror(errno));
119
120         close(fd);
121 }
122
123 static int pass_to_socket(const char *devpath, const char *action, const char *env)
124 {
125         struct udevice *udev;
126         struct name_entry *name_loop;
127         char buf[4096];
128         size_t bufpos = 0;
129         ssize_t count;
130         char path[PATH_SIZE];
131         int fd;
132         char link_target[PATH_SIZE];
133         int len;
134         int err = 0;
135
136         if (verbose)
137                 printf("%s\n", devpath);
138
139         udev = udev_device_init();
140         if (udev == NULL)
141                 return -1;
142         udev_db_get_device(udev, devpath);
143
144         /* add header */
145         bufpos = snprintf(buf, sizeof(buf)-1, "%s@%s", action, devpath);
146         bufpos++;
147
148         /* add cookie */
149         if (env != NULL) {
150                 bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "%s", env);
151                 bufpos++;
152         }
153
154         /* add standard keys */
155         bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "DEVPATH=%s", devpath);
156         bufpos++;
157         bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "ACTION=%s", action);
158         bufpos++;
159
160         /* add subsystem */
161         strlcpy(path, sysfs_path, sizeof(path));
162         strlcat(path, devpath, sizeof(path));
163         strlcat(path, "/subsystem", sizeof(path));
164         len = readlink(path, link_target, sizeof(link_target));
165         if (len > 0) {
166                 char *pos;
167
168                 link_target[len] = '\0';
169                 pos = strrchr(link_target, '/');
170                 if (pos != NULL) {
171                         bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "SUBSYSTEM=%s", &pos[1]);
172                         bufpos++;
173                 }
174         }
175
176         /* add symlinks and node name */
177         path[0] = '\0';
178         list_for_each_entry(name_loop, &udev->symlink_list, node) {
179                 strlcat(path, udev_root, sizeof(path));
180                 strlcat(path, "/", sizeof(path));
181                 strlcat(path, name_loop->name, sizeof(path));
182                 strlcat(path, " ", sizeof(path));
183         }
184         remove_trailing_chars(path, ' ');
185         if (path[0] != '\0') {
186                 bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "DEVLINKS=%s", path);
187                 bufpos++;
188         }
189         if (udev->name[0] != '\0') {
190                 strlcpy(path, udev_root, sizeof(path));
191                 strlcat(path, "/", sizeof(path));
192                 strlcat(path, udev->name, sizeof(path));
193                 bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "DEVNAME=%s", path);
194                 bufpos++;
195         }
196
197         /* add keys from device "uevent" file */
198         strlcpy(path, sysfs_path, sizeof(path));
199         strlcat(path, devpath, sizeof(path));
200         strlcat(path, "/uevent", sizeof(path));
201         fd = open(path, O_RDONLY);
202         if (fd >= 0) {
203                 char value[4096];
204
205                 count = read(fd, value, sizeof(value));
206                 close(fd);
207                 if (count > 0) {
208                         char *key;
209
210                         value[count] = '\0';
211                         key = value;
212                         while (key[0] != '\0') {
213                                 char *next;
214
215                                 next = strchr(key, '\n');
216                                 if (next == NULL)
217                                         break;
218                                 next[0] = '\0';
219                                 bufpos += strlcpy(&buf[bufpos], key, sizeof(buf) - bufpos-1);
220                                 bufpos++;
221                                 key = &next[1];
222                         }
223                 }
224         }
225
226         /* add keys from database */
227         list_for_each_entry(name_loop, &udev->env_list, node) {
228                 bufpos += strlcpy(&buf[bufpos], name_loop->name, sizeof(buf) - bufpos-1);
229                 bufpos++;
230         }
231         if (bufpos > sizeof(buf))
232                 bufpos = sizeof(buf);
233
234         count = sendto(sock, &buf, bufpos, 0, (struct sockaddr *)&saddr, saddrlen);
235         if (count < 0)
236                 err = -1;
237
238         return err;
239 }
240
241 static void exec_list(const char *action, const char *env)
242 {
243         struct name_entry *loop_device;
244         struct name_entry *tmp_device;
245
246         list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) {
247                 if (delay_device(loop_device->name))
248                         continue;
249                 if (sock >= 0)
250                         pass_to_socket(loop_device->name, action, env);
251                 else
252                         trigger_uevent(loop_device->name, action);
253                 list_del(&loop_device->node);
254                 free(loop_device);
255         }
256
257         /* trigger remaining delayed devices */
258         list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) {
259                 if (sock >= 0)
260                         pass_to_socket(loop_device->name, action, env);
261                 else
262                         trigger_uevent(loop_device->name, action);
263                 list_del(&loop_device->node);
264                 free(loop_device);
265         }
266 }
267
268 static int subsystem_filtered(const char *subsystem)
269 {
270         struct name_entry *loop_name;
271
272         /* skip devices matching the listed subsystems */
273         list_for_each_entry(loop_name, &filter_subsystem_nomatch_list, node)
274                 if (fnmatch(loop_name->name, subsystem, 0) == 0)
275                         return 1;
276
277         /* skip devices not matching the listed subsystems */
278         if (!list_empty(&filter_subsystem_match_list)) {
279                 list_for_each_entry(loop_name, &filter_subsystem_match_list, node)
280                         if (fnmatch(loop_name->name, subsystem, 0) == 0)
281                                 return 0;
282                 return 1;
283         }
284
285         return 0;
286 }
287
288 static int attr_match(const char *path, const char *attr_value)
289 {
290         char attr[NAME_SIZE];
291         char file[PATH_SIZE];
292         char *match_value;
293
294         strlcpy(attr, attr_value, sizeof(attr));
295
296         /* separate attr and match value */
297         match_value = strchr(attr, '=');
298         if (match_value != NULL) {
299                 match_value[0] = '\0';
300                 match_value = &match_value[1];
301         }
302
303         strlcpy(file, path, sizeof(file));
304         strlcat(file, "/", sizeof(file));
305         strlcat(file, attr, sizeof(file));
306
307         if (match_value != NULL) {
308                 /* match file content */
309                 char value[NAME_SIZE];
310                 int fd;
311                 ssize_t size;
312
313                 fd = open(file, O_RDONLY);
314                 if (fd < 0)
315                         return 0;
316                 size = read(fd, value, sizeof(value));
317                 close(fd);
318                 if (size < 0)
319                         return 0;
320                 value[size] = '\0';
321                 remove_trailing_chars(value, '\n');
322
323                 /* match if attribute value matches */
324                 if (fnmatch(match_value, value, 0) == 0)
325                         return 1;
326         } else {
327                 /* match if attribute exists */
328                 struct stat statbuf;
329
330                 if (stat(file, &statbuf) == 0)
331                         return 1;
332         }
333         return 0;
334 }
335
336 static int attr_filtered(const char *path)
337 {
338         struct name_entry *loop_name;
339
340         /* skip devices matching the listed sysfs attributes */
341         list_for_each_entry(loop_name, &filter_attr_nomatch_list, node)
342                 if (attr_match(path, loop_name->name))
343                         return 1;
344
345         /* skip devices not matching the listed sysfs attributes */
346         if (!list_empty(&filter_attr_match_list)) {
347                 list_for_each_entry(loop_name, &filter_attr_match_list, node)
348                         if (attr_match(path, loop_name->name))
349                                 return 0;
350                 return 1;
351         }
352         return 0;
353 }
354
355 enum scan_type {
356         SCAN_DEVICES,
357         SCAN_SUBSYSTEM,
358 };
359
360 static void scan_subsystem(const char *subsys, enum scan_type scan)
361 {
362         char base[PATH_SIZE];
363         DIR *dir;
364         struct dirent *dent;
365         const char *subdir;
366
367         if (scan == SCAN_DEVICES)
368                 subdir = "/devices";
369         else if (scan == SCAN_SUBSYSTEM)
370                 subdir = "/drivers";
371         else
372                 return;
373
374         strlcpy(base, sysfs_path, sizeof(base));
375         strlcat(base, "/", sizeof(base));
376         strlcat(base, subsys, sizeof(base));
377
378         dir = opendir(base);
379         if (dir != NULL) {
380                 for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
381                         char dirname[PATH_SIZE];
382                         DIR *dir2;
383                         struct dirent *dent2;
384
385                         if (dent->d_name[0] == '.')
386                                 continue;
387
388                         if (scan == SCAN_DEVICES)
389                                 if (subsystem_filtered(dent->d_name))
390                                         continue;
391
392                         strlcpy(dirname, base, sizeof(dirname));
393                         strlcat(dirname, "/", sizeof(dirname));
394                         strlcat(dirname, dent->d_name, sizeof(dirname));
395
396                         if (scan == SCAN_SUBSYSTEM) {
397                                 if (attr_filtered(dirname))
398                                         continue;
399                                 if (!subsystem_filtered("subsystem"))
400                                         device_list_insert(dirname);
401                                 if (subsystem_filtered("drivers"))
402                                         continue;
403                         }
404
405                         strlcat(dirname, subdir, sizeof(dirname));
406
407                         /* look for devices/drivers */
408                         dir2 = opendir(dirname);
409                         if (dir2 != NULL) {
410                                 for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) {
411                                         char dirname2[PATH_SIZE];
412
413                                         if (dent2->d_name[0] == '.')
414                                                 continue;
415
416                                         strlcpy(dirname2, dirname, sizeof(dirname2));
417                                         strlcat(dirname2, "/", sizeof(dirname2));
418                                         strlcat(dirname2, dent2->d_name, sizeof(dirname2));
419                                         if (attr_filtered(dirname2))
420                                                 continue;
421                                         device_list_insert(dirname2);
422                                 }
423                                 closedir(dir2);
424                         }
425                 }
426                 closedir(dir);
427         }
428 }
429
430 static void scan_block(void)
431 {
432         char base[PATH_SIZE];
433         DIR *dir;
434         struct dirent *dent;
435
436         if (subsystem_filtered("block"))
437                 return;
438
439         strlcpy(base, sysfs_path, sizeof(base));
440         strlcat(base, "/block", sizeof(base));
441
442         dir = opendir(base);
443         if (dir != NULL) {
444                 for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
445                         char dirname[PATH_SIZE];
446                         DIR *dir2;
447                         struct dirent *dent2;
448
449                         if (dent->d_name[0] == '.')
450                                 continue;
451
452                         strlcpy(dirname, base, sizeof(dirname));
453                         strlcat(dirname, "/", sizeof(dirname));
454                         strlcat(dirname, dent->d_name, sizeof(dirname));
455                         if (attr_filtered(dirname))
456                                 continue;
457                         if (device_list_insert(dirname) != 0)
458                                 continue;
459
460                         /* look for partitions */
461                         dir2 = opendir(dirname);
462                         if (dir2 != NULL) {
463                                 for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) {
464                                         char dirname2[PATH_SIZE];
465
466                                         if (dent2->d_name[0] == '.')
467                                                 continue;
468
469                                         if (!strcmp(dent2->d_name,"device"))
470                                                 continue;
471
472                                         strlcpy(dirname2, dirname, sizeof(dirname2));
473                                         strlcat(dirname2, "/", sizeof(dirname2));
474                                         strlcat(dirname2, dent2->d_name, sizeof(dirname2));
475                                         if (attr_filtered(dirname2))
476                                                 continue;
477                                         device_list_insert(dirname2);
478                                 }
479                                 closedir(dir2);
480                         }
481                 }
482                 closedir(dir);
483         }
484 }
485
486 static void scan_class(void)
487 {
488         char base[PATH_SIZE];
489         DIR *dir;
490         struct dirent *dent;
491
492         strlcpy(base, sysfs_path, sizeof(base));
493         strlcat(base, "/class", sizeof(base));
494
495         dir = opendir(base);
496         if (dir != NULL) {
497                 for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
498                         char dirname[PATH_SIZE];
499                         DIR *dir2;
500                         struct dirent *dent2;
501
502                         if (dent->d_name[0] == '.')
503                                 continue;
504
505                         if (subsystem_filtered(dent->d_name))
506                                 continue;
507
508                         strlcpy(dirname, base, sizeof(dirname));
509                         strlcat(dirname, "/", sizeof(dirname));
510                         strlcat(dirname, dent->d_name, sizeof(dirname));
511                         dir2 = opendir(dirname);
512                         if (dir2 != NULL) {
513                                 for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) {
514                                         char dirname2[PATH_SIZE];
515
516                                         if (dent2->d_name[0] == '.')
517                                                 continue;
518
519                                         if (!strcmp(dent2->d_name, "device"))
520                                                 continue;
521
522                                         strlcpy(dirname2, dirname, sizeof(dirname2));
523                                         strlcat(dirname2, "/", sizeof(dirname2));
524                                         strlcat(dirname2, dent2->d_name, sizeof(dirname2));
525                                         if (attr_filtered(dirname2))
526                                                 continue;
527                                         device_list_insert(dirname2);
528                                 }
529                                 closedir(dir2);
530                         }
531                 }
532                 closedir(dir);
533         }
534 }
535
536 static void scan_failed(void)
537 {
538         char base[PATH_SIZE];
539         DIR *dir;
540         struct dirent *dent;
541
542         strlcpy(base, udev_root, sizeof(base));
543         strlcat(base, "/.udev/failed", sizeof(base));
544
545         dir = opendir(base);
546         if (dir != NULL) {
547                 for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
548                         char device[PATH_SIZE];
549                         size_t start;
550
551                         if (dent->d_name[0] == '.')
552                                 continue;
553
554                         start = strlcpy(device, sysfs_path, sizeof(device));
555                         if(start >= sizeof(device))
556                                 start = sizeof(device) - 1;
557                         strlcat(device, dent->d_name, sizeof(device));
558                         path_decode(&device[start]);
559                         device_list_insert(device);
560                 }
561                 closedir(dir);
562         }
563 }
564
565 int udevtrigger(int argc, char *argv[])
566 {
567         int failed = 0;
568         const char *sockpath = NULL;
569         int option;
570         const char *action = "add";
571         const char *env = NULL;
572         static const struct option options[] = {
573                 { "verbose", 0, NULL, 'v' },
574                 { "dry-run", 0, NULL, 'n' },
575                 { "retry-failed", 0, NULL, 'F' },
576                 { "socket", 1, NULL, 'o' },
577                 { "help", 0, NULL, 'h' },
578                 { "action", 1, NULL, 'c' },
579                 { "subsystem-match", 1, NULL, 's' },
580                 { "subsystem-nomatch", 1, NULL, 'S' },
581                 { "attr-match", 1, NULL, 'a' },
582                 { "attr-nomatch", 1, NULL, 'A' },
583                 { "env", 1, NULL, 'e' },
584                 {}
585         };
586
587         logging_init("udevtrigger");
588         udev_config_init();
589         dbg("version %s\n", VERSION);
590         sysfs_init();
591
592         while (1) {
593                 option = getopt_long(argc, argv, "vnFo:hce::s:S:a:A:", options, NULL);
594                 if (option == -1)
595                         break;
596
597                 switch (option) {
598                 case 'v':
599                         verbose = 1;
600                         break;
601                 case 'n':
602                         dry_run = 1;
603                         break;
604                 case 'F':
605                         failed = 1;
606                         break;
607                 case 'o':
608                         sockpath = optarg;
609                         break;
610                 case 'c':
611                         action = optarg;
612                         break;
613                 case 'e':
614                         if (strchr(optarg, '=') != NULL)
615                                 env = optarg;
616                         break;
617                 case 's':
618                         name_list_add(&filter_subsystem_match_list, optarg, 0);
619                         break;
620                 case 'S':
621                         name_list_add(&filter_subsystem_nomatch_list, optarg, 0);
622                         break;
623                 case 'a':
624                         name_list_add(&filter_attr_match_list, optarg, 0);
625                         break;
626                 case 'A':
627                         name_list_add(&filter_attr_nomatch_list, optarg, 0);
628                         break;
629                 case 'h':
630                         printf("Usage: udevadm trigger OPTIONS\n"
631                                "  --verbose                       print the list of devices while running\n"
632                                "  --dry-run                       do not actually trigger the events\n"
633                                "  --retry-failed                  trigger only the events which have been\n"
634                                "                                  marked as failed during a previous run\n"
635                                "  --socket=<socket path>          pass events to socket instead of triggering kernel events\n"
636                                "  --env=<KEY>=<value>             pass an additional key (works only with --socket=)\n"
637                                "  --subsystem-match=<subsystem>   trigger devices from a matching subystem\n"
638                                "  --subsystem-nomatch=<subsystem> exclude devices from a matching subystem\n"
639                                "  --attr-match=<file[=<value>]>   trigger devices with a matching sysfs\n"
640                                "                                  attribute\n"
641                                "  --attr-nomatch=<file[=<value>]> exclude devices with a matching sysfs\n"
642                                "                                  attribute\n"
643                                "  --help                          print this text\n"
644                                "\n");
645                         goto exit;
646                 default:
647                         goto exit;
648                 }
649         }
650
651         if (sockpath != NULL) {
652                 struct stat stats;
653
654                 sock = socket(AF_LOCAL, SOCK_DGRAM, 0);
655                 memset(&saddr, 0x00, sizeof(struct sockaddr_un));
656                 saddr.sun_family = AF_LOCAL;
657                 if (sockpath[0] == '@') {
658                         /* abstract namespace socket requested */
659                         strlcpy(&saddr.sun_path[1], &sockpath[1], sizeof(saddr.sun_path)-1);
660                         saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]);
661                 } else if (stat(sockpath, &stats) == 0 && S_ISSOCK(stats.st_mode)) {
662                         /* existing socket file */
663                         strlcpy(saddr.sun_path, sockpath, sizeof(saddr.sun_path));
664                         saddrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path);
665                 } else {
666                         /* no socket file, assume abstract namespace socket */
667                         strlcpy(&saddr.sun_path[1], sockpath, sizeof(saddr.sun_path)-1);
668                         saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]);
669                 }
670         } else if (env != NULL) {
671                 fprintf(stderr, "error: --env= only valid with --socket= option\n");
672                 goto exit;
673         }
674
675         if (failed) {
676                 scan_failed();
677                 exec_list(action, env);
678         } else {
679                 char base[PATH_SIZE];
680                 struct stat statbuf;
681
682                 /* if we have /sys/subsystem, forget all the old stuff */
683                 strlcpy(base, sysfs_path, sizeof(base));
684                 strlcat(base, "/subsystem", sizeof(base));
685                 if (stat(base, &statbuf) == 0) {
686                         scan_subsystem("subsystem", SCAN_SUBSYSTEM);
687                         exec_list(action, env);
688                         scan_subsystem("subsystem", SCAN_DEVICES);
689                         exec_list(action, env);
690                 } else {
691                         scan_subsystem("bus", SCAN_SUBSYSTEM);
692                         exec_list(action, env);
693                         scan_subsystem("bus", SCAN_DEVICES);
694                         scan_class();
695
696                         /* scan "block" if it isn't a "class" */
697                         strlcpy(base, sysfs_path, sizeof(base));
698                         strlcat(base, "/class/block", sizeof(base));
699                         if (stat(base, &statbuf) != 0)
700                                 scan_block();
701                         exec_list(action, env);
702                 }
703         }
704
705 exit:
706         name_list_cleanup(&filter_subsystem_match_list);
707         name_list_cleanup(&filter_subsystem_nomatch_list);
708         name_list_cleanup(&filter_attr_match_list);
709         name_list_cleanup(&filter_attr_nomatch_list);
710
711         if (sock >= 0)
712                 close(sock);
713         sysfs_cleanup();
714         logging_close();
715         return 0;
716 }