Show 25 quoted lines
> @@ -43,17 +42,28 @@ static int stack_filename(struct reftable_buf *dest, struct reftable_stack *st,
> return 0;
> }
>
> -static ssize_t reftable_fd_write(void *arg, const void *data, size_t sz)
> +static int stack_fsync(const struct reftable_write_options *opts, int fd)
> {
> - int *fdp = (int *)arg;
> - return write_in_full(*fdp, data, sz);
> + if (opts->fsync)
> + return opts->fsync(fd);
> + return fsync(fd);
> }
>
> -static int reftable_fd_flush(void *arg)
> +struct fd_writer {
> + const struct reftable_write_options *opts;
> + int fd;
> +};
> +
> +static ssize_t fd_writer_write(void *arg, const void *data, size_t sz)
> {
> - int *fdp = (int *)arg;
> + struct fd_writer *writer = arg;
> + return write_in_full(writer->fd, data, sz);Tangent: eventually we'd also want to get rid of `write_in_full` no?
Since it is also an internal Git implementation.
The patch itself looks good to me.
[snip]
- Karthik