1 /* Copyright 1996,1997,1999,2001,2002,2009 Alain Knaff.
2 * This file is part of mtools.
4 * Mtools is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Mtools is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Mtools. If not, see <http://www.gnu.org/licenses/>.
17 * Force I/O to be done to complete transfer length
26 #include "sysincludes.h"
30 static int force_io(Stream_t *Stream,
31 char *buf, mt_off_t start, size_t len,
32 int (*io)(Stream_t *, char *, mt_off_t, size_t))
38 ret = io(Stream, buf, start, len);
53 int force_write(Stream_t *Stream, char *buf, mt_off_t start, size_t len)
55 return force_io(Stream, buf, start, len,
56 Stream->Class->write);
59 int force_read(Stream_t *Stream, char *buf, mt_off_t start, size_t len)
61 return force_io(Stream, buf, start, len,