Commit 2c94dbd0 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 4bc654d8
...@@ -55,10 +55,14 @@ namespace os { ...@@ -55,10 +55,14 @@ namespace os {
// os::File mimics os.File from Go. // os::File mimics os.File from Go.
// its operations return error with full file context. // its operations return error with full file context.
struct File { class File {
int fd; int _fd;
string path; string _path;
public:
// XXX empty ctor -> fd=-1, path=?
int fd();
string name();
error close(); error close();
error stat(struct stat *st); error stat(struct stat *st);
}; };
......
...@@ -79,7 +79,7 @@ struct WCFS { ...@@ -79,7 +79,7 @@ struct WCFS {
Conn *connect(Tid at); Conn *connect(Tid at);
string _path(const string &obj); string _path(const string &obj);
tuple<os::File, error> _open(const string &path /*, XXX mode*/); tuple<os::File, error> _open(const string &path, int mode=O_RDONLY);
}; };
// Conn represents logical connection that provides view of data on wcfs // Conn represents logical connection that provides view of data on wcfs
...@@ -289,7 +289,7 @@ string WCFS::_path(const string &obj) { ...@@ -289,7 +289,7 @@ string WCFS::_path(const string &obj) {
return wc->mountpoint + "/" + obj; return wc->mountpoint + "/" + obj;
} }
tuple<os::File, error> WCFS::_open(const string &path, int flags=O_RDONLY) { tuple<os::File, error> WCFS::_open(const string &path, int flags) {
WCFS *wc = this; WCFS *wc = this;
string path_ = wc->_path(path); string path_ = wc->_path(path);
return os::open(path_, flags); return os::open(path_, flags);
......
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