]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | |
2 | #include "include/types.h" | |
3 | #include "common/config.h" | |
4 | #include "common/ceph_argparse.h" | |
5 | #include "common/errno.h" | |
6 | #include "global/global_init.h" | |
7 | ||
8 | #include "DataScan.h" | |
9 | ||
10 | ||
11 | int main(int argc, const char **argv) | |
12 | { | |
13 | vector<const char*> args; | |
14 | argv_to_vec(argc, argv, args); | |
11fdf7f2 TL |
15 | |
16 | if (args.empty()) { | |
17 | cerr << argv[0] << ": -h or --help for usage" << std::endl; | |
18 | exit(1); | |
19 | } | |
20 | if (ceph_argparse_need_usage(args)) { | |
21 | DataScan::usage(); | |
22 | exit(0); | |
23 | } | |
7c673cae FG |
24 | |
25 | auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, | |
26 | CODE_ENVIRONMENT_UTILITY, 0); | |
27 | common_init_finish(g_ceph_context); | |
28 | ||
29 | DataScan data_scan; | |
30 | ||
7c673cae FG |
31 | // Connect to mon cluster, download MDS map etc |
32 | int rc = data_scan.init(); | |
33 | if (rc != 0) { | |
34 | std::cerr << "Error in initialization: " << cpp_strerror(rc) << std::endl; | |
35 | return rc; | |
36 | } | |
37 | ||
38 | // Finally, execute the user's commands | |
39 | rc = data_scan.main(args); | |
40 | if (rc != 0) { | |
41 | std::cerr << "Error (" << cpp_strerror(rc) << ")" << std::endl; | |
42 | } | |
43 | ||
7c673cae FG |
44 | |
45 | return rc; | |
46 | } | |
47 |