Mon, 12 Aug 2024 21:20:17 +0200
fix memory leak in case handle_request fails (some illegal requests)
275
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | /* |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | * |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | * Copyright 2022 Olaf Wintermann. All rights reserved. |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
5 | * |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6 | * Redistribution and use in source and binary forms, with or without |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | * modification, are permitted provided that the following conditions are met: |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | * |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9 | * 1. Redistributions of source code must retain the above copyright |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10 | * notice, this list of conditions and the following disclaimer. |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | * |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | * 2. Redistributions in binary form must reproduce the above copyright |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13 | * notice, this list of conditions and the following disclaimer in the |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14 | * documentation and/or other materials provided with the distribution. |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
15 | * |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
26 | * POSSIBILITY OF SUCH DAMAGE. |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
27 | */ |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
28 | |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
29 | #ifndef WS_PG_VFS_H |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | #define WS_PG_VFS_H |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
31 | |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
32 | #include "../../public/nsapi.h" |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
33 | #include "../../public/vfs.h" |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
34 | |
374
77506ec632a4
use configured root node from PgRepository in pg vfs/webdav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
35 | #include "config.h" |
77506ec632a4
use configured root node from PgRepository in pg vfs/webdav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
36 | |
276
0cb4eda146c4
add function to create a postgresql-based VFS
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
275
diff
changeset
|
37 | #include <libpq-fe.h> |
283
25e5b771677d
minimal working send_file with postgresql vfs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
282
diff
changeset
|
38 | #include <libpq/libpq-fs.h> |
276
0cb4eda146c4
add function to create a postgresql-based VFS
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
275
diff
changeset
|
39 | |
275
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
40 | #ifdef __cplusplus |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
41 | extern "C" { |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
42 | #endif |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
43 | |
346
784b24381bed
extend postgresql vfs to store an etag in the file
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
44 | #define PG_ETAG_MAXLEN 48 |
784b24381bed
extend postgresql vfs to store an etag in the file
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
45 | |
276
0cb4eda146c4
add function to create a postgresql-based VFS
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
275
diff
changeset
|
46 | typedef struct PgVFS { |
0cb4eda146c4
add function to create a postgresql-based VFS
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
275
diff
changeset
|
47 | ResourceData *pg_resource; |
0cb4eda146c4
add function to create a postgresql-based VFS
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
275
diff
changeset
|
48 | PGconn *connection; |
374
77506ec632a4
use configured root node from PgRepository in pg vfs/webdav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
49 | char root_resource_id_str[32]; |
366
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
346
diff
changeset
|
50 | int64_t root_resource_id; |
276
0cb4eda146c4
add function to create a postgresql-based VFS
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
275
diff
changeset
|
51 | } PgVFS; |
278
38bf7b42b58c
implement pg_vfs_open
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
276
diff
changeset
|
52 | |
38bf7b42b58c
implement pg_vfs_open
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
276
diff
changeset
|
53 | typedef struct PgFile { |
346
784b24381bed
extend postgresql vfs to store an etag in the file
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
54 | int64_t resource_id; |
784b24381bed
extend postgresql vfs to store an etag in the file
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
55 | int64_t parent_id; |
784b24381bed
extend postgresql vfs to store an etag in the file
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
56 | WSBool iscollection; |
784b24381bed
extend postgresql vfs to store an etag in the file
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
57 | Oid oid; |
784b24381bed
extend postgresql vfs to store an etag in the file
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
58 | int fd; |
784b24381bed
extend postgresql vfs to store an etag in the file
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
59 | int oflags; |
784b24381bed
extend postgresql vfs to store an etag in the file
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
60 | char etag[PG_ETAG_MAXLEN]; |
784b24381bed
extend postgresql vfs to store an etag in the file
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
61 | struct stat s; |
278
38bf7b42b58c
implement pg_vfs_open
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
276
diff
changeset
|
62 | } PgFile; |
38bf7b42b58c
implement pg_vfs_open
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
276
diff
changeset
|
63 | |
279
79029fe26aae
add basic postgresql vfs directory functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
278
diff
changeset
|
64 | typedef struct PgDir { |
346
784b24381bed
extend postgresql vfs to store an etag in the file
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
65 | VFSFile *file; |
784b24381bed
extend postgresql vfs to store an etag in the file
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
66 | PGresult *result; |
784b24381bed
extend postgresql vfs to store an etag in the file
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
67 | int row; |
784b24381bed
extend postgresql vfs to store an etag in the file
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
68 | int nrows; |
279
79029fe26aae
add basic postgresql vfs directory functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
278
diff
changeset
|
69 | } PgDir; |
79029fe26aae
add basic postgresql vfs directory functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
278
diff
changeset
|
70 | |
366
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
346
diff
changeset
|
71 | void* pg_vfs_init(ServerConfiguration *cfg, pool_handle_t *pool, WSConfigNode *config); |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
346
diff
changeset
|
72 | |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
346
diff
changeset
|
73 | VFS* pg_vfs_create(Session *sn, Request *rq, pblock *pb, void *initData); |
278
38bf7b42b58c
implement pg_vfs_open
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
276
diff
changeset
|
74 | |
374
77506ec632a4
use configured root node from PgRepository in pg vfs/webdav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
75 | VFS* pg_vfs_create_from_resourcedata(Session *sn, Request *rq, PgRepository *repo, ResourceData *resdata); |
289
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
285
diff
changeset
|
76 | |
278
38bf7b42b58c
implement pg_vfs_open
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
276
diff
changeset
|
77 | |
38bf7b42b58c
implement pg_vfs_open
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
276
diff
changeset
|
78 | /* |
38bf7b42b58c
implement pg_vfs_open
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
276
diff
changeset
|
79 | * Resolve a path into a parent_id and resource name |
38bf7b42b58c
implement pg_vfs_open
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
276
diff
changeset
|
80 | * |
38bf7b42b58c
implement pg_vfs_open
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
276
diff
changeset
|
81 | * Only absolute paths are supported, therefore path[0] must be '/' |
38bf7b42b58c
implement pg_vfs_open
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
276
diff
changeset
|
82 | * |
305
4db64fe30588
change pg_resolve_path signature to be useable without VFS
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
304
diff
changeset
|
83 | * If the resource is not found, res_errno is set to ENOENT |
278
38bf7b42b58c
implement pg_vfs_open
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
276
diff
changeset
|
84 | */ |
281
e9dc53661df4
add pg vfs stat/fstat implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
279
diff
changeset
|
85 | int pg_resolve_path( |
305
4db64fe30588
change pg_resolve_path signature to be useable without VFS
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
304
diff
changeset
|
86 | PGconn *connection, |
281
e9dc53661df4
add pg vfs stat/fstat implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
279
diff
changeset
|
87 | const char *path, |
374
77506ec632a4
use configured root node from PgRepository in pg vfs/webdav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
88 | const char *root_id, |
281
e9dc53661df4
add pg vfs stat/fstat implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
279
diff
changeset
|
89 | int64_t *parent_id, |
e9dc53661df4
add pg vfs stat/fstat implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
279
diff
changeset
|
90 | int64_t *resource_id, |
283
25e5b771677d
minimal working send_file with postgresql vfs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
282
diff
changeset
|
91 | Oid *oid, |
281
e9dc53661df4
add pg vfs stat/fstat implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
279
diff
changeset
|
92 | const char **resource_name, |
e9dc53661df4
add pg vfs stat/fstat implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
279
diff
changeset
|
93 | WSBool *iscollection, |
305
4db64fe30588
change pg_resolve_path signature to be useable without VFS
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
304
diff
changeset
|
94 | struct stat *s, |
346
784b24381bed
extend postgresql vfs to store an etag in the file
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
95 | char *etag, |
305
4db64fe30588
change pg_resolve_path signature to be useable without VFS
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
304
diff
changeset
|
96 | int *res_errno); |
282
cfb588e27198
add support for getstat parameter in pg readdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
281
diff
changeset
|
97 | |
cfb588e27198
add support for getstat parameter in pg readdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
281
diff
changeset
|
98 | void pg_set_stat( |
cfb588e27198
add support for getstat parameter in pg readdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
281
diff
changeset
|
99 | struct stat *s, |
cfb588e27198
add support for getstat parameter in pg readdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
281
diff
changeset
|
100 | const char *iscollection, |
cfb588e27198
add support for getstat parameter in pg readdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
281
diff
changeset
|
101 | const char *lastmodified, |
cfb588e27198
add support for getstat parameter in pg readdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
281
diff
changeset
|
102 | const char *creationdate, |
cfb588e27198
add support for getstat parameter in pg readdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
281
diff
changeset
|
103 | const char *contentlength); |
285
96e53bd94958
add support for O_CREAT flag in postgresql vfs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
283
diff
changeset
|
104 | |
96e53bd94958
add support for O_CREAT flag in postgresql vfs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
283
diff
changeset
|
105 | int pg_create_file( |
96e53bd94958
add support for O_CREAT flag in postgresql vfs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
283
diff
changeset
|
106 | VFSContext *ctx, |
96e53bd94958
add support for O_CREAT flag in postgresql vfs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
283
diff
changeset
|
107 | PgVFS *pg, |
96e53bd94958
add support for O_CREAT flag in postgresql vfs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
283
diff
changeset
|
108 | const char *path, |
96e53bd94958
add support for O_CREAT flag in postgresql vfs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
283
diff
changeset
|
109 | int64_t *new_resource_id, |
96e53bd94958
add support for O_CREAT flag in postgresql vfs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
283
diff
changeset
|
110 | int64_t *res_parent_id, |
96e53bd94958
add support for O_CREAT flag in postgresql vfs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
283
diff
changeset
|
111 | Oid *oid, |
96e53bd94958
add support for O_CREAT flag in postgresql vfs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
283
diff
changeset
|
112 | const char **resource_name, |
290
efc10acf539f
implement pg vfs mkdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
289
diff
changeset
|
113 | struct stat *s, |
efc10acf539f
implement pg vfs mkdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
289
diff
changeset
|
114 | WSBool collection); |
292
7c31bcd5b4be
update pg resource metadata on close
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
291
diff
changeset
|
115 | |
296
78e92337fa4e
implement pg rmdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
295
diff
changeset
|
116 | int pg_remove_res( |
294
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
292
diff
changeset
|
117 | VFSContext *ctx, |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
292
diff
changeset
|
118 | PgVFS *pg, |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
292
diff
changeset
|
119 | int64_t resource_id, |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
292
diff
changeset
|
120 | Oid oid); |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
292
diff
changeset
|
121 | |
292
7c31bcd5b4be
update pg resource metadata on close
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
291
diff
changeset
|
122 | int pg_update_resource(PgVFS *pg, int64_t resource_id, int64_t contentlength); |
275
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
123 | |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
124 | SYS_FILE pg_vfs_open(VFSContext *ctx, const char *path, int oflags); |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
125 | int pg_vfs_stat(VFSContext *ctx, const char *path, struct stat *buf); |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
126 | int pg_vfs_fstat(VFSContext *ctx, SYS_FILE fd, struct stat *buf); |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
127 | VFS_DIR pg_vfs_opendir(VFSContext *ctx, const char *path); |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
128 | VFS_DIR pg_vfs_fdopendir(VFSContext *ctx, SYS_FILE fd); |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
129 | int pg_vfs_mkdir(VFSContext *ctx, const char *path); |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
130 | int pg_vfs_unlink(VFSContext *ctx, const char *path); |
295
73a1243fce15
add pg mkdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
294
diff
changeset
|
131 | int pg_vfs_rmdir(VFSContext *ctx, const char *path); |
275
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
132 | |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
133 | |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
134 | ssize_t pg_vfs_io_read(SYS_FILE fd, void *buf, size_t nbyte); |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
135 | ssize_t pg_vfs_io_write(SYS_FILE fd, const void *buf, size_t nbyte); |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
136 | ssize_t pg_vfs_io_pread(SYS_FILE fd, void *buf, size_t nbyte, off_t offset); |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
137 | ssize_t pg_vfs_io_pwrite(SYS_FILE fd, const void *buf, size_t nbyte, off_t offset); |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
138 | off_t pg_vfs_io_seek(SYS_FILE fd, off_t offset, int whence); |
291
0f46b645aea4
add pg_vfs_io_tell
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
139 | off_t pg_vfs_io_tell(SYS_FILE fd); |
275
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
140 | void pg_vfs_io_close(SYS_FILE fd); |
345
5832e10fc59a
add optional getetag function to VFS API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
311
diff
changeset
|
141 | const char *pg_vfs_io_getetag(SYS_FILE fd); |
275
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
142 | |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
143 | |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
144 | int pg_vfs_dirio_readdir(VFS_DIR dir, VFS_ENTRY *entry, int getstat); |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
145 | void pg_vfs_dirio_close(VFS_DIR dir); |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
146 | |
304
33911d44111d
add basic parser for pg timestamps
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
296
diff
changeset
|
147 | time_t pg_convert_timestamp(const char *timestamp); |
311
e676ed461b5b
implement pg getlastmodified propfind (and prepare creationdate)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
305
diff
changeset
|
148 | int pg_convert_timestamp_tm(const char *timestamp, struct tm *tm); |
304
33911d44111d
add basic parser for pg timestamps
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
296
diff
changeset
|
149 | |
275
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
150 | #ifdef __cplusplus |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
151 | } |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
152 | #endif |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
153 | |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
154 | #endif /* WS_PG_VFS_H */ |
535004faa1a5
add empty postgresql VFS functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
155 |