srvr_nfs.c (39159) | srvr_nfs.c (42633) |
---|---|
1/* 2 * Copyright (c) 1997-1998 Erez Zadok 3 * Copyright (c) 1990 Jan-Simon Pendry 4 * Copyright (c) 1990 Imperial College of Science, Technology & Medicine 5 * Copyright (c) 1990 The Regents of the University of California. 6 * All rights reserved. 7 * 8 * This code is derived from software contributed to Berkeley by 9 * Jan-Simon Pendry at Imperial College, London. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions and the following disclaimer. 16 * 2. Redistributions in binary form must reproduce the above copyright 17 * notice, this list of conditions and the following disclaimer in the 18 * documentation and/or other materials provided with the distribution. 19 * 3. All advertising materials mentioning features or use of this software | 1/* 2 * Copyright (c) 1997-1998 Erez Zadok 3 * Copyright (c) 1990 Jan-Simon Pendry 4 * Copyright (c) 1990 Imperial College of Science, Technology & Medicine 5 * Copyright (c) 1990 The Regents of the University of California. 6 * All rights reserved. 7 * 8 * This code is derived from software contributed to Berkeley by 9 * Jan-Simon Pendry at Imperial College, London. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions and the following disclaimer. 16 * 2. Redistributions in binary form must reproduce the above copyright 17 * notice, this list of conditions and the following disclaimer in the 18 * documentation and/or other materials provided with the distribution. 19 * 3. All advertising materials mentioning features or use of this software |
20 * must display the following acknowledgement: | 20 * must display the following acknowledgment: |
21 * This product includes software developed by the University of 22 * California, Berkeley and its contributors. 23 * 4. Neither the name of the University nor the names of its contributors 24 * may be used to endorse or promote products derived from this software 25 * without specific prior written permission. 26 * 27 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 28 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE --- 4 unchanged lines hidden (view full) --- 33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * SUCH DAMAGE. 38 * 39 * %W% (Berkeley) %G% 40 * | 21 * This product includes software developed by the University of 22 * California, Berkeley and its contributors. 23 * 4. Neither the name of the University nor the names of its contributors 24 * may be used to endorse or promote products derived from this software 25 * without specific prior written permission. 26 * 27 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 28 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE --- 4 unchanged lines hidden (view full) --- 33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * SUCH DAMAGE. 38 * 39 * %W% (Berkeley) %G% 40 * |
41 * $Id: srvr_nfs.c,v 1.1.1.1 1998/08/23 22:07:20 obrien Exp $ | 41 * $Id: srvr_nfs.c,v 1.2 1998/09/14 08:20:37 obrien Exp $ |
42 * 43 */ 44 45/* 46 * NFS server modeling 47 */ 48 49#ifdef HAVE_CONFIG_H --- 434 unchanged lines hidden (view full) --- 484 (voidp) ping_buf, 485 ping_len, 486 fs->fs_ip, 487 (struct sockaddr_in *) 0, 488 (voidp) ((long) np->np_xid), /* for 64-bit archs */ 489 nfs_pinged); 490 491 /* | 42 * 43 */ 44 45/* 46 * NFS server modeling 47 */ 48 49#ifdef HAVE_CONFIG_H --- 434 unchanged lines hidden (view full) --- 484 (voidp) ping_buf, 485 ping_len, 486 fs->fs_ip, 487 (struct sockaddr_in *) 0, 488 (voidp) ((long) np->np_xid), /* for 64-bit archs */ 489 nfs_pinged); 490 491 /* |
492 * See if a hard error occured | 492 * See if a hard error occurred |
493 */ 494 switch (error) { 495 case ENETDOWN: 496 case ENETUNREACH: 497 case EHOSTDOWN: 498 case EHOSTUNREACH: 499 np->np_ping = MAX_ALLOWED_PINGS; /* immediately down */ 500 np->np_ttl = (time_t) 0; --- 65 unchanged lines hidden (view full) --- 566 np->np_mountd_inval = TRUE; 567 } else { 568 error = EWOULDBLOCK; 569 } 570 } 571 if (error < 0 && wchan && !(fs->fs_flags & FSF_WANT)) { 572 /* 573 * If a wait channel is supplied, and no | 493 */ 494 switch (error) { 495 case ENETDOWN: 496 case ENETUNREACH: 497 case EHOSTDOWN: 498 case EHOSTUNREACH: 499 np->np_ping = MAX_ALLOWED_PINGS; /* immediately down */ 500 np->np_ttl = (time_t) 0; --- 65 unchanged lines hidden (view full) --- 566 np->np_mountd_inval = TRUE; 567 } else { 568 error = EWOULDBLOCK; 569 } 570 } 571 if (error < 0 && wchan && !(fs->fs_flags & FSF_WANT)) { 572 /* 573 * If a wait channel is supplied, and no |
574 * error has yet occured, then arrange | 574 * error has yet occurred, then arrange |
575 * that a wakeup is done on the wait channel, 576 * whenever a wakeup is done on this fs node. 577 * Wakeup's are done on the fs node whenever 578 * it changes state - thus causing control to 579 * come back here and new, better things to happen. 580 */ 581 fs->fs_flags |= FSF_WANT; 582 sched_task(wakeup_task, wchan, (voidp) fs); --- 75 unchanged lines hidden (view full) --- 658 } 659 if (*p == NULL) 660 plog(XLOG_WARNING, "ignoring unknown protocol option for %s:%s", 661 host, rfsname); 662 } 663 } 664#endif /* MNTTAB_OPT_PROTO */ 665 | 575 * that a wakeup is done on the wait channel, 576 * whenever a wakeup is done on this fs node. 577 * Wakeup's are done on the fs node whenever 578 * it changes state - thus causing control to 579 * come back here and new, better things to happen. 580 */ 581 fs->fs_flags |= FSF_WANT; 582 sched_task(wakeup_task, wchan, (voidp) fs); --- 75 unchanged lines hidden (view full) --- 658 } 659 if (*p == NULL) 660 plog(XLOG_WARNING, "ignoring unknown protocol option for %s:%s", 661 host, rfsname); 662 } 663 } 664#endif /* MNTTAB_OPT_PROTO */ 665 |
666/* XXX: do we want to do this unconditionally of #define's? */ 667/* #if defined(MNTTAB_OPT_VERS ) && defined( MNTTAB_OPT_PROTO ) */ 668 { 669 char *nfsv2_opt = hasmntopt(&mnt, "nfsv2"); 670 if (nfsv2_opt) { 671 nfs_version = (unsigned long)2; /* nullify any ``vers=X'' statements */ 672 nfs_proto = "udp"; /* nullify any ``proto=tcp'' stmts */ 673 plog(XLOG_WARNING, "found compatiblity option \"nfsv2\": set options" 674 " vers=2, proto=udp for host %s", host); 675 } | 666#ifdef HAVE_NFS_NFSV2_H 667 /* allow overriding if nfsv2 option is specified in mount options */ 668 if (hasmntopt(&mnt, "nfsv2")) { 669 nfs_version = (u_long) 2; /* nullify any ``vers=X'' statements */ 670 nfs_proto = "udp"; /* nullify any ``proto=tcp'' stmts */ 671 plog(XLOG_WARNING, "found compatiblity option \"nfsv2\": set options vers=2, proto=udp for host %s", host); |
676 } | 672 } |
677/*#endif*/ /* MNTTAB_OPT_VERS && MNTTAB_OPT_PROTO */ | 673#endif /* HAVE_NFS_NFSV2_H */ |
678 679 /* 680 * lookup host address and canonical name 681 */ 682 hp = gethostbyname(host); 683 684 /* 685 * New code from Bob Harris <harris@basil-rathbone.mit.edu> --- 72 unchanged lines hidden (view full) --- 758 759 if (!nfs_proto) 760 nfs_proto = "udp"; 761 762 plog(XLOG_INFO, "Using NFS version %d, protocol %s on host %s", 763 nfs_version, nfs_proto, host); 764 765 /* | 674 675 /* 676 * lookup host address and canonical name 677 */ 678 hp = gethostbyname(host); 679 680 /* 681 * New code from Bob Harris <harris@basil-rathbone.mit.edu> --- 72 unchanged lines hidden (view full) --- 754 755 if (!nfs_proto) 756 nfs_proto = "udp"; 757 758 plog(XLOG_INFO, "Using NFS version %d, protocol %s on host %s", 759 nfs_version, nfs_proto, host); 760 761 /* |
766 * Try to find an existing fs server stucture for this host. | 762 * Try to find an existing fs server structure for this host. |
767 * Note that differing versions or protocols have their own structures. 768 * XXX: Need to fix the ping mechanism to actually use the NFS protocol 769 * chosen here (right now it always uses datagram sockets). 770 */ 771 ITER(fs, fserver, &nfs_srvr_list) { 772 if (STREQ(host, fs->fs_host) && 773 nfs_version == fs->fs_version && 774 STREQ(nfs_proto, fs->fs_proto)) { --- 90 unchanged lines hidden --- | 763 * Note that differing versions or protocols have their own structures. 764 * XXX: Need to fix the ping mechanism to actually use the NFS protocol 765 * chosen here (right now it always uses datagram sockets). 766 */ 767 ITER(fs, fserver, &nfs_srvr_list) { 768 if (STREQ(host, fs->fs_host) && 769 nfs_version == fs->fs_version && 770 STREQ(nfs_proto, fs->fs_proto)) { --- 90 unchanged lines hidden --- |