
The original placement of this module in src/fe_utils/ is ill-considered, because several src/common/ modules have dependencies on it, meaning that libpgcommon and libpgfeutils now have mutual dependencies. That makes it pointless to have distinct libraries at all. The intended design is that libpgcommon is lower-level than libpgfeutils, so only dependencies from the latter to the former are acceptable. We already have the precedent that fe_memutils and a couple of other modules in src/common/ are frontend-only, so it's not stretching anything out of whack to treat logging.c as a frontend-only module in src/common/. To the extent that such modules help provide a common frontend/backend environment for the rest of common/ to use, it's a reasonable design. (logging.c does not yet provide an ereport() emulation, but one can dream.) Hence, move these files over, and revert basically all of the build-system changes made by commit cc8d41511. There are no places that need to grow new dependencies on libpgcommon, further reinforcing the idea that this is the right solution. Discussion: https://postgr.es/m/a912ffff-f6e4-778a-c86a-cf5c47a12933@2ndquadrant.com
39 lines
1.1 KiB
C
39 lines
1.1 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* pg_backup_utils.h
|
|
* Utility routines shared by pg_dump and pg_restore.
|
|
*
|
|
*
|
|
* Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
* src/bin/pg_dump/pg_backup_utils.h
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
|
|
#ifndef PG_BACKUP_UTILS_H
|
|
#define PG_BACKUP_UTILS_H
|
|
|
|
#include "common/logging.h"
|
|
|
|
typedef enum /* bits returned by set_dump_section */
|
|
{
|
|
DUMP_PRE_DATA = 0x01,
|
|
DUMP_DATA = 0x02,
|
|
DUMP_POST_DATA = 0x04,
|
|
DUMP_UNSECTIONED = 0xff
|
|
} DumpSections;
|
|
|
|
typedef void (*on_exit_nicely_callback) (int code, void *arg);
|
|
|
|
extern const char *progname;
|
|
|
|
extern void set_dump_section(const char *arg, int *dumpSections);
|
|
extern void on_exit_nicely(on_exit_nicely_callback function, void *arg);
|
|
extern void exit_nicely(int code) pg_attribute_noreturn();
|
|
|
|
#define fatal(...) do { pg_log_error(__VA_ARGS__); exit_nicely(1); } while(0)
|
|
|
|
#endif /* PG_BACKUP_UTILS_H */
|