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
, int defersleep
) {
21 if (!VREFCOUNT_GT(avc
,0)
22 && avc
->opens
== 0 && (avc
->f
.states
& CUnlinkedDel
) == 0) {
23 code
= afs_FlushVCache(avc
, slept
);
34 tvc
= afs_osi_Alloc(sizeof(struct vcache
));
35 osi_Assert(tvc
!= NULL
);
37 #ifdef KERNEL_HAVE_PIN
38 pin((char *)tvc
, sizeof(struct vcache
)); /* XXX */
45 osi_PrePopulateVCache(struct vcache
*avc
) {
46 memset(avc
, 0, sizeof(struct vcache
));
49 LOCK_INIT(&avc
->pvmlock
, "vcache pvmlock");
50 avc
->vmh
= avc
->segid
= NULL
;
54 /* Don't forget to free the gnode space */
55 avc
->v
.v_gnode
= osi_AllocSmallSpace(sizeof(struct gnode
));
56 memset(avc
->v
.v_gnode
, 0, sizeof(struct gnode
));
60 osi_AttachVnode(struct vcache
*avc
, int seq
) { }
63 osi_PostPopulateVCache(struct vcache
*avc
) {
64 avc
->v
.v_op
= afs_ops
;
66 avc
->v
.v_vfsp
= afs_globalVFS
;
69 avc
->v
.v_vfsnext
= afs_globalVFS
->vfs_vnodes
; /* link off vfs */
70 avc
->v
.v_vfsprev
= NULL
;
71 afs_globalVFS
->vfs_vnodes
= &avc
->v
;
72 if (avc
->v
.v_vfsnext
!= NULL
)
73 avc
->v
.v_vfsnext
->v_vfsprev
= &avc
->v
;
74 avc
->v
.v_next
= avc
->v
.v_gnode
->gn_vnode
; /*Single vnode per gnode for us! */
75 avc
->v
.v_gnode
->gn_vnode
= &avc
->v
;