vlserver: Access cache via vl_ctx
[openafs.git] / src / vlserver / vlserver_internal.h
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 #ifndef _VLSERVER_INTERNAL_H
11 #define _VLSERVER_INTERNAL_H
12
13 /**
14  * context for a transaction of a single VL operation.
15  */
16 struct vl_ctx {
17     struct ubik_trans *trans;
18     afs_uint32 *hostaddress;
19     struct extentaddr **ex_addr;
20     struct vlheader *cheader;
21 };
22
23 /* vlprocs.c */
24 extern int Init_VLdbase(struct vl_ctx *ctx, int locktype, int this_op);
25
26 /* vlutils.c */
27 extern afs_int32 vlwrite(struct ubik_trans *trans, afs_int32 offset,
28                          void *buffer, afs_int32 length);
29 extern afs_int32 vlentrywrite(struct ubik_trans *trans, afs_int32 offset,
30                               void *buffer, afs_int32 length);
31 extern int write_vital_vlheader(struct vl_ctx *ctx);
32 extern afs_int32 readExtents(struct ubik_trans *trans);
33 extern afs_int32 CheckInit(struct ubik_trans *trans, int builddb);
34 extern afs_int32 AllocBlock(struct vl_ctx *ctx,
35                             struct nvlentry *tentry);
36 extern afs_int32 FindExtentBlock(struct vl_ctx *ctx, afsUUID *uuidp,
37                                  afs_int32 createit, afs_int32 hostslot,
38                                  struct extentaddr **expp, afs_int32 *basep);
39 extern afs_int32 FindByID(struct vl_ctx *ctx, afs_uint32 volid,
40                           afs_int32 voltype, struct nvlentry *tentry,
41                           afs_int32 *error);
42 extern afs_int32 FindByName(struct vl_ctx *ctx, char *volname,
43                             struct nvlentry *tentry, afs_int32 *error);
44 extern int EntryIDExists(struct vl_ctx *ctx, const afs_uint32 *ids,
45                          afs_int32 ids_len, afs_int32 *error);
46 extern afs_uint32 NextUnusedID(struct vl_ctx *ctx, afs_uint32 maxvolid,
47                                afs_uint32 bump, afs_int32 *error);
48 extern int HashNDump(struct vl_ctx *ctx, int hashindex);
49 extern int HashIdDump(struct vl_ctx *ctx, int hashindex);
50 extern int ThreadVLentry(struct vl_ctx *ctx, afs_int32 blockindex,
51                          struct nvlentry *tentry);
52 extern int UnthreadVLentry(struct vl_ctx *ctx, afs_int32 blockindex,
53                          struct nvlentry *aentry);
54 extern int HashVolid(struct vl_ctx *ctx, afs_int32 voltype,
55                      afs_int32 blockindex, struct nvlentry *tentry);
56 extern int UnhashVolid(struct vl_ctx *ctx, afs_int32 voltype,
57                        afs_int32 blockindex, struct nvlentry *aentry);
58 extern int HashVolname(struct vl_ctx *ctx, afs_int32 blockindex,
59                        struct nvlentry *aentry);
60 extern int UnhashVolname(struct vl_ctx *ctx, afs_int32 blockindex,
61                          struct nvlentry *aentry);
62 extern afs_int32 NextEntry(struct vl_ctx *ctx, afs_int32 blockindex,
63                            struct nvlentry *tentry, afs_int32 *remaining);
64 extern int FreeBlock(struct vl_ctx *ctx, afs_int32 blockindex);
65 extern int vlsetcache(struct vl_ctx *ctx, int locktype);
66 #endif