afs: Fix a few ARCH/osi_vcache.c style errors
[openafs.git] / src / afs / AIX / 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 extern struct vnodeops *afs_ops;
17
18 int
19 osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep)
20 {
21     int code;
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     struct vcache *tvc;
35
36     tvc = afs_osi_Alloc(sizeof(struct vcache));
37     osi_Assert(tvc != NULL);
38
39 #ifdef  KERNEL_HAVE_PIN
40     pin((char *)tvc, sizeof(struct vcache));    /* XXX */
41 #endif
42
43     return tvc;
44 }
45
46 void
47 osi_PrePopulateVCache(struct vcache *avc)
48 {
49     memset(avc, 0, sizeof(struct vcache));
50
51 #ifdef  AFS_AIX32_ENV
52     LOCK_INIT(&avc->pvmlock, "vcache pvmlock");
53     avc->vmh = avc->segid = NULL;
54     avc->credp = NULL;
55 #endif
56
57     /* Don't forget to free the gnode space */
58     avc->v.v_gnode = osi_AllocSmallSpace(sizeof(struct gnode));
59     memset(avc->v.v_gnode, 0, sizeof(struct gnode));
60 }
61
62 void
63 osi_AttachVnode(struct vcache *avc, int seq)
64 {
65 }
66
67 void
68 osi_PostPopulateVCache(struct vcache *avc)
69 {
70     avc->v.v_op = afs_ops;
71
72     avc->v.v_vfsp = afs_globalVFS;
73     avc->v.v_type = VREG;
74
75     avc->v.v_vfsnext = afs_globalVFS->vfs_vnodes;       /* link off vfs */
76     avc->v.v_vfsprev = NULL;
77     afs_globalVFS->vfs_vnodes = &avc->v;
78     if (avc->v.v_vfsnext != NULL)
79         avc->v.v_vfsnext->v_vfsprev = &avc->v;
80     avc->v.v_next = avc->v.v_gnode->gn_vnode;   /*Single vnode per gnode for us! */
81     avc->v.v_gnode->gn_vnode = &avc->v;
82 }
83