nfs.c (111776) | nfs.c (124811) |
---|---|
1/* $NetBSD: nfs.c,v 1.2 1998/01/24 12:43:09 drochner Exp $ */ 2 3/*- 4 * Copyright (c) 1993 John Brezak 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 15 unchanged lines hidden (view full) --- 24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 27 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31#include <sys/cdefs.h> | 1/* $NetBSD: nfs.c,v 1.2 1998/01/24 12:43:09 drochner Exp $ */ 2 3/*- 4 * Copyright (c) 1993 John Brezak 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 15 unchanged lines hidden (view full) --- 24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 27 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31#include <sys/cdefs.h> |
32__FBSDID("$FreeBSD: head/lib/libstand/nfs.c 111776 2003-03-03 00:58:47Z marcel $"); | 32__FBSDID("$FreeBSD: head/lib/libstand/nfs.c 124811 2004-01-21 20:12:23Z jhb $"); |
33 34#include <sys/param.h> 35#include <sys/time.h> 36#include <sys/socket.h> 37#include <sys/stat.h> 38#include <string.h> 39 40#include <netinet/in.h> --- 628 unchanged lines hidden (view full) --- 669 break; 670 case SEEK_CUR: 671 d->off += offset; 672 break; 673 case SEEK_END: 674 d->off = size - offset; 675 break; 676 default: | 33 34#include <sys/param.h> 35#include <sys/time.h> 36#include <sys/socket.h> 37#include <sys/stat.h> 38#include <string.h> 39 40#include <netinet/in.h> --- 628 unchanged lines hidden (view full) --- 669 break; 670 case SEEK_CUR: 671 d->off += offset; 672 break; 673 case SEEK_END: 674 d->off = size - offset; 675 break; 676 default: |
677 errno = EINVAL; |
|
677 return (-1); 678 } 679 680 return (d->off); 681} 682 683/* NFNON=0, NFREG=1, NFDIR=2, NFBLK=3, NFCHR=4, NFLNK=5 */ 684int nfs_stat_types[8] = { --- 51 unchanged lines hidden (view full) --- 736 args->count = htonl(NFS_READDIRSIZE); 737 738 cc = rpc_call(fp->iodesc, NFS_PROG, NFS_VER2, NFSPROC_READDIR, 739 args, sizeof(*args), 740 rdata.d, sizeof(rdata.d)); 741 buf = rdata.d; 742 roff = (struct nfs_readdir_off *)buf; 743 if (ntohl(roff->cookie) != 0) | 678 return (-1); 679 } 680 681 return (d->off); 682} 683 684/* NFNON=0, NFREG=1, NFDIR=2, NFBLK=3, NFCHR=4, NFLNK=5 */ 685int nfs_stat_types[8] = { --- 51 unchanged lines hidden (view full) --- 737 args->count = htonl(NFS_READDIRSIZE); 738 739 cc = rpc_call(fp->iodesc, NFS_PROG, NFS_VER2, NFSPROC_READDIR, 740 args, sizeof(*args), 741 rdata.d, sizeof(rdata.d)); 742 buf = rdata.d; 743 roff = (struct nfs_readdir_off *)buf; 744 if (ntohl(roff->cookie) != 0) |
744 return 1; | 745 return EIO; |
745 } 746 roff = (struct nfs_readdir_off *)buf; 747 748 if (ntohl(roff->follows) == 0) { 749 eof = ntohl((roff+1)->cookie); 750 if (eof) { 751 cookie = 0; | 746 } 747 roff = (struct nfs_readdir_off *)buf; 748 749 if (ntohl(roff->follows) == 0) { 750 eof = ntohl((roff+1)->cookie); 751 if (eof) { 752 cookie = 0; |
752 return 1; | 753 return ENOENT; |
753 } 754 goto refill; 755 } 756 757 buf += sizeof(struct nfs_readdir_off); 758 rd = (struct nfs_readdir_data *)buf; 759 d->d_namlen = ntohl(rd->len); 760 bcopy(rd->name, d->d_name, d->d_namlen); 761 d->d_name[d->d_namlen] = '\0'; 762 763 buf += (sizeof(struct nfs_readdir_data) + roundup(htonl(rd->len),4)); 764 roff = (struct nfs_readdir_off *)buf; 765 cookie = ntohl(roff->cookie); 766 return 0; 767} | 754 } 755 goto refill; 756 } 757 758 buf += sizeof(struct nfs_readdir_off); 759 rd = (struct nfs_readdir_data *)buf; 760 d->d_namlen = ntohl(rd->len); 761 bcopy(rd->name, d->d_name, d->d_namlen); 762 d->d_name[d->d_namlen] = '\0'; 763 764 buf += (sizeof(struct nfs_readdir_data) + roundup(htonl(rd->len),4)); 765 roff = (struct nfs_readdir_off *)buf; 766 cookie = ntohl(roff->cookie); 767 return 0; 768} |