diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2013-02-21 22:46:17 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2013-02-21 22:46:17 -0300 |
commit | a73018392636ce832b09b5c31f6ad1f18a4643ea (patch) | |
tree | 45ff73dc25699e9156147948e7f4ba2a85961a33 /src/include/common/relpath.h | |
parent | 6e3fd964632e95c7359457b7d67aa20c72a71679 (diff) | |
download | postgresql-a73018392636ce832b09b5c31f6ad1f18a4643ea.tar.gz postgresql-a73018392636ce832b09b5c31f6ad1f18a4643ea.zip |
Move relpath() to libpgcommon
This enables non-backend code, such as pg_xlogdump, to use it easily.
The previous location, in src/backend/catalog/catalog.c, made that
essentially impossible because that file depends on many backend-only
facilities; so this needs to live separately.
Diffstat (limited to 'src/include/common/relpath.h')
-rw-r--r-- | src/include/common/relpath.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/include/common/relpath.h b/src/include/common/relpath.h new file mode 100644 index 00000000000..5b28bd03619 --- /dev/null +++ b/src/include/common/relpath.h @@ -0,0 +1,41 @@ +/*------------------------------------------------------------------------- + * + * relpath.h + * Declarations for relpath() and friends + * + * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/relpath.h + * + *------------------------------------------------------------------------- + */ +#ifndef RELPATH_H +#define RELPATH_H + +/* + * 'pgrminclude ignore' needed here because CppAsString2() does not throw + * an error if the symbol is not defined. + */ +#include "catalog/catversion.h" /* pgrminclude ignore */ +#include "storage/relfilenode.h" + + +#define OIDCHARS 10 /* max chars printed by %u */ +#define TABLESPACE_VERSION_DIRECTORY "PG_" PG_MAJORVERSION "_" \ + CppAsString2(CATALOG_VERSION_NO) + +extern const char *forkNames[]; +extern int forkname_chars(const char *str, ForkNumber *fork); +extern char *relpathbackend(RelFileNode rnode, BackendId backend, + ForkNumber forknum); + +/* First argument is a RelFileNodeBackend */ +#define relpath(rnode, forknum) \ + relpathbackend((rnode).node, (rnode).backend, (forknum)) + +/* First argument is a RelFileNode */ +#define relpathperm(rnode, forknum) \ + relpathbackend((rnode), InvalidBackendId, (forknum)) + +#endif /* RELPATH_H */ |