sg: 16-byte cdb support and lots of fixes
[fio.git] / fio.c
... / ...
CommitLineData
1/*
2 * fio - the flexible io tester
3 *
4 * Copyright (C) 2005 Jens Axboe <axboe@suse.de>
5 * Copyright (C) 2006-2012 Jens Axboe <axboe@kernel.dk>
6 *
7 * The license below covers all files distributed with fio unless otherwise
8 * noted in the file itself.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24#include <unistd.h>
25#include <locale.h>
26#include <time.h>
27
28#include "fio.h"
29#include "smalloc.h"
30
31int main(int argc, char *argv[], char *envp[])
32{
33 int ret = 1;
34
35 if (initialize_fio(envp))
36 return 1;
37
38#if !defined(CONFIG_GETTIMEOFDAY) && !defined(CONFIG_CLOCK_GETTIME)
39#error "No available clock source!"
40#endif
41
42 if (parse_options(argc, argv))
43 goto done;
44
45 fio_time_init();
46
47 if (nr_clients) {
48 set_genesis_time();
49
50 if (fio_start_all_clients())
51 goto done;
52 ret = fio_handle_clients(&fio_client_ops);
53 } else
54 ret = fio_backend();
55
56done:
57 deinitialize_fio();
58 return ret;
59}