a7f1862f2747919090da85c2c4fcc140ae282463
[project/mountd.git] / mount.c
1 #include <stdio.h>
2 #include <string.h>
3 #include <stdlib.h>
4 #include <unistd.h>
5 #include <sys/stat.h>
6 #include <sys/types.h>
7 #include <fcntl.h>
8 #include <sys/ioctl.h>
9 #include <linux/hdreg.h>
10 #include <scsi/sg.h>
11 #include <dirent.h>
12 #include <sys/wait.h>
13 #include <sys/inotify.h>
14 #include <sys/stat.h>
15 #include <sys/types.h>
16 #include <glob.h>
17 #include <libgen.h>
18 #include <poll.h>
19 #include <dirent.h>
20 #include <syslog.h>
21
22 #include "include/log.h"
23 #include "include/list.h"
24 #include "include/sys.h"
25 #include "include/signal.h"
26 #include "include/timer.h"
27 #include "include/autofs.h"
28 #include "include/ucix.h"
29 #include "include/fs.h"
30 #include "include/mount.h"
31
32 int mount_new(char *path, char *dev);
33
34 static struct list_head mounts;
35
36 struct mount {
37 struct list_head list;
38 char name[64];
39 char dev[64];
40 char serial[64];
41 char vendor[64];
42 char model[64];
43 char rev[64];
44 int mounted;
45 int ignore;
46 char size[64];
47 char sector_size[64];
48 int fs;
49 };
50
51 static char *fs_names[] = {
52 "",
53 "",
54 "mbr",
55 "ext2",
56 "ext3",
57 "fat",
58 "hfsplus",
59 "",
60 "ntfs",
61 "",
62 "exfat",
63 "ext4",
64 "hfsplusjournal"
65 };
66
67 #define MAX_MOUNTED 32
68 #define MAX_MOUNT_NAME 32
69
70 static char mounted[MAX_MOUNTED][3][MAX_MOUNT_NAME];
71 static int mounted_count = 0;
72 extern char uci_path[32];
73
74 static void mount_dump_uci_state(void)
75 {
76 struct uci_context *ctx;
77 struct list_head *p;
78 char mountd[] = {"mountd"};
79 char type[] = {"mountd_disc"};
80 int mounted = 0;
81 unsigned long long int size = 0;
82 unlink("/var/state/mountd");
83 ctx = ucix_init("mountd");
84 uci_set_savedir(ctx, "/var/state/");
85 ucix_add_option_int(ctx, mountd, mountd, "count", list_count(&mounts));
86 list_for_each(p, &mounts)
87 {
88 struct mount *q = container_of(p, struct mount, list);
89 char t[64];
90 if(q->fs == EXTENDED)
91 continue;
92 ucix_add_section(ctx, mountd, q->serial, type);
93 strcpy(t, q->dev);
94 t[3] = '\0';
95 ucix_add_option(ctx, mountd, q->serial, "disc", t);
96 ucix_add_option(ctx, mountd, q->serial, "sector_size", q->sector_size);
97 snprintf(t, 64, "part%dmounted", atoi(&q->dev[3]));
98 ucix_add_option(ctx, mountd, q->serial, t, (q->mounted)?("1"):("0"));
99 ucix_add_option(ctx, mountd, q->serial, "vendor", q->vendor);
100 ucix_add_option(ctx, mountd, q->serial, "model", q->model);
101 ucix_add_option(ctx, mountd, q->serial, "rev", q->rev);
102 snprintf(t, 64, "size%d", atoi(&q->dev[3]));
103 ucix_add_option(ctx, mountd, q->serial, t, q->size);
104 if(q->fs > MBR && q->fs <= LASTFS)
105 {
106 snprintf(t, 64, "fs%d", atoi(&q->dev[3]));
107 ucix_add_option(ctx, mountd, q->serial, t, fs_names[q->fs]);
108 }
109 if(q->mounted)
110 mounted++;
111 if((!q->ignore) && q->size && q->sector_size)
112 size = size + (((unsigned long long int)atoi(q->size)) * ((unsigned long long int)atoi(q->sector_size)));
113 }
114 ucix_add_option_int(ctx, mountd, mountd, "mounted", mounted);
115 ucix_add_option_int(ctx, mountd, mountd, "total", size);
116 system_printf("echo -n %llu > /tmp/run/mountd_size", size);
117 ucix_save_state(ctx, "mountd");
118 ucix_cleanup(ctx);
119 }
120
121 static struct mount* mount_find(char *name, char *dev)
122 {
123 struct list_head *p;
124 list_for_each(p, &mounts)
125 {
126 struct mount *q = container_of(p, struct mount, list);
127 if(name)
128 if(!strcmp(q->name, name))
129 return q;
130 if(dev)
131 if(!strcmp(q->dev, dev))
132 return q;
133 }
134 return 0;
135 }
136
137 static void mount_add_list(char *name, char *dev, char *serial,
138 char *vendor, char *model, char *rev, int ignore, char *size, char *sector_size, int fs)
139 {
140 struct mount *mount;
141 char tmp[64], tmp2[64];
142 if(fs <= MBR || fs > LASTFS)
143 return;
144 mount = malloc(sizeof(struct mount));
145 INIT_LIST_HEAD(&mount->list);
146 strncpy(mount->vendor, vendor, 64);
147 strncpy(mount->model, model, 64);
148 strncpy(mount->rev, rev, 64);
149 strncpy(mount->name, name, 64);
150 strncpy(mount->dev, dev, 64);
151 strncpy(mount->serial, serial, 64);
152 strncpy(mount->size, size, 64);
153 strncpy(mount->sector_size, sector_size, 64);
154 mount->ignore = ignore;
155 mount->mounted = 0;
156 mount->fs = fs;
157 list_add(&mount->list, &mounts);
158 if((!mount->ignore) && (mount->fs > MBR) && (mount->fs <= LASTFS))
159 {
160 log_printf("new mount : %s -> %s (%s)\n", name, dev, fs_names[mount->fs]);
161 snprintf(tmp, 64, "%s%s", uci_path, name);
162 snprintf(tmp2, 64, "/tmp/run/mountd/%s", dev);
163 symlink(tmp2, tmp);
164 mount_new("/tmp/run/mountd/", dev);
165 system_printf("ACTION=add DEVICE=%s NAME=%s /sbin/hotplug-call mount", dev, name);
166 }
167 }
168
169 static int mount_check_disc(char *disc)
170 {
171 FILE *fp = fopen("/proc/mounts", "r");
172 char tmp[256];
173 int avail = -1;
174 if(!fp)
175 {
176 log_printf("error reading /proc/mounts");
177 fclose(fp);
178 return avail;
179 }
180 while((fgets(tmp, 256, fp) != NULL) && (avail == -1))
181 {
182 char *t;
183 char tmp2[32];
184 t = strstr(tmp, " ");
185 if(t)
186 {
187 int l;
188 *t = '\0';
189 l = snprintf(tmp2, 31, "/dev/%s", disc);
190
191 if(!strncmp(tmp, tmp2, l))
192 avail = 0;
193 }
194 }
195 fclose(fp);
196 return avail;
197 }
198
199 static int mount_wait_for_disc(char *disc)
200 {
201 int i = 10;
202 while(i--)
203 {
204 int ret = mount_check_disc(disc);
205 if(!ret)
206 return ret;
207 poll(0, 0, 100);
208 }
209 return -1;
210 }
211
212 int mount_new(char *path, char *dev)
213 {
214 struct mount *mount;
215 char tmp[256];
216 int ret = 1;
217 pid_t pid;
218 mount = mount_find(0, dev);
219 if(!mount)
220 {
221 log_printf("request for invalid path %s%s\n", path, dev);
222 return -1;
223 }
224 if(mount->ignore || mount->mounted || mount->fs == EXTENDED)
225 return -1;
226 snprintf(tmp, 256, "%s%s", path, mount->dev);
227 log_printf("mounting %s\n", tmp);
228 mkdir(tmp, 777);
229
230 pid = autofs_safe_fork();
231 if(!pid)
232 {
233 char *options, *fstype;
234 if(mount->fs == EXFAT)
235 {
236 options = "rw,uid=1000,gid=1000";
237 fstype = "exfat";
238 }
239 if(mount->fs == FAT)
240 {
241 options = "rw,uid=1000,gid=1000";
242 fstype = "vfat";
243 }
244 if(mount->fs == EXT4)
245 {
246 options = "rw,defaults";
247 fstype = "ext4";
248 }
249 if(mount->fs == EXT3)
250 {
251 options = "rw,defaults";
252 fstype = "ext3";
253 }
254 if(mount->fs == EXT2)
255 {
256 options = "rw,defaults";
257 fstype = "ext2";
258 }
259 if(mount->fs == HFSPLUS)
260 {
261 options = "rw,defaults,uid=1000,gid=1000";
262 fstype = "hfsplus";
263 }
264 if(mount->fs == HFSPLUSJOURNAL)
265 {
266 options = "ro,defaults,uid=1000,gid=1000";
267 fstype = "hfsplus";
268 }
269 if(mount->fs == NTFS)
270 {
271 options = "force";
272 fstype = "ntfs-3g";
273 }
274 if(mount->fs > MBR && mount->fs <= LASTFS)
275 {
276 struct uci_context *ctx;
277 char *uci_options, *uci_fstype;
278 ctx = ucix_init("mountd");
279 if(fs_names[mount->fs])
280 {
281 uci_options = ucix_get_option(ctx, "mountd", fs_names[mount->fs], "options");
282 uci_fstype = ucix_get_option(ctx, "mountd", fs_names[mount->fs], "fstype");
283 if(uci_options)
284 options = uci_options;
285 if(uci_fstype)
286 fstype = uci_fstype;
287 log_printf("mount -t %s -o %s /dev/%s %s", fstype, options, mount->dev, tmp);
288 ret = system_printf("mount -t %s -o %s /dev/%s %s", fstype, options, mount->dev, tmp);
289 }
290 ucix_cleanup(ctx);
291 }
292 exit(WEXITSTATUS(ret));
293 }
294 pid = waitpid(pid, &ret, 0);
295 ret = WEXITSTATUS(ret);
296 log_printf("----------> mount ret = %d\n", ret);
297 if(ret && (ret != 0xff))
298 return -1;
299 if(mount_wait_for_disc(mount->dev) == 0)
300 {
301 mount->mounted = 1;
302 mount_dump_uci_state();
303 } else return -1;
304 return 0;
305 }
306
307 int mount_remove(char *path, char *dev)
308 {
309 struct mount *mount;
310 char tmp[256];
311 int ret;
312 snprintf(tmp, 256, "%s%s", path, dev);
313 log_printf("%s has expired... unmounting\n", tmp);
314 ret = system_printf("/bin/umount %s", tmp);
315 if(ret != 0)
316 return 0;
317 rmdir(tmp);
318 mount = mount_find(0, dev);
319 if(mount)
320 mount->mounted = 0;
321 log_printf("finished unmounting\n");
322 mount_dump_uci_state();
323 return 0;
324 }
325
326 static int dir_sort(const struct dirent **a, const struct dirent **b)
327 {
328 return 0;
329 }
330
331 static int dir_filter(const struct dirent *a)
332 {
333 if(strstr(a->d_name, ":"))
334 return 1;
335 return 0;
336 }
337
338 static char* mount_get_serial(char *dev)
339 {
340 static char tmp[64];
341 static char tmp2[64];
342 int disc;
343 static struct hd_driveid hd;
344 int i;
345 static char *serial;
346 static char disc_id[13];
347 snprintf(tmp, 64, "/dev/%s", dev);
348 disc = open(tmp, O_RDONLY);
349 if(!disc)
350 {
351 log_printf("Trying to open unknown disc\n");
352 return 0;
353 }
354 i = ioctl(disc, HDIO_GET_IDENTITY, &hd);
355 close(disc);
356 if(!i)
357 serial = (char*)hd.serial_no;
358 /* if we failed, it probably a usb storage device */
359 /* there must be a better way for this */
360 if(i)
361 {
362 struct dirent **namelist;
363 int n = scandir("/sys/bus/scsi/devices/", &namelist, dir_filter, dir_sort);
364 if(n > 0)
365 {
366 while(n--)
367 {
368 char *t = strstr(namelist[n]->d_name, ":");
369 if(t)
370 {
371 int id;
372 struct stat buf;
373 char tmp3[64];
374 int ret;
375 *t = 0;
376 id = atoi(namelist[n]->d_name);
377 *t = ':';
378 sprintf(tmp3, "/sys/bus/scsi/devices/%s/block:%s/", namelist[n]->d_name, dev);
379 ret = stat(tmp3, &buf);
380 if(ret)
381 {
382 sprintf(tmp3, "/sys/bus/scsi/devices/%s/block/%s/", namelist[n]->d_name, dev);
383 ret = stat(tmp3, &buf);
384 }
385 if(!ret)
386 {
387 FILE *fp;
388 snprintf(tmp2, 64, "/proc/scsi/usb-storage/%d", id);
389 fp = fopen(tmp2, "r");
390 if(fp)
391 {
392 while(fgets(tmp2, 64, fp) != NULL)
393 {
394 serial = strstr(tmp2, "Serial Number:");
395 if(serial)
396 {
397 serial += strlen("Serial Number: ");
398 serial[strlen(serial) - 1] = '\0';
399 i = 0;
400 break;
401 }
402 }
403 fclose(fp);
404 }
405 }
406 }
407 free(namelist[n]);
408 }
409 free(namelist);
410 }
411 }
412 if(i)
413 {
414 log_printf("could not find a serial number for the device %s\n", dev);
415 } else {
416 /* serial string id is cheap, but makes the discs anonymous */
417 unsigned char uniq[6];
418 unsigned int *u = (unsigned int*) uniq;
419 int l = strlen(serial);
420 int i;
421 memset(disc_id, 0, 13);
422 memset(uniq, 0, 6);
423 for(i = 0; i < l; i++)
424 {
425 uniq[i%6] += serial[i];
426 }
427 sprintf(disc_id, "%08X%02X%02X", *u, uniq[4], uniq[5]);
428 //log_printf("Serial number - %s %s\n", serial, disc_id);
429 return disc_id;
430 }
431 sprintf(disc_id, "000000000000");
432 return disc_id;
433 }
434
435 static void mount_dev_add(char *dev)
436 {
437 struct mount *mount = mount_find(0, dev);
438 if(!mount)
439 {
440 char node[64];
441 char name[64];
442 int ignore = 0;
443 char *s;
444 char tmp[64];
445 char tmp2[64];
446 char *p;
447 struct uci_context *ctx;
448 char vendor[64];
449 char model[64];
450 char rev[64];
451 char size[64];
452 char sector_size[64];
453 FILE *fp;
454 int offset = 3;
455
456 strcpy(name, dev);
457 if (!strncmp(name, "mmcblk", 6))
458 offset = 7;
459 name[offset] = '\0';
460 s = mount_get_serial(name);
461 if(!s) {
462 return;
463 }
464 if (!strncmp(name, "mmcblk", 6)) {
465 snprintf(tmp, 64, "part%s", &dev[8]);
466 snprintf(node, 64, "SD-P%s", &dev[8]);
467
468 } else {
469 snprintf(tmp, 64, "part%s", &dev[3]);
470 snprintf(node, 64, "USB-%s", &dev[2]);
471 }
472 if(node[4] >= 'a' && node[4] <= 'z')
473 {
474 node[4] -= 'a';
475 node[4] += 'A';
476 }
477 ctx = ucix_init("mountd");
478 p = ucix_get_option(ctx, "mountd", s, tmp);
479 ucix_cleanup(ctx);
480 if(p)
481 {
482 if(strlen(p) == 1)
483 {
484 if(*p == '0')
485 ignore = 1;
486 } else {
487 snprintf(node, 64, "%s", p);
488 }
489 }
490 strcpy(name, dev);
491 name[3] = '\0';
492 snprintf(tmp, 64, "/sys/class/block/%s/device/model", name);
493 fp = fopen(tmp, "r");
494 if(!fp)
495 {
496 snprintf(tmp, 64, "/sys/block/%s/device/model", name);
497 fp = fopen(tmp, "r");
498 }
499 if(!fp)
500 snprintf(model, 64, "unknown");
501 else {
502 fgets(model, 64, fp);
503 model[strlen(model) - 1] = '\0';;
504 fclose(fp);
505 }
506 snprintf(tmp, 64, "/sys/class/block/%s/device/vendor", name);
507 fp = fopen(tmp, "r");
508 if(!fp)
509 {
510 snprintf(tmp, 64, "/sys/block/%s/device/vendor", name);
511 fp = fopen(tmp, "r");
512 }
513 if(!fp)
514 snprintf(vendor, 64, "unknown");
515 else {
516 fgets(vendor, 64, fp);
517 vendor[strlen(vendor) - 1] = '\0';
518 fclose(fp);
519 }
520 snprintf(tmp, 64, "/sys/class/block/%s/device/rev", name);
521 fp = fopen(tmp, "r");
522 if(!fp)
523 {
524 snprintf(tmp, 64, "/sys/block/%s/device/rev", name);
525 fp = fopen(tmp, "r");
526 }
527 if(!fp)
528 snprintf(rev, 64, "unknown");
529 else {
530 fgets(rev, 64, fp);
531 rev[strlen(rev) - 1] = '\0';
532 fclose(fp);
533 }
534 snprintf(tmp, 64, "/sys/class/block/%s/size", dev);
535 fp = fopen(tmp, "r");
536 if(!fp)
537 {
538 snprintf(tmp, 64, "/sys/block/%s/%s/size", name, dev);
539 fp = fopen(tmp, "r");
540 }
541 if(!fp)
542 snprintf(size, 64, "unknown");
543 else {
544 fgets(size, 64, fp);
545 size[strlen(size) - 1] = '\0';
546 fclose(fp);
547 }
548 strcpy(tmp2, dev);
549 tmp2[3] = '\0';
550 snprintf(tmp, 64, "/sys/block/%s/queue/hw_sector_size", tmp2);
551 fp = fopen(tmp, "r");
552 if(!fp)
553 snprintf(sector_size, 64, "unknown");
554 else {
555 fgets(sector_size, 64, fp);
556 sector_size[strlen(sector_size) - 1] = '\0';
557 fclose(fp);
558 }
559 snprintf(tmp, 64, "/dev/%s", dev);
560 mount_add_list(node, dev, s, vendor, model, rev, ignore, size, sector_size, detect_fs(tmp));
561 mount_dump_uci_state();
562 }
563 }
564
565 static void mount_dev_del(char *dev)
566 {
567 struct mount *mount = mount_find(0, dev);
568 char tmp[256];
569 if(mount)
570 {
571 if(mount->mounted)
572 {
573 snprintf(tmp, 256, "%s%s", "/tmp/run/mountd/", mount->name);
574 log_printf("%s has dissappeared ... unmounting\n", tmp);
575 snprintf(tmp, 256, "%s%s", "/tmp/run/mountd/", mount->dev);
576 system_printf("/bin/umount %s", tmp);
577 rmdir(tmp);
578 snprintf(tmp, 64, "%s%s", uci_path, mount->name);
579 unlink(tmp);
580 mount_dump_uci_state();
581 }
582 }
583 }
584
585 void mount_dump_list(void)
586 {
587 struct list_head *p;
588 list_for_each(p, &mounts)
589 {
590 struct mount *q = container_of(p, struct mount, list);
591 log_printf("* %s %s %d\n", q->name, q->dev, q->mounted);
592 }
593 }
594
595 char* is_mounted(char *block, char *path)
596 {
597 int i;
598 for(i = 0; i < mounted_count; i++)
599 {
600 if(block)
601 if(!strncmp(&mounted[i][0][0], block, strlen(&mounted[i][0][0])))
602 return &mounted[i][0][0];
603 if(path)
604 if(!strncmp(&mounted[i][1][1], &path[1], strlen(&mounted[i][1][0])))
605 return &mounted[i][0][0];
606 }
607 return 0;
608 }
609
610 static void mount_check_mount_list(void)
611 {
612 FILE *fp = fopen("/proc/mounts", "r");
613 char tmp[256];
614
615 if(!fp)
616 {
617 log_printf("error reading /proc/mounts");
618 fclose(fp);
619 return;
620 }
621 mounted_count = 0;
622 while(fgets(tmp, 256, fp) != NULL)
623 {
624 char *t, *t2;
625 t = strstr(tmp, " ");
626 if(t)
627 {
628 *t = '\0';
629 t++;
630 } else t = tmp;
631 strncpy(&mounted[mounted_count][0][0], tmp, MAX_MOUNT_NAME);
632 t2 = strstr(t, " ");
633 if(t2)
634 {
635 *t2 = '\0';
636 t2++;
637 } else t2 = t;
638 strncpy(&mounted[mounted_count][1][0], t, MAX_MOUNT_NAME);
639 t = strstr(t2, " ");
640 if(t)
641 {
642 *t = '\0';
643 t++;
644 } else t = tmp;
645 strncpy(&mounted[mounted_count][2][0], t2, MAX_MOUNT_NAME);
646 /* printf("%s %s %s\n",
647 mounted[mounted_count][0],
648 mounted[mounted_count][1],
649 mounted[mounted_count][2]);*/
650 if(mounted_count < MAX_MOUNTED - 1)
651 mounted_count++;
652 else
653 log_printf("found more than %d mounts \n", MAX_MOUNTED);
654 }
655 fclose(fp);
656 }
657
658 /* FIXME: we need more intelligence here */
659 static int dir_filter2(const struct dirent *a)
660 {
661 if(!strncmp(a->d_name, "mmcblk", 6) || !strncmp(a->d_name, "sd", 2))
662 return 1;
663 return 0;
664 }
665 #define MAX_BLOCK 64
666 static char block[MAX_BLOCK][MAX_BLOCK];
667 static int blk_cnt = 0;
668
669 static int check_block(char *b)
670 {
671 int i;
672 for(i = 0; i < blk_cnt; i++)
673 {
674 if(!strcmp(block[i], b))
675 return 1;
676 }
677 return 0;
678 }
679
680 static void mount_enum_drives(void)
681 {
682 struct dirent **namelist, **namelist2;
683 int i, n = scandir("/sys/block/", &namelist, dir_filter2, dir_sort);
684 struct list_head *p;
685 blk_cnt = 0;
686 if(n > 0)
687 {
688 while(n--)
689 {
690 if(blk_cnt < MAX_BLOCK)
691 {
692 int m;
693 char tmp[64];
694 snprintf(tmp, 64, "/sys/block/%s/", namelist[n]->d_name);
695 m = scandir(tmp, &namelist2, dir_filter2, dir_sort);
696 if(m > 0)
697 {
698 while(m--)
699 {
700 strncpy(&block[blk_cnt][0], namelist2[m]->d_name, MAX_BLOCK);
701 blk_cnt++;
702 free(namelist2[m]);
703 }
704 free(namelist2);
705 } else {
706 strncpy(&block[blk_cnt][0], namelist[n]->d_name, MAX_BLOCK);
707 blk_cnt++;
708 }
709 }
710 free(namelist[n]);
711 }
712 free(namelist);
713 }
714 p = mounts.next;
715 while(p != &mounts)
716 {
717 struct mount *q = container_of(p, struct mount, list);
718 char tmp[64];
719 struct uci_context *ctx;
720 int del = 0;
721 char *t;
722 snprintf(tmp, 64, "part%s", &q->dev[3]);
723 ctx = ucix_init("mountd");
724 t = ucix_get_option(ctx, "mountd", q->serial, tmp);
725 ucix_cleanup(ctx);
726 if(t && !q->mounted)
727 {
728 if(!strcmp(t, "0"))
729 {
730 if(!q->ignore)
731 del = 1;
732 } else if(!strcmp(t, "1"))
733 {
734 if(strncmp(q->name, "Disc-", 5))
735 del = 1;
736 } else if(strcmp(q->name, t))
737 {
738 del = 1;
739 }
740 }
741 if(!check_block(q->dev)||del)
742 {
743 mount_dev_del(q->dev);
744 p->prev->next = p->next;
745 p->next->prev = p->prev;
746 p = p->next;
747 log_printf("removing %s\n", q->dev);
748 snprintf(tmp, 64, "%s%s", "/tmp/run/mountd/", q->dev);
749 rmdir(tmp);
750 snprintf(tmp, 64, "%s%s", uci_path, q->name);
751 unlink(tmp);
752 system_printf("ACTION=remove DEVICE=%s NAME=%s /sbin/hotplug-call mount", q->dev, q->name);
753 free(q);
754 mount_dump_uci_state();
755 system_printf("/etc/fonstated/ReloadSamba");
756 } else p = p->next;
757 }
758
759 for(i = 0; i < blk_cnt; i++)
760 mount_dev_add(block[i]);
761 }
762
763 static void mount_check_enum(void)
764 {
765 waitpid(-1, 0, WNOHANG);
766 mount_enum_drives();
767 }
768
769 void mount_init(void)
770 {
771 INIT_LIST_HEAD(&mounts);
772 timer_add(mount_check_mount_list, 2);
773 timer_add(mount_check_enum, 1);
774 mount_check_mount_list();
775 }