summaryrefslogtreecommitdiff
path: root/bin/dd/dd.h
diff options
context:
space:
mode:
authorKiyoshi Aman <kiyoshi.aman+adelie@gmail.com>2019-05-16 11:47:54 -0500
committerKiyoshi Aman <kiyoshi.aman+adelie@gmail.com>2019-05-16 11:47:54 -0500
commit5fa3142cdbb67cbb8287b2ec4fc35ee6532b3c6d (patch)
tree6abb866f965d62c64868a01950e53e0e6c21f06a /bin/dd/dd.h
parent5aef04248e45a1a0ce74d96e78abd871048369bf (diff)
downloaduserland-5fa3142cdbb67cbb8287b2ec4fc35ee6532b3c6d.tar.gz
userland-5fa3142cdbb67cbb8287b2ec4fc35ee6532b3c6d.tar.bz2
userland-5fa3142cdbb67cbb8287b2ec4fc35ee6532b3c6d.tar.xz
userland-5fa3142cdbb67cbb8287b2ec4fc35ee6532b3c6d.zip
bin/dd: make buildable with libbsd
Diffstat (limited to 'bin/dd/dd.h')
-rw-r--r--bin/dd/dd.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/bin/dd/dd.h b/bin/dd/dd.h
index 2b2712d..c630c0a 100644
--- a/bin/dd/dd.h
+++ b/bin/dd/dd.h
@@ -36,6 +36,10 @@
*/
#include <sys/stat.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <sys/time.h>
+#include <stdarg.h>
struct ddfops {
int (*op_init)(void);
@@ -44,7 +48,7 @@ struct ddfops {
int (*op_close)(int);
int (*op_fcntl)(int, int, ...);
- int (*op_ioctl)(int, unsigned long, ...);
+ int (*op_ioctl)(int, int, ...);
int (*op_fstat)(int, struct stat *);
int (*op_fsync)(int);
@@ -56,10 +60,10 @@ struct ddfops {
ssize_t (*op_write)(int, const void *, size_t);
};
-#define ddop_open(dir, a1, a2, ...) dir.ops->op_open(a1, a2, __VA_ARGS__)
+#define ddop_open(dir, a1, a2, ...) dir.ops->op_open(a1, a2, ##__VA_ARGS__)
#define ddop_close(dir, a1) dir.ops->op_close(a1)
-#define ddop_fcntl(dir, a1, a2, ...) dir.ops->op_fcntl(a1, a2, __VA_ARGS__)
-#define ddop_ioctl(dir, a1, a2, ...) dir.ops->op_ioctl(a1, a2, __VA_ARGS__)
+#define ddop_fcntl(dir, a1, a2, ...) dir.ops->op_fcntl(a1, a2, ##__VA_ARGS__)
+#define ddop_ioctl(dir, a1, a2, ...) dir.ops->op_ioctl(a1, a2, ##__VA_ARGS__)
#define ddop_fsync(dir, a1) dir.ops->op_fsync(a1)
#define ddop_ftruncate(dir, a1, a2) dir.ops->op_ftruncate(a1, a2)
#define ddop_lseek(dir, a1, a2, a3) dir.ops->op_lseek(a1, a2, a3)
@@ -68,8 +72,8 @@ struct ddfops {
/* Input/output stream state. */
typedef struct {
- u_char *db; /* buffer address */
- u_char *dbp; /* current buffer I/O address */
+ unsigned char *db; /* buffer address */
+ unsigned char *dbp; /* current buffer I/O address */
uint64_t dbcnt; /* current buffer byte count */
int64_t dbrcnt; /* last read byte count */
uint64_t dbsz; /* buffer size */
@@ -78,7 +82,7 @@ typedef struct {
#define ISPIPE 0x02 /* pipe (not truncatable) */
#define ISTAPE 0x04 /* tape (not seekable) */
#define NOREAD 0x08 /* not readable */
- u_int flags;
+ unsigned int flags;
const char *name; /* name */
int fd; /* file descriptor */