PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
genericdesc.c
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * genericdesc.c
4  * rmgr descriptor routines for access/transam/generic_xlog.c
5  *
6  *
7  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/backend/access/rmgrdesc/genericdesc.c
11  *
12  *-------------------------------------------------------------------------
13  */
14 #include "postgres.h"
15 
16 #include "access/generic_xlog.h"
17 #include "lib/stringinfo.h"
18 #include "storage/relfilenode.h"
19 
20 /*
21  * Description of generic xlog record: write page regions that this record
22  * overrides.
23  */
24 void
26 {
27  Pointer ptr = XLogRecGetData(record),
28  end = ptr + XLogRecGetDataLen(record);
29 
30  while (ptr < end)
31  {
32  OffsetNumber offset,
33  length;
34 
35  memcpy(&offset, ptr, sizeof(offset));
36  ptr += sizeof(offset);
37  memcpy(&length, ptr, sizeof(length));
38  ptr += sizeof(length);
39  ptr += length;
40 
41  if (ptr < end)
42  appendStringInfo(buf, "offset %u, length %u; ", offset, length);
43  else
44  appendStringInfo(buf, "offset %u, length %u", offset, length);
45  }
46 
47  return;
48 }
49 
50 /*
51  * Identification of generic xlog record: we don't distinguish any subtypes
52  * inside generic xlog records.
53  */
54 const char *
56 {
57  return "Generic";
58 }
int length(const List *list)
Definition: list.c:1271
unsigned char uint8
Definition: c.h:266
uint16 OffsetNumber
Definition: off.h:24
char * Pointer
Definition: c.h:245
#define XLogRecGetData(decoder)
Definition: xlogreader.h:220
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:78
#define XLogRecGetDataLen(decoder)
Definition: xlogreader.h:221
void generic_desc(StringInfo buf, XLogReaderState *record)
Definition: genericdesc.c:25
static char * buf
Definition: pg_test_fsync.c:66
const char * generic_identify(uint8 info)
Definition: genericdesc.c:55