-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathfastdd.h
More file actions
70 lines (54 loc) · 1.43 KB
/
fastdd.h
File metadata and controls
70 lines (54 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* vim: expandtab:tw=68:ts=4:sw=4:
*
* fastdd.h - common functions and types
*
* Copyright (c) 2018 Sudhi Herle <sw at herle.net>
*
* Licensing Terms: GPLv2
*
* If you need a commercial license for this work, please contact
* the author.
*
* This software does not come with any express or implied
* warranty; it is provided "as is". No claim is made to its
* suitability for any purpose.
*/
#ifndef ___FASTDD_H__uT79yi1XEBN8awV4___
#define ___FASTDD_H__uT79yi1XEBN8awV4___ 1
/* Provide C linkage for symbols declared here .. */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <stdio.h>
#include <stdarg.h>
#include <stdint.h>
#include <inttypes.h>
#include "args.h"
struct Acctg {
uint64_t nrd,
nwr;
uint64_t elapsed_us;
};
typedef struct Acctg Acctg;
/*
* Perform a copy operation for arguments in 'a' and write stats
* into 'g'.
*/
extern int Copy(Acctg *g, Args *a);
/*
* Return blocksize of device in 'fd'.
*/
extern int Blksize(uint64_t *p_size, int fd);
// -- Internal functions --
ssize_t fullread(int fd, void *buf, size_t n);
ssize_t fullwrite(int fd, void *buf, size_t n);
ssize_t skip(int fd, uint64_t n);
extern int Quiet;
#define Verbose(fmt,...) do { \
if (!Quiet) fprintf(stderr, fmt,##__VA_ARGS__);\
} while(0)
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* ! ___FASTDD_H__uT79yi1XEBN8awV4___ */
/* EOF */