]> granicus.if.org Git - postgresql/blobdiff - src/bin/pg_rewind/filemap.h
Update copyright via script for 2017
[postgresql] / src / bin / pg_rewind / filemap.h
index 57f0f92fb90dcc9a6db10286f9d2cd450bab39d9..3431047bf7d2ca2fca51df0b30c6680bda4565d5 100644 (file)
@@ -2,7 +2,7 @@
  *
  * filemap.h
  *
- * Copyright (c) 2013-2015, PostgreSQL Global Development Group
+ * Copyright (c) 2013-2017, PostgreSQL Global Development Group
  *-------------------------------------------------------------------------
  */
 #ifndef FILEMAP_H
  */
 typedef enum
 {
-       FILE_ACTION_CREATE,             /* create local directory or symbolic link */
-       FILE_ACTION_COPY,               /* copy whole file, overwriting if exists */
-       FILE_ACTION_COPY_TAIL,  /* copy tail from 'oldsize' to 'newsize' */
-       FILE_ACTION_NONE,               /* no action (we might still copy modified blocks
-                                                        * based on the parsed WAL) */
-       FILE_ACTION_TRUNCATE,   /* truncate local file to 'newsize' bytes */
-       FILE_ACTION_REMOVE,             /* remove local file / directory / symlink */
-
+       FILE_ACTION_CREATE,                     /* create local directory or symbolic link */
+       FILE_ACTION_COPY,                       /* copy whole file, overwriting if exists */
+       FILE_ACTION_COPY_TAIL,          /* copy tail from 'oldsize' to 'newsize' */
+       FILE_ACTION_NONE,                       /* no action (we might still copy modified
+                                                                * blocks based on the parsed WAL) */
+       FILE_ACTION_TRUNCATE,           /* truncate local file to 'newsize' bytes */
+       FILE_ACTION_REMOVE                      /* remove local file / directory / symlink */
 } file_action_t;
 
 typedef enum
@@ -40,7 +39,7 @@ typedef enum
        FILE_TYPE_SYMLINK
 } file_type_t;
 
-struct file_entry_t
+typedef struct file_entry_t
 {
        char       *path;
        file_type_t type;
@@ -52,57 +51,55 @@ struct file_entry_t
        size_t          newsize;
        bool            isrelfile;              /* is it a relation data file? */
 
-       datapagemap_t   pagemap;
+       datapagemap_t pagemap;
 
        /* for a symlink */
-       char            *link_target;
+       char       *link_target;
 
        struct file_entry_t *next;
-};
-
-typedef struct file_entry_t file_entry_t;
+} file_entry_t;
 
-struct filemap_t
+typedef struct filemap_t
 {
        /*
-        * New entries are accumulated to a linked list, in process_remote_file
-        * and process_local_file.
+        * New entries are accumulated to a linked list, in process_source_file
+        * and process_target_file.
         */
        file_entry_t *first;
        file_entry_t *last;
-       int                     nlist;
+       int                     nlist;                  /* number of entries currently in list */
 
        /*
         * After processing all the remote files, the entries in the linked list
         * are moved to this array. After processing local files, too, all the
-        * local entries are added to the array by filemap_finalize, and sorted
-        * in the final order. After filemap_finalize, all the entries are in
-        * the array, and the linked list is empty.
+        * local entries are added to the array by filemap_finalize, and sorted in
+        * the final order. After filemap_finalize, all the entries are in the
+        * array, and the linked list is empty.
         */
        file_entry_t **array;
-       int                     narray;
+       int                     narray;                 /* current length of array */
 
        /*
-        * Summary information. total_size is the total size of the source cluster,
-        * and fetch_size is the number of bytes that needs to be copied.
+        * Summary information. total_size is the total size of the source
+        * cluster, and fetch_size is the number of bytes that needs to be copied.
         */
        uint64          total_size;
        uint64          fetch_size;
-};
-
-typedef struct filemap_t filemap_t;
-
-extern filemap_t * filemap;
+} filemap_t;
 
-extern filemap_t *filemap_create(void);
+extern filemap_t *filemap;
 
+extern void filemap_create(void);
 extern void calculate_totals(void);
 extern void print_filemap(void);
 
 /* Functions for populating the filemap */
-extern void process_remote_file(const char *path, file_type_t type, size_t newsize, const char *link_target);
-extern void process_local_file(const char *path, file_type_t type, size_t newsize, const char *link_target);
-extern void process_block_change(ForkNumber forknum, RelFileNode rnode, BlockNumber blkno);
+extern void process_source_file(const char *path, file_type_t type,
+                                       size_t newsize, const char *link_target);
+extern void process_target_file(const char *path, file_type_t type,
+                                       size_t newsize, const char *link_target);
+extern void process_block_change(ForkNumber forknum, RelFileNode rnode,
+                                        BlockNumber blkno);
 extern void filemap_finalize(void);
 
 #endif   /* FILEMAP_H */