diff options
author | Ramon Fernandez <ramon@mongodb.com> | 2016-04-14 15:24:51 +0100 |
---|---|---|
committer | Ramon Fernandez <ramon@mongodb.com> | 2016-04-14 15:25:01 +0100 |
commit | 7ee4e4e493c3785fea489ee3508ca18526709c16 (patch) | |
tree | 2c88bd0fde275f00a68512757fc22edf0bb98e72 /src/third_party/wiredtiger/src/include/os.h | |
parent | e266e7e354ae4f2a34c7a3c5dc754ec236d82334 (diff) | |
download | mongo-7ee4e4e493c3785fea489ee3508ca18526709c16.tar.gz |
Import wiredtiger-wiredtiger-2.8.0-201-g7ea2631.tar.gz from wiredtiger branch mongodb-3.2
ref: 43e885a..7ea2631
SERVER-23504 Coverity analysis defect 98177: Resource leak
SERVER-23526 Replication relies on storage engines reporting a non-zero size for correctness
SERVER-23588 mongod with WiredTiger won't start on Windows when built with --dbg=on --opt=off
SERVER-23682 WiredTiger changes for MongoDB 3.2.6
WT-2330 in-memory configurations should not create on-disk collection files
WT-2507 Add upgrading documentation in preparation for 2.8 release.
WT-2512 wtperf: MSVC complains about float conversion in throttle code
WT-2513 conversion from 'int64_t' to 'uint32_t'
WT-2517 wtperf uses setvbuf in a way that isn't supported on Windows
WT-2522 Incorrect format code in message
WT-2525 in-memory configurations: miscellaneous cleanups
WT-2527 OS X compile error, missing POSIX_FADV_WILLNEED #define
WT-2528 style error in WiredTiger build
WT-2529 The readonly test case is crashing with a stack overflow
WT-2531 in-memory tables are allocating unnecessary memory
WT-2532 WT_STREAM_APPEND and WT_STREAM_LINE_BUFFER flag overlap
WT-2533 Ensure that in-memory tables don't report a zero size
WT-2534 Invalid transaction snapshots on PowerPC
Diffstat (limited to 'src/third_party/wiredtiger/src/include/os.h')
-rw-r--r-- | src/third_party/wiredtiger/src/include/os.h | 87 |
1 files changed, 57 insertions, 30 deletions
diff --git a/src/third_party/wiredtiger/src/include/os.h b/src/third_party/wiredtiger/src/include/os.h index fbba7f05f88..2ff41d39f46 100644 --- a/src/third_party/wiredtiger/src/include/os.h +++ b/src/third_party/wiredtiger/src/include/os.h @@ -7,29 +7,6 @@ */ /* - * FILE handle close/open configuration. - */ -typedef enum { - WT_FHANDLE_APPEND, WT_FHANDLE_READ, WT_FHANDLE_WRITE -} WT_FHANDLE_MODE; - -#ifdef _WIN32 -/* - * Open in binary (untranslated) mode; translations involving carriage-return - * and linefeed characters are suppressed. - */ -#define WT_FOPEN_APPEND "ab" -#define WT_FOPEN_READ "rb" -#define WT_FOPEN_WRITE "wb" -#else -#define WT_FOPEN_APPEND "a" -#define WT_FOPEN_READ "r" -#define WT_FOPEN_WRITE "w" -#endif - -#define WT_FOPEN_FIXED 0x1 /* Path isn't relative to home */ - -/* * Number of directory entries can grow dynamically. */ #define WT_DIR_ENTRY 32 @@ -81,24 +58,52 @@ typedef enum { (t1).tv_nsec < (t2).tv_nsec ? -1 : \ (t1).tv_nsec == (t2).tv_nsec ? 0 : 1 : 1) +/* + * The underlying OS calls return ENOTSUP if posix_fadvise functionality isn't + * available, but WiredTiger uses the POSIX flag names in the API. Use distinct + * values so the underlying code can distinguish. + */ +#ifndef POSIX_FADV_DONTNEED +#define POSIX_FADV_DONTNEED 0x01 +#endif +#ifndef POSIX_FADV_WILLNEED +#define POSIX_FADV_WILLNEED 0x02 +#endif + +#define WT_OPEN_CREATE 0x001 /* Create is OK */ +#define WT_OPEN_EXCLUSIVE 0x002 /* Exclusive open */ +#define WT_OPEN_FIXED 0x004 /* Path isn't relative to home */ +#define WT_OPEN_READONLY 0x008 /* Readonly open */ +#define WT_STREAM_APPEND 0x010 /* Open a stream: append */ +#define WT_STREAM_LINE_BUFFER 0x020 /* Line buffer the stream */ +#define WT_STREAM_READ 0x040 /* Open a stream: read */ +#define WT_STREAM_WRITE 0x080 /* Open a stream: write */ + struct __wt_fh { - char *name; /* File name */ + const char *name; /* File name */ uint64_t name_hash; /* Hash of name */ TAILQ_ENTRY(__wt_fh) q; /* List of open handles */ TAILQ_ENTRY(__wt_fh) hashq; /* Hashed list of handles */ u_int ref; /* Reference count */ -#ifndef _WIN32 - int fd; /* POSIX file handle */ -#else + /* + * Underlying file system handle support. + */ +#ifdef _WIN32 HANDLE filehandle; /* Windows file handle */ HANDLE filehandle_secondary; /* Windows file handle for file size changes */ +#else + int fd; /* POSIX file handle */ #endif - wt_off_t size; /* File size */ - wt_off_t extend_size; /* File extended size */ - wt_off_t extend_len; /* File extend chunk size */ + FILE *fp; /* ANSI C stdio handle */ + + /* + * Underlying in-memory handle support. + */ + size_t off; /* Read/write offset */ + WT_ITEM buf; /* Data */ bool direct_io; /* O_DIRECT configured */ @@ -109,4 +114,26 @@ struct __wt_fh { WT_FALLOCATE_STD, WT_FALLOCATE_SYS } fallocate_available; bool fallocate_requires_locking; + +#define WT_FH_FLUSH_ON_CLOSE 0x01 /* Flush when closing */ +#define WT_FH_IN_MEMORY 0x02 /* In-memory, don't remove */ + uint32_t flags; + + int (*fh_advise)(WT_SESSION_IMPL *, WT_FH *, wt_off_t, wt_off_t, int); + int (*fh_allocate)(WT_SESSION_IMPL *, WT_FH *, wt_off_t, wt_off_t); + int (*fh_close)(WT_SESSION_IMPL *, WT_FH *); + int (*fh_getc)(WT_SESSION_IMPL *, WT_FH *, int *); + int (*fh_lock)(WT_SESSION_IMPL *, WT_FH *, bool); + int (*fh_map)(WT_SESSION_IMPL *, WT_FH *, void *, size_t *, void **); + int (*fh_map_discard)(WT_SESSION_IMPL *, WT_FH *, void *, size_t); + int (*fh_map_preload)(WT_SESSION_IMPL *, WT_FH *, const void *, size_t); + int (*fh_map_unmap)( + WT_SESSION_IMPL *, WT_FH *, void *, size_t, void **); + int (*fh_printf)(WT_SESSION_IMPL *, WT_FH *, const char *, va_list); + int (*fh_read)(WT_SESSION_IMPL *, WT_FH *, wt_off_t, size_t, void *); + int (*fh_size)(WT_SESSION_IMPL *, WT_FH *, wt_off_t *); + int (*fh_sync)(WT_SESSION_IMPL *, WT_FH *, bool); + int (*fh_truncate)(WT_SESSION_IMPL *, WT_FH *, wt_off_t); + int (*fh_write)( + WT_SESSION_IMPL *, WT_FH *, wt_off_t, size_t, const void *); }; |