Support fallocate on Linux#5147
Conversation
198044f to
f519204
Compare
|
@rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
|
@rustbot ready |
This comment was marked as off-topic.
This comment was marked as off-topic.
There was a problem hiding this comment.
Thanks a lot! And sorry for the slow review, I was dealing with a $job deadline.
@rustbot author
| offset: i64, | ||
| size: i64, | ||
| ) -> InterpResult<'tcx, Scalar> { | ||
| let this = self.eval_context_mut(); |
There was a problem hiding this comment.
| let this = self.eval_context_mut(); | |
| // This is mostly a copy of `posix_fallocate` except that errors are returned via errno. | |
| let this = self.eval_context_mut(); |
Any idea how we could avoid all this code duplication?
There was a problem hiding this comment.
3rd commit shows my vision of it.
| // libc::off_t is i32 in target i686-unknown-linux-gnu | ||
| // https://docs.rs/libc/latest/i686-unknown-linux-gnu/libc/type.off_t.html | ||
|
|
||
| let test_errors = || { |
There was a problem hiding this comment.
Why are you packing these into closures?
There was a problem hiding this comment.
posix_fallocate does the same and that was accepted and never changed (my pr).
I can remove both uses of closures.
There was a problem hiding this comment.
split them up into 2 separate test functions. posix_fallocate is left untouched.
There was a problem hiding this comment.
Yeah it is hard to apply consistent standards, especially in tests. ;)
But please just use comments or top-level functions for grouping here.
|
@rustbot ready |
This comment has been minimized.
This comment has been minimized.
|
@RalfJung I have a feeling something is broken? When I try to fetch and rebase i get a merge conflict which seems easy to fix. Even though its weird i get a conflict in the first place since i didn't change anything in that file other than the rename of the And then when I fix that conflict i get the following: I expect that these would be a conflict as well, but that is not the case? |
|
Well, try pushing something that resolves the conflicts and we can see what happens. Did you remember to |
f885e2b to
81c29e2
Compare
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Oops... It has been some time 😅. rebased to fix conflict and address second round of comments, @rustbot ready. |
|
This looks great, thanks! Please squash the commits. You can squash manually if there are multiple independent commits you want to preserve, or use @rustbot author |
…is is the same behaviour as `posix_fallocate`. And add tests for `fallocate` based on `posix_fallocate`.
81c29e2 to
2787339
Compare
|
1 commit is fine, I think. @rustbot ready |
Closes #5137
This PR implements the linux syscall
fallocateand its 64-bit version. It is an extended version ofposix_fallocate. So for now this pr only implements theposix_fallocatebehaviour as explained in the man page.All other "features" are rather specific and I couldn't find a reliable way to mimic them in Miri, they also specify that they require file system support, so i have no clue there.
If needed, I can include them here or in a follow-up PR.