Add basic NFS tests, fix bugs

This commit is contained in:
Vitaliy Filippov
2024-03-16 13:24:36 +03:00
parent a574f9ad71
commit ecfc753e93
14 changed files with 367 additions and 86 deletions
+6 -1
View File
@@ -94,6 +94,10 @@ static void kv_do_create(kv_create_state *st)
cb(-EINVAL);
return;
}
if (st->attrobj.find("mtime") == st->attrobj.end())
st->attrobj["mtime"] = nfstime_now_str();
if (st->attrobj.find("atime") == st->attrobj.end())
st->attrobj["atime"] = st->attrobj["mtime"];
// Generate inode ID
allocate_new_id(st->self, [st](int res, uint64_t new_id)
{
@@ -105,7 +109,8 @@ static void kv_do_create(kv_create_state *st)
}
st->new_id = new_id;
auto direntry = json11::Json::object{ { "ino", st->new_id } };
if (st->attrobj["type"].string_value() == "dir")
if (st->attrobj.find("type") != st->attrobj.end() &&
st->attrobj["type"].string_value() == "dir")
{
direntry["type"] = "dir";
}