Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / afs / UKERNEL / osi_vcache.c
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
4 *
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
8 */
9
10 #include <afsconfig.h>
11 #include "afs/param.h"
12
13 #include "afs/sysincludes.h" /*Standard vendor system headers */
14 #include "afsincludes.h" /*AFS-based standard headers */
15
16 int
17 osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) {
18 int code;
19
20 if (!VREFCOUNT_GT(avc,0)
21 && avc->opens == 0 && (avc->f.states & CUnlinkedDel) == 0) {
22 code = afs_FlushVCache(avc, slept);
23 if (code == 0)
24 return 1;
25 }
26 return 0;
27 }
28
29 struct vcache *
30 osi_NewVnode(void) {
31 return afs_osi_Alloc(sizeof(struct vcache));
32 }
33
34 void
35 osi_PrePopulateVCache(struct vcache *avc) {
36 memset(avc, 0, sizeof(struct vcache));
37 }
38
39 void
40 osi_AttachVnode(struct vcache *avc, int seq) { }
41
42 extern struct vnodeops *afs_ops;
43 void
44 osi_PostPopulateVCache(struct vcache *avc) {
45 AFSTOV(avc)->v_vfsp = afs_globalVFS;
46 AFSTOV(avc)->v_op = afs_ops;
47 vSetType(avc, VREG);
48 }
49