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) {
20 if (!VREFCOUNT_GT(avc,0)
21 && avc->opens == 0 && (avc->f.states & CUnlinkedDel) == 0) {
22 code = afs_FlushVCache(avc, slept);
33 tvc = (struct vcache *)afs_osi_Alloc(sizeof(struct vcache));
35 #ifdef KERNEL_HAVE_PIN
36 pin((char *)tvc, sizeof(struct vcache)); /* XXX */
43 osi_PrePopulateVCache(struct vcache *avc) {
44 memset(avc, 0, sizeof(struct vcache));
47 LOCK_INIT(&avc->pvmlock, "vcache pvmlock");
48 avc->vmh = avc->segid = NULL;
52 /* Don't forget to free the gnode space */
53 avc->v.v_gnode = osi_AllocSmallSpace(sizeof(struct gnode));
54 memset(avc->v.v_gnode, 0, sizeof(struct gnode));
58 osi_AttachVnode(struct vcache *avc, int seq) { }
61 osi_PostPopulateVCache(struct vcache *avc) {
62 avc->v.v_op = afs_ops;
64 avc->v.v_vfsp = afs_globalVFS;
67 avc->v.v_vfsnext = afs_globalVFS->vfs_vnodes; /* link off vfs */
68 avc->v.v_vfsprev = NULL;
69 afs_globalVFS->vfs_vnodes = &avc->v;
70 if (avc->v.v_vfsnext != NULL)
71 avc->v.v_vfsnext->v_vfsprev = &avc->v;
72 avc->v.v_next = avc->v.v_gnode->gn_vnode; /*Single vnode per gnode for us! */
73 avc->v.v_gnode->gn_vnode = &avc->v;