mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-18 02:20:59 +03:00
zed: remove unused zed_file_read_n()
Same deal as zed_file_close_on_exec() Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #11834
This commit is contained in:
parent
cb97db792e
commit
48b60cffda
@ -24,35 +24,6 @@
|
||||
#include "zed_file.h"
|
||||
#include "zed_log.h"
|
||||
|
||||
/*
|
||||
* Read up to [n] bytes from [fd] into [buf].
|
||||
* Return the number of bytes read, 0 on EOF, or -1 on error.
|
||||
*/
|
||||
ssize_t
|
||||
zed_file_read_n(int fd, void *buf, size_t n)
|
||||
{
|
||||
unsigned char *p;
|
||||
size_t n_left;
|
||||
ssize_t n_read;
|
||||
|
||||
p = buf;
|
||||
n_left = n;
|
||||
while (n_left > 0) {
|
||||
if ((n_read = read(fd, p, n_left)) < 0) {
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
else
|
||||
return (-1);
|
||||
|
||||
} else if (n_read == 0) {
|
||||
break;
|
||||
}
|
||||
n_left -= n_read;
|
||||
p += n_read;
|
||||
}
|
||||
return (n - n_left);
|
||||
}
|
||||
|
||||
/*
|
||||
* Write [n] bytes from [buf] out to [fd].
|
||||
* Return the number of bytes written, or -1 on error.
|
||||
|
@ -18,8 +18,6 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
ssize_t zed_file_read_n(int fd, void *buf, size_t n);
|
||||
|
||||
ssize_t zed_file_write_n(int fd, void *buf, size_t n);
|
||||
|
||||
int zed_file_lock(int fd);
|
||||
|
Loading…
Reference in New Issue
Block a user