Switch buffile.c/h to use pgoff_t
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Postgres hackers <pgsql-hackers@lists.postgresql.org>
Cc: Bryan Green <dbryan.green@gmail.com>
Date: 2025-12-19T01:43:10Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Upgrade BufFile to use int64 for byte positions
- bde3a4616072 19 (unreleased) landed
-
Switch buffile.c/h to use pgoff_t instead of off_t
- e5f3839af685 19 (unreleased) landed
Attachments
- 0001-Switch-buffile.c-h-to-use-portable-pgoff_t.patch (text/x-diff) patch 0001
Hi all, (Added Bryan in CC as he has been looking at this stuff previously.) An mentioned on this thread and as a part of the quest to remove more of long in the tree, buffile.c and buffile.h still rely on an unportable off_t, which is signed 4 bytes on Windows: https://www.postgresql.org/message-id/0f238ff4-c442-42f5-adb8-01b762c94ca1@gmail.com Please find attached a patch to do the switch. I was surprised to see that the amount of code to adapt was limited, the routines of buffile.h changed in this commit being used in other places that keep track of offsets. Hence these other files just need to do a off_t => pgoff_t flip in a couple of structures to be updated, as far as I can see. This removes a couple of extra long casts, as well as one comment in BufFileSeek() that relates to overflows for large offsets, that would not exist with this switch, which is nice. Thanks, -- Michael