提交 5fd96933 创建 作者: Nickolai Zeldovich's avatar Nickolai Zeldovich

try to live without operator->()

上级 9c16a4ba
......@@ -246,14 +246,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return __pointer_type(_M_b); }
__pointer_type
operator->() const
{ return __pointer_type(_M_b); }
__pointer_type
operator->() const volatile
{ return __pointer_type(_M_b); }
__pointer_type
operator=(__pointer_type __p)
{ return _M_b.operator=(__p); }
......
......@@ -228,11 +228,12 @@ inode::inode()
inode::~inode()
{
if (dir) {
dir->remove(strbuf<DIRSIZ>("."));
dir->remove(strbuf<DIRSIZ>(".."));
gc_delayed(dir);
dir = 0;
auto d = dir.load();
if (d) {
d->remove(strbuf<DIRSIZ>("."));
d->remove(strbuf<DIRSIZ>(".."));
gc_delayed(d);
assert(cmpxch(&dir, d, (decltype(d)) 0));
}
destroylock(&lock);
......@@ -659,7 +660,7 @@ dir_flush(struct inode *dp)
return;
u32 off = 0;
dp->dir->enumerate([dp, &off](const strbuf<DIRSIZ> &name, const u32 &inum)->bool{
dp->dir.load()->enumerate([dp, &off](const strbuf<DIRSIZ> &name, const u32 &inum)->bool{
struct dirent de;
strncpy(de.name, name._buf, DIRSIZ);
de.inum = inum;
......@@ -676,7 +677,7 @@ dirlookup(struct inode *dp, char *name)
{
dir_init(dp);
u32 inum = dp->dir->lookup(strbuf<DIRSIZ>(name));
u32 inum = dp->dir.load()->lookup(strbuf<DIRSIZ>(name));
//cprintf("dirlookup: %x (%d): %s -> %d\n", dp, dp->inum, name, inum);
if (inum == 0)
......@@ -692,7 +693,7 @@ dirlink(struct inode *dp, const char *name, u32 inum)
dir_init(dp);
//cprintf("dirlink: %x (%d): %s -> %d\n", dp, dp->inum, name, inum);
return dp->dir->insert(strbuf<DIRSIZ>(name), inum);
return dp->dir.load()->insert(strbuf<DIRSIZ>(name), inum);
}
// Paths
......
......@@ -99,7 +99,7 @@ class xns : public rcu_freed {
u64 i = h(key);
scoped_gc_epoch gc;
auto e = table[i].chain;
auto e = table[i].chain.load();
while (e) {
if (e->key == key)
......@@ -153,7 +153,7 @@ class xns : public rcu_freed {
void enumerate(CB cb) {
scoped_gc_epoch gc;
for (int i = 0; i < NHASH; i++) {
auto e = table[i].chain;
auto e = table[i].chain.load();
while (e) {
if (cb(e->key, e->val))
return;
......
......@@ -183,7 +183,7 @@ isdirempty(struct inode *dp)
{
dir_init(dp);
int empty = 1;
dp->dir->enumerate([&empty](const strbuf<DIRSIZ> &name, u64 ino)->bool{
dp->dir.load()->enumerate([&empty](const strbuf<DIRSIZ> &name, u64 ino)->bool{
if (!strcmp(name._buf, "."))
return false;
if (!strcmp(name._buf, ".."))
......@@ -229,7 +229,7 @@ sys_unlink(void)
}
dir_init(dp);
if (dp->dir->remove(strbuf<DIRSIZ>(name), &ip->inum) == 0) {
if (dp->dir.load()->remove(strbuf<DIRSIZ>(name), &ip->inum) == 0) {
iunlockput(ip);
goto retry;
}
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论