blob: d1aa17f475975214d0e31a4a759897b60fd6fa1c (
plain) (
blame)
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
|
///////////////////////////////////////////////////////////////////////////////
//
/// \file io.h
/// \brief I/O types and functions
//
// Copyright (C) 2007 Lasse Collin
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef IO_H
#define IO_H
#include "private.h"
#if BUFSIZ <= 1024
# define IO_BUFFER_SIZE 8192
#else
# define IO_BUFFER_SIZE BUFSIZ
#endif
typedef struct {
const char *src_name;
char *dest_name;
int dir_fd;
int src_fd;
int dest_fd;
struct stat src_st;
ino_t dest_ino;
bool src_eof;
} file_pair;
extern void io_init(void);
extern void io_finish(void);
extern file_pair *io_open(const char *src_name);
extern void io_close(file_pair *pair, bool success);
extern size_t io_read(file_pair *pair, uint8_t *buf, size_t size);
extern int io_write(const file_pair *pair, const uint8_t *buf, size_t size);
#endif
|