PostgreSQL Source Code  git master
file_ops.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * file_ops.h
4  * Helper functions for operating on files
5  *
6  * Copyright (c) 2013-2021, PostgreSQL Global Development Group
7  *
8  *-------------------------------------------------------------------------
9  */
10 #ifndef FILE_OPS_H
11 #define FILE_OPS_H
12 
13 #include "filemap.h"
14 
15 extern void open_target_file(const char *path, bool trunc);
16 extern void write_target_range(char *buf, off_t begin, size_t size);
17 extern void close_target_file(void);
18 extern void remove_target_file(const char *path, bool missing_ok);
19 extern void truncate_target_file(const char *path, off_t newsize);
20 extern void create_target(file_entry_t *t);
21 extern void remove_target(file_entry_t *t);
22 extern void sync_target_dir(void);
23 
24 extern char *slurpFile(const char *datadir, const char *path, size_t *filesize);
25 
26 typedef void (*process_file_callback_t) (const char *path, file_type_t type, size_t size, const char *link_target);
28 
29 #endif /* FILE_OPS_H */
char * slurpFile(const char *datadir, const char *path, size_t *filesize)
Definition: file_ops.c:314
void(* process_file_callback_t)(const char *path, file_type_t type, size_t size, const char *link_target)
Definition: file_ops.h:26
void traverse_datadir(const char *datadir, process_file_callback_t callback)
Definition: file_ops.c:362
void close_target_file(void)
Definition: file_ops.c:75
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)
Definition: test_ifaddrs.c:48
static char * buf
Definition: pg_test_fsync.c:68
char * datadir
void open_target_file(const char *path, bool trunc)
Definition: file_ops.c:47
Definition: filemap.h:49
void remove_target(file_entry_t *t)
Definition: file_ops.c:130
void sync_target_dir(void)
Definition: file_ops.c:294
void truncate_target_file(const char *path, off_t newsize)
Definition: file_ops.c:206
file_type_t
Definition: filemap.h:30
void write_target_range(char *buf, off_t begin, size_t size)
Definition: file_ops.c:88
void create_target(file_entry_t *t)
Definition: file_ops.c:156
void remove_target_file(const char *path, bool missing_ok)
Definition: file_ops.c:187