File API cleanup

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: File API cleanup
Date: 2022-12-01 08:25:44
Message-ID: 11dda853-bb5b-59ba-a746-e168b1ce4bdb@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Here are a couple of patches that clean up the internal File API and
related things a bit:

0001-Update-types-in-File-API.patch

Make the argument types of the File API match stdio better:

- Change the data buffer to void *, from char *.
- Change FileWrite() data buffer to const on top of that.
- Change amounts to size_t, from int.

In passing, change the FilePrefetch() amount argument from int to
off_t, to match the underlying posix_fadvise().

0002-Remove-unnecessary-casts.patch

Some code carefully cast all data buffer arguments for
BufFileWrite() and BufFileRead() to void *, even though the
arguments are already void * (and AFAICT were never anything else).
Remove this unnecessary clutter.

(I had initially thought these casts were related to the first patch,
but as I said the BufFile API never used char * arguments, so this
turned out to be unrelated, but still weird.)

Attachment Content-Type Size
0001-Update-types-in-File-API.patch text/plain 3.2 KB
0002-Remove-unnecessary-casts.patch text/plain 3.7 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2022-12-01 08:46:10 Re: Perform streaming logical transactions by background workers and parallel apply
Previous Message Noah Misch 2022-12-01 08:25:33 Re: pgsql: Revoke PUBLIC CREATE from public schema, now owned by pg_databas