Signed-off-by: Christopher Bii <christopherbii@xxxxxxxx> --- support/export/cache.c | 4 +-- support/export/export.c | 2 +- support/include/nfsd_path.h | 3 --- support/misc/nfsd_path.c | 49 ------------------------------------- 4 files changed, 3 insertions(+), 55 deletions(-) diff --git a/support/export/cache.c b/support/export/cache.c index 6859a55b..0f6cf443 100644 --- a/support/export/cache.c +++ b/support/export/cache.c @@ -59,12 +59,12 @@ static int is_mountpoint(const char *path) static ssize_t cache_read(int fd, char *buf, size_t len) { - return nfsd_path_read(fd, buf, len); + return read(fd, buf, len); } static ssize_t cache_write(int fd, void *buf, size_t len) { - return nfsd_path_write(fd, buf, len); + return write(fd, buf, len); } static bool path_lookup_error(int err) diff --git a/support/export/export.c b/support/export/export.c index 2c8c3335..e50af371 100644 --- a/support/export/export.c +++ b/support/export/export.c @@ -463,7 +463,7 @@ int export_test(struct exportent *eep, int with_fsid) fd = open("/proc/net/rpc/nfsd.export/channel", O_WRONLY); if (fd < 0) return 0; - n = nfsd_path_write(fd, buf, strlen(buf)); + n = write(fd, buf, strlen(buf)); close(fd); if (n < 0) return 0; diff --git a/support/include/nfsd_path.h b/support/include/nfsd_path.h index f600fb5a..f43040d5 100644 --- a/support/include/nfsd_path.h +++ b/support/include/nfsd_path.h @@ -24,9 +24,6 @@ int nfsd_path_statfs(const char *pathname, char * nfsd_realpath(const char *path, char *resolved_path); -ssize_t nfsd_path_read(int fd, void* buf, size_t len); -ssize_t nfsd_path_write(int fd, void* buf, size_t len); - int nfsd_name_to_handle_at(int fd, const char *path, struct file_handle *fh, int *mount_id, int flags); diff --git a/support/misc/nfsd_path.c b/support/misc/nfsd_path.c index caec33ca..99c41206 100644 --- a/support/misc/nfsd_path.c +++ b/support/misc/nfsd_path.c @@ -203,55 +203,6 @@ nfsd_realpath(const char *path, char *resolved_buf) return realpath_buf.res_ptr; } -struct nfsd_rw_data { - int fd; - void* buf; - size_t len; - ssize_t bytes_read; -}; - -static void -nfsd_readfunc(void *data) -{ - struct nfsd_rw_data* t = (struct nfsd_rw_data*)data; - t->bytes_read = read(t->fd, t->buf, t->len); -} - -static ssize_t -nfsd_run_read(int fd, void* buf, size_t len) -{ - struct nfsd_rw_data d = { .fd = fd, .buf = buf, .len = len }; - nfsd_run_task(nfsd_readfunc, &d); - return d.bytes_read; -} - -ssize_t -nfsd_path_read(int fd, void* buf, size_t len) -{ - return nfsd_run_read(fd, buf, len); -} - -static void -nfsd_writefunc(void *data) -{ - struct nfsd_rw_data* d = data; - d->bytes_read = write(d->fd, d->buf, d->len); -} - -static ssize_t -nfsd_run_write(int fd, void* buf, size_t len) -{ - struct nfsd_rw_data d = { .fd = fd, .buf = buf, .len = len }; - nfsd_run_task(nfsd_writefunc, &d); - return d.bytes_read; -} - -ssize_t -nfsd_path_write(int fd, void* buf, size_t len) -{ - return nfsd_run_write(fd, buf, len); -} - #if defined(HAVE_NAME_TO_HANDLE_AT) struct nfsd_handle_data { int fd; -- 2.48.0