pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter_e@gmx.net>
To: pgsql-committers@postgresql.org
Subject: pgsql: Refactor new file permission handling
Date: Sat, 23 Sep 2017 14:22:05 +0000
Message-ID: <E1dvlJl-0002zO-Px@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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


Message-ID: <E1dvlJl-0002zO-Px@gemulon.postgresql.org>
Permalink:  ../E1dvlJl-0002zO-Px@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1dvlJl-0002zO-Px@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: peter_e@gmx.net
  Subject: Re: pgsql: Refactor new file permission handling
  In-Reply-To: <E1dvlJl-0002zO-Px@gemulon.postgresql.org>
  References: <E1dvlJl-0002zO-Px@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox