Re: [PATCH v6 4/8] core.fsyncobjectfiles: add windows support for batch mode
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 27, 2021, 20:07 UTC
- Message-ID
- <xmqq1r59rde8.fsf@gitster.g>
- In-Reply-To
- <bdb99822f8c45a8b2855ee2ab38c4460e4b5e22e.1632527609.git.gitgitgadget@gmail.com>
"Neeraj Singh via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 10 quoted lines
> diff --git a/compat/mingw.h b/compat/mingw.h > index c9a52ad64a6..6074a3d3ced 100644 > --- a/compat/mingw.h > +++ b/compat/mingw.h > @@ -329,6 +329,9 @@ int mingw_getpagesize(void); > #define getpagesize mingw_getpagesize > #endif > > +int win32_fsync_no_flush(int fd); > +#define fsync_no_flush win32_fsync_no_flush
...
Show 14 quoted lines
> diff --git a/wrapper.c b/wrapper.c > index bb4f9f043ce..1a1e2fba9c9 100644 > --- a/wrapper.c > +++ b/wrapper.c > @@ -567,6 +567,10 @@ int git_fsync(int fd, enum fsync_action action) > SYNC_FILE_RANGE_WAIT_AFTER); > #endif > > +#ifdef fsync_no_flush > + return fsync_no_flush(fd); > +#endif > + > errno = ENOSYS; > return -1;
This almost makes me wonder if we want to have a fallback implementation of fsync_no_flush() that does
int fsync_no_flush(int unused)
{
errno = ENOSYS;
return -1;
}when nobody (like Windows) define their own fsync_no_flush(). That way, this codepath does not have to have #ifdef/#endif here.
This function is already #ifdef ridden anyway, so reducing just one instance may not make much difference, but since I noticed it ...
Thanks.