PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
#include "libpq/be-fsstubs.h"
#include "libpq/libpq-fs.h"
#include "miscadmin.h"
#include "storage/fd.h"
#include "storage/large_object.h"
#include "utils/acl.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
Go to the source code of this file.
Macros | |
#define | BUFSIZE 8192 |
#define | CreateFSContext() |
Variables | |
static LargeObjectDesc ** | cookies = NULL |
static int | cookies_size = 0 |
static MemoryContext | fscxt = NULL |
#define BUFSIZE 8192 |
Definition at line 57 of file be-fsstubs.c.
Referenced by be_lo_export(), and lo_import_internal().
#define CreateFSContext | ( | ) |
Definition at line 72 of file be-fsstubs.c.
Referenced by be_lo_creat(), be_lo_create(), be_lo_export(), be_lo_from_bytea(), be_lo_open(), be_lo_put(), lo_get_fragment_internal(), and lo_import_internal().
void AtEOSubXact_LargeObject | ( | bool | isCommit, |
SubTransactionId | mySubid, | ||
SubTransactionId | parentSubid | ||
) |
Definition at line 632 of file be-fsstubs.c.
References cookies_size, deleteLOfd(), i, inv_close(), and LargeObjectDesc::subid.
Referenced by AbortSubTransaction(), and CommitSubTransaction().
void AtEOXact_LargeObject | ( | bool | isCommit | ) |
Definition at line 591 of file be-fsstubs.c.
References close_lo_relation(), cookies_size, deleteLOfd(), i, inv_close(), and MemoryContextDelete().
Referenced by AbortTransaction(), CommitTransaction(), and PrepareTransaction().
Datum be_lo_close | ( | PG_FUNCTION_ARGS | ) |
Definition at line 112 of file be-fsstubs.c.
References cookies_size, DEBUG4, deleteLOfd(), elog, ereport, errcode(), errmsg(), ERROR, fd(), inv_close(), PG_GETARG_INT32, and PG_RETURN_INT32.
Datum be_lo_creat | ( | PG_FUNCTION_ARGS | ) |
Definition at line 237 of file be-fsstubs.c.
References CreateFSContext, inv_create(), InvalidOid, and PG_RETURN_OID.
Datum be_lo_create | ( | PG_FUNCTION_ARGS | ) |
Definition at line 253 of file be-fsstubs.c.
References CreateFSContext, inv_create(), PG_GETARG_OID, and PG_RETURN_OID.
Datum be_lo_export | ( | PG_FUNCTION_ARGS | ) |
Definition at line 473 of file be-fsstubs.c.
References buf, BUFSIZE, CloseTransientFile(), CreateFSContext, ereport, errcode_for_file_access(), errmsg(), ERROR, fd(), filename, inv_close(), inv_open(), INV_READ, inv_read(), MAXPGPATH, OpenTransientFilePerm(), PG_BINARY, PG_END_TRY, PG_FINALLY, PG_GETARG_OID, PG_GETARG_TEXT_PP, PG_RETURN_INT32, PG_TRY, S_IRGRP, S_IROTH, S_IRUSR, S_IWGRP, S_IWOTH, S_IWUSR, text_to_cstring_buffer(), and write.
Datum be_lo_from_bytea | ( | PG_FUNCTION_ARGS | ) |
Definition at line 813 of file be-fsstubs.c.
References Assert, CreateFSContext, inv_close(), inv_create(), inv_open(), INV_WRITE, inv_write(), PG_GETARG_BYTEA_PP, PG_GETARG_OID, PG_RETURN_OID, PG_USED_FOR_ASSERTS_ONLY, generate_unaccent_rules::str, VARDATA_ANY, and VARSIZE_ANY_EXHDR.
Datum be_lo_get | ( | PG_FUNCTION_ARGS | ) |
Definition at line 778 of file be-fsstubs.c.
References lo_get_fragment_internal(), PG_GETARG_OID, and PG_RETURN_BYTEA_P.
Datum be_lo_get_fragment | ( | PG_FUNCTION_ARGS | ) |
Definition at line 792 of file be-fsstubs.c.
References ereport, errcode(), errmsg(), ERROR, lo_get_fragment_internal(), PG_GETARG_INT32, PG_GETARG_INT64, PG_GETARG_OID, and PG_RETURN_BYTEA_P.
Datum be_lo_import | ( | PG_FUNCTION_ARGS | ) |
Definition at line 391 of file be-fsstubs.c.
References filename, InvalidOid, lo_import_internal(), PG_GETARG_TEXT_PP, and PG_RETURN_OID.
Datum be_lo_import_with_oid | ( | PG_FUNCTION_ARGS | ) |
Definition at line 403 of file be-fsstubs.c.
References filename, lo_import_internal(), PG_GETARG_OID, PG_GETARG_TEXT_PP, and PG_RETURN_OID.
Datum be_lo_lseek | ( | PG_FUNCTION_ARGS | ) |
Definition at line 194 of file be-fsstubs.c.
References cookies_size, ereport, errcode(), errmsg(), ERROR, fd(), inv_seek(), PG_GETARG_INT32, PG_RETURN_INT32, and status().
Datum be_lo_lseek64 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 219 of file be-fsstubs.c.
References cookies_size, ereport, errcode(), errmsg(), ERROR, fd(), inv_seek(), PG_GETARG_INT32, PG_GETARG_INT64, PG_RETURN_INT64, and status().
Datum be_lo_open | ( | PG_FUNCTION_ARGS | ) |
Definition at line 91 of file be-fsstubs.c.
References CreateFSContext, DEBUG4, elog, fd(), inv_open(), mode, newLOfd(), PG_GETARG_INT32, PG_GETARG_OID, and PG_RETURN_INT32.
Datum be_lo_put | ( | PG_FUNCTION_ARGS | ) |
Definition at line 835 of file be-fsstubs.c.
References ACL_UPDATE, ACLCHECK_OK, Assert, CreateFSContext, ereport, errcode(), errmsg(), ERROR, GetUserId(), LargeObjectDesc::id, inv_close(), inv_open(), inv_seek(), INV_WRITE, inv_write(), lo_compat_privileges, PG_GETARG_BYTEA_PP, PG_GETARG_INT64, PG_GETARG_OID, pg_largeobject_aclcheck_snapshot(), PG_RETURN_VOID, PG_USED_FOR_ASSERTS_ONLY, LargeObjectDesc::snapshot, generate_unaccent_rules::str, VARDATA_ANY, and VARSIZE_ANY_EXHDR.
Datum be_lo_tell | ( | PG_FUNCTION_ARGS | ) |
Definition at line 269 of file be-fsstubs.c.
References cookies_size, ereport, errcode(), errmsg(), ERROR, fd(), inv_tell(), PG_GETARG_INT32, and PG_RETURN_INT32.
Datum be_lo_tell64 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 292 of file be-fsstubs.c.
References cookies_size, ereport, errcode(), errmsg(), ERROR, fd(), inv_tell(), PG_GETARG_INT32, and PG_RETURN_INT64.
Datum be_lo_truncate | ( | PG_FUNCTION_ARGS | ) |
Definition at line 567 of file be-fsstubs.c.
References fd(), lo_truncate_internal(), PG_GETARG_INT32, and PG_RETURN_INT32.
Datum be_lo_truncate64 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 577 of file be-fsstubs.c.
References fd(), lo_truncate_internal(), PG_GETARG_INT32, PG_GETARG_INT64, and PG_RETURN_INT32.
Datum be_lo_unlink | ( | PG_FUNCTION_ARGS | ) |
Definition at line 308 of file be-fsstubs.c.
References cookies_size, deleteLOfd(), ereport, errcode(), errmsg(), ERROR, GetUserId(), i, inv_close(), inv_drop(), lo_compat_privileges, PG_GETARG_OID, pg_largeobject_ownercheck(), and PG_RETURN_INT32.
Referenced by lo_manage().
Datum be_loread | ( | PG_FUNCTION_ARGS | ) |
Definition at line 352 of file be-fsstubs.c.
References fd(), lo_read(), palloc(), PG_GETARG_INT32, PG_RETURN_BYTEA_P, SET_VARSIZE, VARDATA, and VARHDRSZ.
Datum be_lowrite | ( | PG_FUNCTION_ARGS | ) |
Definition at line 370 of file be-fsstubs.c.
References fd(), lo_write(), PG_GETARG_BYTEA_PP, PG_GETARG_INT32, PG_RETURN_INT32, VARDATA_ANY, and VARSIZE_ANY_EXHDR.
|
static |
Definition at line 709 of file be-fsstubs.c.
References fd().
Referenced by AtEOSubXact_LargeObject(), AtEOXact_LargeObject(), be_lo_close(), and be_lo_unlink().
Definition at line 722 of file be-fsstubs.c.
References Assert, CreateFSContext, ereport, errcode(), errmsg(), ERROR, inv_close(), inv_open(), INV_READ, inv_read(), inv_seek(), MaxAllocSize, palloc(), PG_USED_FOR_ASSERTS_ONLY, SET_VARSIZE, VARDATA, and VARHDRSZ.
Referenced by be_lo_get(), and be_lo_get_fragment().
Definition at line 412 of file be-fsstubs.c.
References Assert, buf, BUFSIZE, CloseTransientFile(), CreateFSContext, ereport, errcode_for_file_access(), errmsg(), ERROR, fd(), inv_close(), inv_create(), inv_open(), INV_WRITE, inv_write(), MAXPGPATH, OpenTransientFile(), PG_BINARY, PG_USED_FOR_ASSERTS_ONLY, read, and text_to_cstring_buffer().
Referenced by be_lo_import(), and be_lo_import_with_oid().
int lo_read | ( | int | fd, |
char * | buf, | ||
int | len | ||
) |
Definition at line 142 of file be-fsstubs.c.
References cookies_size, ereport, errcode(), errmsg(), ERROR, fd(), LargeObjectDesc::flags, IFS_RDLOCK, inv_read(), and status().
Referenced by be_loread(), dumpBlobs(), exportFile(), and pickout().
|
static |
Definition at line 546 of file be-fsstubs.c.
References cookies_size, ereport, errcode(), errmsg(), ERROR, fd(), LargeObjectDesc::flags, IFS_WRLOCK, and inv_truncate().
Referenced by be_lo_truncate(), and be_lo_truncate64().
int lo_write | ( | int | fd, |
const char * | buf, | ||
int | len | ||
) |
Definition at line 170 of file be-fsstubs.c.
References cookies_size, ereport, errcode(), errmsg(), ERROR, fd(), LargeObjectDesc::flags, IFS_WRLOCK, inv_write(), and status().
Referenced by be_lowrite(), dump_lo_buf(), importFile(), and overwrite().
|
static |
Definition at line 666 of file be-fsstubs.c.
References Assert, cookies_size, i, MemoryContextAllocZero(), MemSet, and repalloc().
Referenced by be_lo_open().
|
static |
Definition at line 67 of file be-fsstubs.c.
|
static |
Definition at line 68 of file be-fsstubs.c.
Referenced by AtEOSubXact_LargeObject(), AtEOXact_LargeObject(), be_lo_close(), be_lo_lseek(), be_lo_lseek64(), be_lo_tell(), be_lo_tell64(), be_lo_unlink(), lo_read(), lo_truncate_internal(), lo_write(), and newLOfd().
|
static |
Definition at line 70 of file be-fsstubs.c.