5a1df46d4343261d695ecb445f8857926d04433f
[openafs.git] / src / afs / HPUX / 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 {
19     int code;
20
21     /* we can't control whether we sleep */
22     if (!VREFCOUNT_GT(avc,0)
23         && avc->opens == 0 && (avc->f.states & CUnlinkedDel) == 0) {
24         code = afs_FlushVCache(avc, slept);
25         if (code == 0)
26             return 1;
27     }
28     return 0;
29 }
30
31 struct vcache *
32 osi_NewVnode(void)
33 {
34     return afs_osi_Alloc(sizeof(struct vcache));
35 }
36
37 void
38 osi_PrePopulateVCache(struct vcache *avc)
39 {
40     memset(avc, 0, sizeof(struct vcache));
41
42     avc->flushDV.low = avc->flushDV.high = AFS_MAXDV;
43 }
44
45 void
46 osi_AttachVnode(struct vcache *avc, int seq)
47 {
48 }
49
50 void
51 osi_PostPopulateVCache(struct vcache *avc)
52 {
53     AFSTOV(avc)->v_op = afs_ops;
54     avc->v.v_vfsp = afs_globalVFS;
55     vSetType(avc, VREG);
56 }