Re: File API cleanup - Mailing list pgsql-hackers

From Bharath Rupireddy
Subject Re: File API cleanup
Date
Msg-id CALj2ACX=T6fdB983A51iFVKFQDdw+rkuk6ifVo5t1Q1qg4RjGg@mail.gmail.com
Whole thread Raw
In response to File API cleanup  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
Responses Re: File API cleanup
List pgsql-hackers
On Thu, Dec 1, 2022 at 1:55 PM Peter Eisentraut
<peter.eisentraut@enterprisedb.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



pgsql-hackers by date:

Previous
From: John Naylor
Date:
Subject: Re: [PoC] Improve dead tuple storage for lazy vacuum
Next
From: Dean Rasheed
Date:
Subject: Re: Allow round() function to accept float and double precision