[COMMITTERS] pgsql: Refactor new file permission handling - Mailing list pgsql-committers

From Peter Eisentraut
Subject [COMMITTERS] pgsql: Refactor new file permission handling
Date
Msg-id E1dvlJl-0002zO-Px@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Refactor new file permission handling

The file handling functions from fd.c were called with a diverse mix of
notations for the file permissions when they were opening new files.
Almost all files created by the server should have the same permissions
set.  So change the API so that e.g. OpenTransientFile() automatically
uses the standard permissions set, and OpenTransientFilePerm() is a new
function that takes an explicit permissions set for the few cases where
it is needed.  This also saves an unnecessary argument for call sites
that are just opening an existing file.

While we're reviewing these APIs, get rid of the FileName typedef and
use the standard const char * for the file name and mode_t for the file
mode.  This makes these functions match other file handling functions
and removes an unnecessary layer of mysteriousness.  We can also get rid
of a few casts that way.

Author: David Steele <david@pgmasters.net>

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0c5803b450e0cc29b3527df3f352e6f18a038cc6

Modified Files
--------------
contrib/pg_stat_statements/pg_stat_statements.c |  5 +-
src/backend/access/heap/rewriteheap.c           |  8 ++-
src/backend/access/transam/slru.c               |  7 ++-
src/backend/access/transam/timeline.c           |  8 ++-
src/backend/access/transam/twophase.c           |  5 +-
src/backend/access/transam/xlog.c               | 28 ++++------
src/backend/access/transam/xlogutils.c          |  2 +-
src/backend/catalog/catalog.c                   |  2 +-
src/backend/libpq/be-fsstubs.c                  |  6 +--
src/backend/replication/logical/origin.c        |  7 ++-
src/backend/replication/logical/reorderbuffer.c |  7 ++-
src/backend/replication/logical/snapbuild.c     |  5 +-
src/backend/replication/slot.c                  |  6 +--
src/backend/replication/walsender.c             |  4 +-
src/backend/storage/file/copydir.c              |  5 +-
src/backend/storage/file/fd.c                   | 68 ++++++++++++++++++-------
src/backend/storage/ipc/dsm_impl.c              |  2 +-
src/backend/storage/smgr/md.c                   | 12 ++---
src/backend/utils/cache/relmapper.c             |  7 +--
src/backend/utils/misc/guc.c                    |  3 +-
src/include/storage/fd.h                        | 15 +++---
21 files changed, 110 insertions(+), 102 deletions(-)


--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

pgsql-committers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [COMMITTERS] pgsql: Fix saving and restoring umask
Next
From: Tom Lane
Date:
Subject: [COMMITTERS] pgsql: Ten-second timeout in 013_crash_restart.pl is not enough,let's