Deleted Added
full compact
nfs_common.c (3664) nfs_common.c (5455)
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Rick Macklem at The University of Guelph.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 20 unchanged lines hidden (view full) ---

29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Rick Macklem at The University of Guelph.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 20 unchanged lines hidden (view full) ---

29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94
37 * $Id: nfs_subs.c,v 1.6 1994/10/02 17:27:01 phk Exp $
37 * $Id: nfs_subs.c,v 1.7 1994/10/17 17:47:37 phk Exp $
38 */
39
40/*
41 * These functions support the macros and help fiddle mbuf chains for
42 * the nfs op functions. They do things like create the rpc header and
43 * copy data between mbuf chains and uio lists.
44 */
45#include <sys/param.h>

--- 944 unchanged lines hidden (view full) ---

990 error = EINVAL;
991 goto out;
992 }
993 /*
994 * Check for saved name request
995 */
996 if (cnp->cn_flags & (SAVENAME | SAVESTART)) {
997 cnp->cn_flags |= HASBUF;
38 */
39
40/*
41 * These functions support the macros and help fiddle mbuf chains for
42 * the nfs op functions. They do things like create the rpc header and
43 * copy data between mbuf chains and uio lists.
44 */
45#include <sys/param.h>

--- 944 unchanged lines hidden (view full) ---

990 error = EINVAL;
991 goto out;
992 }
993 /*
994 * Check for saved name request
995 */
996 if (cnp->cn_flags & (SAVENAME | SAVESTART)) {
997 cnp->cn_flags |= HASBUF;
998 nfsrv_vmio( ndp->ni_vp);
998 return (0);
999 }
1000out:
1001 FREE(cnp->cn_pnbuf, M_NAMEI);
1002 return (error);
1003}
1004
1005/*

--- 112 unchanged lines hidden (view full) ---

1118 cred->cr_ngroups = i;
1119 }
1120 if (exflags & MNT_EXRDONLY)
1121 *rdonlyp = 1;
1122 else
1123 *rdonlyp = 0;
1124 if (!lockflag)
1125 VOP_UNLOCK(*vpp);
999 return (0);
1000 }
1001out:
1002 FREE(cnp->cn_pnbuf, M_NAMEI);
1003 return (error);
1004}
1005
1006/*

--- 112 unchanged lines hidden (view full) ---

1119 cred->cr_ngroups = i;
1120 }
1121 if (exflags & MNT_EXRDONLY)
1122 *rdonlyp = 1;
1123 else
1124 *rdonlyp = 0;
1125 if (!lockflag)
1126 VOP_UNLOCK(*vpp);
1127 nfsrv_vmio(*vpp);
1126 return (0);
1127}
1128
1129/*
1130 * This function compares two net addresses by family and returns TRUE
1131 * if they are the same host.
1132 * If there is any doubt, return FALSE.
1133 * The AF_INET family is handled as a special case so that address mbufs

--- 29 unchanged lines hidden (view full) ---

1163 break;
1164 }
1165#endif /* ISO */
1166 default:
1167 break;
1168 };
1169 return (0);
1170}
1128 return (0);
1129}
1130
1131/*
1132 * This function compares two net addresses by family and returns TRUE
1133 * if they are the same host.
1134 * If there is any doubt, return FALSE.
1135 * The AF_INET family is handled as a special case so that address mbufs

--- 29 unchanged lines hidden (view full) ---

1165 break;
1166 }
1167#endif /* ISO */
1168 default:
1169 break;
1170 };
1171 return (0);
1172}
1173
1174int
1175nfsrv_vmio( struct vnode *vp) {
1176 int rtval;
1177 vm_object_t object;
1178 vm_pager_t pager;
1179
1180 if( (vp == NULL) || (vp->v_type != VREG))
1181 return 1;
1182
1183retry:
1184 if( (vp->v_flag & VVMIO) == 0) {
1185 pager = (vm_pager_t) vnode_pager_alloc(vp, 0, 0, 0);
1186 object = (vm_object_t) vp->v_vmdata;
1187 if( object->pager != pager)
1188 panic("nfsrv_vmio: pager/object mismatch");
1189 (void) vm_object_lookup( pager);
1190 pager_cache( object, TRUE);
1191 vp->v_flag |= VVMIO;
1192 } else {
1193 if( (object = (vm_object_t)vp->v_vmdata) &&
1194 (object->flags & OBJ_DEAD)) {
1195 tsleep( (caddr_t) object, PVM, "nfdead", 0);
1196 goto retry;
1197 }
1198 if( !object)
1199 panic("nfsrv_vmio: VMIO object missing");
1200 pager = object->pager;
1201 if( !pager)
1202 panic("nfsrv_vmio: VMIO pager missing");
1203 (void) vm_object_lookup( pager);
1204 }
1205 return 0;
1206}
1207int
1208nfsrv_vput( struct vnode *vp) {
1209 if( (vp->v_flag & VVMIO) && vp->v_vmdata) {
1210 vm_object_deallocate( (vm_object_t) vp->v_vmdata);
1211 }
1212 vput( vp);
1213 return 0;
1214}
1215int
1216nfsrv_vrele( struct vnode *vp) {
1217 if( (vp->v_flag & VVMIO) && vp->v_vmdata) {
1218 vm_object_deallocate( (vm_object_t) vp->v_vmdata);
1219 }
1220 vrele( vp);
1221 return 0;
1222}
1223