Annotation of fam/fam/FileSystem.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 FileSystem_included
24: #define FileSystem_included
25:
26: #include "ClientInterest.h"
27: #include "Request.h"
28: #include "Set.h"
29:
30: struct mntent;
31: struct stat;
32:
33: // FileSystem is the abstract base class for a per-filesystem object.
34: // A FileSystem has two monitoring interfaces: high level and low
35: // level. It also maintains a set of all ClientInterests on the
36: // file system
37: //
38: // It also has miscellaneous access functions:
39: //
40: // dir() returns the mount point.
41: //
42: // fsname() returns the device name.
43: //
44: // matches() tests whether a given struct mntent describes the
45: // current filesystem.
46: //
47: // interests() returns a set of all ClientInterests on the
48: // filesystem.
49: //
50: // A FileSystem also can relocate its interests (after it's been
51: // dismounted or another FileSystem has been mounted on it), by calling
52: // relocate_interests(). This checks all Interests to see what FileSystem
53: // they're on, and moves them appropriately.
54: //
55: // The high level interface supports monitoring a file whether it
56: // exists or not, and can monitor all entries in a directory.
57: // The high level interface corresponds to what fam can rely
58: // on from a remote fam on an NFS server.
59: //
60: // The high level interface is:
61: //
62: // monitor()
63: // cancel()
64: // hl_suspend()
65: // hl_resume()
66: // hl_map_path()
67: //
68: // See the strong resemblance to FAM's client interface? (-:
69: // hl_map_path() maps a local pathname to a remote pathname.
70: // For a local FileSystem, this is trivial. For a remote
71: // file system, it's less trivial.
72: //
73: // The low level interface monitors a single filesystem entity
74: // and must be informed if the entity is a special file or does
75: // not exist. The low level interface corresponds to what fam
76: // needs for local files.
77: //
78: // The low level interface is:
79: //
80: // ll_monitor() start monitoring an interest.
81: // ll_notify_created() notify the FS that the interest was deleted.
82: // ll_notify_deleted() notify the FS that the interest was created.
83: //
84: // The two subclasses of FileSystem are LocalFileSystem and
85: // NFSFileSystem. LocalFileSystem implements the low level
86: // interface. NFSFileSystem implements the high level interface.
87:
88: class FileSystem {
89:
90: public:
91:
92: typedef Set<ClientInterest *> Interests;
93:
94: FileSystem(const mntent&);
95: virtual ~FileSystem();
96:
97: // Miscellaneous routines
98:
99: bool matches(const mntent& m) const;
100: const char *dir() const { return mydir; }
101: const char *fsname() const { return myfsname; }
102: const Interests& interests() { return myinterests; }
103: virtual bool dir_entries_scanned() const = 0;
104: void relocate_interests();
105: virtual int get_attr_cache_timeout() const = 0;
106:
107: // High level monitoring interface
108:
109: Request monitor(ClientInterest *, ClientInterest::Type);
110: void cancel(ClientInterest *, Request);
111: virtual void hl_suspend(Request) = 0;
112: virtual void hl_resume(Request) = 0;
113: virtual void hl_map_path(char *remote_path, const char *local_path,
114: const Cred& cr) = 0;
115:
116: // Low level monitoring interface
117:
118: virtual void ll_monitor(Interest *, bool imonitored) = 0;
119: virtual void ll_notify_created(Interest *) = 0;
120: virtual void ll_notify_deleted(Interest *) = 0;
121:
122: private:
123:
124: // Instance Variables
125:
126: char *mydir;
127: char *myfsname;
128: Interests myinterests;
129:
130: virtual Request hl_monitor(ClientInterest *, ClientInterest::Type) = 0;
131: virtual void hl_cancel(Request) = 0;
132:
133: };
134:
135: #endif /* !FileSystem_included */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>