Skip to content

Commit

Permalink
zed: remove unused zed_file_read_n()
Browse files Browse the repository at this point in the history
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 openzfs#11834
  • Loading branch information
nabijaczleweli authored and behlendorf committed Apr 14, 2021
1 parent cb97db7 commit 48b60cf
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 31 deletions.
29 changes: 0 additions & 29 deletions cmd/zed/zed_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 0 additions & 2 deletions cmd/zed/zed_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 48b60cf

Please sign in to comment.