From: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
---|---|
To: | Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: File API cleanup |
Date: | 2022-12-01 08:55:16 |
Message-ID: | CALj2ACX=T6fdB983A51iFVKFQDdw+rkuk6ifVo5t1Q1qg4RjGg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Dec 1, 2022 at 1:55 PM Peter Eisentraut
<peter(dot)eisentraut(at)enterprisedb(dot)com> wrote:
>
> 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.)
Thanks. Please note that I've not looked at the patches attached.
However, I'm here after reading the $subject - can we have a generic,
single function file_exists() in fd.c/file_utils.c so that both
backend and frontend code can use it? I see there are 3 uses and
definitions of it in jit.c, dfmgr.c and pg_regress.c. This will reduce
the code duplication. Thoughts?
--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
From | Date | Subject | |
---|---|---|---|
Next Message | Dean Rasheed | 2022-12-01 08:55:33 | Re: Allow round() function to accept float and double precision |
Previous Message | John Naylor | 2022-12-01 08:49:09 | Re: [PoC] Improve dead tuple storage for lazy vacuum |