Re: Switch buffile.c/h to use pgoff_t
| От | Michael Paquier |
|---|---|
| Тема | Re: Switch buffile.c/h to use pgoff_t |
| Дата | |
| Msg-id | aUx6TMczfmwyv_h3@paquier.xyz обсуждение исходный текст |
| Ответ на | Re: Switch buffile.c/h to use pgoff_t (Chao Li <li.evan.chao@gmail.com>) |
| Ответы |
Re: Switch buffile.c/h to use pgoff_t
Re: Switch buffile.c/h to use pgoff_t |
| Список | pgsql-hackers |
On Wed, Dec 24, 2025 at 05:01:57PM +0800, Chao Li wrote: > Make sense, bytestowrite is not a file offset. So, in the current code, > availbytes is not a file offset either, but it is defined as pgoff_t, which > has the same confusion, right? Also bytestowrite is casted to pgoff_t, it's > the same confusion again. Yeah, actually this suggestion makes more sense. availbytes is a computation made of a maximal size and an offset, so defining it as an offset from the start is kind of weird. Now I don't think that your suggested set of changes could become more consistent with a few more changes. For example, what about pos and nbytes in BufFile? While ssize_t is more consistent with FileRead() and FileWrite(), this code is written to care about signedness while ssize_t has a stricter range per posix, hence could int64 be a better choice for the whole interface? int64 is already what we use for BufFileSize(), which is due to the limit of MAX_PHYSICAL_FILESIZE of course. -- Michael
Вложения
В списке pgsql-hackers по дате отправления: