Line data Source code
1 : /**
2 : * This file is part of rmlint.
3 : *
4 : * rmlint is free software: you can redistribute it and/or modify
5 : * it under the terms of the GNU General Public License as published by
6 : * the Free Software Foundation, either version 3 of the License, or
7 : * (at your option) any later version.
8 : *
9 : * rmlint is distributed in the hope that it will be useful,
10 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 : * GNU General Public License for more details.
13 : *
14 : * You should have received a copy of the GNU General Public License
15 : * along with rmlint. If not, see <http://www.gnu.org/licenses/>.
16 : *
17 : * Authors:
18 : *
19 : * - Christopher <sahib> Pahl 2010-2015 (https://github.com/sahib)
20 : * - Daniel <SeeSpotRun> T. 2014-2015 (https://github.com/SeeSpotRun)
21 : *
22 : * Hosted on http://github.com/sahib/rmlint
23 : **/
24 :
25 : #include <string.h>
26 : #include <stdbool.h>
27 : #include <unistd.h>
28 :
29 : #include "cfg.h"
30 :
31 : /* Options not specified by commandline get a default option -
32 : * this is usually called before rm_cmd_parse_args */
33 54884 : void rm_cfg_set_default(RmCfg *cfg) {
34 : /* Set everything to 0 at first,
35 : * only non-null options are listed below.
36 : */
37 54884 : memset(cfg, 0, sizeof(RmCfg));
38 :
39 : /* Traversal options */
40 54884 : cfg->depth = PATH_MAX / 2;
41 54884 : cfg->minsize = 0;
42 54884 : cfg->maxsize = G_MAXUINT64;
43 :
44 : /* Lint Types */
45 54884 : cfg->ignore_hidden = true;
46 54884 : cfg->find_emptydirs = true;
47 54884 : cfg->find_emptyfiles = true;
48 54884 : cfg->find_duplicates = true;
49 54884 : cfg->find_badids = true;
50 54884 : cfg->find_badlinks = true;
51 54884 : cfg->find_hardlinked_dupes = true;
52 54884 : cfg->build_fiemap = true;
53 :
54 : /* Misc options */
55 54884 : strcpy(cfg->sort_criteria, "pm");
56 :
57 54884 : cfg->checksum_type = RM_DEFAULT_DIGEST;
58 54884 : cfg->with_color = true;
59 54884 : cfg->with_stdout_color = true;
60 54884 : cfg->with_stderr_color = true;
61 54884 : cfg->threads = 32;
62 54884 : cfg->verbosity = G_LOG_LEVEL_INFO;
63 54884 : cfg->follow_symlinks = false;
64 :
65 54884 : cfg->read_buffer_mem = 16 * 1024 * 1024;
66 54884 : cfg->paranoid_mem = 256 * 1024 * 1024;
67 54884 : cfg->total_mem = (RmOff)2 * 1024 * 1024 * 1024;
68 54884 : cfg->sweep_size = 1024 * 1024 * 1024;
69 54884 : cfg->sweep_count = 1024 * 16;
70 :
71 54884 : cfg->skip_start_factor = 0.0;
72 54884 : cfg->skip_end_factor = 1.0;
73 :
74 54884 : cfg->use_absolute_start_offset = false;
75 54884 : cfg->use_absolute_end_offset = false;
76 54884 : cfg->skip_start_offset = 0;
77 54884 : cfg->skip_end_offset = 0;
78 :
79 54884 : rm_trie_init(&cfg->file_trie);
80 54884 : }
|