-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WasmFS JS API: Implement allocate #19602
WasmFS JS API: Implement allocate #19602
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, and good find about the wrong types in that syscall.
stat("/dir1", &rmdirStat); | ||
assert(S_ISDIR(rmdirStat.st_mode)); | ||
stat("/dir2", &rmdirStat); | ||
assert(S_ISDIR(rmdirStat.st_mode)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the reason for the name change is to avoid a collision, another option is to add a scope,
{
struct stat s;
..
}
But the more explicit name also seems good by itself, either sgtm.
Or, it might be nice to split up the tests into their own functions, as the new test here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was some collision after merging in the other tests, but I did move each test to its own function in the utime
PR after a suggestion from Sam, so the collision should be fixed (#19561). I was originally planning on changing the names back to struct stat s
after the tests as individual functions are merged in.
This PR implements
allocate
. I did not see any tests forFS.allocate
, so added new ones totest_fs_js_api.c
.I also had to change the type of the
__syscall_fallocate
to useint64_t
instead ofuint64_t
so that negative numbers would correctly throw error handling. Withuint64_t
setSize()
would abort without an error code, since it was interpreting negative numbers incorrectly. Now, the syscall correctly returns an error code if either offset or length is negative.