1274116Sdteske/*-
2274116Sdteske * Copyright (c) 2013-2014 Devin Teske <dteske@FreeBSD.org>
3274116Sdteske * All rights reserved.
4274116Sdteske *
5274116Sdteske * Redistribution and use in source and binary forms, with or without
6274116Sdteske * modification, are permitted provided that the following conditions
7274116Sdteske * are met:
8274116Sdteske * 1. Redistributions of source code must retain the above copyright
9274116Sdteske *    notice, this list of conditions and the following disclaimer.
10274116Sdteske * 2. Redistributions in binary form must reproduce the above copyright
11274116Sdteske *    notice, this list of conditions and the following disclaimer in the
12274116Sdteske *    documentation and/or other materials provided with the distribution.
13274116Sdteske *
14274116Sdteske * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15274116Sdteske * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16274116Sdteske * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17274116Sdteske * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18274116Sdteske * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19274116Sdteske * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20274116Sdteske * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21274116Sdteske * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22274116Sdteske * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23274116Sdteske * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24274116Sdteske * SUCH DAMAGE.
25274116Sdteske *
26274116Sdteske * $FreeBSD$
27274116Sdteske */
28274116Sdteske
29274116Sdteske#ifndef _DPV_UTIL_H_
30274116Sdteske#define _DPV_UTIL_H_
31274116Sdteske
32274116Sdteske/* Limits */
33274116Sdteske#define BUFSIZE_MAX		(2 * 1024 * 1024)
34274116Sdteske					/* Buffer size for read(2) input */
35274116Sdteske#ifndef MAXPHYS
36274116Sdteske#define MAXPHYS			(128 * 1024)
37274116Sdteske					/* max raw I/O transfer size */
38274116Sdteske#endif
39274116Sdteske
40274116Sdteske/*
41274116Sdteske * Memory strategry threshold, in pages: if physmem is larger than this,
42274116Sdteske * use a large buffer.
43274116Sdteske */
44274116Sdteske#define PHYSPAGES_THRESHOLD	(32 * 1024)
45274116Sdteske
46274116Sdteske/*
47274116Sdteske * Small (default) buffer size in bytes. It's inefficient for this to be
48274116Sdteske * smaller than MAXPHYS.
49274116Sdteske */
50274116Sdteske#define BUFSIZE_SMALL		(MAXPHYS)
51274116Sdteske
52274116Sdteske/*
53274116Sdteske * Math macros
54274116Sdteske */
55274116Sdteske#undef  MIN
56274116Sdteske#define MIN(x,y) ((x) < (y) ? (x) : (y))
57274116Sdteske#undef  MAX
58274116Sdteske#define MAX(x,y) ((x) > (y) ? (x) : (y))
59274116Sdteske
60274116Sdteske/*
61274116Sdteske * Extra display information
62274116Sdteske */
63274116Sdteske#define BYTE_STATUS_SOLO	"%'10lli bytes read @ %'9.1f bytes/sec."
64274116Sdteske#define BYTE_STATUS_MANY	(BYTE_STATUS_SOLO " [%i/%i busy/wait]")
65274116Sdteske#define LINE_STATUS_SOLO	"%'10lli lines read @ %'9.1f lines/sec."
66274116Sdteske#define LINE_STATUS_MANY	(LINE_STATUS_SOLO " [%i/%i busy/wait]")
67274116Sdteske
68274116Sdteske#endif /* !_DPV_UTIL_H_ */
69