Coda Distributed File System
volhash.h
Go to the documentation of this file.
1/* BLURB gpl
2
3 Coda File System
4 Release 8
5
6 Copyright (c) 1987-2025 Carnegie Mellon University
7 Additional copyrights listed below
8
9This code is distributed "AS IS" without warranty of any kind under
10the terms of the GNU General Public Licence Version 2, as shown in the
11file LICENSE. The technical and financial contributors to Coda are
12listed in the file CREDITS.
13
14 Additional copyrights
15 none currently
16
17#*/
18
19/*
20 *
21 * Specification of the Volume name hash table.
22 *
23 */
24
25#ifndef _VOLHASH_H
26#define _VOLHASH_H 1
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32#include <sys/types.h>
33#include <sys/stat.h>
34#include <unistd.h>
35#include <stdlib.h>
36#include <stdio.h>
37#include <stdint.h>
38
39#ifdef __cplusplus
40}
41#endif
42
43#include <ohash.h>
44#include <olist.h>
45#include <inconsist.h>
46
47class vhash_iterator;
48class hashent;
49
50class vhashtab : public ohashtab {
51 friend void InitVolTable(int);
52 char *name; /* table name */
53 int vols; /* number of volumes in table */
54 int lock;
55
56public:
57 vhashtab(int size, intptr_t (*hashfn)(void *), const char *);
58 ~vhashtab();
59 void Lock(int);
60 void Unlock();
61 void add(hashent *);
62 void remove(hashent *);
63 hashent *find(VolumeId);
64 int volumes();
65 void vprint(FILE * = NULL);
66};
67
69public:
70 vhash_iterator(vhashtab &, VolumeId = -1);
72};
73
74class hashent : public olink {
75 friend class vhashtab;
76 friend class vhashtab_iterator;
77 friend int HashInsert(VolumeId, int);
78 friend int HashLookup(VolumeId);
79 friend int HashDelete(VolumeId);
80 VolumeId id;
81 int index;
82
83 int get_index() { return (index); };
84
85public:
86 hashent(VolumeId, int);
88};
89
90extern int HashInsert(VolumeId, int);
91extern int HashLookup(VolumeId);
92extern int HashDelete(VolumeId);
93
94#endif /* _VOLHASH_H */
Definition: volhash.h:74
~hashent()
Definition: volhash.h:87
hashent(VolumeId, int)
Definition: volhash.cc:156
friend int HashDelete(VolumeId)
Definition: volhash.cc:186
friend int HashLookup(VolumeId)
Definition: volhash.cc:164
friend class vhashtab_iterator
Definition: volhash.h:76
friend int HashInsert(VolumeId, int)
Definition: volhash.cc:174
Definition: ohash.h:77
Definition: ohash.h:45
Definition: volhash.h:68
hashent * operator()()
Definition: volhash.cc:150
vhash_iterator(vhashtab &, VolumeId=-1)
Definition: volhash.cc:144
Definition: volhash.h:50
friend void InitVolTable(int)
Definition: volhash.cc:64
void vprint(FILE *=NULL)
Definition: volhash.cc:132
void Lock(int)
Definition: volhash.cc:85
hashent * find(VolumeId)
Definition: volhash.cc:113
void Unlock()
Definition: volhash.cc:90
vhashtab(int size, intptr_t(*hashfn)(void *), const char *)
Definition: volhash.cc:71
void add(hashent *)
Definition: volhash.cc:95
int volumes()
Definition: volhash.cc:127
~vhashtab()
Definition: volhash.cc:80
void remove(hashent *)
Definition: volhash.cc:101
int HashDelete(VolumeId)
Definition: volhash.cc:186
int HashLookup(VolumeId)
Definition: volhash.cc:164
int HashInsert(VolumeId, int)
Definition: volhash.cc:174
#define NULL
Definition: voltypes.h:44