libsa: cstyle cleanup for open/close/read/write sources

This commit is contained in:
tsoome 2018-06-14 08:58:10 +00:00
parent 7c724d790e
commit 08a8304a34
4 changed files with 178 additions and 175 deletions

View File

@ -89,8 +89,8 @@ read(int fd, void *dest, size_t bcount)
/*
* Optimise reads from regular files using a readahead buffer.
* If the request can't be satisfied from the current buffer contents,
* check to see if it should be bypassed, or refill the buffer and complete
* the request.
* check to see if it should be bypassed, or refill the buffer and
* complete the request.
*/
resid = bcount;
for (;;) {
@ -109,14 +109,20 @@ read(int fd, void *dest, size_t bcount)
/* will filling the readahead buffer again not help? */
if (resid >= SOPEN_RASIZE) {
/* bypass the rest of the request and leave the buffer empty */
if ((errno = (f->f_ops->fo_read)(f, dest, resid, &cresid)))
/*
* bypass the rest of the request and leave the
* buffer empty
*/
errno = (f->f_ops->fo_read)(f, dest, resid, &cresid);
if (errno != 0)
return (-1);
return (bcount - cresid);
}
/* fetch more data */
if ((errno = (f->f_ops->fo_read)(f, f->f_rabuf, SOPEN_RASIZE, &cresid)))
errno = (f->f_ops->fo_read)(f, f->f_rabuf, SOPEN_RASIZE,
&cresid);
if (errno != 0)
return (-1);
f->f_raoffset = 0;
f->f_ralen = SOPEN_RASIZE - cresid;

View File

@ -67,10 +67,7 @@ __FBSDID("$FreeBSD$");
#include "stand.h"
ssize_t
write(fd, dest, bcount)
int fd;
const void *dest;
size_t bcount;
write(int fd, const void *dest, size_t bcount)
{
struct open_file *f = &files[fd];
size_t resid;