HEAD: better documentation for wvx509 constructors.
[wvapps.git] / funfs / wvfusecbmgr.cc
blob1d3dcb52bf76dcfb7e6f38cf94085a2798cc3ca9
1 #include "wvfusecbmgr.h"
2 #include "wvfuse.h"
4 #include <assert.h>
6 WvFuseCbMgr::WvFuseCbMgr(WvFuse *_fuse, WvStringParm _basepath)
7 : fuse(_fuse), basepath(_basepath),
8 callback(WvFuseDirCb(this, &WvFuseCbMgr::callback_func))
10 fp = tmpfile();
13 WvFuseCbMgr::~WvFuseCbMgr()
15 fclose(fp);
18 int WvFuseCbMgr::getfd()
20 fflush(fp);
21 return fileno(fp);
24 void WvFuseCbMgr::callback_func(fuse_dirent *fde)
26 WvString fullpath = basepath;
27 if (fullpath[fullpath.len()] != '/')
28 fullpath.append("/");
29 fullpath.append(fde->name);
30 fde->ino = fuse->get_ino_by_path(fullpath);
32 size_t reclen = FUSE_DIRENT_SIZE(fde);
33 size_t wrres = fwrite(fde, reclen, 1, fp);
34 assert(wrres == 1);