// waiters
multimap<int,Context*> waiting;
+ // issued client capabilities
+ map<int, Capability> caps;
+
// open file state (me)
map<fileh_t, CFile*> fh_map; // locally opened files
int nrdonly, nrdwr, nwronly; // file mode counts
void finish_waiting(int mask, int result = 0);
+ // -- caps -- (new)
+ bool is_caps_issued() { return !caps.empty(); }
+ void add_cap(int client, Capability& cap) {
+ assert(caps.count(client) == 0);
+ caps[client] = cap;
+ }
+ void remove_cap(int client) {
+ assert(caps.count(client) == 1);
+ caps.erase(client);
+ }
- // -- open files --
+ // -- open files -- (old)
bool is_open_write() { return nwronly; }
bool is_open_read() { return nrdonly; }
bool is_open() { return is_open_write() || is_open_read(); }
--- /dev/null
+#ifndef __CAPABILITY_H
+#define __CAPABILITY_H
+
+// definite caps
+#define CAP_FILE_RDCACHE 1
+#define CAP_FILE_RD 2
+#define CAP_FILE_WR 4
+#define CAP_FILE_WRBUFFER 8
+#define CAP_INODE_STAT 16
+
+// heuristics
+#define CAP_FILE_DELAYFLUSH 32
+
+class Capability {
+ int wanted_caps; // what the client wants
+ int pending_caps; // what we've sent them
+ int confirmed_caps; // what they've confirmed they've received
+
+ Capability(int wants = 0) :
+ wanted_caps(wants),
+ pending_caps(0),
+ confirmed_caps(0) { }
+};
+
+
+
+
+
+#endif