From: Ronnie Sahlberg Date: Wed, 17 Apr 2013 01:28:50 +0000 (-0700) Subject: Change nfs-cp.c example to use lseek+read/write instead of pread/pwrite since some... X-Git-Tag: upstream/1.9.6^2~208 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=3d574b1eab581b59afce94a85853ec47e7ef404e;p=deb_libnfs.git Change nfs-cp.c example to use lseek+read/write instead of pread/pwrite since some platforms (==amiga) dont have pread/pwrite Build nfs-ls and nfs-cp for amiga/aros --- diff --git a/aros/Makefile.AROS b/aros/Makefile.AROS index 9ad038c..6d39137 100755 --- a/aros/Makefile.AROS +++ b/aros/Makefile.AROS @@ -10,7 +10,7 @@ OBJS+=portmap/portmap.o portmap/libnfs-raw-portmap.o OBJS+=rquota/rquota.o rquota/libnfs-raw-rquota.o OBJS+=aros/aros_compat.o -EXAMPLES=examples/nfsclient-listservers examples/nfsclient-sync +EXAMPLES=examples/nfsclient-listservers examples/nfsclient-sync examples/nfs-cp examples/nfs-ls all: lib/libnfs.a $(EXAMPLES) @@ -27,3 +27,8 @@ examples/nfsclient-listservers: examples/nfsclient-listservers.c lib/libnfs.a examples/nfsclient-sync: examples/nfsclient-sync.c lib/libnfs.a $(CC) $(CFLAGS) -o $@ $< lib/libnfs.a +examples/nfs-ls: examples/nfs-ls.c lib/libnfs.a + $(CC) $(CFLAGS) -o $@ $< lib/libnfs.a + +examples/nfs-cp: examples/nfs-cp.c lib/libnfs.a + $(CC) $(CFLAGS) -o $@ $< lib/libnfs.a diff --git a/examples/nfs-cp.c b/examples/nfs-cp.c index 53e22d6..eeea404 100644 --- a/examples/nfs-cp.c +++ b/examples/nfs-cp.c @@ -96,7 +96,8 @@ static int64_t file_pread(struct file_context *fc, char *buf, int64_t count, uint64_t off) { if (fc->is_nfs == 0) { - return pread(fc->fd, buf, count, off); + lseek(fc->fd, off, SEEK_SET); + return read(fc->fd, buf, count); } else { return nfs_pread(fc->nfs, fc->nfsfh, off, count, buf); } @@ -106,7 +107,8 @@ static int64_t file_pwrite(struct file_context *fc, char *buf, int64_t count, uint64_t off) { if (fc->is_nfs == 0) { - return pwrite(fc->fd, buf, count, off); + lseek(fc->fd, off, SEEK_SET); + return write(fc->fd, buf, count); } else { return nfs_pwrite(fc->nfs, fc->nfsfh, off, count, buf); }