]> git.proxmox.com Git - mirror_zfs.git/blob - cmd/zpios/zpios.h
cstyle: Resolve C style issues
[mirror_zfs.git] / cmd / zpios / zpios.h
1 /*
2 * ZPIOS is a heavily modified version of the original PIOS test code.
3 * It is designed to have the test code running in the Linux kernel
4 * against ZFS while still being flexibly controled from user space.
5 *
6 * Copyright (C) 2008-2010 Lawrence Livermore National Security, LLC.
7 * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
8 * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
9 * LLNL-CODE-403049
10 *
11 * Original PIOS Test Code
12 * Copyright (C) 2004 Cluster File Systems, Inc.
13 * Written by Peter Braam <braam@clusterfs.com>
14 * Atul Vidwansa <atul@clusterfs.com>
15 * Milind Dumbare <milind@clusterfs.com>
16 *
17 * This file is part of ZFS on Linux.
18 * For details, see <http://zfsonlinux.org/>.
19 *
20 * ZPIOS is free software; you can redistribute it and/or modify it
21 * under the terms of the GNU General Public License as published by the
22 * Free Software Foundation; either version 2 of the License, or (at your
23 * option) any later version.
24 *
25 * ZPIOS is distributed in the hope that it will be useful, but WITHOUT
26 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
27 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
28 * for more details.
29 *
30 * You should have received a copy of the GNU General Public License along
31 * with ZPIOS. If not, see <http://www.gnu.org/licenses/>.
32 */
33
34 #ifndef _ZPIOS_H
35 #define _ZPIOS_H
36
37 #include <zpios-ctl.h>
38
39 #define VERSION_SIZE 64
40
41 /* Regular expressions */
42 #define REGEX_NUMBERS "^[0-9]*[0-9]$"
43 #define REGEX_NUMBERS_COMMA "^([0-9]+,)*[0-9]+$"
44 #define REGEX_SIZE "^[0-9][0-9]*[kmgt]$"
45 #define REGEX_SIZE_COMMA "^([0-9][0-9]*[kmgt]+,)*[0-9][0-9]*[kmgt]$"
46
47 /* Flags for low, high, incr */
48 #define FLAG_SET 0x01
49 #define FLAG_LOW 0x02
50 #define FLAG_HIGH 0x04
51 #define FLAG_INCR 0x08
52
53 #define TRUE 1
54 #define FALSE 0
55
56 #define KB (1024)
57 #define MB (KB * 1024)
58 #define GB (MB * 1024)
59 #define TB (GB * 1024)
60
61 #define KMGT_SIZE 16
62
63 /*
64 * All offsets, sizes and counts can be passed to the application in
65 * multiple ways.
66 * 1. a value (stored in val[0], val_count will be 1)
67 * 2. a comma separated list of values (stored in val[], using val_count)
68 * 3. a range and block sizes, low, high, factor (val_count must be 0)
69 */
70 typedef struct pios_range_repeat {
71 uint64_t val[32]; /* Comma sep array, or low, high, inc */
72 uint64_t val_count; /* Num of values */
73 uint64_t val_low;
74 uint64_t val_high;
75 uint64_t val_inc_perc;
76 uint64_t next_val; /* For multiple runs in get_next() */
77 } range_repeat_t;
78
79 typedef struct cmd_args {
80 range_repeat_t T; /* Thread count */
81 range_repeat_t N; /* Region count */
82 range_repeat_t O; /* Offset count */
83 range_repeat_t C; /* Chunksize */
84 range_repeat_t S; /* Regionsize */
85
86 const char *pool; /* Pool */
87 const char *name; /* Name */
88 uint32_t flags; /* Flags */
89 uint32_t io_type; /* DMUIO only */
90 uint32_t verbose; /* Verbose */
91 uint32_t human_readable; /* Human readable output */
92
93 uint64_t regionnoise; /* Region noise */
94 uint64_t chunknoise; /* Chunk noise */
95 uint64_t thread_delay; /* Thread delay */
96
97 char pre[ZPIOS_PATH_SIZE]; /* Pre-exec hook */
98 char post[ZPIOS_PATH_SIZE]; /* Post-exec hook */
99 char log[ZPIOS_PATH_SIZE]; /* Requested log dir */
100
101 /* Control */
102 int current_id;
103 uint64_t current_T;
104 uint64_t current_N;
105 uint64_t current_C;
106 uint64_t current_S;
107 uint64_t current_O;
108
109 uint32_t rc;
110 } cmd_args_t;
111
112 int set_count(char *pattern1, char *pattern2, range_repeat_t *range,
113 char *optarg, uint32_t *flags, char *arg);
114 int set_lhi(char *pattern, range_repeat_t *range, char *optarg,
115 int flag, uint32_t *flag_thread, char *arg);
116 int set_noise(uint64_t *noise, char *optarg, char *arg);
117 int set_load_params(cmd_args_t *args, char *optarg);
118 int check_mutual_exclusive_command_lines(uint32_t flag, char *arg);
119 void print_stats_header(cmd_args_t *args);
120 void print_stats(cmd_args_t *args, zpios_cmd_t *cmd);
121
122 #endif /* _ZPIOS_H */