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-2024, 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 *entry);
21 extern void remove_target(file_entry_t *entry);
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 */
void remove_target_file(const char *path, bool missing_ok)
Definition: file_ops.c:187
void traverse_datadir(const char *datadir, process_file_callback_t callback)
Definition: file_ops.c:362
char * slurpFile(const char *datadir, const char *path, size_t *filesize)
Definition: file_ops.c:314
void close_target_file(void)
Definition: file_ops.c:75
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 truncate_target_file(const char *path, off_t newsize)
Definition: file_ops.c:206
void remove_target(file_entry_t *entry)
Definition: file_ops.c:130
void sync_target_dir(void)
Definition: file_ops.c:294
void create_target(file_entry_t *entry)
Definition: file_ops.c:156
void open_target_file(const char *path, bool trunc)
Definition: file_ops.c:47
void write_target_range(char *buf, off_t begin, size_t size)
Definition: file_ops.c:88
file_type_t
Definition: filemap.h:31
char * datadir
static char * buf
Definition: pg_test_fsync.c:72
static pg_noinline void Size size
Definition: slab.c:607
Definition: filemap.h:50
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)
Definition: test_ifaddrs.c:46
const char * type