FreeCalypso > hg > freecalypso-tools
comparison ffstools/tiffs-mkfs/main.c @ 717:178ed445021d
tiffs-mkfs: journal creation implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 23 Aug 2020 03:40:10 +0000 |
parents | 12ae93940467 |
children |
comparison
equal
deleted
inserted
replaced
716:3713a349fb1e | 717:178ed445021d |
---|---|
14 { | 14 { |
15 extern int optind; | 15 extern int optind; |
16 extern char *optarg; | 16 extern char *optarg; |
17 int c; | 17 int c; |
18 | 18 |
19 while ((c = getopt(argc, argv, "c:f:m:")) != EOF) | 19 while ((c = getopt(argc, argv, "c:f:j:Jm:")) != EOF) |
20 switch (c) { | 20 switch (c) { |
21 case 'c': | 21 case 'c': |
22 chunk_size_max = strtoul(optarg, 0, 0); | 22 chunk_size_max = strtoul(optarg, 0, 0); |
23 continue; | 23 continue; |
24 case 'f': | 24 case 'f': |
26 fprintf(stderr, | 26 fprintf(stderr, |
27 "error: format name must begin with \'/\'\n"); | 27 "error: format name must begin with \'/\'\n"); |
28 exit(1); | 28 exit(1); |
29 } | 29 } |
30 format_name = optarg; | 30 format_name = optarg; |
31 continue; | |
32 case 'j': | |
33 journal_size = strtoul(optarg, 0, 0); | |
34 continue; | |
35 case 'J': | |
36 no_journal = 1; | |
31 continue; | 37 continue; |
32 case 'm': | 38 case 'm': |
33 block_files_max = strtoul(optarg, 0, 0); | 39 block_files_max = strtoul(optarg, 0, 0); |
34 continue; | 40 continue; |
35 default: | 41 default: |
50 { | 56 { |
51 process_cmdline(argc, argv); | 57 process_cmdline(argc, argv); |
52 if (!format_name) | 58 if (!format_name) |
53 format_name = "/"; | 59 format_name = "/"; |
54 preen_chunk_size_max(); | 60 preen_chunk_size_max(); |
61 preen_journal_size(); | |
55 preen_block_files_max(); | 62 preen_block_files_max(); |
56 /* input phase */ | 63 /* input phase */ |
57 read_dir_level(&root, input_host_dir, 0); | 64 read_dir_level(&root, input_host_dir, 0); |
58 sort_dir_level(&root); | 65 sort_dir_level(&root); |
59 /* output phase */ | 66 /* output phase */ |
60 prepare_output_buffers(); | 67 prepare_output_buffers(); |
61 open_output_file(); | 68 open_output_file(); |
62 create_root_dir(); | 69 create_root_dir(); |
63 process_dir_level(&root); | 70 process_dir_level(&root); |
71 if (!no_journal) | |
72 create_journal(); | |
64 finish_output(); | 73 finish_output(); |
65 close(output_fd); | 74 close(output_fd); |
66 exit(0); | 75 exit(0); |
67 } | 76 } |