Coda Distributed File System
rec_smolist.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 * rec_smolist.h -- Specification of a recoverable singly-linked list type
22 * where list elements can be on only one list at a time.
23 *
24 * NOTE (Satya, 5/31/95)
25 * ---------------------
26 * The files util/rec_smolist.[ch] were originally called vol/recolist.[ch].
27 * The original data structures recolink and recolist are now
28 * called rec_smolink and rec_smolist (for "small" olist and olink).
29 * No functional code changes have been made --- just systematic renaming.
30 *
31 * This change was made to reduce confusion with rec_olist and rec_olink.
32 * The rec_smo* data structures are very similar to the rec_o* data structures
33 * except that the recoverable structures are smaller.
34 * rec_smolist occupies the size of one long (pointer to the last element)
35 * while rec_olist is 12 bytes long.
36 * These data structures were defined as part of a fix to the
37 * server a long time ago, avoiding re-initialization.
38 * rec_smolist was designed to convert each volume's vnode array from an
39 * array of pointers (each to a single vnode) to an array of lists of
40 * vnodes without having to reinitialize the servers. It is now
41 * possible to have multiple vnodes with the same vnode number because
42 * resolution can recreate a previously deleted vnode.
43 *
44 */
45
46#ifndef _UTIL_REC_SMOLIST_H_
47#define _UTIL_REC_SMOLIST_H_ 1
48
49#ifdef __cplusplus
50extern "C" {
51#endif
52
53#include <stdio.h>
54
55#ifdef __cplusplus
56}
57#endif
58
59#include <coda_tsa.h>
60
61class rec_smolist;
63struct rec_smolink;
64
67 struct rec_smolink *last; // last->next is head of list
68
69public:
72 void
73 insert(struct rec_smolink *) REQUIRES_TRANSACTION; // add at head of list
74 void
75 append(struct rec_smolink *) REQUIRES_TRANSACTION; // add at tail of list
76 struct rec_smolink *
77 remove(struct rec_smolink *) REQUIRES_TRANSACTION; // remove specified entry
78 struct rec_smolink *
79 get(void) REQUIRES_TRANSACTION; // return and remove head of list
80 int IsEmpty(void); // 1 if list is empty
81 void print(void);
82 void print(FILE *);
83 void print(int);
84};
85
87 rec_smolist *clist; // current olist
88 struct rec_smolink *clink; // current olink
89 struct rec_smolink *nlink; // next olink (in case they remove the object)
90
91public:
93 rec_smolink *operator()(); // return next object or 0
94 // Support safe deletion of currently
95 // returned entry. See dlist.h also.
96};
97
100};
101void rec_smolink_print(struct rec_smolink *l, int fd);
102
103#endif /* _UTIL_REC_SMOLIST_H_ */
Definition: rec_smolist.h:86
rec_smolist_iterator(rec_smolist &)
Definition: rec_smolist.cc:148
rec_smolink * operator()()
Definition: rec_smolist.cc:159
Definition: rec_smolist.h:65
void insert(struct rec_smolink *) REQUIRES_TRANSACTION
Definition: rec_smolist.cc:51
~rec_smolist()
Definition: rec_smolist.cc:49
void append(struct rec_smolink *) REQUIRES_TRANSACTION
Definition: rec_smolist.cc:64
struct rec_smolink * remove(struct rec_smolink *) REQUIRES_TRANSACTION
Definition: rec_smolist.cc:78
int IsEmpty(void)
Definition: rec_smolist.cc:116
void print(void)
Definition: rec_smolist.cc:123
rec_smolist()
Definition: rec_smolist.cc:44
struct rec_smolink * get(void) REQUIRES_TRANSACTION
Definition: rec_smolist.cc:102
#define REQUIRES_TRANSACTION
Definition: coda_tsa.h:107
void rec_smolink_print(struct rec_smolink *l, int fd)
Definition: rec_smolist.cc:173
int * last
Definition: rvm_basher.c:131