Coda Distributed File System
ds_rrlist.private.h
Go to the documentation of this file.
1
2#ifndef _DS_RRLIST_PRIVATE_H_
3#define _DS_RRLIST_PRIVATE_H_
4
5#include <odytypes.h>
6
7#include "ds_list.h"
8#include "ds_rrlist.h"
9
10/*
11 * ds_rrlist.private.h: implementation-specific details of
12 * resource request lists.
13 */
14
15extern const magic_t ds_rrlist_magic;
16
17#define DS_RRLIST_VALID(rp) ((rp) && ((rp)->magic == ds_rrlist_magic))
18
19/*
20 Each request node is placed in four different structures for
21 fast access: hashed by pid and reqid, and sorted by lower bound
22 and upper bound. The sorted forms are currently kept as
23 lists; this may change to something slicker if insertion seems
24 to take too long. I don't expect these to grow very much, so
25 I'm really not worried about it.
26*/
27
29 magic_t magic; /* magic number */
30 long value; /* current value */
31 ds_hash_t *pidhash; /* hash table on pids */
32 ds_hash_t *reqhash; /* hash table on request id's */
33 ds_list_t *less; /* list for lower bounds */
34 ds_list_t *greater; /* list for upper bounds */
35};
36
37/* size of hash tables */
38#define DS_RRLIST_HASHSIZE 67
39
40/* We need a structure that hashes all request id's to the rrlist that
41 that request is currently on. */
42
43/* elements for that hash table */
44
46
47#define DS_RRLIST_REQTAB_ELT_VALID(rre) \
48 ((rre) && ((rre)->magic == ds_rrlist_reqtab_elt_magic))
49
50typedef struct ds_rrlist_reqtab_elt_t {
52 long reqid;
55
56/*
57 * Note: ds_rrlist.c is the only entity that sees these monsters,
58 * so it is responsible for both allocation and deallocation.
59 */
60
61/* ds_rrlist_reqtab_elt_t *rre, long rqid, ds_rrlist_t *lst */
62#define DS_RRLIST_REQTAB_ELT_CREATE(rre, rqid, lst) \
63 do { \
64 ALLOC(rre, ds_rrlist_reqtab_elt_t); \
65 (rre)->magic = ds_rrlist_reqtab_elt_magic; \
66 (rre)->reqid = rqid; \
67 (rre)->list = lst; \
68 } while (0)
69
70#define DS_RRLIST_REQTAB_ELT_DESTROY(rre) \
71 do { \
72 CODA_ASSERT(DS_RRLIST_REQTAB_ELT_VALID(rre)); \
73 (rre)->magic = 0; \
74 (rre)->reqid = 0; \
75 (rre)->list = NULL; \
76 FREE(rre); \
77 } while (0)
78
79#endif /* _DS_RRLIST_PRIVATE_H_ */
const magic_t ds_rrlist_magic
Definition: ds_rrlist.c:15
const magic_t ds_rrlist_reqtab_elt_magic
Definition: ds_rrlist.c:16
struct ds_rrlist_reqtab_elt_t ds_rrlist_reqtab_elt_t
unsigned long magic_t
Definition: odytypes.h:44
Definition: ds_hash.private.h:29
Definition: ds_list.private.h:41
Definition: ds_rrlist.private.h:50
long reqid
Definition: ds_rrlist.private.h:52
ds_rrlist_t * list
Definition: ds_rrlist.private.h:53
magic_t magic
Definition: ds_rrlist.private.h:51
Definition: ds_rrlist.private.h:28
ds_list_t * less
Definition: ds_rrlist.private.h:33
ds_hash_t * reqhash
Definition: ds_rrlist.private.h:32
magic_t magic
Definition: ds_rrlist.private.h:29
ds_list_t * greater
Definition: ds_rrlist.private.h:34
ds_hash_t * pidhash
Definition: ds_rrlist.private.h:31
long value
Definition: ds_rrlist.private.h:30