2 * utils - miscellaneous I/O utilities for cryptsetup
4 * Copyright (C) 2004 Jana Saout <jana@saout.de>
5 * Copyright (C) 2004-2007 Clemens Fruhwirth <clemens@endorphin.org>
6 * Copyright (C) 2009-2023 Red Hat, Inc. All rights reserved.
7 * Copyright (C) 2009-2023 Milan Broz
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.
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.
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.
24 #ifndef _CRYPTSETUP_UTILS_IO_H
25 #define _CRYPTSETUP_UTILS_IO_H
28 #include <sys/types.h>
30 ssize_t read_buffer(int fd, void *buf, size_t length);
31 ssize_t read_buffer_intr(int fd, void *buf, size_t length, volatile int *quit);
32 ssize_t write_buffer(int fd, const void *buf, size_t length);
33 ssize_t write_buffer_intr(int fd, const void *buf, size_t length, volatile int *quit);
34 ssize_t write_blockwise(int fd, size_t bsize, size_t alignment,
35 void *orig_buf, size_t length);
36 ssize_t read_blockwise(int fd, size_t bsize, size_t alignment,
37 void *orig_buf, size_t length);
38 ssize_t write_lseek_blockwise(int fd, size_t bsize, size_t alignment,
39 void *buf, size_t length, off_t offset);
40 ssize_t read_lseek_blockwise(int fd, size_t bsize, size_t alignment,
41 void *buf, size_t length, off_t offset);