Please sign in to comment.
Implement an option to align final incomplete data chunk
Writing unaligned data causes `EINVAL` (from `write(2)`): > EINVAL > fd is attached to an object which is unsuitable for writing; or the > file was opened with the O_DIRECT flag, and either the address > specified in buf, the value specified in count, or the current file > offset is not suitably aligned. This pull request implements an opt-in option (to preserve backwards compatibility) called `align`, that when used in conjunction to `flush`, will cause the incomplete data chunk to be padded with null bytes to match the passed chunk size. For example, in the added test, the chunk size is 4 bytes, and we push three chunks: - `12`: 2 bytes - `34`: 2 bytes - `5`: 1 byte The final incomplete data chunk will become `5\0\0\0` (to match the specified 4 bytes) if the `align` option was enabled. Signed-off-by: Juan Cruz Viotti <firstname.lastname@example.org>
- Loading branch information...
Showing with 31 additions and 1 deletion.