Annotation of fam/fam/FileSystemTable.h, Revision 1.1.1.1
1.1 trev 1: // Copyright (C) 1999 Silicon Graphics, Inc. All Rights Reserved.
2: //
3: // This program is free software; you can redistribute it and/or modify it
4: // under the terms of version 2 of the GNU General Public License as
5: // published by the Free Software Foundation.
6: //
7: // This program is distributed in the hope that it would be useful, but
8: // WITHOUT ANY WARRANTY; without even the implied warranty of
9: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Further, any
10: // license provided herein, whether implied or otherwise, is limited to
11: // this program in accordance with the express provisions of the GNU
12: // General Public License. Patent licenses, if any, provided herein do not
13: // apply to combinations of this program with other product or programs, or
14: // any other product whatsoever. This program is distributed without any
15: // warranty that the program is delivered free of the rightful claim of any
16: // third person by way of infringement or the like. See the GNU General
17: // Public License for more details.
18: //
19: // You should have received a copy of the GNU General Public License along
20: // with this program; if not, write the Free Software Foundation, Inc., 59
21: // Temple Place - Suite 330, Boston MA 02111-1307, USA.
22:
23: #ifndef FileSystemTable_included
24: #define FileSystemTable_included
25:
26: #include "config.h"
27: #include "SmallTable.h"
28: #include "StringTable.h"
29:
30: class Cred;
31: class Event;
32: class FileSystem;
33: class InternalClient;
34:
35: // FileSystemTable provides a static function, find(), which looks up
36: // a path and returns a pointer to the FileSystem where that path
37: // resides.
38:
39: class FileSystemTable {
40:
41: public:
42:
43: #ifdef HAPPY_PURIFY
44: FileSystemTable();
45: ~FileSystemTable();
46: #endif
47:
48: static FileSystem *find(const char *path, const Cred& cr);
49:
50: private:
51:
52: typedef SmallTable<unsigned long, FileSystem *> IDTable;
53: typedef StringTable<FileSystem *> NameTable;
54:
55: // Class Variables
56:
57: static const char mtab_name[];
58: static unsigned int count;
59: static IDTable fs_by_id;
60: static NameTable *fs_by_name;
61: static InternalClient *mtab_watcher;
62: static FileSystem *root;
63:
64: // Class Methods
65:
66: static void create_fs_by_name();
67: static void destroy_fses(NameTable *);
68: static FileSystem *longest_prefix(const char *path);
69: static void mtab_event_handler(const Event&, void *);
70:
71: };
72:
73: #ifdef HAPPY_PURIFY
74: static FileSystemTable FileSystemTable_instance;
75: #endif
76:
77: #endif /* !FileSystemTable_included */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>