]> granicus.if.org Git - postgresql/blob - src/backend/access/rmgrdesc/smgrdesc.c
pgindent run for 9.4
[postgresql] / src / backend / access / rmgrdesc / smgrdesc.c
1 /*-------------------------------------------------------------------------
2  *
3  * smgrdesc.c
4  *        rmgr descriptor routines for catalog/storage.c
5  *
6  * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  *
10  * IDENTIFICATION
11  *        src/backend/access/rmgrdesc/smgrdesc.c
12  *
13  *-------------------------------------------------------------------------
14  */
15 #include "postgres.h"
16
17 #include "catalog/catalog.h"
18 #include "catalog/storage_xlog.h"
19
20
21 void
22 smgr_desc(StringInfo buf, uint8 xl_info, char *rec)
23 {
24         uint8           info = xl_info & ~XLR_INFO_MASK;
25
26         if (info == XLOG_SMGR_CREATE)
27         {
28                 xl_smgr_create *xlrec = (xl_smgr_create *) rec;
29                 char       *path = relpathperm(xlrec->rnode, xlrec->forkNum);
30
31                 appendStringInfo(buf, "file create: %s", path);
32                 pfree(path);
33         }
34         else if (info == XLOG_SMGR_TRUNCATE)
35         {
36                 xl_smgr_truncate *xlrec = (xl_smgr_truncate *) rec;
37                 char       *path = relpathperm(xlrec->rnode, MAIN_FORKNUM);
38
39                 appendStringInfo(buf, "file truncate: %s to %u blocks", path,
40                                                  xlrec->blkno);
41                 pfree(path);
42         }
43         else
44                 appendStringInfoString(buf, "UNKNOWN");
45 }