Commit f8526f45 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent c4013452
...@@ -40,6 +40,8 @@ struct IContext { ...@@ -40,6 +40,8 @@ struct IContext {
struct Conn; struct Conn;
struct _File; struct _File;
struct WatchLink;
struct SrvReq;
// WCFS represents filesystem-level connection to wcfs server. // WCFS represents filesystem-level connection to wcfs server.
// XXX doc // XXX doc
...@@ -55,7 +57,7 @@ struct WCFS { ...@@ -55,7 +57,7 @@ struct WCFS {
struct Conn { struct Conn {
WCFS *_wc; WCFS *_wc;
Tid at; Tid at;
// _wlink WatchLink *_wlink;
sync::Mutex _filemu; sync::Mutex _filemu;
dict<Oid, _File*> _filetab; // {} foid -> _file dict<Oid, _File*> _filetab; // {} foid -> _file
...@@ -63,6 +65,7 @@ struct Conn { ...@@ -63,6 +65,7 @@ struct Conn {
private: private:
void _pinner(IContext *ctx); void _pinner(IContext *ctx);
void _pin1(SrvReq *req);
}; };
// _File represent isolated file view under Conn. // _File represent isolated file view under Conn.
...@@ -75,6 +78,19 @@ struct _File { ...@@ -75,6 +78,19 @@ struct _File {
// XXX struct Mapping // XXX struct Mapping
// XXX struct WatchLink
struct WatchLink {
// XXX
SrvReq *recvReq(IContext *ctx);
};
// SrvReq represents 1 server-initiated wcfs request received over /head/watch link.
struct SrvReq {
// XXX
};
// connect creates new Conn viewing WCFS state as of @at. // connect creates new Conn viewing WCFS state as of @at.
Conn *WCFS::connect(Tid at) { Conn *WCFS::connect(Tid at) {
WCFS *wc = this; WCFS *wc = this;
...@@ -100,4 +116,24 @@ Conn *WCFS::connect(Tid at) { ...@@ -100,4 +116,24 @@ Conn *WCFS::connect(Tid at) {
// _pinner receives pin messages from wcfs and adjusts wconn mappings. // _pinner receives pin messages from wcfs and adjusts wconn mappings.
void Conn::_pinner(IContext *ctx) { void Conn::_pinner(IContext *ctx) {
Conn *wconn = this; Conn *wconn = this;
// XXX panic/exc -> log.CRITICAL
while (1) {
SrvReq *req = wconn->_wlink->recvReq(ctx);
if (req == NULL)
return // XXX ok? (EOF - when wcfs closes wlink)
// we received request to pin/unpin file block. handle it
wconn->_pin1(req);
// XXX free req?
}
}
// pin1 handles one pin request received from wcfs.
void Conn::_pin1(SrvReq *req) {
Conn *wconn = this;
// XXX
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment