Skip to content

Commit 1eed6e0

Browse files
committed
This commit adds protection against a platform-specific feature in
polar_vfs. In particular: - Gate .vfs_posix_fallocate behind HAVE_POSIX_FALLOCATE across VFS managers. Wrap .vfs_posix_fallocate assignments with HAVE_POSIX_FALLOCATE and set to NULL when the platform does not provide posix_fallocate.
1 parent c8886ea commit 1eed6e0

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

src/backend/storage/file/polar_fd.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,11 @@ vfs_mgr polar_vfs[] =
104104
.vfs_fsync = pg_fsync,
105105
.vfs_unlink = unlink,
106106
.vfs_rename = rename,
107+
#ifdef HAVE_POSIX_FALLOCATE
107108
.vfs_posix_fallocate = posix_fallocate,
109+
#else
110+
.vfs_posix_fallocate = NULL,
111+
#endif
108112
#ifdef __linux__
109113
.vfs_fallocate = fallocate,
110114
#else

src/polar_vfs/polar_bufferio.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ const vfs_mgr polar_vfs_bio =
5757
#endif
5858
.vfs_unlink = unlink,
5959
.vfs_rename = rename,
60+
#ifdef HAVE_POSIX_FALLOCATE
6061
.vfs_posix_fallocate = posix_fallocate,
62+
#else
63+
.vfs_posix_fallocate = NULL,
64+
#endif
6165
#ifdef __linux__
6266
.vfs_fallocate = fallocate,
6367
#else

src/polar_vfs/polar_directio.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ const vfs_mgr polar_vfs_dio =
7979
.vfs_fsync = polar_directio_fsync,
8080
.vfs_unlink = unlink,
8181
.vfs_rename = rename,
82+
#ifdef HAVE_POSIX_FALLOCATE
8283
.vfs_posix_fallocate = posix_fallocate,
84+
#else
85+
.vfs_posix_fallocate = NULL,
86+
#endif
8387
#ifdef __linux__
8488
.vfs_fallocate = fallocate,
8589
#else

src/polar_vfs/polar_vfs_fe.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ vfs_mgr polar_vfs[] =
105105
.vfs_fsync = fsync,
106106
.vfs_unlink = unlink,
107107
.vfs_rename = rename,
108+
#ifdef HAVE_POSIX_FALLOCATE
108109
.vfs_posix_fallocate = posix_fallocate,
110+
#else
111+
.vfs_posix_fallocate = NULL,
112+
#endif
109113
#ifdef __linux__
110114
.vfs_fallocate = fallocate,
111115
#else

0 commit comments

Comments
 (0)