diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/api.h | 7 | ||||
-rw-r--r-- | src/include/cursor.h | 6 | ||||
-rw-r--r-- | src/include/cursor.i | 12 | ||||
-rw-r--r-- | src/include/extern.h | 76 | ||||
-rw-r--r-- | src/include/wiredtiger.in | 44 |
5 files changed, 63 insertions, 82 deletions
diff --git a/src/include/api.h b/src/include/api.h index 63cb9530fd0..296adc0f1dc 100644 --- a/src/include/api.h +++ b/src/include/api.h @@ -75,10 +75,10 @@ struct __wt_session_impl { WT_BTREE *schematab; /* Schema tables */ TAILQ_HEAD(__tables, __wt_table) tables; - WT_BUF logrec_buf; /* Buffer for log records */ - WT_BUF logprint_buf; /* Buffer for debug log records */ + WT_ITEM logrec_buf; /* Buffer for log records */ + WT_ITEM logprint_buf; /* Buffer for debug log records */ - WT_BUF **scratch; /* Temporary memory for any function */ + WT_ITEM **scratch; /* Temporary memory for any function */ u_int scratch_alloc; /* Currently allocated */ /* Serialized operation state */ @@ -264,7 +264,6 @@ extern WT_PROCESS __wt_process; * DO NOT EDIT: automatically built by dist/api_flags.py. * API flags section: BEGIN */ -#define WT_BUF_INUSE 0x00000001 #define WT_PAGE_FREE_IGNORE_DISK 0x00000001 #define WT_REC_SINGLE 0x00000001 #define WT_SERVER_RUN 0x00000001 diff --git a/src/include/cursor.h b/src/include/cursor.h index f281d0bc4ee..c3310ff6056 100644 --- a/src/include/cursor.h +++ b/src/include/cursor.h @@ -73,7 +73,7 @@ struct __wt_cursor_btree { * A temporary buffer with two uses: caching RLE values for column-store * files, and caching the last-returned keys for row-store files. */ - WT_BUF tmp; + WT_ITEM tmp; /* * Fixed-length column-store items are a single byte, and it's simpler @@ -100,7 +100,7 @@ struct __wt_cursor_bulk { * part of RLE compression, row-store compares keys during bulk load * to avoid corruption. */ - WT_BUF cmp; /* Comparison buffer */ + WT_ITEM cmp; /* Comparison buffer */ /* * Variable-length column-store RLE counter (also overloaded to mean @@ -138,7 +138,7 @@ struct __wt_cursor_stat { int key; /* Current stats key */ uint64_t v; /* Current stats value */ - WT_BUF pv; /* Current stats value (string) */ + WT_ITEM pv; /* Current stats value (string) */ void (*clear_func)(WT_STATS *); /* Function to clear stats. */ WT_BTREE *btree; /* Pinned btree handle. */ diff --git a/src/include/cursor.i b/src/include/cursor.i index 3fc8b5d5b5b..cea5ac359f9 100644 --- a/src/include/cursor.i +++ b/src/include/cursor.i @@ -87,7 +87,7 @@ static inline int __cursor_row_slot_return(WT_CURSOR_BTREE *cbt, WT_ROW *rip) { WT_BTREE *btree; - WT_BUF *kb, *vb; + WT_ITEM *kb, *vb; WT_CELL *cell; WT_CELL_UNPACK *unpack, _unpack; WT_IKEY *ikey; @@ -147,14 +147,14 @@ __cursor_row_slot_return(WT_CURSOR_BTREE *cbt, WT_ROW *rip) cbt->rip_saved != NULL && cbt->rip_saved == rip - 1) { /* * If we previously built a prefix-compressed key in the - * temporary buffer, the WT_BUF->data field will be the - * same as the WT_BUF->mem field: grow the buffer if + * temporary buffer, the WT_ITEM->data field will be the + * same as the WT_ITEM->mem field: grow the buffer if * necessary and copy the suffix into place. If we * previously pointed the temporary buffer at an on-page - * key, the WT_BUF->data field will not be the same as - * the WT_BUF->mem field: grow the buffer if necessary, + * key, the WT_ITEM->data field will not be the same as + * the WT_ITEM->mem field: grow the buffer if necessary, * copy the prefix into place, and then re-point the - * WT_BUF->data field to the newly constructed memory. + * WT_ITEM->data field to the newly constructed memory. */ WT_RET(__wt_buf_grow( session, &cbt->tmp, unpack->prefix + unpack->size)); diff --git a/src/include/extern.h b/src/include/extern.h index d8f70d2c9d3..4f8973d5c11 100644 --- a/src/include/extern.h +++ b/src/include/extern.h @@ -16,7 +16,7 @@ extern int __wt_block_addr_valid(WT_SESSION_IMPL *session, uint32_t addr_size); extern int __wt_block_addr_string(WT_SESSION_IMPL *session, WT_BLOCK *block, - WT_BUF *buf, + WT_ITEM *buf, const uint8_t *addr, uint32_t addr_size); extern int __wt_block_alloc( WT_SESSION_IMPL *session, @@ -47,7 +47,7 @@ extern int __wt_bm_addr_stderr( WT_SESSION_IMPL *session, const uint8_t *addr, uint32_t addr_size); extern int __wt_bm_addr_string(WT_SESSION_IMPL *session, - WT_BUF *buf, + WT_ITEM *buf, const uint8_t *addr, uint32_t addr_size); extern int __wt_bm_create(WT_SESSION_IMPL *session, const char *filename); @@ -62,19 +62,19 @@ extern int __wt_bm_free(WT_SESSION_IMPL *session, const uint8_t *addr, uint32_t addr_size); extern int __wt_bm_read(WT_SESSION_IMPL *session, - WT_BUF *buf, + WT_ITEM *buf, const uint8_t *addr, uint32_t addr_size); extern int __wt_bm_block_header(WT_SESSION_IMPL *session, uint32_t *headerp); extern int __wt_bm_write_size(WT_SESSION_IMPL *session, uint32_t *sizep); extern int __wt_bm_write( WT_SESSION_IMPL *session, - WT_BUF *buf, + WT_ITEM *buf, uint8_t *addr, uint32_t *addr_size); extern int __wt_bm_stat(WT_SESSION_IMPL *session); extern int __wt_bm_salvage_start(WT_SESSION_IMPL *session); extern int __wt_bm_salvage_next(WT_SESSION_IMPL *session, - WT_BUF *buf, + WT_ITEM *buf, uint8_t *addr, uint32_t *addr_sizep, uint64_t *write_genp, @@ -97,12 +97,12 @@ extern int __wt_block_close(WT_SESSION_IMPL *session, WT_BLOCK *block); extern int __wt_desc_init(WT_SESSION_IMPL *session, WT_FH *fh); extern int __wt_block_read_buf(WT_SESSION_IMPL *session, WT_BLOCK *block, - WT_BUF *buf, + WT_ITEM *buf, const uint8_t *addr, uint32_t addr_size); extern int __wt_block_read(WT_SESSION_IMPL *session, WT_BLOCK *block, - WT_BUF *buf, + WT_ITEM *buf, off_t offset, uint32_t size, uint32_t cksum); @@ -112,7 +112,7 @@ extern int __wt_block_salvage_end(WT_SESSION_IMPL *session, int success); extern int __wt_block_salvage_next( WT_SESSION_IMPL *session, WT_BLOCK *block, - WT_BUF *buf, + WT_ITEM *buf, uint8_t *addr, uint32_t *addr_sizep, uint64_t *write_genp, @@ -133,12 +133,12 @@ extern int __wt_block_write_size( WT_SESSION_IMPL *session, uint32_t *sizep); extern int __wt_block_write_buf(WT_SESSION_IMPL *session, WT_BLOCK *block, - WT_BUF *buf, + WT_ITEM *buf, uint8_t *addr, uint32_t *addr_size); extern int __wt_block_write(WT_SESSION_IMPL *session, WT_BLOCK *block, - WT_BUF *buf, + WT_ITEM *buf, off_t *offsetp, uint32_t *sizep, uint32_t *cksump); @@ -150,10 +150,10 @@ extern void __wt_cache_stats_update(WT_CONNECTION_IMPL *conn); extern void __wt_cache_destroy(WT_CONNECTION_IMPL *conn); extern int __wt_cell_copy(WT_SESSION_IMPL *session, WT_CELL *cell, - WT_BUF *retb); + WT_ITEM *retb); extern int __wt_cell_unpack_copy( WT_SESSION_IMPL *session, WT_CELL_UNPACK *unpack, - WT_BUF *retb); + WT_ITEM *retb); extern void __wt_btcur_iterate_setup(WT_CURSOR_BTREE *cbt, int next); extern int __wt_btcur_first(WT_CURSOR_BTREE *cbt); extern int __wt_btcur_next(WT_CURSOR_BTREE *cbt); @@ -198,7 +198,7 @@ extern int __wt_btree_open(WT_SESSION_IMPL *session, const char *cfg[], uint32_t flags); extern int __wt_btree_reopen(WT_SESSION_IMPL *session, uint32_t flags); -extern int __wt_btree_root_init(WT_SESSION_IMPL *session, WT_BUF *addr); +extern int __wt_btree_root_init(WT_SESSION_IMPL *session, WT_ITEM *addr); extern int __wt_btree_root_empty(WT_SESSION_IMPL *session, WT_PAGE **leafp); extern int __wt_btree_close(WT_SESSION_IMPL *session); extern int __wt_btree_huffman_open(WT_SESSION_IMPL *session, @@ -207,14 +207,14 @@ extern void __wt_btree_huffman_close(WT_SESSION_IMPL *session); extern const char *__wt_page_type_string(u_int type); extern const char *__wt_cell_type_string(uint8_t type); extern const char *__wt_page_addr_string(WT_SESSION_IMPL *session, - WT_BUF *buf, + WT_ITEM *buf, WT_PAGE *page); extern const char *__wt_addr_string( WT_SESSION_IMPL *session, - WT_BUF *buf, + WT_ITEM *buf, const uint8_t *addr, uint32_t size); extern int __wt_ovfl_in( WT_SESSION_IMPL *session, - WT_BUF *store, + WT_ITEM *store, const uint8_t *addr, uint32_t len); extern int @@ -236,7 +236,7 @@ extern int __wt_cache_read(WT_SESSION_IMPL *session, extern int __wt_kv_return(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, int key_ret); -extern int __wt_btree_get_root(WT_SESSION_IMPL *session, WT_BUF *addr); +extern int __wt_btree_get_root(WT_SESSION_IMPL *session, WT_ITEM *addr); extern int __wt_btree_free_root(WT_SESSION_IMPL *session); extern int __wt_btree_set_root(WT_SESSION_IMPL *session, uint8_t *addr, @@ -299,7 +299,7 @@ extern int __wt_row_leaf_keys(WT_SESSION_IMPL *session, WT_PAGE *page); extern int __wt_row_key( WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW *rip_arg, - WT_BUF *retb); + WT_ITEM *retb); extern WT_CELL *__wt_row_value(WT_PAGE *page, WT_ROW *rip); extern int __wt_row_ikey_alloc(WT_SESSION_IMPL *session, uint32_t cell_offset, @@ -311,13 +311,13 @@ extern int __wt_row_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, int is_remove); extern int __wt_row_insert_alloc(WT_SESSION_IMPL *session, - WT_BUF *key, + WT_ITEM *key, u_int skipdepth, WT_INSERT **insp, size_t *ins_sizep); extern void __wt_insert_serial_func(WT_SESSION_IMPL *session); extern int __wt_update_alloc(WT_SESSION_IMPL *session, - WT_BUF *value, + WT_ITEM *value, WT_UPDATE **updp, size_t *sizep); extern void __wt_update_serial_func(WT_SESSION_IMPL *session); @@ -641,18 +641,18 @@ extern int __wt_struct_plan(WT_SESSION_IMPL *session, const char *columns, size_t len, int value_only, - WT_BUF *plan); + WT_ITEM *plan); extern int __wt_struct_reformat(WT_SESSION_IMPL *session, WT_TABLE *table, const char *columns, size_t len, const char *extra_cols, int value_only, - WT_BUF *format); + WT_ITEM *format); extern int __wt_struct_truncate(WT_SESSION_IMPL *session, const char *input_fmt, u_int ncols, - WT_BUF *format); + WT_ITEM *format); extern int __wt_schema_project_in(WT_SESSION_IMPL *session, WT_CURSOR **cp, const char *proj_arg, @@ -671,7 +671,7 @@ extern int __wt_schema_project_merge(WT_SESSION_IMPL *session, WT_CURSOR **cp, const char *proj_arg, const char *vformat, - WT_BUF *value); + WT_ITEM *value); extern int __wt_schema_rename(WT_SESSION_IMPL *session, const char *uri, const char *newname, @@ -811,50 +811,50 @@ extern int __wt_huffman_encode(WT_SESSION_IMPL *session, void *huffman_arg, const uint8_t *from_arg, uint32_t from_len, - WT_BUF *to_buf); + WT_ITEM *to_buf); extern int __wt_huffman_decode(WT_SESSION_IMPL *session, void *huffman_arg, const uint8_t *from_arg, uint32_t from_len, - WT_BUF *to_buf); + WT_ITEM *to_buf); extern uint32_t __wt_nlpo2_round(uint32_t v); extern uint32_t __wt_nlpo2(uint32_t v); extern int __wt_ispo2(uint32_t v); extern uint32_t __wt_random(void); -extern int __wt_buf_init(WT_SESSION_IMPL *session, WT_BUF *buf, size_t size); +extern int __wt_buf_init(WT_SESSION_IMPL *session, WT_ITEM *buf, size_t size); extern int __wt_buf_initsize(WT_SESSION_IMPL *session, - WT_BUF *buf, + WT_ITEM *buf, size_t size); -extern int __wt_buf_grow(WT_SESSION_IMPL *session, WT_BUF *buf, size_t size); +extern int __wt_buf_grow(WT_SESSION_IMPL *session, WT_ITEM *buf, size_t size); extern int __wt_buf_set( WT_SESSION_IMPL *session, - WT_BUF *buf, + WT_ITEM *buf, const void *data, size_t size); extern int __wt_buf_set_printable( WT_SESSION_IMPL *session, - WT_BUF *buf, + WT_ITEM *buf, const void *from_arg, size_t size); extern void *__wt_buf_steal(WT_SESSION_IMPL *session, - WT_BUF *buf, + WT_ITEM *buf, uint32_t *sizep); -extern void __wt_buf_swap(WT_BUF *a, WT_BUF *b); -extern void __wt_buf_free(WT_SESSION_IMPL *session, WT_BUF *buf); +extern void __wt_buf_swap(WT_ITEM *a, WT_ITEM *b); +extern void __wt_buf_free(WT_SESSION_IMPL *session, WT_ITEM *buf); extern int __wt_buf_fmt(WT_SESSION_IMPL *session, - WT_BUF *buf, + WT_ITEM *buf, const char *fmt, ...) WT_GCC_ATTRIBUTE((format (printf, 3, 4))); extern int __wt_buf_catfmt(WT_SESSION_IMPL *session, - WT_BUF *buf, + WT_ITEM *buf, const char *fmt, ...) WT_GCC_ATTRIBUTE((format (printf, 3, 4))); extern int __wt_scr_alloc(WT_SESSION_IMPL *session, uint32_t size, - WT_BUF **scratchp); -extern void __wt_scr_free(WT_BUF **bufp); + WT_ITEM **scratchp); +extern void __wt_scr_free(WT_ITEM **bufp); extern void __wt_scr_discard(WT_SESSION_IMPL *session); extern void *__wt_scr_alloc_ext(WT_SESSION *wt_session, size_t size); extern void __wt_scr_free_ext(WT_SESSION *wt_session, void *p); diff --git a/src/include/wiredtiger.in b/src/include/wiredtiger.in index 857a51e7961..faa29d7c6fa 100644 --- a/src/include/wiredtiger.in +++ b/src/include/wiredtiger.in @@ -98,6 +98,18 @@ struct __wt_item { * The number of bytes in the data item. */ uint32_t size; + +#ifndef DOXYGEN +#define WT_ITEM_INUSE 0x00000001 + /* This appears in the middle of the struct to avoid padding. */ + /*! Object flags (internal use). */ + uint32_t flags; + + /*! Managed memory chunk (internal use). */ + void *mem; + /*! Managed memory size (internal use). */ + size_t memsize; +#endif }; /*! @@ -112,36 +124,6 @@ struct __wt_item { */ #define WT_INTPACK32_MAXSIZE ((int)sizeof (int32_t) + 1) -#ifndef DOXYGEN -/* Forward structure declarations */ -struct __wt_buf; typedef struct __wt_buf WT_BUF; - -/*! - * A data item with memory management. Used internally to manage returned keys - * and values in the WT_CURSOR implementation. - */ -struct __wt_buf { - /* - * Note: the first two fields must match WT_ITEM, we cast between - * those types. - */ - /*! The memory reference of the data item. */ - const void *data; - /*! The number of bytes in the data item. */ - uint32_t size; - - /* This appears in the middle of the struct to avoid padding. */ -#define WT_BUF_INUSE 0x00000001 - /*! Object flags (internal use). */ - uint32_t flags; - - /*! Managed memory chunk (internal use). */ - void *mem; - /*! Managed memory size (internal use). */ - size_t memsize; -}; -#endif - /*! * A WT_CURSOR handle is the interface to a cursor. * @@ -399,7 +381,7 @@ struct __wt_cursor { uint64_t recno; uint8_t raw_recno_buf[WT_INTPACK64_MAXSIZE]; /* Holds a recno in raw mode. */ - WT_BUF key, value; + WT_ITEM key, value; int saved_err; /* Saved error in set_{key,value}. */ #define WT_CURSTD_APPEND 0x0001 |