2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #include <afsconfig.h>
11 #include "afs/param.h"
13 #include "afs/sysincludes.h" /*Standard vendor system headers */
14 #include "afsincludes.h" /*AFS-based standard headers */
16 extern struct vnodeops *afs_ops;
19 osi_TryEvictVCache(struct vcache *avc, int *slept) {
21 if (!VREFCOUNT_GT(avc,0)
22 && avc->opens == 0 && (avc->f.states & CUnlinkedDel) == 0) {
23 code = afs_FlushVCache(avc, slept);
34 tvc = (struct vcache *)afs_osi_Alloc(sizeof(struct vcache));
36 #ifdef KERNEL_HAVE_PIN
37 pin((char *)tvc, sizeof(struct vcache)); /* XXX */
44 osi_PrePopulateVCache(struct vcache *avc) {
45 memset(avc, 0, sizeof(struct vcache));
48 LOCK_INIT(&avc->pvmlock, "vcache pvmlock");
49 avc->vmh = avc->segid = NULL;
53 /* Don't forget to free the gnode space */
54 avc->v.v_gnode = osi_AllocSmallSpace(sizeof(struct gnode));
55 memset(avc->v.v_gnode, 0, sizeof(struct gnode));
59 osi_AttachVnode(struct vcache *avc, int seq) { }
62 osi_PostPopulateVCache(struct vcache *avc) {
63 avc->v.v_op = afs_ops;
65 avc->v.v_vfsp = afs_globalVFS;
68 avc->v.v_vfsnext = afs_globalVFS->vfs_vnodes; /* link off vfs */
69 avc->v.v_vfsprev = NULL;
70 afs_globalVFS->vfs_vnodes = &avc->v;
71 if (avc->v.v_vfsnext != NULL)
72 avc->v.v_vfsnext->v_vfsprev = &avc->v;
73 avc->v.v_next = avc->v.v_gnode->gn_vnode; /*Single vnode per gnode for us! */
74 avc->v.v_gnode->gn_vnode = &avc->v;