nfs_common.c (33134) | nfs_common.c (34961) |
---|---|
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.50 1998/02/04 22:33:15 eivind Exp $ | 37 * $Id: nfs_subs.c,v 1.51 1998/02/06 12:13:57 eivind 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> --- 507 unchanged lines hidden (view full) --- 553extern int getfh(struct proc *, struct getfh_args *, int *); 554struct nfssvc_args; 555extern int nfssvc(struct proc *, struct nfssvc_args *, int *); 556 557LIST_HEAD(nfsnodehashhead, nfsnode); 558 559int nfs_webnamei __P((struct nameidata *, struct vnode *, struct proc *)); 560 | 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> --- 507 unchanged lines hidden (view full) --- 553extern int getfh(struct proc *, struct getfh_args *, int *); 554struct nfssvc_args; 555extern int nfssvc(struct proc *, struct nfssvc_args *, int *); 556 557LIST_HEAD(nfsnodehashhead, nfsnode); 558 559int nfs_webnamei __P((struct nameidata *, struct vnode *, struct proc *)); 560 |
561u_quad_t 562nfs_curusec() 563{ 564 struct timeval tv; 565 566 getmicrotime(&tv); 567 return ((u_quad_t)tv.tv_sec * 1000000 + (u_quad_t)tv.tv_usec); 568} 569 |
|
561/* 562 * Create the header for an rpc request packet 563 * The hsiz is the size of the rest of the nfs request header. 564 * (just used to decide if a cluster is a good idea) 565 */ 566struct mbuf * 567nfsm_reqh(vp, procid, hsiz, bposp) 568 struct vnode *vp; --- 774 unchanged lines hidden (view full) --- 1343 else 1344 np->n_size = vap->va_size; 1345 } else 1346 np->n_size = vap->va_size; 1347 vnode_pager_setsize(vp, (u_long)np->n_size); 1348 } else 1349 np->n_size = vap->va_size; 1350 } | 570/* 571 * Create the header for an rpc request packet 572 * The hsiz is the size of the rest of the nfs request header. 573 * (just used to decide if a cluster is a good idea) 574 */ 575struct mbuf * 576nfsm_reqh(vp, procid, hsiz, bposp) 577 struct vnode *vp; --- 774 unchanged lines hidden (view full) --- 1352 else 1353 np->n_size = vap->va_size; 1354 } else 1355 np->n_size = vap->va_size; 1356 vnode_pager_setsize(vp, (u_long)np->n_size); 1357 } else 1358 np->n_size = vap->va_size; 1359 } |
1351 np->n_attrstamp = time.tv_sec; | 1360 np->n_attrstamp = time_second; |
1352 if (vaper != NULL) { 1353 bcopy((caddr_t)vap, (caddr_t)vaper, sizeof(*vap)); 1354 if (np->n_flag & NCHG) { 1355 if (np->n_flag & NACC) 1356 vaper->va_atime = np->n_atim; 1357 if (np->n_flag & NUPD) 1358 vaper->va_mtime = np->n_mtim; 1359 } --- 9 unchanged lines hidden (view full) --- 1369int 1370nfs_getattrcache(vp, vaper) 1371 register struct vnode *vp; 1372 struct vattr *vaper; 1373{ 1374 register struct nfsnode *np = VTONFS(vp); 1375 register struct vattr *vap; 1376 | 1361 if (vaper != NULL) { 1362 bcopy((caddr_t)vap, (caddr_t)vaper, sizeof(*vap)); 1363 if (np->n_flag & NCHG) { 1364 if (np->n_flag & NACC) 1365 vaper->va_atime = np->n_atim; 1366 if (np->n_flag & NUPD) 1367 vaper->va_mtime = np->n_mtim; 1368 } --- 9 unchanged lines hidden (view full) --- 1378int 1379nfs_getattrcache(vp, vaper) 1380 register struct vnode *vp; 1381 struct vattr *vaper; 1382{ 1383 register struct nfsnode *np = VTONFS(vp); 1384 register struct vattr *vap; 1385 |
1377 if ((time.tv_sec - np->n_attrstamp) >= NFS_ATTRTIMEO(np)) { | 1386 if ((time_second - np->n_attrstamp) >= NFS_ATTRTIMEO(np)) { |
1378 nfsstats.attrcache_misses++; 1379 return (ENOENT); 1380 } 1381 nfsstats.attrcache_hits++; 1382 vap = &np->n_vattr; 1383 if (vap->va_size != np->n_size) { 1384 if (vap->va_type == VREG) { 1385 if (np->n_flag & NMODIFIED) { --- 710 unchanged lines hidden --- | 1387 nfsstats.attrcache_misses++; 1388 return (ENOENT); 1389 } 1390 nfsstats.attrcache_hits++; 1391 vap = &np->n_vattr; 1392 if (vap->va_size != np->n_size) { 1393 if (vap->va_type == VREG) { 1394 if (np->n_flag & NMODIFIED) { --- 710 unchanged lines hidden --- |