4e64d86c58ae42d2efc0872e3e26d86e2ed66249
[platform/upstream/cryptsetup.git] / lib / utils_io.h
1 /*
2  * utils - miscellaneous I/O utilities for cryptsetup
3  *
4  * Copyright (C) 2004 Jana Saout <jana@saout.de>
5  * Copyright (C) 2004-2007 Clemens Fruhwirth <clemens@endorphin.org>
6  * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
7  * Copyright (C) 2009-2020 Milan Broz
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
23
24 #ifndef _CRYPTSETUP_UTILS_IO_H
25 #define _CRYPTSETUP_UTILS_IO_H
26
27 #include <sys/types.h>
28
29 ssize_t read_buffer(int fd, void *buf, size_t length);
30 ssize_t read_buffer_intr(int fd, void *buf, size_t length, volatile int *quit);
31 ssize_t write_buffer(int fd, const void *buf, size_t length);
32 ssize_t write_buffer_intr(int fd, const void *buf, size_t length, volatile int *quit);
33 ssize_t write_blockwise(int fd, size_t bsize, size_t alignment,
34                         void *orig_buf, size_t length);
35 ssize_t read_blockwise(int fd, size_t bsize, size_t alignment,
36                        void *orig_buf, size_t length);
37 ssize_t write_lseek_blockwise(int fd, size_t bsize, size_t alignment,
38                               void *buf, size_t length, off_t offset);
39 ssize_t read_lseek_blockwise(int fd, size_t bsize, size_t alignment,
40                              void *buf, size_t length, off_t offset);
41
42 #endif