forked from vmware-archive/pg_rewind
-
Notifications
You must be signed in to change notification settings - Fork 0
/
util.c
34 lines (30 loc) · 725 Bytes
/
util.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*-------------------------------------------------------------------------
*
* util.c
* Misc utility functions
*
* Portions Copyright (c) 2013-2015 VMware, Inc. All Rights Reserved.
*
*-------------------------------------------------------------------------
*/
#include "postgres_fe.h"
#include "common/relpath.h"
#include "catalog/catalog.h"
#include "catalog/pg_tablespace.h"
#include "pg_rewind.h"
char *
datasegpath(RelFileNode rnode, ForkNumber forknum, BlockNumber segno)
{
char *path;
char *segpath;
path = relpathperm(rnode, forknum);
if (segno > 0)
{
segpath = pg_malloc(strlen(path) + 13);
sprintf(segpath, "%s.%u", path, segno);
pg_free(path);
return segpath;
}
else
return path;
}